From 40e7d25aca1abbe080e00e2bed64b444a5ec7858 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 1 Feb 2010 23:48:27 +0100 Subject: mkXXXX: unify [KBYTES] parameter handling (added it to mkswap) Signed-off-by: Denys Vlasenko --- util-linux/mkfs_reiser.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'util-linux/mkfs_reiser.c') diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c index 7f37eb845..eb2c94d02 100644 --- a/util-linux/mkfs_reiser.c +++ b/util-linux/mkfs_reiser.c @@ -175,23 +175,12 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv) // check if it is mounted // N.B. what if we format a file? find_mount_point will return false negative since - // it is loop block device which mounted! + // it is loop block device which is mounted! if (find_mount_point(argv[0], 0)) bb_error_msg_and_die("can't format mounted filesystem"); // open the device, get size in blocks - if (argv[1]) { - blocks = xatoull(argv[1]); - // seek past end fails on block devices but works on files - if (lseek(fd, blocks * blocksize - 1, SEEK_SET) != (off_t)-1) { - xwrite(fd, "", 1); // file grows if needed - } - //else { - // bb_error_msg("warning, block device is smaller"); - //} - } else { - blocks = (uoff_t)xlseek(fd, 0, SEEK_END) / blocksize; - } + blocks = get_volume_size_in_bytes(fd, argv[1], blocksize, /*extend:*/ 1) / blocksize; // block number sanity check // we have a limit: skipped area, super block, journal and root block -- cgit v1.2.3