[PATCH] one more hdparm patch with command line parsing bug fix
Tito
farmatito at tiscali.it
Sun May 14 14:40:12 UTC 2006
On Saturday 13 May 2006 16:20, Tito wrote:
> Hi,
> this is a new hdparm patch to fix one bug, reduce size and clean up the code.
> The main changes are:
>
> Fixed bug in command line arg parsing: flags for options without args are reset on next getopt_long iteration.
> Updated the timing algorithm in do_time() to that of hdparm 6.6 (gives better results on my drives and code is cleaner).
> Changed switch() to if() else if() else to reduce size.
> Renamed if_printf_on_off() to print_flag_on() and optimised for size.
> Removed if_printf() as it increases size and substituted with print_flag() where appropriate.
> Removed check_if_min_and_set_val() as it increases size.
> Removed check_if_maj_and_set_val() as it increases size.
> Removed if_else_printf() as it increases size.
> Removed sync_and_sleep() as now it was used only in one place.
> Moved code used 2 times in do_time() to print_timing().
> Optimised some text strings to reduce size.
>
> Commandline option parsing should now work in all cases.
> Size reduction for hdparm.o (with all options enabled) is:
> text data bss dec hex filename
> 23525 176 872 24573 5ffd hdparm.o.orig
> 22209 176 864 23249 5ad1hdparm.o
>
> Please apply before feature freeze.
>
> Thanks and Ciao,
> Tito
>
> PS.: Rob, I know the patch is rather big, but it does mostly trivial stuff, the only real changes
> are the bugfix in main and the timing algorithm update in do_time(). Sorry!
> If you really, really, really want this patch splitted in pieces....... i will do it.
>
>
This patch replaces the previous (hdparm10.patch) reduces size further and includes Bernhard Fischer's
optimisations.
Log is:
Fixed bug in command line arg parsing: flags for options without args are reset on next getopt_long iteration.
Updated the timing algorithm in do_time() to that of hdparm 6.6 (gives better results on my drives and code is cleaner).
Changed switch() to if() else if() else to reduce size.
Renamed if_printf_on_off() to print_flag_on() and optimised for size.
Removed if_printf() as it increases size and substituted with print_flag() where appropriate.
Removed check_if_min_and_set_val() as it increases size.
Removed check_if_maj_and_set_val() as it increases size.
Removed if_else_printf() as it increases size.
Removed sync_and_sleep() as now it was used only in one place.
Moved code used 2 times in do_time() to print_timing().
Optimised some text strings to reduce size.
Added some more optimisations by Bernhard Fischer.
Size now is:
22096 176 864 23136 5a60 hdparm.o
This patch is tested and seems to be safe.
Please apply.
Ciao,
Tito
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hdparm11.patch.bz2
Type: application/x-bzip2
Size: 13379 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060514/f8ffd705/attachment.bin
More information about the busybox
mailing list