Whamcloud - gitweb
LU-6210 utils: Use C99 initializer in jt_nodemap_del_range() 83/27883/2
authorSteve Guminski <stephenx.guminski@intel.com>
Mon, 22 May 2017 12:46:52 +0000 (08:46 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 5 Aug 2017 00:38:18 +0000 (00:38 +0000)
This patch makes no functional changes.  The long_options struct
initializer in jt_nodemap_del_range() 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: I442d2cb65c1ffefc2229ead83e04b7ec2d8160e5
Reviewed-on: https://review.whamcloud.com/27883
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>
lustre/utils/obd.c

index a47b29a..795d73f 100644 (file)
@@ -3499,28 +3499,15 @@ int jt_nodemap_del_range(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           = "range",
-                       .has_arg        = required_argument,
-                       .flag           = 0,
-                       .val            = 'r',
-               },
-               {
-                       NULL
-               }
-       };
+       static struct option long_opts[] = {
+       { .val = 'n',   .name = "name",         .has_arg = required_argument },
+       { .val = 'r',   .name = "range",        .has_arg = required_argument },
+       { .name = NULL } };
 
        INIT_LIST_HEAD(&nidlist);
 
        while ((c = getopt_long(argc, argv, "n:r:",
-                               long_options, NULL)) != -1) {
+                               long_opts, NULL)) != -1) {
                switch (c) {
                case 'n':
                        nodemap_name = optarg;