From: Steve Guminski Date: Fri, 19 May 2017 19:17:03 +0000 (-0400) Subject: LU-6210 utils: Use C99 struct initializers in lustre_fsck.c X-Git-Tag: 2.10.51~60 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=4bf65a2f6b215644b17ed20beaae1b7ff1a73bc5 LU-6210 utils: Use C99 struct initializers in lustre_fsck.c This patch makes no functional changes. The long_opt_stop and long_opt_query struct initializers in lustre_lfsck.c 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. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: Ie713904f31208447e4d5741023356aa1a37c0ea3 Reviewed-on: https://review.whamcloud.com/27790 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Fan Yong --- diff --git a/lustre/utils/lustre_lfsck.c b/lustre/utils/lustre_lfsck.c index 94f0b2b..b09742b 100644 --- a/lustre/utils/lustre_lfsck.c +++ b/lustre/utils/lustre_lfsck.c @@ -71,19 +71,17 @@ static struct option long_opt_start[] = { }; static struct option long_opt_stop[] = { - {"device", required_argument, 0, 'M'}, - {"all", no_argument, 0, 'A'}, - {"help", no_argument, 0, 'h'}, - {0, 0, 0, 0 } -}; + { .val = 'A', .name = "all", .has_arg = no_argument }, + { .val = 'h', .name = "help", .has_arg = no_argument }, + { .val = 'M', .name = "device", .has_arg = required_argument }, + { .name = NULL } }; static struct option long_opt_query[] = { - {"device", required_argument, 0, 'M'}, - {"type", required_argument, 0, 't'}, - {"help", no_argument, 0, 'h'}, - {"wait", no_argument, 0, 'w'}, - {0, 0, 0, 0 } -}; + { .val = 'h', .name = "help", .has_arg = no_argument }, + { .val = 'M', .name = "device", .has_arg = required_argument }, + { .val = 't', .name = "type", .has_arg = required_argument }, + { .val = 'w', .name = "wait", .has_arg = no_argument }, + { .name = NULL } }; struct lfsck_type_name { char *ltn_name;