[patch] size optimization for mkswap.c

Bernhard Fischer rep.nop at aon.at
Fri Mar 17 02:02:37 UTC 2006


On Thu, Mar 16, 2006 at 03:12:21PM +0100, Tito wrote:
>On Thursday 16 March 2006 15:06, Bernhard Fischer wrote:
>With  USE_FEATURE_MKSWAP_V0 but no error message  ;-)
>
>+       bb_opt_complementally = "?";   /* call bb_show_usage internally */
>+       sz = bb_getopt_ulflags(argc, argv, "+cfv:", &tmp);
>-       if (sz & BB_GETOPT_ERROR)
>-               bb_show_usage();
generally unneeded, thus dropped. Thanks for pointing this out..
>-       version = atoi(tmp);
>        /* check if value is correct */
>+     version =  bb_xgetlarg(tmp, 10,  (USE_FEATURE_MKSWAP_V0) ? 0 : 1, 1);
>
>                        /* check if value is correct or call bb_show_usage internally */
>+                     PAGES = bb_xgetlarg(arv[0], 0, min value?, max value?)  / blocks_per_page;
>-                       PAGES = strtol(argv[0], &tmp, 0) / blocks_per_page;
>-                       if (*tmp)
>-                               bb_show_usage();
Still experimenting with this and the needed follow-up bits.

We will no longer give useful information *why* we refuse to creat a
non-conforming area, iff we go down that path. Initially, i intended to
keep the UI differences as few as possible, but if we drop v0 support
for busybox-1.2 all at once, i tend to agree that we can favour size
over usability as far as error checking is concerned there.

i.e.: From now on, there will be *no* verbose error if the user requests
-) to create a device with less than 10k size
-) to create a device bigger than the available total size
-) thus we can as well drop -force support except for sparc.

Although i don't use it, i think that we may want keep the support for
sparc et al, as it does not pessimize e.g. the x86 code, so it's of no
benefit to cripple the implementation.

One point eventually worth a hint is whether we should support
swap-areas with HOST_WIDE_INT (or however it's called ) or not.
>
>
>Just an idea.

Thanks!
>
>Ciao,
>TIto

>_______________________________________________
>busybox mailing list
>busybox at busybox.net
>http://busybox.net/cgi-bin/mailman/listinfo/busybox



More information about the busybox mailing list