Whamcloud - gitweb
LU-6210 utils: Use C99 struct initializers in lfs_setquota() 21/27521/3
authorSteve Guminski <stephenx.guminski@intel.com>
Fri, 14 Apr 2017 19:31:40 +0000 (15:31 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 29 Jul 2017 00:02:38 +0000 (00:02 +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_setquota() to use the C99 syntax.

Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: I4bae3ccf40380d662b151b8ac53976f38c63daf6
Reviewed-on: https://review.whamcloud.com/27521
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/lfs.c

index 1c77560..ef2205a 100644 (file)
@@ -3709,15 +3709,18 @@ int lfs_setquota(int argc, char **argv)
         char *mnt, *obd_type = (char *)qctl.obd_type;
         struct obd_dqblk *dqb = &qctl.qc_dqblk;
         struct option long_opts[] = {
-                {"block-softlimit", required_argument, 0, 'b'},
-                {"block-hardlimit", required_argument, 0, 'B'},
-                {"group",           required_argument, 0, 'g'},
-                {"inode-softlimit", required_argument, 0, 'i'},
-                {"inode-hardlimit", required_argument, 0, 'I'},
-                {"user",            required_argument, 0, 'u'},
-               {"projid",         required_argument, 0, 'p'},
-                {0, 0, 0, 0}
-        };
+       { .val = 'b',   .name = "block-softlimit",
+                                               .has_arg = required_argument },
+       { .val = 'B',   .name = "block-hardlimit",
+                                               .has_arg = required_argument },
+       { .val = 'g',   .name = "group",        .has_arg = required_argument },
+       { .val = 'i',   .name = "inode-softlimit",
+                                               .has_arg = required_argument },
+       { .val = 'I',   .name = "inode-hardlimit",
+                                               .has_arg = required_argument },
+       { .val = 'p',   .name = "projid",       .has_arg = required_argument },
+       { .val = 'u',   .name = "user",         .has_arg = required_argument },
+       { .name = NULL } };
         unsigned limit_mask = 0;
         char *endptr;
        int qtype;