[lvm-devel] [PATCH 30/30] Update pvseg_start and pvseg_size fields to have a disp function calling liblvm

Dave Wysochanski dwysocha at redhat.com
Mon May 11 13:01:43 UTC 2009


Call into liblvm 'get' functions from 'disp' functions.
Note that the 'get' functions were some of the simple ones autogenerated
by the perl script in an earlier patch.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha at redhat.com>
---
 lib/report/columns.h |    4 ++--
 lib/report/report.c  |   24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/lib/report/columns.h b/lib/report/columns.h
index c4463cf..c3ae040 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -130,6 +130,6 @@ FIELD(SEGS, seg, STR, "Seg Tags", tags, 8, tags, "seg_tags", "Tags, if any.")
 FIELD(SEGS, seg, STR, "PE Ranges", list, 9, peranges, "seg_pe_ranges", "Ranges of Physical Extents of underlying devices in command line format.")
 FIELD(SEGS, seg, STR, "Devices", list, 7, devices, "devices", "Underlying devices used with starting extent numbers.")
 
-FIELD(PVSEGS, pvseg, NUM, "Start", pe, 5, uint32, "pvseg_start", "Physical Extent number of start of segment.")
-FIELD(PVSEGS, pvseg, NUM, "SSize", len, 5, uint32, "pvseg_size", "Number of extents in segment.")
+FIELD(PVSEGS, pvseg, NUM, "Start", list, 5, pvsegstart, "pvseg_start", "Physical Extent number of start of segment.")
+FIELD(PVSEGS, pvseg, NUM, "SSize", list, 5, pvsegsize, "pvseg_size", "Number of extents in segment.")
 /* *INDENT-ON* */
diff --git a/lib/report/report.c b/lib/report/report.c
index e91cef2..968c798 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -811,6 +811,30 @@ static int _chunksize_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _size64_disp(rh, mem, field, &size, private);
 }
 
+static int _pvsegstart_disp(struct dm_report *rh, struct dm_pool *mem,
+			    struct dm_report_field *field,
+			    const void *data, void *private)
+{
+	const struct pv_segment *pvseg = (const struct pv_segment *) data;
+	uint32_t start;
+
+	start = lvm_pvseg_get_start(pvseg);
+
+	return _uint32_disp(rh, mem, field, &start, private);
+}
+
+static int _pvsegsize_disp(struct dm_report *rh, struct dm_pool *mem,
+			   struct dm_report_field *field,
+			   const void *data, void *private)
+{
+	const struct pv_segment *pvseg = (const struct pv_segment *) data;
+	uint32_t value;
+
+	value = lvm_pvseg_get_size(pvseg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
 static int _originsize_disp(struct dm_report *rh, struct dm_pool *mem,
 			    struct dm_report_field *field,
 			    const void *data, void *private)
-- 
1.6.0.6




More information about the lvm-devel mailing list