From 1d6d594d1043425a237585d2d5ad33599127dc3d Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Fri, 14 Apr 2017 15:33:23 -0400 Subject: [PATCH] LU-6210 utils: Use C99 initializers in lfs_changelog() 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_changelog() to use the C99 syntax. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: I4f9d82974f68742d788f00d58c5e3d61449fc5bb Reviewed-on: https://review.whamcloud.com/27522 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Frank Zago Reviewed-by: Sebastien Buisson Reviewed-by: Andreas Dilger --- lustre/utils/lfs.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 2d9eeeb..189c1dd 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -4367,19 +4367,18 @@ static int lfs_ls(int argc, char **argv) static int lfs_changelog(int argc, char **argv) { - void *changelog_priv; + void *changelog_priv; struct changelog_rec *rec; - long long startrec = 0, endrec = 0; - char *mdd; - struct option long_opts[] = { - {"follow", no_argument, 0, 'f'}, - {0, 0, 0, 0} - }; - char short_opts[] = "f"; - int rc, follow = 0; - - while ((rc = getopt_long(argc, argv, short_opts, - long_opts, NULL)) != -1) { + long long startrec = 0, endrec = 0; + char *mdd; + struct option long_opts[] = { + { .val = 'f', .name = "follow", .has_arg = no_argument }, + { .name = NULL } }; + char short_opts[] = "f"; + int rc, follow = 0; + + while ((rc = getopt_long(argc, argv, short_opts, + long_opts, NULL)) != -1) { switch (rc) { case 'f': follow++; -- 1.8.3.1