Whamcloud - gitweb
LU-6210 utils: Use C99 struct initializers in lfs_getdirstripe 21/28421/2
authorSteve Guminski <stephenx.guminski@intel.com>
Tue, 8 Aug 2017 17:46:24 +0000 (13:46 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Aug 2017 06:26:46 +0000 (06:26 +0000)
This patch makes no functional changes.  The option struct
initializer in lfs_getdirstripe() is 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: I6f2d4a82e5a9ef2c76946746d6c46b1202e8c278
Reviewed-on: https://review.whamcloud.com/28421
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/utils/lfs.c

index 189c1dd..1b5536d 100644 (file)
@@ -2749,20 +2749,19 @@ static int lfs_getdirstripe(int argc, char **argv)
        struct find_param param = { 0 };
        struct option long_opts[] = {
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
-               {"mdt-count",   no_argument,            0, 'c'},
+       { .val = 'c',   .name = "mdt-count",    .has_arg = no_argument },
 #endif
-               {"mdt-hash",    no_argument,            0, 'H'},
-               {"mdt-index",   no_argument,            0, 'i'},
-               {"recursive",   no_argument,            0, 'r'},
+       { .val = 'D',   .name = "default",      .has_arg = no_argument },
+       { .val = 'H',   .name = "mdt-hash",     .has_arg = no_argument },
+       { .val = 'i',   .name = "mdt-index",    .has_arg = no_argument },
+       { .val = 'O',   .name = "obd",          .has_arg = required_argument },
+       { .val = 'r',   .name = "recursive",    .has_arg = no_argument },
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
-               {"mdt-hash",    no_argument,            0, 't'},
+       { .val = 't',   .name = "mdt-hash",     .has_arg = no_argument },
 #endif
-               {"default",     no_argument,            0, 'D'},
-               {"obd",         required_argument,      0, 'O'},
-               {"mdt-count",   no_argument,            0, 'T'},
-               {"yaml",        no_argument,            0, 'y'},
-               {0, 0, 0, 0}
-       };
+       { .val = 'T',   .name = "mdt-count",    .has_arg = no_argument },
+       { .val = 'y',   .name = "yaml",         .has_arg = no_argument },
+       { .name = NULL } };
        int c, rc;
 
        param.fp_get_lmv = 1;