[lvm-devel] master - dmstats: add stats_name field
Bryn Reeves
bmr at fedoraproject.org
Tue Jul 5 18:35:05 UTC 2016
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3626cf025dbb0e17a4bda7fabd4b081021eaddcc
Commit: 3626cf025dbb0e17a4bda7fabd4b081021eaddcc
Parent: 65606c90d922450eacf1e10fbd73c8ef2b96429e
Author: Bryn M. Reeves <bmr at redhat.com>
AuthorDate: Mon Jun 13 14:28:37 2016 +0100
Committer: Bryn M. Reeves <bmr at redhat.com>
CommitterDate: Tue Jul 5 19:29:50 2016 +0100
dmstats: add stats_name field
To allow the names used to describe statistics report objects to
change (for e.g to support groups and region and group aliases)
introduce a new "stats_name" field that evaluates to the correct
name for the object being reported.
---
tools/dmsetup.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 9f63608..f7a3f74 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -3462,6 +3462,19 @@ static int _dm_stats_aux_data_disp(struct dm_report *rh,
return dm_report_field_string(rh, field, (const char * const *) &aux_data);
}
+static int _dm_stats_name_disp(struct dm_report *rh,
+ struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field, const void *data,
+ void *private __attribute__((unused)))
+{
+ const struct dm_stats *dms = (const struct dm_stats *) data;
+ const char *stats_name;
+ if (!(stats_name = dm_stats_get_alias(dms, DM_STATS_REGION_CURRENT)))
+ return_0;
+
+ return dm_report_field_string(rh, field, (const char * const *) &stats_name);
+}
+
static int _dm_stats_precise_disp(struct dm_report *rh,
struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field, const void *data,
@@ -4229,6 +4242,7 @@ FIELD_F(STATS_META, STR, "Precise", 7, dm_stats_precise, "precise", "Set if nano
FIELD_F(STATS_META, STR, "#Bins", 9, dm_stats_hist_bins, "hist_bins", "The number of histogram bins configured.")
FIELD_F(STATS_META, STR, "Histogram Bounds", 16, dm_stats_hist_bounds, "hist_bounds", "Latency histogram bin boundaries.")
FIELD_F(STATS_META, STR, "Histogram Ranges", 16, dm_stats_hist_ranges, "hist_ranges", "Latency histogram bin ranges.")
+FIELD_F(STATS, STR, "Name", 16, dm_stats_name, "stats_name", "Stats name of current row.")
{0, 0, 0, 0, "", "", NULL, NULL},
/* *INDENT-ON* */
};
More information about the lvm-devel
mailing list