Whamcloud - gitweb
LU-6210 utils: Use C99 struct initializers in lfs_hsm_state() 25/27525/2
authorSteve Guminski <stephenx.guminski@intel.com>
Fri, 14 Apr 2017 19:45:59 +0000 (15:45 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 19 Jul 2017 03:31:23 +0000 (03:31 +0000)
This patch makes no functional changes.  Struct initializers that
use C89 or GCC-only syntax 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.

This patch updates lfs_hsm_state() to use the C99 syntax.

Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: I32f427396e99f1b86d329eb8457883a9aaaed181
Reviewed-on: https://review.whamcloud.com/27525
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lustre/utils/lfs.c

index 6aeb484..f0e8543 100644 (file)
@@ -4774,14 +4774,13 @@ static int lfs_hsm_state(int argc, char **argv)
 static int lfs_hsm_change_flags(int argc, char **argv, int mode)
 {
        struct option long_opts[] = {
-               {"lost", 0, 0, 'l'},
-               {"norelease", 0, 0, 'r'},
-               {"noarchive", 0, 0, 'a'},
-               {"archived", 0, 0, 'A'},
-               {"dirty", 0, 0, 'd'},
-               {"exists", 0, 0, 'e'},
-               {0, 0, 0, 0}
-       };
+       { .val = 'A',   .name = "archived",     .has_arg = no_argument },
+       { .val = 'a',   .name = "noarchive",    .has_arg = no_argument },
+       { .val = 'd',   .name = "dirty",        .has_arg = no_argument },
+       { .val = 'e',   .name = "exists",       .has_arg = no_argument },
+       { .val = 'l',   .name = "lost",         .has_arg = no_argument },
+       { .val = 'r',   .name = "norelease",    .has_arg = no_argument },
+       { .name = NULL } };
        char short_opts[] = "lraAde";
        __u64 mask = 0;
        int c, rc;