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/mkfs_ext2.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/mkfs_ext2.c')
-rw-r--r-- | util-linux/mkfs_ext2.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 19c3c673e..44fb40250 100644 --- a/util-linux/mkfs_ext2.c +++ b/util-linux/mkfs_ext2.c @@ -230,19 +230,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv) bb_error_msg_and_die("can't format mounted filesystem"); // open the device, get size in kbytes - if (argv[1]) { - kilobytes = xatoull(argv[1]); - // seek past end fails on block devices but works on files - if (lseek(fd, kilobytes * 1024 - 1, SEEK_SET) != (off_t)-1) { - if (!(option_mask32 & OPT_n)) - xwrite(fd, "", 1); // file grows if needed - } - //else { - // bb_error_msg("warning, block device is smaller"); - //} - } else { - kilobytes = (uoff_t)xlseek(fd, 0, SEEK_END) / 1024; - } + kilobytes = get_volume_size_in_bytes(fd, argv[1], 1024, /*extend:*/ !(option_mask32 & OPT_n)) / 1024; bytes_per_inode = 16384; if (kilobytes < 512*1024) |