master - report: select: add support for percent selection
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=51a86dc2f8cdfe3de9f0876548731ede1f6a4f24 Commit: 51a86dc2f8cdfe3de9f0876548731ede1f6a4f24 Parent: cfed0d09e8ef8f0f819420a15c9165d4fd49a890 Author: Peter Rajnoha <[email protected]> AuthorDate: Mon Jun 9 16:23:45 2014 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Tue Jun 17 16:27:21 2014 +0200
report: select: add support for percent selection
--- lib/properties/prop_common.h | 3 +- lib/report/columns.h | 10 ++-- lib/report/report.c | 1 + libdm/libdevmapper.h | 8 ++- libdm/libdm-report.c | 99 ++++++++++++++++++++++++++++++------------ 5 files changed, 84 insertions(+), 37 deletions(-)
lib/properties/prop_common.h +2 -1
@@ -123,7 +123,8 @@ static int _ ## NAME ## _get (const void *obj, struct lvm_property_type *prop) \#define STR 1#define NUM 2#define SIZ 3 -#define STR_LIST 4 +#define PCT 4 +#define STR_LIST 5#define FIELD_MODIFIABLE 0x00000001#define FIELD (type, strct, field_type, head, field, width, fn, id, desc, settable) \
lib/report/columns.h +5 -5
@@ -44,11 +44,11 @@ FIELD(LVS, lv, SIZ, "MSize", lvid, 6, lvmetadatasize, lv_metadata_size, "For thi FIELD(LVS, lv, NUM, "#Seg", lvid, 4, lvsegcount, seg_count, "Number of segments in LV.", 0) FIELD(LVS, lv, STR, "Origin", lvid, 6, origin, origin, "For snapshots, the origin device of this LV.", 0) FIELD(LVS, lv, SIZ, "OSize", lvid, 5, originsize, origin_size, "For snapshots, the size of the origin device of this LV.", 0) -FIELD(LVS, lv, NUM, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0) -FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0) -FIELD(LVS, lv, NUM, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0) -FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) -FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) +FIELD(LVS, lv, PCT, "Data%", lvid, 6, datapercent, data_percent, "For snapshot and thin pools and volumes, the percentage full if LV is active.", 0) +FIELD(LVS, lv, PCT, "Snap%", lvid, 6, snpercent, snap_percent, "For snapshots, the percentage full if LV is active.", 0) +FIELD(LVS, lv, PCT, "Meta%", lvid, 6, metadatapercent, metadata_percent, "For thin pools, the percentage of metadata full if LV is active.", 0) +FIELD(LVS, lv, PCT, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) +FIELD(LVS, lv, PCT, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0) FIELD(LVS, lv, NUM, "Mismatches", lvid, 10, raidmismatchcount, raid_mismatch_count, "For RAID, number of mismatches found or repaired.", 0) FIELD(LVS, lv, STR, "SyncAction", lvid, 10, raidsyncaction, raid_sync_action, "For RAID, the current synchronization action being performed.", 0)FIELD (LVS , lv,NUM ,"WBehind" , lvid,7 , raidwritebehind, raid_write_behind,"For RAID1, the number of outstanding writes allowed to writemostly devices." ,0 )
lib/report/report.c +1 -0
@@ -1203,6 +1203,7 @@ static const struct dm_report_object_type _devtypes_report_types[] = {#define STR DM_REPORT_FIELD_TYPE_STRING#define NUM DM_REPORT_FIELD_TYPE_NUMBER#define SIZ DM_REPORT_FIELD_TYPE_SIZE +#define PCT DM_REPORT_FIELD_TYPE_PERCENT#define STR_LIST DM_REPORT_FIELD_TYPE_STRING_LIST#define FIELD (type, strct, sorttype, head, field, width, func, id, desc, writeable) \ {type, sorttype, offsetof(type_ ## strct, field), width, \
libdm/libdevmapper.h +5 -3
@@ -1628,15 +1628,16 @@ struct dm_report_field;/* * dm_report_field_type flags */ -#define DM_REPORT_FIELD_MASK 0x000000FF +#define DM_REPORT_FIELD_MASK 0x00000FFF#define DM_REPORT_FIELD_ALIGN_MASK 0x0000000F#define DM_REPORT_FIELD_ALIGN_LEFT 0x00000001#define DM_REPORT_FIELD_ALIGN_RIGHT 0x00000002 -#define DM_REPORT_FIELD_TYPE_MASK 0x000000F0 +#define DM_REPORT_FIELD_TYPE_MASK 0x00000FF0#define DM_REPORT_FIELD_TYPE_STRING 0x00000010#define DM_REPORT_FIELD_TYPE_NUMBER 0x00000020#define DM_REPORT_FIELD_TYPE_SIZE 0x00000040 -#define DM_REPORT_FIELD_TYPE_STRING_LIST 0x00000080 +#define DM_REPORT_FIELD_TYPE_PERCENT 0x00000080 +#define DM_REPORT_FIELD_TYPE_STRING_LIST 0x00000100#define DM_REPORT_FIELD_TYPE_ID_LEN 32#define DM_REPORT_FIELD_TYPE_HEADING_LEN 32
@@ -1666,6 +1667,7 @@ struct dm_report_reserved_value {const void const *value;/* reserved value: uint64_t for DM_REPORT_FIELD_TYPE_NUMBER uint64_t for DM_REPORT_FIELD_TYPE_SIZE (number of 512-byte sectors) +uint64_t for DM_REPORT_FIELD_TYPE_PERCENT const char * for DM_REPORT_FIELD_TYPE_STRING */ const char **names;/* null-terminated array of names for this reserved value */ const char *description;/* description of the reserved value */
libdm/libdm-report.c +71 -28
178 lines not on this page · raw message