aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2017-12-06 17:14:27 -0600
committerEric Sandeen <sandeen@redhat.com>2017-12-06 17:14:27 -0600
commit05abf43d42822655557b95ad355be5a21d609ab4 (patch)
treef5b41eb723f53721281da683be7b29f4a31ba89c
parent594932fbf720da416d69d81e6f6d3c29435f122d (diff)
downloadxfsprogs-dev-05abf43d42822655557b95ad355be5a21d609ab4.tar.gz
mkfs: make subopt table const
Use const for all the tables to remove most of the (char **) casts. This adds a couple of temporary (const char **) casts that go away as the input parsing is factored. Signed-Off-By: Dave Chinner <dchinner@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r--mkfs/xfs_mkfs.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index b3d8a51107..3fd8c6a12c 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -24,11 +24,11 @@
/*
* Prototypes for internal functions.
*/
-static void conflict(char opt, char *tab[], int oldidx, int newidx);
+static void conflict(char opt, const char *tab[], int oldidx, int newidx);
static void illegal(const char *value, const char *opt);
static __attribute__((noreturn)) void usage (void);
-static __attribute__((noreturn)) void reqval(char opt, char *tab[], int idx);
-static void respec(char opt, char *tab[], int idx);
+static __attribute__((noreturn)) void reqval(char opt, const char *tab[], int idx);
+static void respec(char opt, const char *tab[], int idx);
static void unknown(char opt, char *s);
static int ispow2(unsigned int i);
@@ -1295,7 +1295,7 @@ check_opt(
fprintf(stderr,
_("Developer screwed up option parsing (%d/%d)! Please report!\n"),
sp->index, index);
- reqval(opts->name, (char **)opts->subopts, index);
+ reqval(opts->name, opts->subopts, index);
}
/*
@@ -1308,11 +1308,11 @@ check_opt(
*/
if (!str_seen) {
if (sp->seen)
- respec(opts->name, (char **)opts->subopts, index);
+ respec(opts->name, opts->subopts, index);
sp->seen = true;
} else {
if (sp->str_seen)
- respec(opts->name, (char **)opts->subopts, index);
+ respec(opts->name, opts->subopts, index);
sp->str_seen = true;
}
@@ -1324,7 +1324,7 @@ check_opt(
break;
if (opts->subopt_params[conflict_opt].seen ||
opts->subopt_params[conflict_opt].str_seen)
- conflict(opts->name, (char **)opts->subopts,
+ conflict(opts->name, opts->subopts,
conflict_opt, index);
}
}
@@ -1342,7 +1342,7 @@ getnum(
/* empty strings might just return a default value */
if (!str || *str == '\0') {
if (sp->defaultval == SUBOPT_NEEDS_VAL)
- reqval(opts->name, (char **)opts->subopts, index);
+ reqval(opts->name, opts->subopts, index);
return sp->defaultval;
}
@@ -1398,7 +1398,7 @@ getstr(
/* empty strings for string options are not valid */
if (!str || *str == '\0')
- reqval(opts->name, (char **)opts->subopts, index);
+ reqval(opts->name, opts->subopts, index);
return str;
}
@@ -1801,7 +1801,7 @@ main(
break;
case M_UUID:
if (!value || *value == '\0')
- reqval('m', subopts, M_UUID);
+ reqval('m', (const char **)subopts, M_UUID);
if (platform_uuid_parse(value, &uuid))
illegal(optarg, "m uuid");
break;
@@ -1915,7 +1915,7 @@ main(
case S_LOG:
case S_SECTLOG:
if (lssflag)
- conflict('s', subopts,
+ conflict('s', (const char **)subopts,
S_SECTSIZE, S_SECTLOG);
sectorlog = getnum(value, &sopts,
S_SECTLOG);
@@ -1927,7 +1927,7 @@ main(
case S_SIZE:
case S_SECTSIZE:
if (lslflag)
- conflict('s', subopts, S_SECTLOG,
+ conflict('s', (const char **)subopts, S_SECTLOG,
S_SECTSIZE);
sectorsize = getnum(value, &sopts,
S_SECTSIZE);
@@ -3390,7 +3390,7 @@ _("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
static void
conflict(
char opt,
- char *tab[],
+ const char *tab[],
int oldidx,
int newidx)
{
@@ -3419,7 +3419,7 @@ ispow2(
static void __attribute__((noreturn))
reqval(
char opt,
- char *tab[],
+ const char *tab[],
int idx)
{
fprintf(stderr, _("-%c %s option requires a value\n"), opt, tab[idx]);
@@ -3429,7 +3429,7 @@ reqval(
static void
respec(
char opt,
- char *tab[],
+ const char *tab[],
int idx)
{
fprintf(stderr, "-%c ", opt);