From 9c6c55c314199a9ba26fe1b864306b2ca8a8dbcd Mon Sep 17 00:00:00 2001 From: David Teigland Date: Tue, 29 Nov 2016 12:00:15 -0600 Subject: process_each_lv: add check_single_lv function The new check_single_lv() function is called prior to the existing process_single_lv(). If the check function returns 0, the LV will not be processed. The check_single_lv function is meant to be a standard method to validate the combination of specific command + specific LV, and decide if the combination is allowed. The check_single function can be used by anything that calls process_each_lv. As commands are migrated to take advantage of command definitions, each command definition gets its own entry point which calls process_each for itself, passing a pair of check_single/process_single functions which can be specific to the narrowly defined command def. --- tools/reporter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tools/reporter.c') diff --git a/tools/reporter.c b/tools/reporter.c index 00606edc4..980f39c7c 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -545,14 +545,14 @@ static int _report_all_in_vg(struct cmd_context *cmd, struct processing_handle * r = _vgs_single(cmd, vg->name, vg, handle); break; case LVS: - r = process_each_lv_in_vg(cmd, vg, NULL, NULL, 0, handle, + r = process_each_lv_in_vg(cmd, vg, NULL, NULL, 0, handle, NULL, do_lv_info && !do_lv_seg_status ? &_lvs_with_info_single : !do_lv_info && do_lv_seg_status ? &_lvs_with_status_single : do_lv_info && do_lv_seg_status ? &_lvs_with_info_and_status_single : &_lvs_single); break; case SEGS: - r = process_each_lv_in_vg(cmd, vg, NULL, NULL, 0, handle, + r = process_each_lv_in_vg(cmd, vg, NULL, NULL, 0, handle, NULL, do_lv_info && !do_lv_seg_status ? &_lvsegs_with_info_single : !do_lv_info && do_lv_seg_status ? &_lvsegs_with_status_single : do_lv_info && do_lv_seg_status ? &_lvsegs_with_info_and_status_single : @@ -1127,7 +1127,7 @@ static int _do_report(struct cmd_context *cmd, struct processing_handle *handle, if (args->full_report_vg) r = _report_all_in_vg(cmd, handle, args->full_report_vg, LVS, lv_info_needed, lv_segment_status_needed); else - r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle, + r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle, NULL, lv_info_needed && !lv_segment_status_needed ? &_lvs_with_info_single : !lv_info_needed && lv_segment_status_needed ? &_lvs_with_status_single : lv_info_needed && lv_segment_status_needed ? &_lvs_with_info_and_status_single : @@ -1161,7 +1161,7 @@ static int _do_report(struct cmd_context *cmd, struct processing_handle *handle, if (args->full_report_vg) r = _report_all_in_vg(cmd, handle, args->full_report_vg, SEGS, lv_info_needed, lv_segment_status_needed); else - r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle, + r = process_each_lv(cmd, args->argc, args->argv, NULL, NULL, 0, handle, NULL, lv_info_needed && !lv_segment_status_needed ? &_lvsegs_with_info_single : !lv_info_needed && lv_segment_status_needed ? &_lvsegs_with_status_single : lv_info_needed && lv_segment_status_needed ? &_lvsegs_with_info_and_status_single : -- cgit v1.2.1