toollib: rework process_each_lv
PATCH 2/5 toollib: rework process_each_lv
A new flag from commands makes explicit when process_each_lv may query for "all vgs" and run the command on each. A command is run against all vgs only when this flag is provided and no vg/lv names or tags are provided.
When vg/lv names or tags are explicitly named on the command line, the command is only run against named vgs/lvs, or vgs/lvs with tags matching one provided.
There should be no functional change.
--- tools/lvdisplay.c | 4 +- tools/lvscan.c | 4 +- tools/reporter.c | 8 +- tools/toollib.c | 459 ++++++++++++++++++++++++++++++------------------------ tools/vgmknodes.c | 4 +- 5 files changed, 267 insertions(+), 212 deletions(-)
tools/lvdisplay.c +2 -2
@@ -54,6 +54,6 @@ int lvdisplay(struct cmd_context *cmd, int argc, char **argv)return EINVALID_CMD_LINE ; } -return process_each_lv (cmd, argc, argv,0 ,NULL , - &_lvdisplay_single); +return process_each_lv (cmd, argc, argv,ENABLE_ALL_VGNAMES , +NULL , &_lvdisplay_single); }
tools/lvscan.c +2 -2
@@ -74,6 +74,6 @@ int lvscan(struct cmd_context *cmd, int argc, char **argv)return EINVALID_CMD_LINE ; } -return process_each_lv (cmd, argc, argv,0 ,NULL , - &lvscan_single); +return process_each_lv (cmd, argc, argv,ENABLE_ALL_VGNAMES , +NULL , &lvscan_single); }
tools/reporter.c +4 -4
@@ -366,8 +366,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,switch (report_type) {case LVS : - r =process_each_lv (cmd, argc, argv,0 , report_handle, - &_lvs_single); + r =process_each_lv (cmd, argc, argv,ENABLE_ALL_VGNAMES , + report_handle, &_lvs_single);break ;case VGS : r = process_each_vg(cmd, argc, argv, ENABLE_ALL_VGNAMES,
@@ -386,8 +386,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, report_handle, &_pvs_in_vg);break ;case SEGS : - r =process_each_lv (cmd, argc, argv,0 , report_handle, - &_lvsegs_single); + r =process_each_lv (cmd, argc, argv,ENABLE_ALL_VGNAMES , + report_handle, &_lvsegs_single);break ;case PVSEGS :if (args_are_pvs)
tools/toollib.c +257 -202
468 lines not on this page · raw message
tools/vgmknodes.c +2 -2
@@ -39,6 +39,6 @@ int vgmknodes(struct cmd_context *cmd, int argc, char **argv)return ECMD_FAILED ; } -return process_each_lv (cmd, argc, argv,LCK_VG_READ ,NULL , - &_vgmknodes_single); +return process_each_lv (cmd, argc, argv,LCK_VG_READ |ENABLE_ALL_VGNAMES , +NULL , &_vgmknodes_single); }
Signature · 1 line
1.8.1.rc1.5.g7e0651a