wiki:StandardsCompliance

Version 3 (modified by bruno, 12 years ago) (diff)

Coding stds are now here

Compliance with Standards

Mondo Rescue aims to be compliant with

Default Exclusion Rules

The following directories will by default be EXCLUDED by mondoarchive:

The following directories will by default NOT be excluded by mondoarchive:

Installation Directories

Distribution packages will install under /usr, builts from the tarballs with install under /usr/local. The following only deals with /usr.

File Locations

  • binaries: /usr/sbin
  • configuration: /etc/[mindi|mondo] (only mindi used ATM)
  • documentation: /usr/share/doc/[mindi|mondo(|mondo-doc)]
  • manpages: /usr/share/man/man8
  • package-specific other files:
    • binary files: /usr/lib/[mindi|mondo]
    • non-binary (platform-independent) files: /usr/share/[mindi|mondo]
  • shared libraries: /usr/lib (shared libraries turned-off in 2.0.8)
  • temporary files, archive and boot images: /var/cache/[mindi|mondo] (not implemented yet; for mondo, it's currently /var/cache/mondo-archive, for mindi this doesn't exist):
    • boot images created by mindi: /var/cache/mindi/images (this is currently /root/images/mindi)
    • data images created by mondo: /var/cache/mondo/images
    • mondo tmp directory: /var/cache/mondo/tmp
    • mondo scratch directory: /var/cache/mondo/tmp

Discussion

'-d' switch should really only allow manipulation of location for data images as it is the case now, i.e. '-d' should allow for changing /var/cache/mondo/images to a different location. Boot images should always go to /var/cache/mindi/images. The reasoning behind it is consistency on the one hand but allowing moving the potentially large contents of the /var/cache/mondo/images someplace else on the other.

During restoration, mondorestore should use also /var/cache/mondo instead of /disponible. {Bruno: Is /disponible French for /tmp?}

GNU Coding Standards

The GNU project has defined a good set of coding standards over the years. The latest version can be found here: http://www.gnu.org/prep/standards/standards.html. In fact, these standards are not really specific to GNU but can be viewed as best practice for at least pretty much any C program - many of the points made applies regardless of the programming language. Mondo Rescue strives to adhere to the GNU Coding Standards unlesss there is a reason not to.

getopt(3) and getopt_long(3) are the two standard function provided by the GNU C library for this purpose. See their manpages for details.

Processing Command Lines Parameters

Currently, we only support short command line switches, i.e. '-<single character>'. This does allow for compact invocation of our programs but is not very expressive. However, the GNU Coding Standards recommend the use of long options of the format '--<expressive expression>' besides the short ones for better trnsparency of the exact nature and working of the command invoked.

mondoarchive Command Line Options

Preliminary table of long command line options verus short ones.

ShortLongDone
-O--backup
-V--verify
-c--media-cd
-w(to be deleted)
-r(to be deleted)
-C--media-cd-stream
-p--prefix
-i--media-iso
-n--media-nfs
-t--media-tape
-u--media-stream-generic
-D--differential
-E--exclude
-I--include
-J-include-list
-N--exclude-netmounts
-d--backup-path
-g(to be deleted)
-k--kernel-path
-m--cd-drive-safe-mode
-o--use-lilo
-s--media-size
-x--partitions-to-archive
-A--run-after each-media
-B--run-before-each-media
-F--dont-ask-for-floppies
-H--non-interactive-restore
-L--use-lzop
-R--use-star
-P--run-post-nuke
-S--scratch-dir
-T--temp-dir
-W--not-bootable
-b--tape-blocksize
-e--dont-eject
-f--mbr-device
-Q--bootloader-info
-K--loglevel
-h--help or --usage
-v--version

Notes: --help and --version recommended by GNU Coding Standards,

mondorestore Command Line Options

Preliminary table of long command line options verus short ones.

ShortLongDone
-h--help or --usage
-v--version

mindi Command Line Options

Preliminary table of long command line options verus short ones.

ShortLongDone
-f--find-kernel
-m--make-mount-list
-s--max-compressed-size
-c--custom
-h--help or --usage
-v--version

Formatting of C Code

The following outlines the coding standard for Mondo Rescue. Note that while mondo is implemented in C, mindi is currently a bash script.

The following indent rules should be used:

-kr -br -brs -ts4 -ut 

The easiest is to put the above in file ~/.indent.pro.

The indent program should come in the indent package or similar. If not, you can get it from http://directory.fsf.org/GNU/indent.html.