summaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-02 18:50:26 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-02 18:50:26 +0100
commit8a0b1d0eff21fc8f0b6007107490d7064af5bacb (patch)
tree7415d398692285106c1bca95f901798334765074 /mkfs
parent027a17b2714c7db6c1824142547afaa0d1ee27e8 (diff)
Support parsing [device] block size argument with SI suffix
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/options.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mkfs/options.c b/mkfs/options.c
index fd6ca46..1fe6081 100644
--- a/mkfs/options.c
+++ b/mkfs/options.c
@@ -185,7 +185,10 @@ void process_command_line(options_t *opt, int argc, char **argv)
opt->cfg.comp_id = ret;
break;
case 'b':
- opt->cfg.block_size = strtol(optarg, NULL, 0);
+ if (parse_size("Block size", &opt->cfg.block_size,
+ optarg)) {
+ exit(EXIT_FAILURE);
+ }
break;
case 'j':
opt->cfg.num_jobs = strtol(optarg, NULL, 0);
@@ -194,7 +197,10 @@ void process_command_line(options_t *opt, int argc, char **argv)
opt->cfg.max_backlog = strtol(optarg, NULL, 0);
break;
case 'B':
- opt->cfg.devblksize = strtol(optarg, NULL, 0);
+ if (parse_size("Device block size",
+ &opt->cfg.devblksize, optarg)) {
+ exit(EXIT_FAILURE);
+ }
if (opt->cfg.devblksize < 1024) {
fputs("Device block size must be at "
"least 1024\n", stderr);