1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

report: properly set "undefined" reserved value for cache_policy field

Use helper macros to handle reserved values and also define "undefined"
reserved value as:

FIELD_RESERVED_VALUE(cache_policy, cache_policy_undef, "", "", "undefined")

Which means:

 - print "" if the cache_policy value is undefined (the first name for this reserved value is "")
 - recognize "undefined" reserved name as synonym to ""
   (so statements like "lvs -S cache_policy=undefined" are still recognized)
This commit is contained in:
Peter Rajnoha 2014-12-18 15:11:25 +01:00
parent 028ff30947
commit da9da0d8c2
2 changed files with 3 additions and 2 deletions

View File

@ -291,7 +291,8 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
if (seg_is_cache(seg))
seg = first_seg(seg->pool_lv);
else
return _field_set_value(field, "", GET_FIRST_RESERVED_NAME(cache_policy_undef));
return _field_set_value(field, GET_FIRST_RESERVED_NAME(cache_policy_undef),
GET_FIELD_RESERVED_VALUE(cache_policy_undef));
if (seg->policy_name) {
if (!(cache_policy_name = dm_pool_strdup(mem, seg->policy_name))) {

View File

@ -86,7 +86,7 @@ FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r_override, "", "read-only-o
FIELD_RESERVED_VALUE(lv_read_ahead, lv_read_ahead_auto, "", &GET_TYPE_RESERVED_VALUE(num_undef_64), "auto")
/* Reserved values for SEG fields */
FIELD_RESERVED_VALUE(cache_policy, cache_policy_undef, "", "undefined", "undefined")
FIELD_RESERVED_VALUE(cache_policy, cache_policy_undef, "", "", "", "undefined")
/* TODO the following 2 need STR_LIST support for reserved values
FIELD_RESERVED_VALUE(cache_settings, cache_settings_default, "", "default", "default")
FIELD_RESERVED_VALUE(cache_settings, cache_settings_undef, "", "undefined", "undefined") */