Skip to contentSkip to conversation

master - libdm: select: recognize special selection string 'all' as an alias for blank selection string

PATCH Peter Rajnoha 1 participant 1 message Jun 20, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5b93db65660c5dbb5b68d458ffa4c034a4c37211
Commit:        5b93db65660c5dbb5b68d458ffa4c034a4c37211
Parent:        1127b090bd07065a6a5046881ba1692bd507b9da
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Mon Jun 13 15:23:44 2016 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Mon Jun 20 11:33:43 2016 +0200

libdm: select: recognize special selection string 'all' as an alias for blank selection string

---
 WHATS_NEW_DM         |    1 +
 libdm/libdm-report.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
WHATS_NEW_DM +1 -0
index 1772e18..8911e36 100644
@@ -1,5 +1,6 @@
 Version 1.02.128 -
 =================================
+  Recognize 'all' keyword used in selection as synonym for "" (no selection).
   Add dm_report_set_selection to set selection for multiple output of report.
   Add DM_REPORT_OUTPUT_MULTIPLE_TIMES flag for multiple output of same report.
   Move field width handling/sort init from dm_report_object to dm_report_output.
libdm/libdm-report.c +3 -1
index cae9c66..1326fdf 100644
@@ -3984,6 +3984,8 @@ static int _alloc_rh_selection(struct dm_report *rh)
 	return 1;
 }
 
+#define SPECIAL_SELECTION_ALL "all"
+
 static int _report_set_selection(struct dm_report *rh, const char *selection, int add_new_fields)
 {
 	struct selection_node *root = NULL;
@@ -3999,7 +4001,7 @@ static int _report_set_selection(struct dm_report *rh, const char *selection, in
 			goto_bad;
 	}
 
-	if (!selection)
+	if (!selection || !strcasecmp(selection, SPECIAL_SELECTION_ALL))
 		return 1;
 
 	rh->selection->add_new_fields = add_new_fields;