mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
vdo: support functions to map enums to string names
Translate VDO enums to printable strings.
This commit is contained in:
parent
aff69ecf39
commit
aa63dfbe39
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user