From: Steve Guminski Date: Fri, 13 Jan 2017 15:43:35 +0000 (-0500) Subject: LU-5170 utils: Add support for --list-commands option X-Git-Tag: 2.9.54~52 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=723f40030aa289f0b44d9394cc2e15a4d1772600 LU-5170 utils: Add support for --list-commands option A --list-commands option has been added to lfs, lctl, lnetctl and lst to output a list of the commands supported by each utility. The commands are printed in a multi-column format to produce more compact output that is easier to read. The appropriate man pages have been updated to include the new options. The obsolete ACL and join commands have been removed from lfs. Signed-off-by: Steve Guminski Change-Id: I3715049539c76e0cd03accfccfbf7eda6f4bf2ff Reviewed-on: https://review.whamcloud.com/24902 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao --- diff --git a/libcfs/include/libcfs/util/parser.h b/libcfs/include/libcfs/util/parser.h index 77dae1d..2fb2db7 100644 --- a/libcfs/include/libcfs/util/parser.h +++ b/libcfs/include/libcfs/util/parser.h @@ -77,6 +77,9 @@ void Parser_printhelp(char *); /* Detailed help routine */ void Parser_exit(int, char **); /* Shuts down command parser */ int Parser_execarg(int argc, char **argv, command_t cmds[]); int execute_line(char * line); +int Parser_list_commands(const command_t *cmdlist, char *buffer, + size_t buf_size, const char *parent_cmd, + int col_start, int col_num); /* Converts a string to an integer */ int Parser_int(char *, int *); diff --git a/libcfs/libcfs/util/parser.c b/libcfs/libcfs/util/parser.c index ae5e082..3aa97a1 100644 --- a/libcfs/libcfs/util/parser.c +++ b/libcfs/libcfs/util/parser.c @@ -53,8 +53,7 @@ static char *skipwhitespace(char *s); static char *skiptowhitespace(char *s); static command_t *find_cmd(char *name, command_t cmds[], char **next); static int process(char *s, char **next, command_t *lookup, command_t **result, - char **prev); -static void print_commands(char *str, command_t *table); + char **prev); static char * skipwhitespace(char * s) { @@ -109,21 +108,21 @@ void Parser_ignore_errors(int ignore) int Parser_execarg(int argc, char **argv, command_t cmds[]) { - command_t *cmd; + command_t *cmd; - cmd = Parser_findargcmd(argv[0], cmds); - if ( cmd ) { - int rc = (cmd->pc_func)(argc, argv); - if (rc == CMD_HELP) - fprintf(stderr, "%s\n", cmd->pc_help); - return rc; - } else { + cmd = Parser_findargcmd(argv[0], cmds); + if (cmd != NULL && cmd->pc_func != NULL) { + int rc = (cmd->pc_func)(argc, argv); + if (rc == CMD_HELP) + fprintf(stderr, "%s\n", cmd->pc_help); + return rc; + } else { printf("Try interactive use without arguments or use one of:\n"); - for (cmd = cmds; cmd->pc_name; cmd++) - printf("\"%s\"\n", cmd->pc_name); - printf("as argument.\n"); - } - return -1; + for (cmd = cmds; cmd->pc_name; cmd++) + printf("\"%s\"\n", cmd->pc_name); + printf("as argument.\n"); + } + return -1; } /* returns the command_t * (NULL if not found) corresponding to a @@ -192,17 +191,17 @@ static int process(char *s, char ** next, command_t *lookup, } got_it: - /* found a unique command: component or full? */ - if ( (*result)->pc_func ) { - return CMD_COMPLETE; - } else { - if ( *next == '\0' ) { - return CMD_INCOMPLETE; - } else { - return process(*next, next, (*result)->pc_sub_cmd, - result, prev); - } - } + /* found a unique command: component or full? */ + if ((*result)->pc_func != NULL) { + return CMD_COMPLETE; + } else { + if (*next == '\0') { + return CMD_INCOMPLETE; + } else { + return process(*next, next, (*result)->pc_sub_cmd, + result, prev); + } + } } #ifdef HAVE_LIBREADLINE @@ -451,10 +450,12 @@ int Parser_int(char *s, int *val) void Parser_qhelp(int argc, char *argv[]) { - printf("Available commands are:\n"); + printf("usage: %s [COMMAND] [OPTIONS]... [ARGS]\n", + program_invocation_short_name); + printf("Without any parameters, interactive mode is invoked\n"); - print_commands(NULL, top_level); - printf("For more help type: help command-name\n"); + printf("Try '%s help ' or '%s --list-commands' for more information\n", + program_invocation_short_name, program_invocation_short_name); } int Parser_help(int argc, char **argv) @@ -524,24 +525,78 @@ void Parser_printhelp(char *cmd) /************************************************************************* * COMMANDS * *************************************************************************/ -static void print_commands(char * str, command_t * table) { - command_t * cmds; - char buf[80]; - - for (cmds = table; cmds->pc_name; cmds++) { - if (cmds->pc_func) { - if (str) printf("\t%s %s\n", str, cmds->pc_name); - else printf("\t%s\n", cmds->pc_name); - } - if (cmds->pc_sub_cmd) { - if (str) { - sprintf(buf, "%s %s", str, cmds->pc_name); - print_commands(buf, cmds->pc_sub_cmd); - } else { - print_commands(cmds->pc_name, cmds->pc_sub_cmd); - } - } - } + +/** + * Parser_list_commands() - Output a list of the supported commands. + * @cmdlist: Array of structures describing the commands. + * @buffer: String buffer used to temporarily store the output text. + * @buf_size: Length of the string buffer. + * @parent_cmd: When called recursively, contains the name of the parent cmd. + * @col_start: Column where printing should begin. + * @col_num: The number of commands printed in a single row. + * + * The commands and subcommands supported by the utility are printed, arranged + * into several columns for readability. If a command supports subcommands, the + * function is called recursively, and the name of the parent command is + * supplied so that it can be prepended to the names of the subcommands. + * + * Return: The number of items that were printed. + */ +int Parser_list_commands(const command_t *cmdlist, char *buffer, + size_t buf_size, const char *parent_cmd, + int col_start, int col_num) +{ + int col = col_start; + int char_max; + int len; + char fmt[6]; + int count = 0; + int rc; + + if (col_start >= col_num) + return 0; + + char_max = (buf_size - 1) / col_num; /* Reserve 1 char for NUL */ + + for (; cmdlist->pc_name != NULL; cmdlist++) { + if (cmdlist->pc_func == NULL && cmdlist->pc_sub_cmd == NULL) + break; + count++; + if (parent_cmd != NULL) + len = snprintf(&buffer[col * char_max], + char_max + 1, "%s %s", parent_cmd, + cmdlist->pc_name); + else + len = snprintf(&buffer[col * char_max], + char_max + 1, "%s", cmdlist->pc_name); + + /* Add trailing spaces to pad the entry to the column size */ + if (len < char_max) { + snprintf(fmt, 6, "%%-%2ds", char_max - len); + snprintf(&buffer[col * char_max] + len, + char_max - len + 1, fmt, " "); + } else { + buffer[(col + 1) * char_max - 1] = ' '; + } + + col++; + if (col >= col_num) { + fprintf(stdout, "%s\n", buffer); + col = 0; + buffer[0] = '\0'; + } + + if (cmdlist->pc_sub_cmd != NULL) { + rc = Parser_list_commands(cmdlist->pc_sub_cmd, buffer, + buf_size, cmdlist->pc_name, + col, col_num); + col = (col + rc) % col_num; + count += rc; + } + } + if (parent_cmd == NULL && col != 0) + fprintf(stdout, "%s\n", buffer); + return count; } char *Parser_getstr(const char *prompt, const char *deft, char *res, diff --git a/lnet/utils/lnetctl.c b/lnet/utils/lnetctl.c index 5444327..56e1033 100644 --- a/lnet/utils/lnetctl.c +++ b/lnet/utils/lnetctl.c @@ -58,6 +58,7 @@ static int jt_set_numa(int argc, char **argv); static int jt_add_peer_nid(int argc, char **argv); static int jt_del_peer_nid(int argc, char **argv); /*static int jt_show_peer(int argc, char **argv);*/ +static int lnetctl_list_commands(int argc, char **argv); command_t lnet_cmds[] = { {"configure", jt_config_lnet, 0, "configure lnet\n" @@ -1250,9 +1251,19 @@ command_t list[] = { {"help", Parser_help, 0, "help"}, {"exit", Parser_quit, 0, "quit"}, {"quit", Parser_quit, 0, "quit"}, + {"--list-commands", lnetctl_list_commands, 0, "list commands"}, { 0, 0, 0, NULL } }; +static int lnetctl_list_commands(int argc, char **argv) +{ + char buffer[81] = ""; /* 80 printable chars + terminating NUL */ + + Parser_list_commands(list, buffer, sizeof(buffer), NULL, 0, 4); + + return 0; +} + int main(int argc, char **argv) { int rc = 0; diff --git a/lnet/utils/lst.c b/lnet/utils/lst.c index 4a71575..78359fe 100644 --- a/lnet/utils/lst.c +++ b/lnet/utils/lst.c @@ -56,6 +56,7 @@ struct lst_sid LST_INVALID_SID = { .ses_nid = LNET_NID_ANY, .ses_stamp = -1 }; static struct lst_sid session_id; static int session_key; +static int lst_list_commands(int argc, char **argv); /* All nodes running 2.6.50 or later understand feature LST_FEAT_BULK_LEN */ static unsigned session_features = LST_FEATS_MASK; @@ -3277,6 +3278,7 @@ static command_t lst_cmdlist[] = { "Usage: lst add_test [--batch BATCH] [--loop #] [--concurrency #] " " [--distribute #:#] [--from GROUP] [--to GROUP] TEST..." }, {"help", Parser_help, 0, "help" }, + {"--list-commands", lst_list_commands, 0, "list commands" }, {0, 0, 0, NULL } }; @@ -3310,6 +3312,15 @@ lst_initialize(void) return 0; } +static int lst_list_commands(int argc, char **argv) +{ + char buffer[81] = ""; /* 80 printable chars + terminating NUL */ + + Parser_list_commands(lst_cmdlist, buffer, sizeof(buffer), NULL, 0, 4); + + return 0; +} + int main(int argc, char **argv) { diff --git a/lustre/doc/lctl.8 b/lustre/doc/lctl.8 index 0ade6ff..f29cce9 100644 --- a/lustre/doc/lctl.8 +++ b/lustre/doc/lctl.8 @@ -1,4 +1,4 @@ -.TH lctl 1 "2016 Sep 8" Lustre "configuration utilities" +.TH lctl 8 "2017 Jan 12" Lustre "configuration utilities" .SH NAME lctl \- Low level Lustre filesystem configuration utility .SH SYNOPSIS @@ -7,6 +7,10 @@ lctl \- Low level Lustre filesystem configuration utility .br .B lctl --device .br +.B lctl --version +.br +.B lctl --list-commands +.br .SH DESCRIPTION .B lctl is used to directly control Lustre via an ioctl interface, allowing @@ -26,7 +30,7 @@ can be invoked in interactive mode by issuing lctl command. After that, commands .BR quit . To get a complete listing of available commands, type -.B help +.B --list-commands at the lctl prompt. To get basic help on the meaning and syntax of a command, type .B help @@ -419,6 +423,9 @@ Output the build version of the Lustre kernel modules .B --version Output the build version of the lctl utility .TP +.B --list-commands +Output a list of the commands supported by the lctl utility +.TP .B help Provides brief help on the various arguments .TP diff --git a/lustre/doc/lfs.1 b/lustre/doc/lfs.1 index ba5d462..ba93482 100644 --- a/lustre/doc/lfs.1 +++ b/lustre/doc/lfs.1 @@ -1,4 +1,4 @@ -.TH lfs 1 "2009 Jan 29" Lustre "user utilities" +.TH lfs 1 "2017 Jan 12" Lustre "user utilities" .SH NAME lfs \- Lustre utility to create a file with specific striping pattern, find the striping pattern of existing files, do certain quota operations, and manage distributed namespace options for directories .SH SYNOPSIS @@ -104,6 +104,8 @@ lfs \- Lustre utility to create a file with specific striping pattern, find the .br .B lfs --version .br +.B lfs --list-commands +.br .B lfs help .SH DESCRIPTION .B lfs @@ -342,6 +344,9 @@ See lfs-migrate(1). .B --version Output the build version of the lfs utility. Use "lctl lustre_build_version" to get the version of the Lustre kernel modules .TP +.B --list-commands +Output a list of the commands supported by the lfs utility +.TP .B help Provides brief help on the various arguments .TP diff --git a/lustre/doc/lnetctl.8 b/lustre/doc/lnetctl.8 index 00e8849..a1165da 100644 --- a/lustre/doc/lnetctl.8 +++ b/lustre/doc/lnetctl.8 @@ -1,12 +1,15 @@ . -.TH lnetctl 1 "2014 Sep 12" Lustre "configuration utilities" +.TH lnetctl 8 "2017 Jan 12" Lustre "configuration utilities" . .SH "SYNOPSIS" \fBlnetctl\fR . .br +.B lnetctl --list-commands +.br \fBlnetctl\fR \fB [optional parameters]\fR . +.br .SH "DESCRIPTION" \fBlnetctl\fR is used to configure LNet parameters allowing various configuration and debugging features to be accessed\. @@ -16,8 +19,9 @@ and debugging features to be accessed\. After that, commands are issued as below\. . .P -To get a complete listing of available commands, type \fBhelp\fR at the -lnetctl prompt\. To get basic help on the meaning and syntax of a command +To get a complete listing of available commands, type +.B --list-commands +at the lnetctl prompt\. To get basic help on the meaning and syntax of a command type \fB\fR \-\-help\. . .P @@ -326,6 +330,37 @@ Show LNET statistics .br . +.SS "Showing Peer Credits" +. +.TP +\fBlnetctl peer_credits\fR +Show details on configured peer credits +. +.br +\-> Peer nid +. +.br +\-> State +. +.br +\-> Reference count on the peer +. +.br +\-> Maximum transmit credits +. +.br +\-> Available transmit credits +. +.br +\-> Available router credits +. +.br +\-> Minimum router credits\. +. +.SH "OPTIONS" +.TP +.B --list-commands +Output a list of the commands supported by the lnetctl utility .SH "EXAMPLES" . .SS "Initializing LNet after load" diff --git a/lustre/doc/lst.8 b/lustre/doc/lst.8 index 2d58444..eda9eed 100644 --- a/lustre/doc/lst.8 +++ b/lustre/doc/lst.8 @@ -1,8 +1,10 @@ -.TH lst 1 "Jul 7, 2008" Lustre "utilities" +.TH lst 8 "2017 Jan 12" Lustre "configuration utilities" .SH NAME lst \- Start the Lustre LNET Self-test .SH SYNOPSIS .B "lst" +.br +.B "lst --list-commands" .SH DESCRIPTION LNET self-test helps site administrators confirm that Lustre Networking (LNET) has been properly installed and configured. @@ -26,6 +28,10 @@ These individual point-to-point tests are instantiated according to the test type, source group, target group and distribution specified when the test is added to the test batch. .LP +.SH OPTIONS +.TP +.B --list-commands +Output a list of the commands supported by the lst utility .SH MODULES To run LNET self-test, load these modules: libcfs, lnet, lnet_selftest and any one of the klnds (i.e, ksocklnd, ko2iblnd...). diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 65edd58..101d6b9 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1121,11 +1121,6 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic) * client holds the lock */ #define OBD_MD_FLOBJCOUNT (0x0000400000000000ULL) /* for multiple destroy */ -/* OBD_MD_FLRMTLSETFACL (0x0001000000000000ULL) lfs lsetfacl, obsolete */ -/* OBD_MD_FLRMTLGETFACL (0x0002000000000000ULL) lfs lgetfacl, obsolete */ -/* OBD_MD_FLRMTRSETFACL (0x0004000000000000ULL) lfs rsetfacl, obsolete */ -/* OBD_MD_FLRMTRGETFACL (0x0008000000000000ULL) lfs rgetfacl, obsolete */ - #define OBD_MD_FLDATAVERSION (0x0010000000000000ULL) /* iversion sum */ #define OBD_MD_CLOSE_INTENT_EXECED (0x0020000000000000ULL) /* close intent executed */ diff --git a/lustre/include/lustre/lustreapi.h b/lustre/include/lustre/lustreapi.h index 73a76a1..6c0a17f 100644 --- a/lustre/include/lustre/lustreapi.h +++ b/lustre/include/lustre/lustreapi.h @@ -284,10 +284,6 @@ extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl); extern int llapi_target_iterate(int type_num, char **obd_type, void *args, llapi_cb_t cb); extern int llapi_get_connect_flags(const char *mnt, __u64 *flags); -extern int llapi_lsetfacl(int argc, char *argv[]); -extern int llapi_lgetfacl(int argc, char *argv[]); -extern int llapi_rsetfacl(int argc, char *argv[]); -extern int llapi_rgetfacl(int argc, char *argv[]); extern int llapi_cp(int argc, char *argv[]); extern int llapi_ls(int argc, char *argv[]); extern int llapi_fid2path(const char *device, const char *fidstr, char *path, diff --git a/lustre/utils/lctl.c b/lustre/utils/lctl.c index 409638f..7af645d 100644 --- a/lustre/utils/lctl.c +++ b/lustre/utils/lctl.c @@ -46,9 +46,7 @@ #include "obdctl.h" #include -static int jt_noop(int argc, char **argv) { - return 0; -} +static int lctl_list_commands(int argc, char **argv); static int jt_opt_ignore_errors(int argc, char **argv) { Parser_ignore_errors(1); @@ -57,7 +55,7 @@ static int jt_opt_ignore_errors(int argc, char **argv) { command_t cmdlist[] = { /* Metacommands */ - {"===== metacommands =======", jt_noop, 0, "metacommands"}, + {"===== metacommands =======", NULL, 0, "metacommands"}, {"--device", jt_opt_device, 0, "run after connecting to device \n" "--device "}, @@ -69,7 +67,7 @@ command_t cmdlist[] = { "ignore_errors"}, /* User interface commands */ - {"======== control =========", jt_noop, 0, "control commands"}, + {"======== control =========", NULL, 0, "control commands"}, {"help", Parser_help, 0, "help"}, {"lustre_build_version", jt_get_version, 0, "print version of Lustre modules\n" @@ -78,9 +76,11 @@ command_t cmdlist[] = { {"quit", Parser_quit, 0, "quit"}, {"--version", Parser_version, 0, "print build version of this utility and exit"}, + {"--list-commands", lctl_list_commands, 0, + "list commands supported by this utility and exit"}, /* Network configuration commands */ - {"===== network config =====", jt_noop, 0, "network config"}, + {"===== network config =====", NULL, 0, "network config"}, {"--net", jt_opt_net, 0, "run after selecting network \n" "usage: --net "}, {"network", jt_ptl_network, 0, "configure LNET" @@ -143,7 +143,7 @@ command_t cmdlist[] = { "usage: net_delay_list"}, /* Device selection commands */ - {"==== obd device selection ====", jt_noop, 0, "device selection"}, + {"==== obd device selection ====", NULL, 0, "device selection"}, {"device", jt_obd_device, 0, "set current device to \n" "usage: device <%name|$name|devno>"}, @@ -153,7 +153,7 @@ command_t cmdlist[] = { "usage: dl [-t]"}, /* Device operations */ - {"==== obd device operations ====", jt_noop, 0, "device operations"}, + {"==== obd device operations ====", NULL, 0, "device operations"}, {"activate", jt_obd_activate, 0, "activate an import\n"}, {"deactivate", jt_obd_deactivate, 0, "deactivate an import. " "This command should be used on failed OSC devices in an MDT LOV.\n"}, @@ -196,7 +196,7 @@ command_t cmdlist[] = { " -R Recursively list all parameters under the specified path.\n"}, /* Debug commands */ - {"==== debugging control ====", jt_noop, 0, "debug"}, + {"==== debugging control ====", NULL, 0, "debug"}, {"debug_daemon", jt_dbg_debug_daemon, 0, "debug daemon control and dump to a file\n" "usage: debug_daemon {start file [#MB]|stop}"}, @@ -228,7 +228,7 @@ command_t cmdlist[] = { "usage: modules "}, /* Pool commands */ - {"=== Pools ==", jt_noop, 0, "pool management"}, + {"=== Pools ==", NULL, 0, "pool management"}, {"pool_new", jt_pool_cmd, 0, "add a new pool\n" "usage: pool_new ."}, @@ -246,7 +246,7 @@ command_t cmdlist[] = { "usage: pool_list [.] | "}, /* Nodemap commands */ - {"=== Nodemap ===", jt_noop, 0, "nodemap management"}, + {"=== Nodemap ===", NULL, 0, "nodemap management"}, {"nodemap_activate", jt_nodemap_activate, 0, "activate nodemap idmapping functions\n" "usage: nodemap_activate {0|1}"}, @@ -280,7 +280,7 @@ command_t cmdlist[] = { "Usage: nodemap_info [list|nodemap_name|all]"}, /* Changelog commands */ - {"=== Changelogs ==", jt_noop, 0, "changelog user management"}, + {"=== Changelogs ==", NULL, 0, "changelog user management"}, {"changelog_register", jt_changelog_register, 0, "register a new persistent changelog user, returns id\n" "usage: --device changelog_register [-n]"}, @@ -290,7 +290,7 @@ command_t cmdlist[] = { /* Device configuration commands */ {"== device setup (these are not normally used post 1.4) ==", - jt_noop, 0, "device config"}, + NULL, 0, "device config"}, {"attach", jt_lcfg_attach, 0, "set the type, name, and uuid of the current device\n" "usage: attach type name uuid"}, @@ -304,7 +304,7 @@ command_t cmdlist[] = { "usage: cleanup [force | failover]"}, /* Test only commands */ - {"==== testing (DANGEROUS) ====", jt_noop, 0, "testing (DANGEROUS)"}, + {"==== testing (DANGEROUS) ====", NULL, 0, "testing (DANGEROUS)"}, {"--threads", jt_opt_threads, 0, "run separate instances of on device \n" "--threads "}, @@ -394,7 +394,7 @@ command_t cmdlist[] = { " getobjversion -i -g "}, /* LFSCK commands */ - {"==== LFSCK ====", jt_noop, 0, "LFSCK"}, + {"==== LFSCK ====", NULL, 0, "LFSCK"}, {"lfsck_start", jt_lfsck_start, 0, "start LFSCK\n" "usage: lfsck_start [-M | --device [MDT,OST]_device]\n" " [-A | --all] [-c | --create-ostobj [on | off]]\n" @@ -413,7 +413,7 @@ command_t cmdlist[] = { " [-t | --type lfsck_type[,lfsck_type...]]\n" " [-w | --wait]"}, - {"==== obsolete (DANGEROUS) ====", jt_noop, 0, "obsolete (DANGEROUS)"}, + {"==== obsolete (DANGEROUS) ====", NULL, 0, "obsolete (DANGEROUS)"}, /* some test scripts still use these */ {"cfg_device", jt_obd_device, 0, "set current device to \n" @@ -497,6 +497,24 @@ int lctl_main(int argc, char **argv) return rc < 0 ? -rc : rc; } +static int lctl_list_commands(int argc, char **argv) +{ + char buffer[81] = ""; /* 80 printable chars + terminating NUL */ + command_t *cmd; + int rc; + + cmd = cmdlist; + while (cmd->pc_name != NULL) { + printf("\n%s\n", cmd->pc_name); /* Command category */ + cmd++; + rc = Parser_list_commands(cmd, buffer, sizeof(buffer), NULL, + 0, 4); + cmd += rc; + } + + return 0; +} + int main(int argc, char **argv) { return lctl_main(argc, argv); diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index da0ccf7..eb78d2b 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -92,11 +92,6 @@ static int lfs_setquota(int argc, char **argv); static int lfs_quota(int argc, char **argv); #endif static int lfs_flushctx(int argc, char **argv); -static int lfs_join(int argc, char **argv); -static int lfs_lsetfacl(int argc, char **argv); -static int lfs_lgetfacl(int argc, char **argv); -static int lfs_rsetfacl(int argc, char **argv); -static int lfs_rgetfacl(int argc, char **argv); static int lfs_cp(int argc, char **argv); static int lfs_ls(int argc, char **argv); static int lfs_poollist(int argc, char **argv); @@ -117,6 +112,7 @@ static int lfs_hsm_cancel(int argc, char **argv); static int lfs_swap_layouts(int argc, char **argv); static int lfs_mv(int argc, char **argv); static int lfs_ladvise(int argc, char **argv); +static int lfs_list_commands(int argc, char **argv); /* Setstripe and migrate share mostly the same parameters */ #define SSM_CMD_COMMON(cmd) \ @@ -236,9 +232,6 @@ command_t cmdlist[] = { "Display the status of MDS or OSTs (as specified in the command)\n" "or all the servers (MDS and OSTs).\n" "usage: check "}, - {"join", lfs_join, 0, - "join two lustre files into one.\n" - "obsolete, HEAD does not support it anymore.\n"}, {"osts", lfs_osts, 0, "list OSTs connected to client " "[for specified path only]\n" "usage: osts [path]"}, {"mdts", lfs_mdts, 0, "list MDTs connected to client " @@ -282,18 +275,6 @@ command_t cmdlist[] = { #endif {"flushctx", lfs_flushctx, 0, "Flush security context for current user.\n" "usage: flushctx [-k] [mountpoint...]"}, - {"lsetfacl", lfs_lsetfacl, 0, - "Remote user setfacl for user/group on the same remote client.\n" - "usage: lsetfacl [-bkndRLPvh] [{-m|-x} acl_spec] [{-M|-X} acl_file] file ..."}, - {"lgetfacl", lfs_lgetfacl, 0, - "Remote user getfacl for user/group on the same remote client.\n" - "usage: lgetfacl [-dRLPvh] file ..."}, - {"rsetfacl", lfs_rsetfacl, 0, - "Remote user setfacl for user/group on other clients.\n" - "usage: rsetfacl [-bkndRLPvh] [{-m|-x} acl_spec] [{-M|-X} acl_file] file ..."}, - {"rgetfacl", lfs_rgetfacl, 0, - "Remote user getfacl for user/group on other clients.\n" - "usage: rgetfacl [-dRLPvh] file ..."}, {"cp", lfs_cp, 0, "Remote user copy files and directories.\n" "usage: cp [OPTION]... [-T] SOURCE DEST\n\tcp [OPTION]... SOURCE... DIRECTORY\n\tcp [OPTION]... -t DIRECTORY SOURCE..."}, @@ -393,6 +374,8 @@ command_t cmdlist[] = { {"quit", Parser_quit, 0, "quit"}, {"--version", Parser_version, 0, "output build version of the utility and exit"}, + {"--list-commands", lfs_list_commands, 0, + "list commands supported by the utility and exit"}, { 0, 0, 0, NULL } }; @@ -2682,13 +2665,6 @@ static int lfs_check(int argc, char **argv) } -static int lfs_join(int argc, char **argv) -{ - fprintf(stderr, "join two lustre files into one.\n" - "obsolete, HEAD does not support it anymore.\n"); - return 0; -} - #ifdef HAVE_SYS_QUOTA_H #define ARG2INT(nr, str, msg) \ do { \ @@ -3509,34 +3485,6 @@ static int lfs_flushctx(int argc, char **argv) return rc; } -static int lfs_lsetfacl(int argc, char **argv) -{ - fprintf(stderr, "local client sets facl for remote client.\n" - "obsolete, does not support it anymore.\n"); - return 0; -} - -static int lfs_lgetfacl(int argc, char **argv) -{ - fprintf(stderr, "local client gets facl for remote client.\n" - "obsolete, does not support it anymore.\n"); - return 0; -} - -static int lfs_rsetfacl(int argc, char **argv) -{ - fprintf(stderr, "remote client sets facl for remote client.\n" - "obsolete, does not support it anymore.\n"); - return 0; -} - -static int lfs_rgetfacl(int argc, char **argv) -{ - fprintf(stderr, "remote client gets facl for remote client.\n" - "obsolete, does not support it anymore.\n"); - return 0; -} - static int lfs_cp(int argc, char **argv) { fprintf(stderr, "remote client copy file(s).\n" @@ -4566,6 +4514,15 @@ next: return rc; } +static int lfs_list_commands(int argc, char **argv) +{ + char buffer[81] = ""; /* 80 printable chars + terminating NUL */ + + Parser_list_commands(cmdlist, buffer, sizeof(buffer), NULL, 0, 4); + + return 0; +} + int main(int argc, char **argv) { int rc;