From c26a4d72445c7ce02e370cc84932d7cc89416966 Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Fri, 14 Apr 2017 15:49:11 -0400 Subject: [PATCH] LU-6210 utils: Use C99 initializers in lfs_get_ladvice() This patch makes no functional changes. Struct initializers that use C89 or GCC-only syntax are updated to C99 syntax. Variables of type struct option are 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. This patch updates lfs_get_ladvice() to use the C99 syntax. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: Ida06e903a53aae37c878eebb8707b8062bef59dc Reviewed-on: https://review.whamcloud.com/27527 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: John L. Hammond --- lustre/utils/lfs.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index f0e8543..192aea7 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -5239,14 +5239,13 @@ static enum lu_ladvise_type lfs_get_ladvice(const char *string) static int lfs_ladvise(int argc, char **argv) { - struct option long_opts[] = { - {"advice", required_argument, 0, 'a'}, - {"background", no_argument, 0, 'b'}, - {"end", required_argument, 0, 'e'}, - {"start", required_argument, 0, 's'}, - {"length", required_argument, 0, 'l'}, - {0, 0, 0, 0} - }; + struct option long_opts[] = { + { .val = 'a', .name = "advice", .has_arg = required_argument }, + { .val = 'b', .name = "background", .has_arg = no_argument }, + { .val = 'e', .name = "end", .has_arg = required_argument }, + { .val = 'l', .name = "length", .has_arg = required_argument }, + { .val = 's', .name = "start", .has_arg = required_argument }, + { .name = NULL } }; char short_opts[] = "a:be:l:s:"; int c; int rc = 0; -- 1.8.3.1