Skip to contentSkip to conversation

master - report: select: add dm_report_init_with_selection to libdm

PATCH Peter Rajnoha 1 participant 1 message Jun 17, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0103738ef5ed5dc165d9b1d29ccc4902bda5998f
Commit:        0103738ef5ed5dc165d9b1d29ccc4902bda5998f
Parent:        2c3e84a68d1f991bfe47637017723b7cf0435dff
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Thu May 29 09:38:08 2014 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Tue Jun 17 16:27:20 2014 +0200

report: select: add dm_report_init_with_selection to libdm

This is rebased and edited version of the original design and patch proposed by Jun'ichi Nomura:
http://www.redhat.com/archives/dm-devel/2007-April/msg00025.html

The dm_report_init_with_selection is the same as dm_report_init but it contains an additional argument to set the selection in the form of a string that contains field names to check against and selection operators. The selection string is parsend and a selection tree is composed for use in the checks against individual fields when the report is processed. The parsed selection tree is stored in dm_report structure as "selection_root".

---
 libdm/libdevmapper.h |   11 ++
 libdm/libdm-report.c |  434 ++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 436 insertions(+), 9 deletions(-)
libdm/libdevmapper.h +11 -0
index 3a51e14..319b07c 100644
@@ -1641,7 +1641,18 @@ struct dm_report *dm_report_init(uint32_t *report_types,
 				 uint32_t output_flags,
 				 const char *sort_keys,
 				 void *private_data);
+struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
+						const struct dm_report_object_type *types,
+						const struct dm_report_field_type *fields,
+						const char *output_fields,
+						const char *output_separator,
+						uint32_t output_flags,
+						const char *sort_keys,
+						const char *selection,
+						void *private_data);
 int dm_report_object(struct dm_report *rh, void *object);
+int dm_report_set_output_selection(struct dm_report *rh, uint32_t *report_types,
+				   const char *selection);
 int dm_report_output(struct dm_report *rh);
 void dm_report_free(struct dm_report *rh);
 
libdm/libdm-report.c +425 -9

465 lines not on this page · raw message