summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2015-08-04 09:03:31 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2015-08-04 09:03:31 +0200
commit6ac5689ce4d4f86c4b3985d73a0fdb4af04c298d (patch)
treef1dbe843ba4303be9cbe0c2897276c8ac2667c38
parentd11f8d42287025ff8584b9d6f1d5e70a0d78371b (diff)
downloadlvm2-6ac5689ce4d4f86c4b3985d73a0fdb4af04c298d.tar.gz
report: also recognize variants without underscores for <prefix>_all fields
For example: "pvs -o pv_all" and pvs -o pvall" are same.
-rw-r--r--libdm/libdm-report.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 5b943117b..225da90f2 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -876,15 +876,20 @@ static void _all_match_combine(const struct dm_report_object_type *types,
const char *field, size_t flen,
uint32_t *report_types)
{
+ char field_canon[DM_REPORT_FIELD_TYPE_ID_LEN];
const struct dm_report_object_type *t;
size_t prefix_len;
+ if (!_get_canonical_field_name(field, flen, field_canon, DM_REPORT_FIELD_TYPE_ID_LEN, NULL))
+ return;
+ flen = strlen(field_canon);
+
for (t = types; t->data_fn; t++) {
- prefix_len = strlen(t->prefix);
+ prefix_len = strlen(t->prefix) - 1;
- if (!strncasecmp(t->prefix, field, prefix_len) &&
+ if (!strncasecmp(t->prefix, field_canon, prefix_len) &&
((unprefixed_all_matched && (flen == prefix_len)) ||
- (!strncasecmp(field + prefix_len, "all", 3) &&
+ (!strncasecmp(field_canon + prefix_len, "all", 3) &&
(flen == prefix_len + 3))))
*report_types |= t->id;
}