Whamcloud - gitweb
LU-6210 utils: Use C99 initializer in jt_nodemap_set_fileset() 88/27888/2
authorSteve Guminski <stephenx.guminski@intel.com>
Mon, 22 May 2017 12:50:48 +0000 (08:50 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 29 Jul 2017 00:02:56 +0000 (00:02 +0000)
This patch makes no functional changes.  The long_options struct
initializer in jt_nodemap_set_fileset() is updated to C99 syntax.
It is renamed to long_opts for consistency.

C89 positional initializers require values to be placed in the
correct order. This will cause errors if the fields of the struct
definition are reordered or fields are added or removed. C99 named
initializers avoid this problem, and also automatically clear any
values that are not explicitly set.

Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: I8c0e90e04dd407246e95e59c5b856b9d11b78500
Reviewed-on: https://review.whamcloud.com/27888
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
lustre/utils/obd.c

index 39bb35f..4c0c14e 100644 (file)
@@ -3599,26 +3599,13 @@ int jt_nodemap_set_fileset(int argc, char **argv)
        int   rc = 0;
        int   c;
 
-       static struct option long_options[] = {
-               {
-                       .name           = "name",
-                       .has_arg        = required_argument,
-                       .flag           = 0,
-                       .val            = 'n',
-               },
-               {
-                       .name           = "fileset",
-                       .has_arg        = required_argument,
-                       .flag           = 0,
-                       .val            = 'f',
-               },
-               {
-                       NULL
-               }
-       };
+       static struct option long_opts[] = {
+       { .val = 'f',   .name = "fileset",      .has_arg = required_argument },
+       { .val = 'n',   .name = "name",         .has_arg = required_argument },
+       { .name = NULL } };
 
        while ((c = getopt_long(argc, argv, "n:f:",
-                               long_options, NULL)) != -1) {
+                               long_opts, NULL)) != -1) {
                switch (c) {
                case 'n':
                        nodemap_name = optarg;