summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-11-05 10:35:38 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-11-05 10:42:18 +0100
commitbf4681ba134914e5847d94bc0ca01b7a2af0b2b5 (patch)
treeb85d1ace933e03623d05a2387a953dfd0dabaab5
parent160777bb3eda1cae32511292070c92e076305ef6 (diff)
downloadlvm2-bf4681ba134914e5847d94bc0ca01b7a2af0b2b5.tar.gz
report: cleanup: simplify LVSINFO detection
LVSINFO is just a subtype of LVS report type with extra "info" ioctl called for each LV reported (per output line) so include its processing within "case LVS" switch, not as completely different kind of reporting which may be misleading when reading the code. There's already the "lv_info_needed" flag set in the _report fn, so call the approriate reporting function based on this flag within the "case LVS" switch line. Actually the same is already done for LV is reported per segments within the "case SEGS" switch line. So this patch makes the code more consistent so it's processed the same way for all cases. Also, this is a preparation for another and new subtype that will be introduced later - the "LVSSTATUS" and "SEGSSTATUS" report type.
-rw-r--r--tools/reporter.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/tools/reporter.c b/tools/reporter.c
index 02f606428..080e3d597 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -394,9 +394,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type = PVS;
else if (report_type & SEGS)
report_type = SEGS;
- else if (report_type & LVSINFO)
- report_type = LVSINFO;
- else if (report_type & LVS)
+ else if (report_type & (LVS | LVSINFO))
report_type = LVS;
/*
@@ -418,11 +416,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
break;
case LVS:
r = process_each_lv(cmd, argc, argv, 0, report_handle,
- &_lvs_single);
- break;
- case LVSINFO:
- r = process_each_lv(cmd, argc, argv, 0, report_handle,
- &_lvs_with_info_single);
+ lv_info_needed ? &_lvs_with_info_single
+ : &_lvs_single);
break;
case VGS:
r = process_each_vg(cmd, argc, argv, 0,