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

libdm: report: compact output applicable only if report is buffered

This commit is contained in:
Peter Rajnoha 2014-12-05 14:18:32 +01:00
parent f3bd9a2797
commit f867dc6b29
3 changed files with 7 additions and 1 deletions

View File

@ -1105,7 +1105,8 @@ activation {
#
# report {
# If compact output is enabled, fields which don't have value
# set for any of the rows reported are skipped on output.
# set for any of the rows reported are skipped on output. Compact
# output is applicable only if report is buffered (report/buffered=1).
# compact_output=0
# Align columns on report output.

View File

@ -1757,6 +1757,8 @@ int dm_report_object(struct dm_report *rh, void *object);
/*
* Compact report output so that if field value is empty for all rows in
* the report, drop the field from output completely (including headers).
* Compact output is applicable only if report is buffered, otherwise
* this function has no effect.
*/
int dm_report_compact_fields(struct dm_report *rh);

View File

@ -1696,6 +1696,9 @@ int dm_report_compact_fields(struct dm_report *rh)
struct field_properties *fp;
struct row *row;
if (!(rh->flags & DM_REPORT_OUTPUT_BUFFERED))
return 1;
if (!rh || dm_list_empty(&rh->rows)) {
log_error("dm_report_enable_compact_output: no report fields to compact");
return 0;