From 924586bdcc5a053bc06ef7c73ae2112866b880c5 Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Fri, 14 Apr 2017 15:45:59 -0400 Subject: [PATCH] LU-6210 utils: Use C99 struct initializers in lfs_hsm_state() 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_hsm_state() to use the C99 syntax. Test-Parameters: trivial Lustre-change: https://review.whamcloud.com/27525 Lustre-commit: 73c2c103f4f43f9bb37119a2e90d6c0fc1870711 Signed-off-by: Steve Guminski Change-Id: I32f427396e99f1b86d329eb8457883a9aaaed181 Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/30499 Tested-by: Jenkins Tested-by: Maloo --- 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 1abe70b..99d8a87 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -4747,14 +4747,13 @@ static int lfs_hsm_state(int argc, char **argv) static int lfs_hsm_change_flags(int argc, char **argv, int mode) { struct option long_opts[] = { - {"lost", 0, 0, 'l'}, - {"norelease", 0, 0, 'r'}, - {"noarchive", 0, 0, 'a'}, - {"archived", 0, 0, 'A'}, - {"dirty", 0, 0, 'd'}, - {"exists", 0, 0, 'e'}, - {0, 0, 0, 0} - }; + { .val = 'A', .name = "archived", .has_arg = no_argument }, + { .val = 'a', .name = "noarchive", .has_arg = no_argument }, + { .val = 'd', .name = "dirty", .has_arg = no_argument }, + { .val = 'e', .name = "exists", .has_arg = no_argument }, + { .val = 'l', .name = "lost", .has_arg = no_argument }, + { .val = 'r', .name = "norelease", .has_arg = no_argument }, + { .name = NULL } }; char short_opts[] = "lraAde"; __u64 mask = 0; int c, rc; -- 1.8.3.1