From dad40c1980cbe67ec60055258f435cc3369745db Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Mon, 26 Jun 2017 14:09:14 -0400 Subject: [PATCH] LU-6210 utils: Use C99 initializer in jt_nodemap_test_id() This patch makes no functional changes. The long_options struct initializer in jt_nodemap_test_id() 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: Iddbee594f8ccd9cada11c6c792e31656c16f7170 Reviewed-on: https://review.whamcloud.com/27881 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- lustre/utils/obd.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index ab5f883..a47b29a 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -3365,32 +3365,15 @@ int jt_nodemap_test_id(int argc, char **argv) int rc = 0; int c; - static struct option long_options[] = { - { - .name = "nid", - .has_arg = required_argument, - .flag = 0, - .val = 'n', - }, - { - .name = "idtype", - .has_arg = required_argument, - .flag = 0, - .val = 't', - }, - { - .name = "id", - .has_arg = required_argument, - .flag = 0, - .val = 'i', - }, - { - NULL - } - }; + static struct option long_opts[] = { + { .val = 'i', .name = "id", .has_arg = required_argument }, + { .val = 'n', .name = "nid", .has_arg = required_argument }, + { .val = 't', .name = "idtype", + .has_arg = required_argument }, + { .name = NULL } }; while ((c = getopt_long(argc, argv, "n:t:i:", - long_options, NULL)) != -1) { + long_opts, NULL)) != -1) { switch (c) { case 'n': nidstr = optarg; -- 1.8.3.1