aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkfs_reiser.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/mkfs_reiser.c')
-rw-r--r--util-linux/mkfs_reiser.c15
1 files changed, 2 insertions, 13 deletions
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