[patch] size optimization for mkswap.c

Bernhard Fischer rep.nop at aon.at
Thu Mar 16 14:06:33 UTC 2006


On Thu, Mar 16, 2006 at 02:29:49PM +0100, Bernhard Fischer wrote:
>Hi,
>
>Attached two patches do
>1) shrink mkswap a little bit
>2) make v0 support optional.
>
>   text    data     bss     dec     hex filename
>   2093       8      28    2129     851 util-linux/mkswap.o.oorig
>   2044       8      28    2080     820 util-linux/mkswap.o.shrink
>   1698       4      28    1730     6c2 util-linux/mkswap.o.no-V0
>
>Comments? Ok to apply?

Forgot to mention these:

>+config CONFIG_FEATURE_MKSWAP_V0
>+	bool "  version 0 support"
>+	default n
>+	depends on CONFIG_MKSWAP
>+#	depends on CONFIG_MKSWAP && CONFIG_DEPRECATED

Should we add something like CONFIG_DEPRECATED for trunk (i.e. for 1.2)?

>+	help
>+	  Enable support for the old v0 style.
>+	  If your kernel is older than 2.1.117, then v0 support is the
>+	  only option.


>-	version = atoi(tmp);
>+	USE_FEATURE_MKSWAP_V0(version = atoi(tmp);)
>+	SKIP_FEATURE_MKSWAP_V0(if (00 && sz & 4)
>+			bb_error_msg_and_die("No v0 support");)

This verbose check would add about 28 Bytes to inform the user that v0
support is not available. Not sure if we want that.

If v0 is disabled and the user requests it, then we could as well
silently create a v1 style swap. By careful inspection, the user would
notice the version anyway as it prints:
Setting up swapspace version 1, size = xyz bytes




More information about the busybox mailing list