From: Steve Guminski Date: Fri, 14 Apr 2017 19:16:23 +0000 (-0400) Subject: LU-6210 utils: Use C99 initializers in lfs_setdirstripe() X-Git-Tag: 2.10.0-RC1~25 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3c60d60188e129f1cad3ed79153626fa118376ae LU-6210 utils: Use C99 initializers in lfs_setdirstripe() This patch makes no functional changes. Struct initializers that use C89 or GCC-only syntax 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. This patch updates lfs_setdirstripe() to use the C99 syntax. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: I0335cae79bc5f57da3d73b40c17e83f87853ef5f Reviewed-on: https://review.whamcloud.com/27515 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond --- diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 89863fd..7e2c61e 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -2858,26 +2858,26 @@ static int lfs_setdirstripe(int argc, char **argv) struct option long_opts[] = { #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - {"count", required_argument, 0, 'c'}, + { .val = 'c', .name = "count", .has_arg = required_argument }, #endif - {"mdt-count", required_argument, 0, 'c'}, - {"delete", no_argument, 0, 'd'}, + { .val = 'c', .name = "mdt-count", .has_arg = required_argument }, + { .val = 'd', .name = "delete", .has_arg = no_argument }, #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - {"index", required_argument, 0, 'i'}, + { .val = 'i', .name = "index", .has_arg = required_argument }, #endif - {"mdt-index", required_argument, 0, 'i'}, - {"mode", required_argument, 0, 'm'}, + { .val = 'i', .name = "mdt-index", .has_arg = required_argument }, + { .val = 'm', .name = "mode", .has_arg = required_argument }, #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - {"hash-type", required_argument, 0, 't'}, - {"mdt-hash", required_argument, 0, 't'}, + { .val = 't', .name = "hash-type", .has_arg = required_argument }, + { .val = 't', .name = "mdt-hash", .has_arg = required_argument }, #endif {"mdt-hash", required_argument, 0, 'H'}, #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0) - {"default_stripe", no_argument, 0, 'D'}, + { .val = 'D', .name = "default_stripe", + .has_arg = no_argument }, #endif - {"default", no_argument, 0, 'D'}, - {0, 0, 0, 0} - }; + { .val = 'D', .name = "default", .has_arg = no_argument }, + { .name = NULL } }; while ((c = getopt_long(argc, argv, "c:dDi:H:m:t:", long_opts, NULL)) >= 0) {