summaryrefslogtreecommitdiffstats
path: root/lib/display/display.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2010-10-25 13:54:29 +0000
committerAlasdair Kergon <agk@redhat.com>2010-10-25 13:54:29 +0000
commit2aa06d73ca75635a6874255409033839b2c26192 (patch)
tree2b75fb0117b57313f787c65baa2eda8d231b2e27 /lib/display/display.c
parent3f329bd02caeed8bcd8bbedb59eec0bd9c795701 (diff)
downloadlvm2-2aa06d73ca75635a6874255409033839b2c26192.tar.gz
lvm2-2aa06d73ca75635a6874255409033839b2c26192.tar.xz
lvm2-2aa06d73ca75635a6874255409033839b2c26192.zip
pre-release
Diffstat (limited to 'lib/display/display.c')
-rw-r--r--lib/display/display.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/display/display.c b/lib/display/display.c
index 86dc87fb..f1d4ff74 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -27,13 +27,14 @@ typedef enum { SIZE_LONG = 0, SIZE_SHORT = 1, SIZE_UNIT = 2 } size_len_t;
static const struct {
alloc_policy_t alloc;
const char str[12]; /* must be changed when size extends 11 chars */
+ const char repchar;
} _policies[] = {
{
- ALLOC_CONTIGUOUS, "contiguous"}, {
- ALLOC_CLING, "cling"}, {
- ALLOC_NORMAL, "normal"}, {
- ALLOC_ANYWHERE, "anywhere"}, {
- ALLOC_INHERIT, "inherit"}
+ ALLOC_CONTIGUOUS, "contiguous", 'c'}, {
+ ALLOC_CLING, "cling", 'l'}, {
+ ALLOC_NORMAL, "normal", 'n'}, {
+ ALLOC_ANYWHERE, "anywhere", 'a'}, {
+ ALLOC_INHERIT, "inherit", 'i'}
};
static const int _num_policies = sizeof(_policies) / sizeof(*_policies);
@@ -120,6 +121,17 @@ uint64_t units_to_bytes(const char *units, char *unit_type)
return v;
}
+const char alloc_policy_char(alloc_policy_t alloc)
+{
+ int i;
+
+ for (i = 0; i < _num_policies; i++)
+ if (_policies[i].alloc == alloc)
+ return _policies[i].repchar;
+
+ return '-';
+}
+
const char *get_alloc_string(alloc_policy_t alloc)
{
int i;