From e8e4324d68bb6ce711b09679e9c83d986bd4a5ee Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 22 Nov 2024 13:25:29 +0100 Subject: [PATCH] tools: enhance lvdisplay vgdisplay pvdisplay Split description for display commands so we can better describe it's usage and combination of individual options in man page. Now we can separately describe: lvdisplay, lvdisplay -c, lvdisplay -C vgdisplay, vgdisplay -c, vgdisplay -C pvdisplay, pvdisplay -c, pvdisplay -C TODO: Drop validation from command code itself. --- tools/command-lines.in | 87 ++++++++++++++++++++++++++++-------------- tools/lvdisplay.c | 10 +++++ tools/lvmcmdline.c | 12 ++++++ tools/pvdisplay.c | 10 +++++ tools/tools.h | 7 ++++ tools/vgdisplay.c | 10 +++++ 6 files changed, 108 insertions(+), 28 deletions(-) diff --git a/tools/command-lines.in b/tools/command-lines.in index ada6b2c38..9820a6bc1 100644 --- a/tools/command-lines.in +++ b/tools/command-lines.in @@ -206,15 +206,20 @@ OO_ALL: --commandprofile String, --config String, --debug, --driverloaded Bool, --help, --nolocking, --lockopt String, --longhelp, --profile String, --quiet, --verbose, --version, --yes, --test, --devicesfile String, --devices PV, --nohints --journal String +# +# options for pvdisplay, lvdisplay, vgdisplay +# +OO_REPORTING: --all, --configreport ConfigReport, --foreign, +--ignorelockingfailure, --logonly, --readonly, --reportformat ReportFmt, +--select String, --shared, --sort String, --units Units + # # options for pvs, lvs, vgs, fullreport # -OO_REPORT: --aligned, --all, --binary, --configreport ConfigReport, --foreign, ---headings HeadingsType --ignorelockingfailure, --logonly, ---nameprefixes, --noheadings, --nosuffix, ---options String, --readonly, --reportformat ReportFmt, --rows, ---select String, --separator String, --shared, --sort String, ---unbuffered, --units Units, --unquoted +OO_REPORT: OO_REPORTING, --aligned, --binary, +--headings HeadingsType, --nameprefixes, --noheadings, +--nosuffix, --options String, --rows, --separator String, +--unbuffered, --unquoted # # options for config, dumpconfig, lvmconfig @@ -1386,15 +1391,23 @@ DESC: new LV to type writecache. --- -lvdisplay -OO: --aligned, --all, --binary, --colon, --columns, ---configreport ConfigReport, --foreign, --history, --ignorelockingfailure, ---logonly, --maps, --noheadings, ---nosuffix, --options String, --sort String, --readonly, ---segments, --select String, --separator String, ---shared, --unbuffered, --units Units +lvdisplay --columns +OO: OO_REPORT, --history, --segments OP: VG|LV|Tag ... -IO: --partial, --ignoreskippedcluster, --reportformat ReportFmt +IO: --partial, --ignoreskippedcluster +RULE: --noheadings not --headings +ID: lvdisplay_columns + +lvdisplay --colon +OO: OO_REPORTING, --history, --segments +OP: VG|LV|Tag ... +IO: --partial, --ignoreskippedcluster +ID: lvdisplay_colon + +lvdisplay +OO: OO_REPORTING, --history, --segments, --maps +OP: VG|LV|Tag ... +IO: --partial, --ignoreskippedcluster ID: lvdisplay_general --- @@ -1622,14 +1635,23 @@ RULE: --bootloaderareasize not --restorefile --- -pvdisplay -OO: --aligned, --all, --binary, --colon, --columns, --configreport ConfigReport, ---foreign, --ignorelockingfailure, ---logonly, --maps, --noheadings, --nosuffix, --options String, ---readonly, --reportformat ReportFmt, --select String, --separator String, --shared, ---short, --sort String, --unbuffered, --units Units +pvdisplay --columns +OO: OO_REPORT, --segments OP: PV|Tag ... -IO: --ignoreskippedcluster +IO: --partial, --ignoreskippedcluster +RULE: --noheadings not --headings +ID: pvdisplay_columns + +pvdisplay --colon +OO: OO_REPORTING, --segments +OP: PV|Tag ... +IO: --partial, --ignoreskippedcluster +ID: pvdisplay_colon + +pvdisplay +OO: OO_REPORTING, --maps, --segments, --short +OP: PV|Tag ... +IO: --partial, --ignoreskippedcluster ID: pvdisplay_general --- @@ -1845,14 +1867,23 @@ ID: vgcreate_general --- -vgdisplay -OO: --activevolumegroups, --aligned, --binary, --colon, --columns, ---configreport ConfigReport, --foreign, --ignorelockingfailure, ---logonly, --noheadings, --nosuffix, ---options String, --readonly, --select String, ---shared, --short, --separator String, --sort String, --unbuffered, --units Units +vgdisplay --columns +OO: OO_REPORT, --activevolumegroups OP: VG|Tag ... -IO: --partial, --ignoreskippedcluster, --reportformat ReportFmt +IO: --partial, --ignoreskippedcluster +RULE: --noheadings not --headings +ID: vgdisplay_columns + +vgdisplay --colon +OO: OO_REPORTING, --activevolumegroups +OP: VG|Tag ... +IO: --partial, --ignoreskippedcluster +ID: vgdisplay_colon + +vgdisplay +OO: OO_REPORTING, --activevolumegroups, --short +OP: VG|Tag ... +IO: --partial, --ignoreskippedcluster ID: vgdisplay_general --- diff --git a/tools/lvdisplay.c b/tools/lvdisplay.c index b8c4b461a..1e26abe37 100644 --- a/tools/lvdisplay.c +++ b/tools/lvdisplay.c @@ -60,3 +60,13 @@ int lvdisplay(struct cmd_context *cmd, int argc, char **argv) return process_each_lv(cmd, argc, argv, NULL, NULL, 0, NULL, NULL, &_lvdisplay_single); } + +int lvdisplay_columns_cmd(struct cmd_context *cmd, int argc, char **argv) +{ + return lvdisplay(cmd, argc, argv); +} + +int lvdisplay_colon_cmd(struct cmd_context *cmd, int argc, char **argv) +{ + return lvdisplay(cmd, argc, argv); +} diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 7209ebd9b..dee8933fd 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -88,6 +88,18 @@ static const struct command_function _command_functions[CMD_COUNT] = { { vgchange_lockstop_CMD, vgchange_lock_start_stop_cmd }, { vgchange_systemid_CMD, vgchange_systemid_cmd }, + /* lvdisplay variants */ + { lvdisplay_columns_CMD, lvdisplay_columns_cmd }, + { lvdisplay_colon_CMD, lvdisplay_colon_cmd }, + + /* pvdisplay variants */ + { pvdisplay_columns_CMD, pvdisplay_columns_cmd }, + { pvdisplay_colon_CMD, pvdisplay_colon_cmd }, + + /* vgdisplay variants */ + { vgdisplay_columns_CMD, vgdisplay_columns_cmd }, + { vgdisplay_colon_CMD, vgdisplay_colon_cmd }, + /* lvconvert utilities related to repair. */ { lvconvert_repair_CMD, lvconvert_repair_cmd }, { lvconvert_replace_pv_CMD, lvconvert_replace_pv_cmd }, diff --git a/tools/pvdisplay.c b/tools/pvdisplay.c index 11f38ebd2..8fb9ab4f3 100644 --- a/tools/pvdisplay.c +++ b/tools/pvdisplay.c @@ -106,3 +106,13 @@ int pvdisplay(struct cmd_context *cmd, int argc, char **argv) return ret; } + +int pvdisplay_columns_cmd(struct cmd_context *cmd, int argc, char **argv) +{ + return pvdisplay(cmd, argc, argv); +} + +int pvdisplay_colon_cmd(struct cmd_context *cmd, int argc, char **argv) +{ + return pvdisplay(cmd, argc, argv); +} diff --git a/tools/tools.h b/tools/tools.h index 57a42f411..0fa00671c 100644 --- a/tools/tools.h +++ b/tools/tools.h @@ -188,6 +188,13 @@ int lvchange_rebuild_cmd(struct cmd_context *cmd, int argc, char **argv); int lvchange_monitor_poll_cmd(struct cmd_context *cmd, int argc, char **argv); int lvchange_persistent_cmd(struct cmd_context *cmd, int argc, char **argv); +int lvdisplay_columns_cmd(struct cmd_context *cmd, int argc, char **argv); +int lvdisplay_colon_cmd(struct cmd_context *cmd, int argc, char **argv); +int pvdisplay_columns_cmd(struct cmd_context *cmd, int argc, char **argv); +int pvdisplay_colon_cmd(struct cmd_context *cmd, int argc, char **argv); +int vgdisplay_columns_cmd(struct cmd_context *cmd, int argc, char **argv); +int vgdisplay_colon_cmd(struct cmd_context *cmd, int argc, char **argv); + int lvconvert_repair_cmd(struct cmd_context *cmd, int argc, char **argv); int lvconvert_replace_pv_cmd(struct cmd_context *cmd, int argc, char **argv); diff --git a/tools/vgdisplay.c b/tools/vgdisplay.c index e9d08428c..f4795e8c5 100644 --- a/tools/vgdisplay.c +++ b/tools/vgdisplay.c @@ -107,3 +107,13 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv) } ************/ } + +int vgdisplay_columns_cmd(struct cmd_context *cmd, int argc, char **argv) +{ + return vgdisplay(cmd, argc, argv); +} + +int vgdisplay_colon_cmd(struct cmd_context *cmd, int argc, char **argv) +{ + return vgdisplay(cmd, argc, argv); +}