Whamcloud - gitweb
LU-5170 utils: Add support for --list-commands option
[fs/lustre-release.git] / lnet / utils / lst.c
index 4a71575..78359fe 100644 (file)
@@ -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)
 {