Whamcloud - gitweb
LU-6210 utils: Use C99 struct initializers in lustre_fsck.c 90/27790/2
authorSteve Guminski <stephenx.guminski@intel.com>
Fri, 19 May 2017 19:17:03 +0000 (15:17 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Jul 2017 03:31:51 +0000 (03:31 +0000)
This patch makes no functional changes.  The long_opt_stop and
long_opt_query struct initializers in lustre_lfsck.c are updated
to C99 syntax.

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: Ie713904f31208447e4d5741023356aa1a37c0ea3
Reviewed-on: https://review.whamcloud.com/27790
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
lustre/utils/lustre_lfsck.c

index 94f0b2b..b09742b 100644 (file)
@@ -71,19 +71,17 @@ static struct option long_opt_start[] = {
 };
 
 static struct option long_opt_stop[] = {
 };
 
 static struct option long_opt_stop[] = {
-       {"device",      required_argument, 0, 'M'},
-       {"all",         no_argument,       0, 'A'},
-       {"help",        no_argument,       0, 'h'},
-       {0,             0,                 0,  0 }
-};
+       { .val = 'A',   .name = "all",          .has_arg = no_argument },
+       { .val = 'h',   .name = "help",         .has_arg = no_argument },
+       { .val = 'M',   .name = "device",       .has_arg = required_argument },
+       { .name = NULL } };
 
 static struct option long_opt_query[] = {
 
 static struct option long_opt_query[] = {
-       {"device",      required_argument, 0, 'M'},
-       {"type",        required_argument, 0, 't'},
-       {"help",        no_argument,       0, 'h'},
-       {"wait",        no_argument,       0, 'w'},
-       {0,             0,                 0,  0 }
-};
+       { .val = 'h',   .name = "help",         .has_arg = no_argument },
+       { .val = 'M',   .name = "device",       .has_arg = required_argument },
+       { .val = 't',   .name = "type",         .has_arg = required_argument },
+       { .val = 'w',   .name = "wait",         .has_arg = no_argument },
+       { .name = NULL } };
 
 struct lfsck_type_name {
        char            *ltn_name;
 
 struct lfsck_type_name {
        char            *ltn_name;