From: Steve Guminski Date: Mon, 22 May 2017 12:54:11 +0000 (-0400) Subject: LU-6210 utils: Use C99 initializer in jt_nodemap_modify() X-Git-Tag: 2.10.51~21 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=8633aaba2da245bc62b876e535e7ac26385e1385;hp=9c5fad36aac2086b38f91e28db90da01efc9126a LU-6210 utils: Use C99 initializer in jt_nodemap_modify() This patch makes no functional changes. The long_options struct initializer in jt_nodemap_modify() is updated to C99 syntax. It is renamed to long_opts for consistency. 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 Change-Id: I4c1bd5a3aa26c486436ae68d698fd89f8735a7fb Reviewed-on: https://review.whamcloud.com/27889 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin --- diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 4c0c14e..f029e92 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -3656,32 +3656,14 @@ int jt_nodemap_modify(int argc, char **argv) char *param = NULL; char *value = NULL; - static struct option long_options[] = { - { - .name = "name", - .has_arg = required_argument, - .flag = 0, - .val = 'n', - }, - { - .name = "property", - .has_arg = required_argument, - .flag = 0, - .val = 'p', - }, - { - .name = "value", - .has_arg = required_argument, - .flag = 0, - .val = 'v', - }, - { - NULL - } - }; + static struct option long_opts[] = { + { .val = 'n', .name = "name", .has_arg = required_argument }, + { .val = 'p', .name = "property", .has_arg = required_argument }, + { .val = 'v', .name = "value", .has_arg = required_argument }, + { .name = NULL } }; while ((c = getopt_long(argc, argv, "n:p:v:", - long_options, NULL)) != -1) { + long_opts, NULL)) != -1) { switch (c) { case 'n': nodemap_name = optarg;