All sopt parameters are already part of struct mkfs_xfs_opts, so all we need to do is use the helper. Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxx> --- mkfs/xfs_mkfs.c | 70 +++++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 39ab08148687..2a3786ece6b6 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1760,6 +1760,38 @@ parse_subopts( } } break; + case 's': + while (*p != '\0') { + switch (getsubopt(&p, (char **)sopts.subopts, &value)) { + case S_LOG: + case S_SECTLOG: + if (params->lssflag) + conflict('s', (char **)sopts.subopts, + S_SECTSIZE, S_SECTLOG); + params->sectorlog = + getnum(value, &sopts, S_SECTLOG); + params->lsectorlog = params->sectorlog; + sectorsize = 1 << params->sectorlog; + params->lsectorsize = sectorsize; + params->lslflag = params->slflag = 1; + break; + case S_SIZE: + case S_SECTSIZE: + if (params->lslflag) + conflict('s', (char **)sopts.subopts, + S_SECTLOG, S_SECTSIZE); + sectorsize = getnum(value, &sopts, S_SECTSIZE); + params->lsectorsize = sectorsize; + params->sectorlog = + libxfs_highbit32(sectorsize); + params->lsectorlog = params->sectorlog; + params->lssflag = params->ssflag = 1; + break; + default: + unknown('s', value); + } + } + break; default: usage(); } @@ -1865,6 +1897,7 @@ main( case 'm': case 'n': case 'r': + case 's': p = optarg; parse_subopts(c, p, ¶ms); break; @@ -1887,43 +1920,6 @@ main( case 'q': qflag = 1; break; - case 's': - p = optarg; - while (*p != '\0') { - char **subopts = (char **)sopts.subopts; - char *value; - - switch (getsubopt(&p, subopts, &value)) { - case S_LOG: - case S_SECTLOG: - if (params.lssflag) - conflict('s', subopts, - S_SECTSIZE, S_SECTLOG); - params.sectorlog = getnum(value, &sopts, - S_SECTLOG); - params.lsectorlog = params.sectorlog; - sectorsize = 1 << params.sectorlog; - params.lsectorsize = sectorsize; - params.lslflag = params.slflag = 1; - break; - case S_SIZE: - case S_SECTSIZE: - if (params.lslflag) - conflict('s', subopts, S_SECTLOG, - S_SECTSIZE); - sectorsize = getnum(value, &sopts, - S_SECTSIZE); - params.lsectorsize = sectorsize; - params.sectorlog = - libxfs_highbit32(sectorsize); - params.lsectorlog = params.sectorlog; - params.lssflag = params.ssflag = 1; - break; - default: - unknown('s', value); - } - } - break; case 'V': printf(_("%s version %s\n"), progname, VERSION); exit(0); -- 2.11.0 -- 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