From: Dave Wysochanski Date: Mon, 11 May 2009 09:01:39 -0400 Subject: [PATCH 26/30] Update a few lvseg field display functions to call liblvm 'get' functions. In-Reply-To: <1242046903-15133-26-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> <1242046903-15133-24-git-send-email-dwysocha@redhat.com> <1242046903-15133-25-git-send-email-dwysocha@redhat.com> <1242046903-15133-26-git-send-email-dwysocha@redhat.com> Message-ID: <1242046903-15133-27-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 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 --- 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