From e69e81388dd84598a37b8b77c17c393bf570cf75 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Tue, 22 Mar 2016 00:12:08 +0000 Subject: [PATCH] report: Add pv_major, pv_minor to reports. --- WHATS_NEW | 1 + lib/report/columns.h | 2 ++ lib/report/properties.c | 4 ++++ lib/report/report.c | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 0f8102129..029405d0a 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.148 - ================================== + Add pv_major and pv_minor report fields. Detect and warn about mismatch between devices used and assumed for an LV. Version 2.02.147 - 19th March 2016 diff --git a/lib/report/columns.h b/lib/report/columns.h index 443904757..7f5e11d62 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -126,6 +126,8 @@ FIELD(LABEL, label, STR, "Fmt", type, 0, pvfmt, pv_fmt, "Type of metadata.", 0) FIELD(LABEL, label, STR, "PV UUID", type, 38, pvuuid, pv_uuid, "Unique identifier.", 0) FIELD(LABEL, label, SIZ, "DevSize", dev, 0, devsize, dev_size, "Size of underlying device in current units.", 0) FIELD(LABEL, label, STR, "PV", dev, 10, dev_name, pv_name, "Name.", 0) +FIELD(LABEL, label, STR, "Maj", dev, 0, devmajor, pv_major, "Device major number.", 0) +FIELD(LABEL, label, STR, "Min", dev, 0, devminor, pv_minor, "Device minor number.", 0) FIELD(LABEL, label, SIZ, "PMdaFree", type, 9, pvmdafree, pv_mda_free, "Free metadata area space on this device in current units.", 0) FIELD(LABEL, label, SIZ, "PMdaSize", type, 9, pvmdasize, pv_mda_size, "Size of smallest metadata area on this device in current units.", 0) FIELD(LABEL, label, NUM, "PExtVsn", type, 0, pvextvsn, pv_ext_vsn, "PV header extension version.", 0) diff --git a/lib/report/properties.c b/lib/report/properties.c index 62c81b95d..7c9bb0cf6 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -194,6 +194,10 @@ GET_PV_NUM_PROPERTY_FN(pv_ba_size, SECTOR_SIZE * pv->ba_size) #define _pv_ext_vsn_set prop_not_implemented_set #define _pv_in_use_get prop_not_implemented_get #define _pv_in_use_set prop_not_implemented_set +#define _pv_major_get prop_not_implemented_set +#define _pv_major_set prop_not_implemented_set +#define _pv_minor_get prop_not_implemented_set +#define _pv_minor_set prop_not_implemented_set #define _vg_permissions_set prop_not_implemented_set #define _vg_permissions_get prop_not_implemented_get diff --git a/lib/report/report.c b/lib/report/report.c index 7070092b1..5009ecc80 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1289,6 +1289,24 @@ static int _uuid_disp(struct dm_report *rh, struct dm_pool *mem, return _field_set_value(field, repstr, NULL); } +static int _devminor_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + int devminor = (int) MINOR((*(const struct device * const *) data)->dev); + + return dm_report_field_int(rh, field, &devminor); +} + +static int _devmajor_disp(struct dm_report *rh, struct dm_pool *mem, + struct dm_report_field *field, + const void *data, void *private) +{ + int devmajor = (int) MAJOR((*(const struct device * const *) data)->dev); + + return dm_report_field_int(rh, field, &devmajor); +} + static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem, struct dm_report_field *field, const void *data, void *private)