aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-01-14 19:03:11 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-01-15 14:06:55 -0500
commit86a985e74987b08090ecbacf3d02c8d80594c809 (patch)
treee6c563204c65b626504d0336d92c25c5e23d9a64
parent35d886b67947dcb802da09306b6a85f1e9f99865 (diff)
downloade2fsprogs-86a985e74987b08090ecbacf3d02c8d80594c809.tar.gz
e2fsprogs-86a985e74987b08090ecbacf3d02c8d80594c809.tar.xz
e2fsprogs-86a985e74987b08090ecbacf3d02c8d80594c809.zip
mke2fs: teach mke2fs to understand -b 4k and -C 256M
The -b and -C options now use parse_num_blocks2() instead of strtol, so that users can specify -C 256M instead of the much less convenient -C 268435456. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
-rw-r--r--misc/mke2fs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 2103f636..ace9eae1 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1324,10 +1324,10 @@ profile_error:
"b:cg:i:jl:m:no:qr:s:t:vC:DE:FG:I:J:KL:M:N:O:R:ST:U:V")) != EOF) {
switch (c) {
case 'b':
- blocksize = strtol(optarg, &tmp, 0);
+ blocksize = parse_num_blocks2(optarg, -1);
b = (blocksize > 0) ? blocksize : -blocksize;
if (b < EXT2_MIN_BLOCK_SIZE ||
- b > EXT2_MAX_BLOCK_SIZE || *tmp) {
+ b > EXT2_MAX_BLOCK_SIZE) {
com_err(program_name, 0,
_("invalid block size - %s"), optarg);
exit(1);
@@ -1345,9 +1345,9 @@ profile_error:
cflag++;
break;
case 'C':
- cluster_size = strtoul(optarg, &tmp, 0);
+ cluster_size = parse_num_blocks2(optarg, -1);
if (cluster_size <= EXT2_MIN_CLUSTER_SIZE ||
- cluster_size > EXT2_MAX_CLUSTER_SIZE || *tmp) {
+ cluster_size > EXT2_MAX_CLUSTER_SIZE) {
com_err(program_name, 0,
_("invalid cluster size - %s"),
optarg);