master - toollib: simplify internal selection calls for non-reporting tools
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=815f1ee26d5ee5c64493f83a78f8c074fc8c82d8 Commit: 815f1ee26d5ee5c64493f83a78f8c074fc8c82d8 Parent: 7d4d0ff606a78909041c0b734a3ceacc94a47fa0 Author: Peter Rajnoha <[email protected]> AuthorDate: Mon May 30 16:28:47 2016 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Mon May 30 16:44:18 2016 +0200
toollib: simplify internal selection calls for non-reporting tools
Some of the variables were set superfluously - we can just use existing "struct processing_handle" which includes "struct selection_handle".
--- lib/report/report.h | 3 +- tools/reporter.c | 3 +- tools/toollib.c | 70 +++++++++++++++++++------------------------------- tools/toollib.h | 6 ++-- 4 files changed, 34 insertions(+), 48 deletions(-)
lib/report/report.h +2 -1
@@ -60,6 +60,7 @@ struct selection_handle {struct field ;struct report_handle ; +struct processing_handle ;typedef int (*field_report_fn ) (struct report_handle * dh,struct field * field,const void *data);
@@ -72,7 +73,7 @@ void *report_init_for_selection(struct cmd_context *cmd, report_type_t *report_t const char *selection);const char *report_get_field_prefix (report_type_t report_type);int report_for_selection (struct cmd_context *cmd, -struct selection_handle *sh, +struct processing_handle *parent_handle,struct physical_volume *pv,struct volume_group *vg,struct logical_volume *lv);
tools/reporter.c +2 -1
@@ -549,11 +549,12 @@ static int _report_all_in_pv(struct cmd_context *cmd, struct processing_handle * }int report_for_selection (struct cmd_context *cmd, -struct selection_handle *sh, +struct processing_handle *parent_handle,struct physical_volume *pv,struct volume_group *vg,struct logical_volume *lv) { +struct selection_handle *sh = parent_handle->selection_handle;int args_are_pvs = sh->orig_report_type ==PVS ;int do_lv_info, do_lv_seg_status;struct processing_handle *handle;
tools/toollib.c +27 -43
150 lines not on this page · raw message
tools/toollib.h +3 -3
@@ -147,11 +147,11 @@ int init_selection_handle(struct cmd_context *cmd, struct processing_handle *hanvoid destroy_processing_handle (struct cmd_context *cmd,struct processing_handle *handle);int select_match_vg (struct cmd_context *cmd,struct processing_handle *handle, -struct volume_group *vg,int *selected); +struct volume_group *vg);int select_match_lv (struct cmd_context *cmd,struct processing_handle *handle, -struct volume_group *vg,struct logical_volume *lv,int *selected); +struct volume_group *vg,struct logical_volume *lv);int select_match_pv (struct cmd_context *cmd,struct processing_handle *handle, -struct volume_group *vg,struct physical_volume *pv,int *selected); +struct volume_group *vg,struct physical_volume *pv);const char *extract_vgname (struct cmd_context *cmd,const char *lv_name); const char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name,