aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkfs_ext2.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-02-01 23:48:27 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-02-01 23:48:27 +0100
commit40e7d25aca1abbe080e00e2bed64b444a5ec7858 (patch)
tree05cda08f66542aeb94d1ebb906a0f04b04a41d62 /util-linux/mkfs_ext2.c
parent4875e7148b0512ee3c255526a484503da984935a (diff)
downloadbusybox-40e7d25aca1abbe080e00e2bed64b444a5ec7858.tar.gz
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.c14
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)