summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-07-21 19:23:33 +0100
committerBryn M. Reeves <bmr@redhat.com>2015-07-31 12:06:10 +0100
commit795c590980b1a932881cf0f809cd9a5f99f29497 (patch)
tree0649e16cd426dc5f6d5ba78153f8b5f1b414ab97
parentba2da29c4cbeefa3acfd291af94c2547886a4e96 (diff)
downloadlvm2-795c590980b1a932881cf0f809cd9a5f99f29497.tar.gz
libdm-report: add dm_report_headings()
Add a function to output the headings of columns-based reports even if they have already been shown. This will be used by dmstats reports to produce iostat-like repeating reports of statistics values. This patch removes a check for RH_HEADINGS_PRINTED from _report_headings that prevents headings being displaye if the flag is already set; this check is redundant since the only existing caller (_output_as_columns()) already tests the flag before calling the function.
-rw-r--r--libdm/.exported_symbols.DM_1_02_1041
-rw-r--r--libdm/libdevmapper.h8
-rw-r--r--libdm/libdm-report.c8
3 files changed, 14 insertions, 3 deletions
diff --git a/libdm/.exported_symbols.DM_1_02_104 b/libdm/.exported_symbols.DM_1_02_104
index 7f08076c1..b2d29346f 100644
--- a/libdm/.exported_symbols.DM_1_02_104
+++ b/libdm/.exported_symbols.DM_1_02_104
@@ -1,6 +1,7 @@
dm_report_get_interval
dm_report_get_interval_ms
dm_report_get_last_interval
+dm_report_headings
dm_report_set_interval
dm_report_set_interval_ms
dm_report_wait
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 54c47367e..7a3d29834 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1891,6 +1891,14 @@ int dm_report_object_is_selected(struct dm_report *rh, void *object, int do_outp
int dm_report_compact_fields(struct dm_report *rh);
int dm_report_output(struct dm_report *rh);
+
+/**
+ * Output the report headings for a columns-based report, even if they
+ * have already been shown. Useful for repeating reports that wish to
+ * issue a periodic reminder of the column headings.
+ */
+int dm_report_headings(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 909f8d675..000929c4a 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -3840,9 +3840,6 @@ static int _report_headings(struct dm_report *rh)
char *buf = NULL;
size_t buf_size = 0;
- if (rh->flags & RH_HEADINGS_PRINTED)
- return 1;
-
rh->flags |= RH_HEADINGS_PRINTED;
if (!(rh->flags & DM_REPORT_OUTPUT_HEADINGS))
@@ -3911,6 +3908,11 @@ static int _report_headings(struct dm_report *rh)
return 0;
}
+int dm_report_headings(struct dm_report *rh)
+{
+ return _report_headings(rh);
+}
+
/*
* Sort rows of data
*/