From 8a0b1d0eff21fc8f0b6007107490d7064af5bacb Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 2 Jan 2020 18:50:26 +0100 Subject: Support parsing [device] block size argument with SI suffix Signed-off-by: David Oberhollenzer --- mkfs/options.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'mkfs') 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); -- cgit v1.2.3