mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
report: add 'multiple_output' arg to report_init
Some reports may be reported several times with possible different selection criteria, just like command log report.
This commit is contained in:
parent
2078b842fb
commit
1b107adc1d
@ -3703,7 +3703,8 @@ static const struct dm_report_field_type _log_fields[] = {
|
|||||||
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
||||||
report_type_t *report_type, const char *separator,
|
report_type_t *report_type, const char *separator,
|
||||||
int aligned, int buffered, int headings, int field_prefixes,
|
int aligned, int buffered, int headings, int field_prefixes,
|
||||||
int quoted, int columns_as_rows, const char *selection)
|
int quoted, int columns_as_rows, const char *selection,
|
||||||
|
int multiple_output)
|
||||||
{
|
{
|
||||||
uint32_t report_flags = 0;
|
uint32_t report_flags = 0;
|
||||||
const struct dm_report_object_type *types;
|
const struct dm_report_object_type *types;
|
||||||
@ -3729,6 +3730,9 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
|||||||
if (columns_as_rows)
|
if (columns_as_rows)
|
||||||
report_flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS;
|
report_flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS;
|
||||||
|
|
||||||
|
if (multiple_output)
|
||||||
|
report_flags |= DM_REPORT_OUTPUT_MULTIPLE_TIMES;
|
||||||
|
|
||||||
if (*report_type & CMDLOG) {
|
if (*report_type & CMDLOG) {
|
||||||
types = _log_report_types;
|
types = _log_report_types;
|
||||||
fields = _log_fields;
|
fields = _log_fields;
|
||||||
|
@ -88,7 +88,8 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
|
|||||||
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
||||||
report_type_t *report_type, const char *separator,
|
report_type_t *report_type, const char *separator,
|
||||||
int aligned, int buffered, int headings, int field_prefixes,
|
int aligned, int buffered, int headings, int field_prefixes,
|
||||||
int quoted, int columns_as_rows, const char *selection);
|
int quoted, int columns_as_rows, const char *selection,
|
||||||
|
int multiple_output);
|
||||||
int report_get_single_selection(struct cmd_context *cmd, const char **selection);
|
int report_get_single_selection(struct cmd_context *cmd, const char **selection);
|
||||||
void *report_init_for_selection(struct cmd_context *cmd, report_type_t *report_type,
|
void *report_init_for_selection(struct cmd_context *cmd, report_type_t *report_type,
|
||||||
const char *selection);
|
const char *selection);
|
||||||
|
@ -1032,7 +1032,7 @@ static int _do_report(struct cmd_context *cmd, struct processing_handle *handle,
|
|||||||
if (!(report_handle = report_init(cmd, single_args->options, single_args->keys, &report_type,
|
if (!(report_handle = report_init(cmd, single_args->options, single_args->keys, &report_type,
|
||||||
args->separator, args->aligned, args->buffered,
|
args->separator, args->aligned, args->buffered,
|
||||||
args->headings, args->field_prefixes, args->quoted,
|
args->headings, args->field_prefixes, args->quoted,
|
||||||
args->columns_as_rows, single_args->selection)))
|
args->columns_as_rows, single_args->selection, 0)))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
handle->custom_handle = report_handle;
|
handle->custom_handle = report_handle;
|
||||||
@ -1462,7 +1462,7 @@ int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_g
|
|||||||
if (!(tmp_log_rh = report_init(NULL, single_args->options, single_args->keys, &single_args->report_type,
|
if (!(tmp_log_rh = report_init(NULL, single_args->options, single_args->keys, &single_args->report_type,
|
||||||
args.separator, args.aligned, args.buffered, args.headings,
|
args.separator, args.aligned, args.buffered, args.headings,
|
||||||
args.field_prefixes, args.quoted, args.columns_as_rows,
|
args.field_prefixes, args.quoted, args.columns_as_rows,
|
||||||
single_args->selection))) {
|
single_args->selection, 1))) {
|
||||||
log_error("Failed to create log report.");
|
log_error("Failed to create log report.");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user