From 7524da20e134f6bbafb2a10aadc89852c6cd236d Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Mon, 22 May 2017 08:42:50 -0400 Subject: [PATCH 1/1] LU-6210 utils: Use C99 initializer in jt_nodemap_add_range() This patch makes no functional changes. The long_options struct initializer in jt_nodemap_add_range() 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: Iba46b68e1c19f89e770f234ab1149926d64f7efb Reviewed-on: https://review.whamcloud.com/27882 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin --- lustre/utils/obd.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 9d125ce..39bb35f 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -3438,28 +3438,15 @@ int jt_nodemap_add_range(int argc, char **argv) int rc = 0; int c; - static struct option long_options[] = { - { - .name = "name", - .has_arg = required_argument, - .flag = 0, - .val = 'n', - }, - { - .name = "range", - .has_arg = required_argument, - .flag = 0, - .val = 'r', - }, - { - NULL - } - }; + static struct option long_opts[] = { + { .val = 'n', .name = "name", .has_arg = required_argument }, + { .val = 'r', .name = "range", .has_arg = required_argument }, + { .name = NULL } }; INIT_LIST_HEAD(&nidlist); while ((c = getopt_long(argc, argv, "n:r:", - long_options, NULL)) != -1) { + long_opts, NULL)) != -1) { switch (c) { case 'n': nodemap_name = optarg; -- 1.8.3.1