diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2014-04-25 17:04:11 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2014-04-25 17:04:11 +0200 |
commit | 934701da9747613002bd3a9c51f16a97ae59e22e (patch) | |
tree | 4e507bc1505b2b9af4d7e33e921f65926900cc42 | |
parent | 862c2a73ad04b6c57b376a9582344f918e3e81c1 (diff) | |
download | lvm2-dev-prajnoha-condout.tar.gz |
condout: make it possible to use condition using fields not reported on current outputdev-prajnoha-condout
-rw-r--r-- | lib/report/report.c | 2 | ||||
-rw-r--r-- | libdm/libdevmapper.h | 3 | ||||
-rw-r--r-- | libdm/libdm-report.c | 6 | ||||
-rw-r--r-- | tools/dmsetup.c | 3 |
4 files changed, 10 insertions, 4 deletions
diff --git a/lib/report/report.c b/lib/report/report.c index e18994cf0..2d48ec66c 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1266,7 +1266,7 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys, if (field_prefixes) dm_report_set_output_field_name_prefix(rh, "lvm2_"); - if (condition && !dm_report_set_output_condition(rh, condition)) { + if (condition && !dm_report_set_output_condition(rh, report_type, condition)) { dm_report_free(rh); rh = NULL; } diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 450a797f6..fceec473e 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -1638,7 +1638,8 @@ struct dm_report *dm_report_init(uint32_t *report_types, const char *sort_keys, void *private_data); int dm_report_object(struct dm_report *rh, void *object); -int dm_report_set_output_condition(struct dm_report *rh, const char *condition); +int dm_report_set_output_condition(struct dm_report *rh, uint32_t *report_types, + const char *condition); int dm_report_output(struct dm_report *rh); void dm_report_free(struct dm_report *rh); diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index 2d7daf272..3566c1dba 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -1173,6 +1173,7 @@ static struct field_condition *_create_field_condition(struct dm_report *rh, if (!found) { if (!(found = _add_field(rh, field_num, FLD_HIDDEN))) return NULL; + rh->report_types |= rh->fields[field_num].type; } /* @@ -1490,7 +1491,8 @@ error: return NULL; } -int dm_report_set_output_condition(struct dm_report *rh, const char *condition) +int dm_report_set_output_condition(struct dm_report *rh, uint32_t *report_types, + const char *condition) { struct condition_node *root = NULL; const char *fin, *next; @@ -1518,6 +1520,8 @@ int dm_report_set_output_condition(struct dm_report *rh, const char *condition) goto error; } + if (report_types) + *report_types = rh->report_types; rh->condition_root = root; return 1; error: diff --git a/tools/dmsetup.c b/tools/dmsetup.c index acb36db97..bae6291b2 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -2934,7 +2934,8 @@ static int _report_init(const struct command *cmd) dm_report_set_output_field_name_prefix(_report, "dm_"); if (_switches[CONDITION_ARG] && - !dm_report_set_output_condition(_report, _string_args[CONDITION_ARG])) { + !dm_report_set_output_condition(_report, &_report_type, + _string_args[CONDITION_ARG])) { err("Failed to set report output condition."); goto out; } |