From 0760baa19438f882edb94e8e86512b9751bc4432 Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Fri, 14 Apr 2017 15:47:25 -0400 Subject: [PATCH] LU-6210 utils: Use C99 struct initializers in lfs_hsm_request() 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_hsm_request() to use the C99 syntax. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: I62b07e59a3f81cf8ee936ae46b1cd8f99913e53c Reviewed-on: https://review.whamcloud.com/27526 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin --- lustre/utils/lfs.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index ef2205a..35c908e 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -5009,13 +5009,12 @@ static int fill_hur_item(struct hsm_user_request *hur, unsigned int idx, static int lfs_hsm_request(int argc, char **argv, int action) { - struct option long_opts[] = { - {"filelist", 1, 0, 'l'}, - {"data", 1, 0, 'D'}, - {"archive", 1, 0, 'a'}, - {"mntpath", 1, 0, 'm'}, - {0, 0, 0, 0} - }; + struct option long_opts[] = { + { .val = 'a', .name = "archive", .has_arg = required_argument }, + { .val = 'D', .name = "data", .has_arg = required_argument }, + { .val = 'l', .name = "filelist", .has_arg = required_argument }, + { .val = 'm', .name = "mntpath", .has_arg = required_argument }, + { .name = NULL } }; dev_t last_dev = 0; char short_opts[] = "l:D:a:m:"; struct hsm_user_request *hur, *oldhur; -- 1.8.3.1