Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod? silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian? keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René? Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-busybox/docs/style-guide.txt

    r821 r1770  
    2121-----------------
    2222
    23 Here is the order in which code should be laid out in a file:
     23Here is the preferred order in which code should be laid out in a file:
    2424
    2525 - commented program name and one-line description
     
    5252multi-line comments that use an asterisk at the beginning of each line, i.e.:
    5353
    54     /t/*
    55     /t * This is a block comment.
    56     /t * Note that it has multiple lines
    57     /t * and that the beginning of each line has a tab plus a space
    58     /t * except for the opening '/*' line where the slash
    59     /t * is used instead of a space.
    60     /t */
     54    \t/*
     55    \t * This is a block comment.
     56    \t * Note that it has multiple lines
     57    \t * and that the beginning of each line has a tab plus a space
     58    \t * except for the opening '/*' line where the slash
     59    \t * is used instead of a space.
     60    \t */
    6161
    6262Furthermore, The preference is that tabs be set to display at four spaces
     
    127127        do {
    128128
    129 Exceptions:
    130 
    131  - if you have long logic statements that need to be wrapped, then uncuddling
    132    the bracket to improve readability is allowed:
    133 
    134         if (some_really_long_checks && some_other_really_long_checks \
    135             && some_more_really_long_checks)
    136         {
     129If you have long logic statements that need to be wrapped, then uncuddling
     130the bracket to improve readability is allowed. Generally, this style makes
     131it easier for reader to notice that 2nd and following lines are still
     132inside 'if':
     133
     134        if (some_really_long_checks && some_other_really_long_checks
     135         && some_more_really_long_checks
     136         && even_more_of_long_checks
     137        ) {
    137138            do_foo_now;
    138139
     
    209210
    210211
     212Labels
     213~~~~~~
     214
     215Labels should start at the beginning of the line, not indented to the block
     216level (because they do not "belong" to block scope, only to whole function).
     217
     218    if (foo) {
     219        stmt;
     220 label:
     221        stmt2;
     222        stmt;
     223    }
     224
     225(Putting label at position 1 prevents diff -p from confusing label for function
     226name, but it's not a policy of busybox project to enforce such a minor detail).
     227
     228
    211229
    212230Variable and Function Names
     
    235253
    236254 - Enums, macros, and constant variables are occasionally written in all
    237    upper-case with words optionally seperatedy by underscores (i.e. FIFOTYPE,
     255   upper-case with words optionally seperatedy by underscores (i.e. FIFO_TYPE,
    238256   ISBLKDEV()).
    239257
     
    300318    Don't do this:
    301319
    302         #define var 80
     320        #define CONST 80
    303321
    304322    Do this instead, when the variable is in a header file and will be used in
    305323    several source files:
    306324
    307         const int var = 80;
    308 
    309     Or do this when the variable is used only in a single source file:
    310 
    311         static const int var = 80;
    312 
    313 Declaring variables as '[static] const' gives variables an actual type and
    314 makes the compiler do type checking for you; the preprocessor does _no_ type
    315 checking whatsoever, making it much more error prone. Declaring variables with
    316 '[static] const' also makes debugging programs much easier since the value of
    317 the variable can be easily queried and displayed.
     325        enum { CONST = 80 };
     326
     327Although enum may look ugly to some people, it is better for code size.
     328With "const int" compiler may fail to optimize it out and will reserve
     329a real storage in rodata for it! (Hopefully, newer gcc will get better
     330at it...).  With "define", you have slight risk of polluting namespace
     331(#define doesn't allow you to redefine the name in the inner scopes),
     332and complex "define" are evaluated each time they uesd, not once
     333at declarations like enums. Also, the preprocessor does _no_ type checking
     334whatsoever, making it much more error prone.
    318335
    319336
     
    361378    (in .h header file)
    362379
    363         #ifdef CONFIG_FEATURE_FUNKY
    364         static inline void maybe_do_funky_stuff (int bar, int baz)
     380        #if ENABLE_FEATURE_FUNKY
     381        static inline void maybe_do_funky_stuff(int bar, int baz)
    365382        {
    366383            /* lotsa code in here */
    367384        }
    368385        #else
    369         static inline void maybe_do_funky_stuff (int bar, int baz) {}
     386        static inline void maybe_do_funky_stuff(int bar, int baz) {}
    370387        #endif
    371388
     
    433450of some of the more notorious troublemakers:
    434451
    435 function     overflows         preferred
    436 ----------------------------------------
    437 strcpy       dest string       strncpy
    438 strcat       dest string       strncat
    439 gets         string it gets    fgets
    440 getwd        buf string        getcwd
    441 [v]sprintf   str buffer        [v]snprintf
    442 realpath     path buffer       use with pathconf
    443 [vf]scanf    its arguments     just avoid it
     452function     overflows                  preferred
     453-------------------------------------------------
     454strcpy       dest string                safe_strncpy
     455strncpy      may fail to 0-terminate dst safe_strncpy
     456strcat       dest string                strncat
     457gets         string it gets             fgets
     458getwd        buf string                 getcwd
     459[v]sprintf   str buffer                 [v]snprintf
     460realpath     path buffer                use with pathconf
     461[vf]scanf    its arguments              just avoid it
    444462
    445463
     
    451469------------------------
    452470
    453 First, some background to put this discussion in context: Static buffers look
     471First, some background to put this discussion in context: static buffers look
    454472like this in code:
    455473
     
    501519and the right thing will happen, based on your configuration.
    502520
     521Another relatively new trick of similar nature is explained
     522in keep_data_small.txt.
     523
    503524
    504525
     
    528549    - The difference is minor or cosmetic
    529550
    530 A note on the 'cosmetic' case: Output differences might be considered
     551A note on the 'cosmetic' case: output differences might be considered
    531552cosmetic, but if the output is significant enough to break other scripts that
    532553use the output, it should really be fixed.
     
    578599            stmt1;
    579600            new_line();
    580         stmt2
     601        stmt2;
    581602        stmt3;
    582603
     
    620641Furthermore, you should put a single comment (not necessarily one line, just
    621642one comment) before the block, rather than commenting each and every line.
    622 There is an optimal ammount of commenting that a program can have; you can
     643There is an optimal amount of commenting that a program can have; you can
    623644comment too much as well as too little.
    624645
     
    626647illustrates how to emphasize logical blocks:
    627648
    628     while (line = get_line_from_file(fp)) {
     649    while (line = xmalloc_fgets(fp)) {
    629650
    630651        /* eat the newline, if any */
     
    650671~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    651672
    652 If your applet needs to process  command-line switches, please use getopt() to
     673If your applet needs to process command-line switches, please use getopt32() to
    653674do so. Numerous examples can be seen in many of the existing applets, but
    654675basically it boils down to two things: at the top of the .c file, have this
    655 line in the midst of your #includes:
     676line in the midst of your #includes, if you need to parse long options:
    656677
    657678    #include <getopt.h>
     679
     680Then have long options defined:
     681
     682    static const struct option <applet>_long_options[] = {
     683        { "list",    0, NULL, 't' },
     684        { "extract", 0, NULL, 'x' },
     685        { NULL, 0, NULL, 0 }
     686    };
    658687
    659688And a code block similar to the following near the top of your applet_main()
    660689routine:
    661690
    662     while ((opt = getopt(argc, argv, "abc")) > 0) {
    663             switch (opt) {
    664             case 'a':
    665                 do_a_opt = 1;
    666                 break;
    667             case 'b':
    668                 do_b_opt = 1;
    669                 break;
    670             case 'c':
    671                 do_c_opt = 1;
    672                 break;
    673             default:
    674                 show_usage();    /* in utility.c */
    675             }
    676     }
     691    char *str_b;
     692
     693    opt_complementary = "cryptic_string";
     694    applet_long_options = <applet>_long_options; /* if you have them */
     695    opt = getopt32(argc, argv, "ab:c", &str_b);
     696    if (opt & 1) {
     697        handle_option_a();
     698    }
     699    if (opt & 2) {
     700        handle_option_b(str_b);
     701    }
     702    if (opt & 4) {
     703        handle_option_c();
     704    }
    677705
    678706If your applet takes no options (such as 'init'), there should be a line
     
    684712use getopt, they won't get false positives.
    685713
    686 Additional Note: Do not use the getopt_long library function and do not try to
    687 hand-roll your own long option parsing. Busybox applets should only support
    688 short options. Explanations and examples of the short options should be
    689 documented in usage.h.
     714For more info and examples, examine getopt32.c, tar.c, wget.c etc.
Note: See TracChangeset for help on using the changeset viewer.