Whamcloud - gitweb
LU-8998 utils: allow "--component-*" to be abbreviated 99/26699/2
authorAndreas Dilger <andreas.dilger@intel.com>
Tue, 18 Apr 2017 07:35:54 +0000 (01:35 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Apr 2017 03:37:27 +0000 (03:37 +0000)
Allow "--component-foo" arguments to be abbreviated to "--comp-foo"
to simplify userspace, especially for options like "--comp-flags"
that do not have a short option.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I8c434dd68c042efefc2df93d0f2d7b9bc33ebbe5
Reviewed-on: https://review.whamcloud.com/26699
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/lfs.c

index 0eaaf7e..c262cc1 100644 (file)
@@ -1303,10 +1303,14 @@ static int lfs_setstripe(int argc, char **argv)
        struct option            long_opts[] = {
                /* --block is only valid in migrate mode */
                {"block",        no_argument,       0, 'b'},
-               {"component-add", no_argument, 0, LFS_COMP_ADD_OPT},
-               {"component-del", no_argument, 0, LFS_COMP_DEL_OPT},
+               {"comp-add",     no_argument,       0, LFS_COMP_ADD_OPT},
+               {"component-add", no_argument,      0, LFS_COMP_ADD_OPT},
+               {"comp-del",     no_argument,       0, LFS_COMP_DEL_OPT},
+               {"component-del", no_argument,      0, LFS_COMP_DEL_OPT},
+               {"comp-flags",   required_argument, 0, LFS_COMP_FLAGS_OPT},
                {"component-flags", required_argument, 0, LFS_COMP_FLAGS_OPT},
-               {"component-set", no_argument, 0, LFS_COMP_SET_OPT},
+               {"comp-set",     no_argument,       0, LFS_COMP_SET_OPT},
+               {"component-set", no_argument,      0, LFS_COMP_SET_OPT},
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0)
                /* This formerly implied "stripe-count", but was explicitly
                 * made "stripe-count" for consistency with other options,
@@ -1316,6 +1320,7 @@ static int lfs_setstripe(int argc, char **argv)
                {"stripe-count", required_argument, 0, 'c'},
                {"stripe_count", required_argument, 0, 'c'},
                {"delete",       no_argument,       0, 'd'},
+               {"comp-end",     required_argument, 0, 'E'},
                {"component-end", required_argument, 0, 'E'},
                /* dirstripe {"mdt-hash",     required_argument, 0, 'H'}, */
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0)
@@ -1326,8 +1331,9 @@ static int lfs_setstripe(int argc, char **argv)
 #endif
                {"stripe-index", required_argument, 0, 'i'},
                {"stripe_index", required_argument, 0, 'i'},
+               {"comp-id",      required_argument, 0, 'I'},
                {"component-id", required_argument, 0, 'I'},
-               {"mdt",          required_argument, 0, 'm'},
+               {"mdt",          required_argument, 0, 'm'},
                {"mdt-index",    required_argument, 0, 'm'},
                {"mdt_index",    required_argument, 0, 'm'},
                /* --non-block is only valid in migrate mode */
@@ -1814,13 +1820,17 @@ static int lfs_find(int argc, char **argv)
        };
         struct option long_opts[] = {
                {"atime",        required_argument, 0, 'A'},
+               {"comp-count",   required_argument, 0, LFS_COMP_COUNT_OPT},
                {"component-count", required_argument, 0, LFS_COMP_COUNT_OPT},
+               {"comp-flags",   required_argument, 0, LFS_COMP_FLAGS_OPT},
                {"component-flags", required_argument, 0, LFS_COMP_FLAGS_OPT},
+               {"comp-start",   required_argument, 0, LFS_COMP_START_OPT},
                {"component-start", required_argument, 0, LFS_COMP_START_OPT},
                {"stripe-count", required_argument, 0, 'c'},
                {"stripe_count", required_argument, 0, 'c'},
                {"ctime",        required_argument, 0, 'C'},
                {"maxdepth",     required_argument, 0, 'D'},
+               {"comp-end",     required_argument, 0, 'E'},
                {"component-end", required_argument, 0, 'E'},
                {"gid",          required_argument, 0, 'g'},
                {"group",        required_argument, 0, 'G'},
@@ -2289,8 +2299,11 @@ static int lfs_getstripe_internal(int argc, char **argv,
                                  struct find_param *param)
 {
        struct option long_opts[] = {
+               {"comp-count",          no_argument, 0, LFS_COMP_COUNT_OPT},
                {"component-count",     no_argument, 0, LFS_COMP_COUNT_OPT},
+               {"comp-flags",      required_argument, 0, LFS_COMP_FLAGS_OPT},
                {"component-flags", required_argument, 0, LFS_COMP_FLAGS_OPT},
+               {"comp-start",      required_argument, 0, LFS_COMP_START_OPT},
                {"component-start", required_argument, 0, LFS_COMP_START_OPT},
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 9, 59, 0)
                /* This formerly implied "stripe-count", but was explicitly
@@ -2302,6 +2315,7 @@ static int lfs_getstripe_internal(int argc, char **argv,
                {"stripe_count",        no_argument,            0, 'c'},
                {"directory",           no_argument,            0, 'd'},
                {"default",             no_argument,            0, 'D'},
+               {"comp-end",            required_argument,      0, 'E'},
                {"component-end",       required_argument,      0, 'E'},
                {"fid",                 no_argument,            0, 'F'},
                {"generation",          no_argument,            0, 'g'},
@@ -2314,6 +2328,7 @@ static int lfs_getstripe_internal(int argc, char **argv,
 #endif
                {"stripe-index",        no_argument,            0, 'i'},
                {"stripe_index",        no_argument,            0, 'i'},
+               {"comp-id",             required_argument,      0, 'I'},
                {"component-id",        required_argument,      0, 'I'},
                {"layout",              no_argument,            0, 'L'},
                {"mdt",                 no_argument,            0, 'm'},