Skip to contentSkip to conversation

master - libdm: allow formatting histogram strings with no whitespace

PATCH Bryn Reeves 1 participant 1 message Sep 3, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f09e4f7b10db5051b40fe50b5d6a99a171ce04ca
Commit:        f09e4f7b10db5051b40fe50b5d6a99a171ce04ca
Parent:        0a73a5012aece3d0f7fd03a270cfe5067c1fafc8
Author:        Bryn M. Reeves <[email protected]>
AuthorDate:    Thu Sep 3 21:48:15 2015 +0100
Committer:     Bryn M. Reeves <[email protected]>
CommitterDate: Thu Sep 3 22:04:10 2015 +0100

libdm: allow formatting histogram strings with no whitespace

Allow dm_histogram_to_string() to format histogram strings with no whitespace by passing a width value less than zero.

---
 libdm/libdevmapper.h |   10 ++++++++--
 libdm/libdm-stats.c  |   48 ++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 46 insertions(+), 12 deletions(-)
libdm/libdevmapper.h +8 -2
index c81a9e5..098fa85 100644
@@ -2826,8 +2826,8 @@ uint64_t dm_histogram_get_sum(const struct dm_histogram *dmh);
 /*
  * Histogram formatting flags.
  */
-#define DM_HISTOGRAM_VALUES  0x1
-#define DM_HISTOGRAM_SUFFIX  0x2
+#define DM_HISTOGRAM_SUFFIX  0x1
+#define DM_HISTOGRAM_VALUES  0x2
 #define DM_HISTOGRAM_PERCENT 0X4
 #define DM_HISTOGRAM_BOUNDS_LOWER 0x10
 #define DM_HISTOGRAM_BOUNDS_UPPER 0x20
@@ -2840,6 +2840,12 @@ uint64_t dm_histogram_get_sum(const struct dm_histogram *dmh);
  * The bin argument selects the bin to format. If this argument is less
  * than zero all bins will be included in the resulting string.
  *
+ * width specifies a minimum width for the field in characters; if it is
+ * zero the width will be determined automatically based on the options
+ * selected for formatting. A value less than zero disables field width
+ * control: bin boundaries and values will be output with a minimum
+ * amount of whitespace.
+ *
  * flags is a collection of flag arguments that control the string format:
  *
  * DM_HISTOGRAM_VALUES  - Include bin values in the string.
libdm/libdm-stats.c +38 -10

90 lines not on this page · raw message