From a303dcde2ae3c1439f4aeef0d04d1b9a4897cb2e Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 11 Aug 2004 13:15:05 +0000 Subject: [PATCH] Add dev_size column to pvs. --- WHATS_NEW | 1 + lib/config/defaults.h | 2 +- lib/report/columns.h | 1 + lib/report/report.c | 12 ++++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index d142b573d..85c2cf8ef 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.00.21 - ============================= + Add dev_size column to pvs. Add report columns for in-kernel device number. Version 2.00.20 - 3 July 2004 diff --git a/lib/config/defaults.h b/lib/config/defaults.h index 00c088066..f7af81ac5 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -98,7 +98,7 @@ #define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,origin,snap_percent,move_pv,copy_percent,lv_uuid" #define DEFAULT_VGS_COLS_VERB "vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid" -#define DEFAULT_PVS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pv_uuid" +#define DEFAULT_PVS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid" #define DEFAULT_SEGS_COLS_VERB "lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize" #define DEFAULT_LVS_SORT "vg_name,lv_name" diff --git a/lib/report/columns.h b/lib/report/columns.h index 715ee41ba..530eb591f 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -36,6 +36,7 @@ FIELD(LVS, lv, STR, "LV Tags", tags, 7, tags, "lv_tags") FIELD(PVS, pv, STR, "Fmt", id, 3, pvfmt, "pv_fmt") FIELD(PVS, pv, STR, "PV UUID", id, 38, uuid, "pv_uuid") FIELD(PVS, pv, NUM, "PSize", id, 5, pvsize, "pv_size") +FIELD(PVS, pv, NUM, "DevSize", dev, 7, devsize, "dev_size") FIELD(PVS, pv, NUM, "PFree", id, 5, pvfree, "pv_free") FIELD(PVS, pv, NUM, "Used", id, 4, pvused, "pv_used") FIELD(PVS, pv, STR, "PV", dev, 10, dev_name, "pv_name") diff --git a/lib/report/report.c b/lib/report/report.c index b32ea5064..e448eff21 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -645,6 +645,18 @@ static int _pvsize_disp(struct report_handle *rh, struct field *field, return _size64_disp(rh, field, &size); } +static int _devsize_disp(struct report_handle *rh, struct field *field, + const void *data) +{ + const struct device *dev = *(const struct device **) data; + uint64_t size; + + if (!dev_get_size(dev, &size)) + size = 0; + + return _size64_disp(rh, field, &size); +} + static int _vgfree_disp(struct report_handle *rh, struct field *field, const void *data) {