From: Dave Chinner <dchinner@xxxxxxxxxx> Signed-Off-By: Dave Chinner <dchinner@xxxxxxxxxx> --- mkfs/xfs_mkfs.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 022fb84016f6..40de7ea9bfa8 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1474,6 +1474,19 @@ block_opts_parser( char *value, struct cli_params *cli) { + int blocklog; + + switch (subopt) { + case B_LOG: + blocklog = getnum(value, opts, B_LOG); + cli->blocksize = 1 << blocklog; + break; + case B_SIZE: + cli->blocksize = getnum(value, opts, B_SIZE); + break; + default: + return -EINVAL; + } return 0; } @@ -1706,6 +1719,7 @@ main( .rmapbt = false, .reflink = false, }; + struct cli_params cli = {}; platform_uuid_generate(&uuid); progname = basename(argv[0]); @@ -1745,27 +1759,14 @@ main( force_overwrite = 1; break; case 'b': - p = optarg; - while (*p != '\0') { - char **subopts = (char **)bopts.subopts; - char *value; - - switch (getsubopt(&p, subopts, &value)) { - case B_LOG: - blocklog = getnum(value, &bopts, B_LOG); - blocksize = 1 << blocklog; - blflag = 1; - break; - case B_SIZE: - blocksize = getnum(value, &bopts, - B_SIZE); - blocklog = libxfs_highbit32(blocksize); - bsflag = 1; - break; - default: - unknown('b', value); - } - } + parse_subopts(c, optarg, &cli); + + /* temp don't break code */ + blocksize = cli.blocksize; + blocklog = libxfs_highbit32(blocksize); + blflag = cli_opt_set(&bopts, B_LOG); + bsflag = cli_opt_set(&bopts, B_SIZE); + /* end temp don't break code */ break; case 'd': p = optarg; -- 2.13.3 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html