dev-prajnoha-condout - condout: make it possible to use condition using fields not reported on current output
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=934701da9747613002bd3a9c51f16a97ae59e22e Commit: 934701da9747613002bd3a9c51f16a97ae59e22e Parent: 862c2a73ad04b6c57b376a9582344f918e3e81c1 Author: Peter Rajnoha <[email protected]> AuthorDate: Fri Apr 25 17:04:11 2014 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Fri Apr 25 17:04:11 2014 +0200
condout: make it possible to use condition using fields not reported on current output
--- lib/report/report.c | 2 +- libdm/libdevmapper.h | 3 ++- libdm/libdm-report.c | 6 +++++- tools/dmsetup.c | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-)
lib/report/report.c +1 -1
@@ -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 ; }
libdm/libdevmapper.h +2 -1
@@ -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);
libdm/libdm-report.c +5 -1
@@ -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:
tools/dmsetup.c +2 -1
@@ -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; }