aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkfs_reiser.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_reiser.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_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