diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-01 23:48:27 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-02-01 23:48:27 +0100 |
commit | 40e7d25aca1abbe080e00e2bed64b444a5ec7858 (patch) | |
tree | 05cda08f66542aeb94d1ebb906a0f04b04a41d62 /util-linux/mkfs_reiser.c | |
parent | 4875e7148b0512ee3c255526a484503da984935a (diff) | |
download | busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.tar.gz busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.tar.bz2 busybox-w32-40e7d25aca1abbe080e00e2bed64b444a5ec7858.zip |
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.c | 15 |
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) | |||
175 | 175 | ||
176 | // check if it is mounted | 176 | // check if it is mounted |
177 | // N.B. what if we format a file? find_mount_point will return false negative since | 177 | // N.B. what if we format a file? find_mount_point will return false negative since |
178 | // it is loop block device which mounted! | 178 | // it is loop block device which is mounted! |
179 | if (find_mount_point(argv[0], 0)) | 179 | if (find_mount_point(argv[0], 0)) |
180 | bb_error_msg_and_die("can't format mounted filesystem"); | 180 | bb_error_msg_and_die("can't format mounted filesystem"); |
181 | 181 | ||
182 | // open the device, get size in blocks | 182 | // open the device, get size in blocks |
183 | if (argv[1]) { | 183 | blocks = get_volume_size_in_bytes(fd, argv[1], blocksize, /*extend:*/ 1) / blocksize; |
184 | blocks = xatoull(argv[1]); | ||
185 | // seek past end fails on block devices but works on files | ||
186 | if (lseek(fd, blocks * blocksize - 1, SEEK_SET) != (off_t)-1) { | ||
187 | xwrite(fd, "", 1); // file grows if needed | ||
188 | } | ||
189 | //else { | ||
190 | // bb_error_msg("warning, block device is smaller"); | ||
191 | //} | ||
192 | } else { | ||
193 | blocks = (uoff_t)xlseek(fd, 0, SEEK_END) / blocksize; | ||
194 | } | ||
195 | 184 | ||
196 | // block number sanity check | 185 | // block number sanity check |
197 | // we have a limit: skipped area, super block, journal and root block | 186 | // we have a limit: skipped area, super block, journal and root block |