1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Fix 'pvs -o pv_all' to include label fields. (Also removed recursion.)

This commit is contained in:
Alasdair Kergon 2011-06-12 19:49:40 +00:00
parent 29f2c5ada6
commit 83e797bc52
2 changed files with 18 additions and 18 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.65 - Version 1.02.65 -
================================== ==================================
Fix "all" report field prefix matching to include label fields with pv_all.
Delay resuming new preloaded mirror devices with core logs in deptree code. Delay resuming new preloaded mirror devices with core logs in deptree code.
Accept new kernel version 3 uname formats in initialisation. Accept new kernel version 3 uname formats in initialisation.

View File

@ -367,33 +367,32 @@ static uint32_t _all_match(struct dm_report *rh, const char *field, size_t flen)
{ {
size_t prefix_len; size_t prefix_len;
const struct dm_report_object_type *t; const struct dm_report_object_type *t;
char prefixed_all[32]; uint32_t report_types = 0;
unsigned unprefixed_all_matched = 0;
if (!strncasecmp(field, "all", 3) && flen == 3) { if (!strncasecmp(field, "all", 3) && flen == 3) {
if (strlen(rh->field_prefix)) { /* If there's no report prefix, match all report types */
strcpy(prefixed_all, rh->field_prefix); if (!(flen = strlen(rh->field_prefix)))
strcat(prefixed_all, "all"); return rh->report_types ? : REPORT_TYPES_ALL;
/*
* Add also prefix to receive all attributes /* otherwise include all fields beginning with the report prefix. */
* (e.g.LABEL/PVS use the same prefix) unprefixed_all_matched = 1;
*/ field = rh->field_prefix;
return rh->report_types | report_types = rh->report_types;
_all_match(rh, prefixed_all,
strlen(prefixed_all));
} else
return (rh->report_types)
? rh->report_types : REPORT_TYPES_ALL;
} }
/* Combine all report types that have a matching prefix. */
for (t = rh->types; t->data_fn; t++) { for (t = rh->types; t->data_fn; t++) {
prefix_len = strlen(t->prefix); prefix_len = strlen(t->prefix);
if (!strncasecmp(t->prefix, field, prefix_len) && if (!strncasecmp(t->prefix, field, prefix_len) &&
!strncasecmp(field + prefix_len, "all", 3) && ((unprefixed_all_matched && (flen == prefix_len)) ||
flen == prefix_len + 3) (!strncasecmp(field + prefix_len, "all", 3) &&
return t->id; (flen == prefix_len + 3))))
report_types |= t->id;
} }
return 0; return report_types;
} }
/* /*