diff options
Diffstat (limited to 'lib/display/display.c')
-rw-r--r-- | lib/display/display.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/display/display.c b/lib/display/display.c index 98433e745..62ad1feba 100644 --- a/lib/display/display.c +++ b/lib/display/display.c @@ -86,6 +86,38 @@ alloc_policy_t get_alloc_from_string(const char *str) return ALLOC_INVALID; } +const char *get_lock_type_string(lock_type_t lock_type) +{ + switch (lock_type) { + case LOCK_TYPE_INVALID: + return "invalid"; + case LOCK_TYPE_NONE: + return "none"; + case LOCK_TYPE_CLVM: + return "clvm"; + case LOCK_TYPE_DLM: + return "dlm"; + case LOCK_TYPE_SANLOCK: + return "sanlock"; + } + return "invalid"; +} + +lock_type_t get_lock_type_from_string(const char *str) +{ + if (!str) + return LOCK_TYPE_NONE; + if (!strcmp(str, "none")) + return LOCK_TYPE_NONE; + if (!strcmp(str, "clvm")) + return LOCK_TYPE_CLVM; + if (!strcmp(str, "dlm")) + return LOCK_TYPE_DLM; + if (!strcmp(str, "sanlock")) + return LOCK_TYPE_SANLOCK; + return LOCK_TYPE_INVALID; +} + static const char *_percent_types[7] = { "NONE", "VG", "FREE", "LV", "PVS", "ORIGIN" }; const char *get_percent_string(percent_type_t def) |