From 0568e93539ebc1bbec601182f9faba4d43ed106b Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Tue, 8 Aug 2017 13:46:24 -0400 Subject: [PATCH] LU-6210 utils: Use C99 struct initializers in lfs_getdirstripe This patch makes no functional changes. The option struct initializer in lfs_getdirstripe() 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: I6f2d4a82e5a9ef2c76946746d6c46b1202e8c278 Reviewed-on: https://review.whamcloud.com/28421 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger --- lustre/utils/lfs.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 189c1dd..1b5536d 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -2749,20 +2749,19 @@ static int lfs_getdirstripe(int argc, char **argv) struct find_param param = { 0 }; struct option long_opts[] = { #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - {"mdt-count", no_argument, 0, 'c'}, + { .val = 'c', .name = "mdt-count", .has_arg = no_argument }, #endif - {"mdt-hash", no_argument, 0, 'H'}, - {"mdt-index", no_argument, 0, 'i'}, - {"recursive", no_argument, 0, 'r'}, + { .val = 'D', .name = "default", .has_arg = no_argument }, + { .val = 'H', .name = "mdt-hash", .has_arg = no_argument }, + { .val = 'i', .name = "mdt-index", .has_arg = no_argument }, + { .val = 'O', .name = "obd", .has_arg = required_argument }, + { .val = 'r', .name = "recursive", .has_arg = no_argument }, #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - {"mdt-hash", no_argument, 0, 't'}, + { .val = 't', .name = "mdt-hash", .has_arg = no_argument }, #endif - {"default", no_argument, 0, 'D'}, - {"obd", required_argument, 0, 'O'}, - {"mdt-count", no_argument, 0, 'T'}, - {"yaml", no_argument, 0, 'y'}, - {0, 0, 0, 0} - }; + { .val = 'T', .name = "mdt-count", .has_arg = no_argument }, + { .val = 'y', .name = "yaml", .has_arg = no_argument }, + { .name = NULL } }; int c, rc; param.fp_get_lmv = 1; -- 1.8.3.1