summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2014-10-22 13:52:15 -0500
committerDavid Teigland <teigland@redhat.com>2014-10-23 15:28:16 -0500
commitc378359445aede111e282f629dee57fc92d0d65f (patch)
tree75f45a0fd5f2b8173481013126fab7d2ae4a0eae
parent3dd73b4bde15e3080b150fa15aa4af6885693053 (diff)
downloadlvm2-c378359445aede111e282f629dee57fc92d0d65f.tar.gz
reporter: always use process_each_pv to iterate through pvs
In a couple places, process_each_vg was used with a single function that would iterate through each pv in the vg. This is now what process_each_pv does, so use that.
-rw-r--r--tools/reporter.c48
-rw-r--r--tools/toollib.c4
-rw-r--r--tools/toollib.h3
3 files changed, 9 insertions, 46 deletions
diff --git a/tools/reporter.c b/tools/reporter.c
index 1fca9bf32..e246562a9 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -224,34 +224,6 @@ static int _label_single(struct cmd_context *cmd, struct label *label,
return ECMD_PROCESSED;
}
-static int _pvs_in_vg(struct cmd_context *cmd, const char *vg_name,
- struct volume_group *vg,
- void *handle)
-{
- int ret = ECMD_PROCESSED;
-
- if (ignore_vg(cmd, vg, vg_name, NULL, 0, &ret)) {
- stack;
- return ret;
- }
-
- return process_each_pv_in_vg(cmd, vg, handle, &_pvs_single);
-}
-
-static int _pvsegs_in_vg(struct cmd_context *cmd, const char *vg_name,
- struct volume_group *vg,
- void *handle)
-{
- int ret = ECMD_PROCESSED;
-
- if (ignore_vg(cmd, vg, vg_name, NULL, 0, &ret)) {
- stack;
- return ret;
- }
-
- return process_each_pv_in_vg(cmd, vg, handle, &_pvsegs_single);
-}
-
static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type_t report_type)
{
@@ -455,12 +427,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_handle, &_label_single);
break;
case PVS:
- if (args_are_pvs)
- r = process_each_pv(cmd, argc, argv, NULL, 0,
- report_handle, &_pvs_single);
- else
- r = process_each_vg(cmd, argc, argv, 0,
- report_handle, &_pvs_in_vg);
+ r = process_each_pv(cmd, argc, argv, NULL, 0,
+ report_handle, &_pvs_single);
break;
case SEGS:
r = process_each_lv(cmd, argc, argv, 0, report_handle,
@@ -469,13 +437,11 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
break;
case PVSEGS:
if (args_are_pvs)
- r = process_each_pv(cmd, argc, argv, NULL, 0,
- report_handle,
- lv_info_needed ? &_pvsegs_with_lv_info_single
- : &_pvsegs_single);
- else
- r = process_each_vg(cmd, argc, argv, 0,
- report_handle, &_pvsegs_in_vg);
+ lv_info_needed = 0;
+
+ r = process_each_pv(cmd, argc, argv, NULL, 0, report_handle,
+ lv_info_needed ? &_pvsegs_with_lv_info_single
+ : &_pvsegs_single);
break;
}
diff --git a/tools/toollib.c b/tools/toollib.c
index 36975b0e6..99204c9bc 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -160,8 +160,8 @@ const char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name,
/*
* Returns 1 if VG should be ignored.
*/
-int ignore_vg(struct cmd_context *cmd, struct volume_group *vg, const char *vg_name,
- struct dm_list *arg_vgnames, int allow_inconsistent, int *ret)
+static int ignore_vg(struct cmd_context *cmd, struct volume_group *vg, const char *vg_name,
+ struct dm_list *arg_vgnames, int allow_inconsistent, int *ret)
{
uint32_t read_error = vg_read_error(vg);
diff --git a/tools/toollib.h b/tools/toollib.h
index dcae5034e..81d445b43 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -20,9 +20,6 @@
int become_daemon(struct cmd_context *cmd, int skip_lvm);
-int ignore_vg(struct cmd_context *cmd, struct volume_group *vg, const char *vg_name,
- struct dm_list *arg_vgnames, int allow_inconsistent, int *ret);
-
typedef int (*process_single_vg_fn_t) (struct cmd_context * cmd,
const char *vg_name,
struct volume_group * vg,