Whamcloud - gitweb
LU-2740 utils: Add support for --version option
[fs/lustre-release.git] / lustre / utils / lctl.c
index 1875b4b..1da619c 100644 (file)
 #include <lnet/lnetctl.h>
 #include "obdctl.h"
 #include <libcfs/libcfsutil.h>
-
-static int jt_quit(int argc, char **argv) {
-        Parser_quit(argc, argv);
-        return 0;
-}
+#include <lustre/lustre_idl.h>
 
 static int jt_noop(int argc, char **argv) {
         return 0;
@@ -79,11 +75,13 @@ command_t cmdlist[] = {
         {"lustre_build_version", jt_get_version, 0,
          "print the build version of lustre\n"
          "usage: lustre_build_version"},
-        {"exit", jt_quit, 0, "quit"},
-        {"quit", jt_quit, 0, "quit"},
+       {"exit", Parser_quit, 0, "quit"},
+       {"quit", Parser_quit, 0, "quit"},
+       {"--version", Parser_version, 0,
+        "output build version of the utility and exit"},
 
-        /* Network configuration commands */
-        {"===== network config =====", jt_noop, 0, "network config"},
+       /* Network configuration commands */
+       {"===== network config =====", jt_noop, 0, "network config"},
         {"--net", jt_opt_net, 0,"run <command> after setting network to <net>\n"
          "usage: --net <tcp/elan/o2ib/...> <command>"},
         {"network", jt_ptl_network, 0, "configure LNET"
@@ -230,15 +228,32 @@ command_t cmdlist[] = {
 
        /* Nodemap commands */
        {"=== Nodemap ===", jt_noop, 0, "nodemap management"},
-       {"nodemap_activate_idmap", jt_nodemap_activate, 0,
+       {"nodemap_activate", jt_nodemap_activate, 0,
         "activate nodemap idmapping functions\n"
-        "usage: nodemap_activate_idmap"},
+        "usage: nodemap_activate"},
        {"nodemap_add", jt_nodemap_add, 0,
         "add a new nodemap\n"
         "usage: nodemap_add <nodemap_name>"},
        {"nodemap_del", jt_nodemap_del, 0,
         "remove a nodemap\n"
         "usage: nodemap_del <nodemap_name>"},
+       {"nodemap_add_range", jt_nodemap_add_range, 0,
+        "add a range to a nodemap\n"
+        "usage: nodemap_add_range <NID range>"},
+       {"nodemap_del_range", jt_nodemap_del_range, 0,
+        "add a range to a nodemap\n"
+        "usage: nodemap_del_range <NID range>"},
+       {"nodemap_modify", jt_nodemap_modify, 0,
+        "modify a nodemap parameters"
+        "usage: nodemap_modify nodemap_name param value"},
+       {"nodemap_add_idmap", jt_nodemap_add_idmap, 0,
+        "add a UID or GID mapping to a nodemap"},
+       {"nodemap_del_idmap", jt_nodemap_del_idmap, 0,
+        "delete a UID or GID mapping from a nodemap"},
+       {"nodemap_test_nid", jt_nodemap_test_nid, 0,
+        "usage: nodemap_test_nid <nid>"},
+       {"nodemap_test_id", jt_nodemap_test_id, 0,
+        "Usage: nodemap_test_id --nid <nid> --idtype [uid|gid] --id <id>"},
 
         /* Changelog commands */
         {"===  Changelogs ==", jt_noop, 0, "changelog user management"},
@@ -365,13 +380,15 @@ command_t cmdlist[] = {
        {"==== LFSCK ====", jt_noop, 0, "LFSCK"},
        {"lfsck_start", jt_lfsck_start, 0, "start LFSCK\n"
         "usage: lfsck_start <-M | --device [MDT,OST]_device>\n"
-        "                   [-e | --error error_handle] [-h | --help]\n"
-        "                   [-n | --dryrun switch] [-r | --reset]\n"
-        "                   [-s | --speed speed_limit]\n"
+        "                   [-A | --all] [-c | --create_ostobj [on | off]]\n"
+        "                   [-e | --error {continue | abort}] [-h | --help]\n"
+        "                   [-n | --dryrun [on | off]] [-o | --orphan]\n"
+        "                   [-r | --reset] [-s | --speed speed_limit]\n"
         "                   [-t | --type lfsck_type[,lfsck_type...]]\n"
-        "                   [-w | --windows win_size]"},
+        "                   [-w | --window_size size]"},
        {"lfsck_stop", jt_lfsck_stop, 0, "stop lfsck(s)\n"
-        "usage: lfsck_stop <-M | --device [MDT,OST]_device> [-h | --help]"},
+        "usage: lfsck_stop <-M | --device [MDT,OST]_device>\n"
+        "                  [-A | --all] [-h | --help]"},
 
        {"==== obsolete (DANGEROUS) ====", jt_noop, 0, "obsolete (DANGEROUS)"},
        /* some test scripts still use these */
@@ -444,7 +461,7 @@ int lctl_main(int argc, char **argv)
         if (dbg_initialize(argc, argv) < 0)
                 exit(3);
 
-        Parser_init("lctl > ", cmdlist);
+       Parser_init("lctl > ", cmdlist);
 
         if (argc > 1) {
                 rc = Parser_execarg(argc - 1, argv + 1, cmdlist);