[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 26/30] Update a few lvseg field display functions to call liblvm 'get' functions.



Update stripes, stripe_size, and region_size to call liblvm 'get' functions.
These functions are simple dereferences, so we adjust the data pointer arg
to the FIELD macro so that we get the lv_segment pointer in the 'data' arg
of the 'disp' functions.  Note that the liblvm 'get' functions do not show
up in this patch - this is because 'get' functions with simple dereferences
were autogenerated in an earlier patch.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha redhat com>
---
 lib/report/columns.h |   10 +++++-----
 lib/report/report.c  |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index 4cbb716..c4463cf 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -116,11 +116,11 @@ FIELD(VGS, vg, NUM, "VMdaFree", cmd, 9, vgmdafree, "vg_mda_free", "Free metadata
 FIELD(VGS, vg, NUM, "VMdaSize", cmd, 9, vgmdasize, "vg_mda_size", "Size of smallest metadata area for this VG in current units.")
 
 FIELD(SEGS, seg, STR, "Type", list, 4, segtype, "segtype", "Type of LV segment.")
-FIELD(SEGS, seg, NUM, "#Str", area_count, 4, uint32, "stripes", "Number of stripes or mirror legs.")
-FIELD(SEGS, seg, NUM, "Stripe", stripe_size, 6, size32, "stripesize", "For stripes, amount of data placed on one device before switching to the next.")
-FIELD(SEGS, seg, NUM, "Stripe", stripe_size, 6, size32, "stripe_size", "For stripes, amount of data placed on one device before switching to the next.")
-FIELD(SEGS, seg, NUM, "Region", region_size, 6, size32, "regionsize", "For mirrors, the unit of data copied when synchronising devices.")
-FIELD(SEGS, seg, NUM, "Region", region_size, 6, size32, "region_size", "For mirrors, the unit of data copied when synchronising devices.")
+FIELD(SEGS, seg, NUM, "#Str", list, 4, stripes, "stripes", "Number of stripes or mirror legs.")
+FIELD(SEGS, seg, NUM, "Stripe", list, 6, stripesize, "stripesize", "For stripes, amount of data placed on one device before switching to the next.")
+FIELD(SEGS, seg, NUM, "Stripe", list, 6, stripesize, "stripe_size", "For stripes, amount of data placed on one device before switching to the next.")
+FIELD(SEGS, seg, NUM, "Region", list, 6, regionsize, "regionsize", "For mirrors, the unit of data copied when synchronising devices.")
+FIELD(SEGS, seg, NUM, "Region", list, 6, regionsize, "region_size", "For mirrors, the unit of data copied when synchronising devices.")
 FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, "chunksize", "For snapshots, the unit of data used when tracking changes.")
 FIELD(SEGS, seg, NUM, "Chunk", list, 5, chunksize, "chunk_size", "For snapshots, the unit of data used when tracking changes.")
 FIELD(SEGS, seg, NUM, "Start", list, 5, segstart, "seg_start", "Offset within the LV to the start of the segment in current units.")
diff --git a/lib/report/report.c b/lib/report/report.c
index c9deba3..e74dd1a 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -760,6 +760,42 @@ static int _segsize_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &size, private);
 }
 
+static int _stripes_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field,
+			 const void *data, void *private)
+{
+	const struct lv_segment *seg = (const struct lv_segment *) data;
+	uint32_t value;
+
+	value = lvm_lvseg_get_stripes(seg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _stripesize_disp(struct dm_report *rh, struct dm_pool *mem,
+			    struct dm_report_field *field,
+			    const void *data, void *private)
+{
+	const struct lv_segment *seg = (const struct lv_segment *) data;
+	uint32_t size;
+
+	size = lvm_lvseg_get_stripe_size(seg);
+
+	return _size32_disp(rh, mem, field, &size, private);
+}
+
+static int _regionsize_disp(struct dm_report *rh, struct dm_pool *mem,
+			    struct dm_report_field *field,
+			    const void *data, void *private)
+{
+	const struct lv_segment *seg = (const struct lv_segment *) data;
+	uint32_t size;
+
+	size = lvm_lvseg_get_region_size(seg);
+
+	return _size32_disp(rh, mem, field, &size, private);
+}
+
 static int _chunksize_disp(struct dm_report *rh, struct dm_pool *mem,
 			   struct dm_report_field *field,
 			   const void *data, void *private)
-- 
1.6.0.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]