diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-01 23:48:27 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-01 23:48:27 +0100 |
commit | 40e7d25aca1abbe080e00e2bed64b444a5ec7858 (patch) | |
tree | 05cda08f66542aeb94d1ebb906a0f04b04a41d62 /util-linux/mkswap.c | |
parent | 4875e7148b0512ee3c255526a484503da984935a (diff) | |
download | busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.tar.gz busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.tar.bz2 busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.zip |
mkXXXX: unify [KBYTES] parameter handling (added it to mkswap)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r-- | util-linux/mkswap.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 289692da3..949c71a78 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
@@ -86,23 +86,19 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv) | |||
86 | off_t len; | 86 | off_t len; |
87 | const char *label = ""; | 87 | const char *label = ""; |
88 | 88 | ||
89 | opt_complementary = "=1"; | 89 | opt_complementary = "-1"; /* at least one param */ |
90 | /* TODO: -p PAGESZ, -U UUID, | 90 | /* TODO: -p PAGESZ, -U UUID */ |
91 | * optional SIZE_IN_KB 2nd param | ||
92 | */ | ||
93 | getopt32(argv, "L:", &label); | 91 | getopt32(argv, "L:", &label); |
94 | argv += optind; | 92 | argv += optind; |
95 | 93 | ||
96 | fd = xopen(argv[0], O_WRONLY); | 94 | fd = xopen(argv[0], O_WRONLY); |
97 | 95 | ||
98 | /* Figure out how big the device is and announce our intentions */ | 96 | /* Figure out how big the device is */ |
99 | /* fdlength was reported to be unreliable - use seek */ | 97 | len = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ 1); |
100 | len = xlseek(fd, 0, SEEK_END); | ||
101 | if (ENABLE_SELINUX) | ||
102 | xlseek(fd, 0, SEEK_SET); | ||
103 | |||
104 | pagesize = getpagesize(); | 98 | pagesize = getpagesize(); |
105 | len -= pagesize; | 99 | len -= pagesize; |
100 | |||
101 | /* Announce our intentions */ | ||
106 | printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", len); | 102 | printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", len); |
107 | mkswap_selinux_setcontext(fd, argv[0]); | 103 | mkswap_selinux_setcontext(fd, argv[0]); |
108 | 104 | ||