Whamcloud - gitweb
LU-6210 utils: Use C99 struct initializers in lfs_df() 18/27518/2
authorSteve Guminski <stephenx.guminski@intel.com>
Fri, 14 Apr 2017 19:25:15 +0000 (15:25 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 13 Jun 2017 16:56:00 +0000 (16:56 +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_df() to use the C99 syntax.

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

index 7e2c61e..668f261 100644 (file)
@@ -3370,13 +3370,13 @@ static int lfs_df(int argc, char **argv)
        int c, rc = 0, index = 0;
        char fsname[PATH_MAX] = "", *pool_name = NULL;
        struct option long_opts[] = {
-               {"human-readable", 0, 0, 'h'},
-               {"inodes", 0, 0, 'i'},
-               {"lazy", 0, 0, 'l'},
-               {"pool", required_argument, 0, 'p'},
-               {"verbose", 0, 0, 'v'},
-               {0, 0, 0, 0}
-       };
+       { .val = 'h',   .name = "human-readable",
+                                               .has_arg = no_argument },
+       { .val = 'i',   .name = "inodes",       .has_arg = no_argument },
+       { .val = 'l',   .name = "lazy",         .has_arg = no_argument },
+       { .val = 'p',   .name = "pool",         .has_arg = required_argument },
+       { .val = 'v',   .name = "verbose",      .has_arg = no_argument },
+       { .name = NULL} };
 
        while ((c = getopt_long(argc, argv, "hilp:v", long_opts, NULL)) != -1) {
                switch (c) {