]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: constify various strings
authorDave Chinner <dchinner@redhat.com>
Fri, 20 Nov 2020 22:03:29 +0000 (17:03 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 20 Nov 2020 22:03:29 +0000 (17:03 -0500)
Because the ini parser uses const strings and so the opt parsing
needs to be told about it to avoid compiler warnings.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/linux.h
mkfs/xfs_mkfs.c

index 57726bb12b7416e794db1602ebdbda982734c14a..03b3278bb895d13dc6e0f6ec80df0aa1b660d1b9 100644 (file)
@@ -92,7 +92,7 @@ static __inline__ void platform_uuid_unparse(uuid_t *uu, char *buffer)
        uuid_unparse(*uu, buffer);
 }
 
-static __inline__ int platform_uuid_parse(char *buffer, uuid_t *uu)
+static __inline__ int platform_uuid_parse(const char *buffer, uuid_t *uu)
 {
        return uuid_parse(buffer, *uu);
 }
index 1d054a3fb7186b58334d1edae2be60e0741b40ef..a5282343b7044ebde0899d48d196fd45d86a6110 100644 (file)
@@ -994,8 +994,8 @@ respec(
 
 static void
 unknown(
-       char            opt,
-       char            *s)
+       const char      opt,
+       const char      *s)
 {
        fprintf(stderr, _("unknown option -%c %s\n"), opt, s);
        usage();
@@ -1406,7 +1406,7 @@ getnum(
  */
 static char *
 getstr(
-       char                    *str,
+       const char              *str,
        struct opt_params       *opts,
        int                     index)
 {
@@ -1415,14 +1415,14 @@ getstr(
        /* empty strings for string options are not valid */
        if (!str || *str == '\0')
                reqval(opts->name, opts->subopts, index);
-       return str;
+       return (char *)str;
 }
 
 static int
 block_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1439,7 +1439,7 @@ static int
 cfgfile_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1456,7 +1456,7 @@ static int
 data_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1533,7 +1533,7 @@ static int
 inode_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1568,7 +1568,7 @@ static int
 log_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1614,7 +1614,7 @@ static int
 meta_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1654,7 +1654,7 @@ static int
 naming_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1683,7 +1683,7 @@ static int
 rtdev_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1713,7 +1713,7 @@ static int
 sector_opts_parser(
        struct opt_params       *opts,
        int                     subopt,
-       char                    *value,
+       const char              *value,
        struct cli_params       *cli)
 {
        switch (subopt) {
@@ -1733,7 +1733,7 @@ static struct subopts {
        struct opt_params *opts;
        int             (*parser)(struct opt_params     *opts,
                                  int                   subopt,
-                                 char                  *value,
+                                 const char            *value,
                                  struct cli_params     *cli);
 } subopt_tab[] = {
        { 'b', &bopts, block_opts_parser },