From: Steve Guminski Date: Mon, 22 May 2017 12:13:56 +0000 (-0400) Subject: LU-6210 utils: Use C99 initializer in jt_obd_md_common() X-Git-Tag: 2.10.51~25 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f4e95a4429e9f6a8aa8170984bc6f8cd14cd5db0 LU-6210 utils: Use C99 initializer in jt_obd_md_common() This patch makes no functional changes. The long_opts struct initializer in jt_obd_md_common() is 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. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: Ifa7140e9980570940f8dfd1200307d02242a8c45 Reviewed-on: https://review.whamcloud.com/27879 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 b45c09d..5331898 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -1150,18 +1150,21 @@ int jt_obd_md_common(int argc, char **argv, int cmd) char *name = NULL; struct jt_fid_space fid_space = {0}; int version = 0; - struct option long_opts[] = { - {"child_base_id", required_argument, 0, 'b'}, - {"stripe_count", required_argument, 0, 'c'}, - {"parent_basedir", required_argument, 0, 'd'}, - {"parent_dircount", required_argument, 0, 'D'}, - {"stripe_index", required_argument, 0, 'i'}, - {"mode", required_argument, 0, 'm'}, - {"count", required_argument, 0, 'n'}, - {"time", required_argument, 0, 't'}, - {"version", no_argument, 0, 'v'}, - {0, 0, 0, 0} - }; + struct option long_opts[] = { + { .val = 'b', .name = "child_base_id", + .has_arg = required_argument }, + { .val = 'c', .name = "stripe_count", + .has_arg = required_argument }, + { .val = 'd', .name = "parent_basedir", + .has_arg = required_argument }, + { .val = 'D', .name = "parent_dircount", + .has_arg = required_argument }, + { .val = 'i', .name = "stripe_index", .has_arg = required_argument }, + { .val = 'm', .name = "mode", .has_arg = required_argument }, + { .val = 'n', .name = "count", .has_arg = required_argument }, + { .val = 't', .name = "time", .has_arg = required_argument }, + { .val = 'v', .name = "version", .has_arg = no_argument }, + { .name = NULL } }; while ((c = getopt_long(argc, argv, "b:c:d:D:m:n:t:v", long_opts, NULL)) >= 0) {