diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-02 01:48:27 +0300 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-02 01:48:27 +0300 |
commit | 40e7d25aca1abbe080e00e2bed64b444a5ec7858 (patch) | |
tree | 05cda08f66542aeb94d1ebb906a0f04b04a41d62 /util-linux/mkswap.c | |
parent | 4875e7148b0512ee3c255526a484503da984935a (diff) |
mkXXXX: unify [KBYTES] parameter handling (added it to mkswap)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mkswap.c')
-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) off_t len; const char *label = ""; - opt_complementary = "=1"; - /* TODO: -p PAGESZ, -U UUID, - * optional SIZE_IN_KB 2nd param - */ + opt_complementary = "-1"; /* at least one param */ + /* TODO: -p PAGESZ, -U UUID */ getopt32(argv, "L:", &label); argv += optind; fd = xopen(argv[0], O_WRONLY); - /* Figure out how big the device is and announce our intentions */ - /* fdlength was reported to be unreliable - use seek */ - len = xlseek(fd, 0, SEEK_END); - if (ENABLE_SELINUX) - xlseek(fd, 0, SEEK_SET); - + /* Figure out how big the device is */ + len = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ 1); pagesize = getpagesize(); len -= pagesize; + + /* Announce our intentions */ printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", len); mkswap_selinux_setcontext(fd, argv[0]); |