]> sourceware.org Git - dm.git/commitdiff
Add dmsetup 'help' command and update usage text.
authorAlasdair Kergon <agk@redhat.com>
Mon, 29 Jan 2007 18:18:40 +0000 (18:18 +0000)
committerAlasdair Kergon <agk@redhat.com>
Mon, 29 Jan 2007 18:18:40 +0000 (18:18 +0000)
WHATS_NEW
dmsetup/dmsetup.c

index c0c8dec08d764863e062f87ce7ab229beb4e66d4..89c43695598f7ebedda0fe0ec3ce52f52397bb4e 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 1.02.17 -
 ===================================
+  Add dmsetup 'help' command and update usage text.
   Use fixed-size fields in report interface and reorder.
 
 Version 1.02.16 - 25th January 2007
index 772aead23ae21aba3882a7743837a7b93166a8ff..0aa18dd1cc855b659d0d948848315001c0fc2a92 100644 (file)
@@ -1567,10 +1567,10 @@ static const struct dm_report_object_type _report_types[] = {
 static const struct dm_report_field_type _report_fields[] = {
 /* *INDENT-OFF* */
 FIELD_F(TASK, STR, "Name", 16, dm_name, "name", "Name of mapped device.")
-FIELD_F(TASK, STR, "UUID", 32, dm_uuid, "uuid", "Unique identifier for mapped device (optional).")
-FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "status", "Attributes.")
-FIELD_O(INFO, dm_info, NUM, "Maj", major, 3, int32, "major", "Major number.")
-FIELD_O(INFO, dm_info, NUM, "Min", minor, 3, int32, "minor", "Minor number.")
+FIELD_F(TASK, STR, "UUID", 32, dm_uuid, "uuid", "Unique (optional) identifier for mapped device.")
+FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "status", "(L)ive, (I)nactive, (s)uspended, (r)ead-only, read-(w)rite.")
+FIELD_O(INFO, dm_info, NUM, "Maj", major, 3, int32, "major", "Block device major number.")
+FIELD_O(INFO, dm_info, NUM, "Min", minor, 3, int32, "minor", "Block device minor number.")
 FIELD_O(INFO, dm_info, NUM, "Open", open_count, 4, int32, "open_count", "Number of references to open device, if requested.")
 FIELD_O(INFO, dm_info, NUM, "Targ", target_count, 4, int32, "target_count", "Number of segments in live table, if present.")
 FIELD_O(INFO, dm_info, NUM, "Event", event_nr, 6, uint32, "event_nr", "Current event number.")
@@ -1673,10 +1673,13 @@ static int _ls(int argc, char **argv, void *data)
                return _process_all(argc, argv, 0, _display_name);
 }
 
+static int _help(int argc, char **argv, void *data);
+
 /*
  * Dispatch table
  */
 static struct command _commands[] = {
+       {"help", "\n", 0, 0, _help},
        {"create", "<dev_name> [-j|--major <major> -m|--minor <minor>]\n"
          "\t                  [-U|--uid <uid>] [-G|--gid <gid>] [-M|--mode <octal_mode>]\n"
          "\t                  [-u|uuid <uuid>]\n"
@@ -1710,14 +1713,17 @@ static void _usage(FILE *out)
 
        fprintf(out, "Usage:\n\n");
        fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n"
-               "        [-r|--readonly] [--noopencount] [--nolockfs]\n\n");
+               "        [-r|--readonly] [--noopencount] [--nolockfs]\n"
+               "        [-c|--columns] [-o <fields>] [--noheadings] [--separator <separator>]\n\n");
        for (i = 0; _commands[i].name; i++)
                fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help);
        fprintf(out, "\n<device> may be device name or -u <uuid> or "
                     "-j <major> -m <minor>\n");
+       fprintf(out, "<fields> are comma-separated.  Use -c -o help for list.\n");
        fprintf(out, "Table_file contents may be supplied on stdin.\n");
        fprintf(out, "Tree options are: ascii, utf, vt100; compact, inverted, notrunc;\n"
-                    "                  [no]device, active, open, rw and uuid.\n\n");
+                    "                  [no]device, active, open, rw and uuid.\n");
+       fprintf(out, "\n");
        return;
 }
 
@@ -1728,6 +1734,13 @@ static void _losetup_usage(FILE *out)
                     "[-o offset] [-f|loop_device] [file]\n\n");
 }
 
+static int _help(int argc, char **argv, void *data)
+{
+       _usage(stderr);
+
+       return 1;
+}
+
 static struct command *_find_command(const char *name)
 {
        int i;
@@ -2096,7 +2109,7 @@ static int _process_switches(int *argc, char ***argv)
                return 1;
        }
 
-       if(!strcmp(base, "losetup") || !strcmp(base, "dmlosetup")){
+       if (!strcmp(base, "losetup") || !strcmp(base, "dmlosetup")){
                r = _process_losetup_switches(base, argc, argv);
                free(namebase);
                return r;
This page took 0.032455 seconds and 5 git commands to generate.