diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/metadata/metadata-exported.h | 3 | ||||
-rw-r--r-- | lib/metadata/vdo_manip.c | 50 |
2 files changed, 53 insertions, 0 deletions
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index f5b540a10..b22113914 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -1251,6 +1251,9 @@ int wipe_cache_pool(struct logical_volume *cache_pool_lv); /* ++ metadata/vdo_manip.c */ +const char *get_vdo_compression_state_name(enum dm_vdo_compression_state state); +const char *get_vdo_index_state_name(enum dm_vdo_index_state state); +const char *get_vdo_operating_mode_name(enum dm_vdo_operating_mode mode); uint64_t get_vdo_pool_virtual_size(const struct lv_segment *vdo_pool_seg); struct logical_volume *convert_vdo_pool_lv(struct logical_volume *data_lv, const struct dm_vdo_target_params *vtp, diff --git a/lib/metadata/vdo_manip.c b/lib/metadata/vdo_manip.c index 451c8bdba..8aee3dc00 100644 --- a/lib/metadata/vdo_manip.c +++ b/lib/metadata/vdo_manip.c @@ -25,6 +25,56 @@ #include "lib/misc/lvm-signal.h" #include "lib/misc/lvm-exec.h" +const char *get_vdo_compression_state_name(enum dm_vdo_compression_state state) +{ + switch (state) { + case DM_VDO_COMPRESSION_ONLINE: + return "online"; + default: + log_debug(INTERNAL_ERROR "Unrecognized compression state: %u.", state); + /* Fall through */ + case DM_VDO_COMPRESSION_OFFLINE: + return "offline"; + } +} + +const char *get_vdo_index_state_name(enum dm_vdo_index_state state) +{ + switch (state) { + case DM_VDO_INDEX_ERROR: + return "error"; + case DM_VDO_INDEX_CLOSED: + return "closed"; + case DM_VDO_INDEX_OPENING: + return "opening"; + case DM_VDO_INDEX_CLOSING: + return "closing"; + case DM_VDO_INDEX_OFFLINE: + return "offline"; + case DM_VDO_INDEX_ONLINE: + return "online"; + default: + log_debug(INTERNAL_ERROR "Unrecognized index state: %u.", state); + /* Fall through */ + case DM_VDO_INDEX_UNKNOWN: + return "unknown"; + } +} + +const char *get_vdo_operating_mode_name(enum dm_vdo_operating_mode mode) +{ + switch (mode) { + case DM_VDO_MODE_RECOVERING: + return "recovering"; + case DM_VDO_MODE_READ_ONLY: + return "read-only"; + default: + log_debug(INTERNAL_ERROR "Unrecognized operating mode: %u.", mode); + /* Fall through */ + case DM_VDO_MODE_NORMAL: + return "normal"; + } +} /* * Size of VDO virtual LV is adding header_size in front and back of device |