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

[lvm-devel] [PATCH 23/30] Update vg_snap_count and vg_seqno display functions to call liblvm 'get'.



Note that vg_snap_count and vg_seqno field values are obtained from a simple
dereference of the vg.  The liblvm 'get' functions do not show up in this
patch as they were generated by an earlier patch.

Should be no functional change.

Signed-off-by: Dave Wysochanski <dwysocha 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 398ff81..4cbb716 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -108,8 +108,8 @@ FIELD(VGS, vg, NUM, "MaxLV", cmd, 5, vgmaxlv, "max_lv", "Maximum number of LVs a
 FIELD(VGS, vg, NUM, "MaxPV", cmd, 5, vgmaxpv, "max_pv", "Maximum number of PVs allowed in VG or 0 if unlimited.")
 FIELD(VGS, vg, NUM, "#PV", cmd, 3, vgpvcount, "pv_count", "Number of PVs.")
 FIELD(VGS, vg, NUM, "#LV", cmd, 3, lvcount, "lv_count", "Number of LVs.")
-FIELD(VGS, vg, NUM, "#SN", snapshot_count, 3, uint32, "snap_count", "Number of snapshots.")
-FIELD(VGS, vg, NUM, "Seq", seqno, 3, uint32, "vg_seqno", "Revision number of internal metadata.  Incremented whenever it changes.")
+FIELD(VGS, vg, NUM, "#SN", cmd, 3, vgsnapcount, "snap_count", "Number of snapshots.")
+FIELD(VGS, vg, NUM, "Seq", cmd, 3, vgseqno, "vg_seqno", "Revision number of internal metadata.  Incremented whenever it changes.")
 FIELD(VGS, vg, STR, "VG Tags", tags, 7, tags, "vg_tags", "Tags, if any.")
 FIELD(VGS, vg, NUM, "#VMda", cmd, 5, vgmdas, "vg_mda_count", "Number of metadata areas in use by this VG.")
 FIELD(VGS, vg, NUM, "VMdaFree", cmd, 9, vgmdafree, "vg_mda_free", "Free metadata area space for this VG in current units.")
diff --git a/lib/report/report.c b/lib/report/report.c
index 447ab24..e0d81d5 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -949,6 +949,30 @@ static int _vgpvcount_disp(struct dm_report *rh, struct dm_pool *mem,
 	return _uint32_disp(rh, mem, field, &value, private);
 }
 
+static int _vgsnapcount_disp(struct dm_report *rh, struct dm_pool *mem,
+			     struct dm_report_field *field,
+			     const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_snap_count(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
+static int _vgseqno_disp(struct dm_report *rh, struct dm_pool *mem,
+			 struct dm_report_field *field,
+			 const void *data, void *private)
+{
+	const struct volume_group *vg = (const struct volume_group *) data;
+	uint32_t value;
+
+	value = lvm_vg_get_seqno(vg);
+
+	return _uint32_disp(rh, mem, field, &value, private);
+}
+
 static int _vgfree_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]