From: Dave Wysochanski Date: Mon, 11 May 2009 09:01:36 -0400 Subject: [PATCH 23/30] Update vg_snap_count and vg_seqno display functions to call liblvm 'get'. In-Reply-To: <1242046903-15133-23-git-send-email-dwysocha@redhat.com> References: <1242046903-15133-1-git-send-email-dwysocha@redhat.com> <1242046903-15133-2-git-send-email-dwysocha@redhat.com> <1242046903-15133-3-git-send-email-dwysocha@redhat.com> <1242046903-15133-4-git-send-email-dwysocha@redhat.com> <1242046903-15133-5-git-send-email-dwysocha@redhat.com> <1242046903-15133-6-git-send-email-dwysocha@redhat.com> <1242046903-15133-7-git-send-email-dwysocha@redhat.com> <1242046903-15133-8-git-send-email-dwysocha@redhat.com> <1242046903-15133-9-git-send-email-dwysocha@redhat.com> <1242046903-15133-10-git-send-email-dwysocha@redhat.com> <1242046903-15133-11-git-send-email-dwysocha@redhat.com> <1242046903-15133-12-git-send-email-dwysocha@redhat.com> <1242046903-15133-13-git-send-email-dwysocha@redhat.com> <1242046903-15133-14-git-send-email-dwysocha@redhat.com> <1242046903-15133-15-git-send-email-dwysocha@redhat.com> <1242046903-15133-16-git-send-email-dwysocha@redhat.com> <1242046903-15133-17-git-send-email-dwysocha@redhat.com> <1242046903-15133-18-git-send-email-dwysocha@redhat.com> <1242046903-15133-19-git-send-email-dwysocha@redhat.com> <1242046903-15133-20-git-send-email-dwysocha@redhat.com> <1242046903-15133-21-git-send-email-dwysocha@redhat.com> <1242046903-15133-22-git-send-email-dwysocha@redhat.com> <1242046903-15133-23-git-send-email-dwysocha@redhat.com> Message-ID: <1242046903-15133-24-git-send-email-dwysocha@redhat.com> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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