diff options
author | Alasdair Kergon <agk@redhat.com> | 2010-10-25 13:54:29 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2010-10-25 13:54:29 +0000 |
commit | 2aa06d73ca75635a6874255409033839b2c26192 (patch) | |
tree | 2b75fb0117b57313f787c65baa2eda8d231b2e27 /lib | |
parent | 3f329bd02caeed8bcd8bbedb59eec0bd9c795701 (diff) | |
download | lvm2-2aa06d73ca75635a6874255409033839b2c26192.tar.gz lvm2-2aa06d73ca75635a6874255409033839b2c26192.tar.xz lvm2-2aa06d73ca75635a6874255409033839b2c26192.zip |
pre-release
Diffstat (limited to 'lib')
-rw-r--r-- | lib/display/display.c | 22 | ||||
-rw-r--r-- | lib/display/display.h | 1 | ||||
-rw-r--r-- | lib/metadata/lv.c | 1 | ||||
-rw-r--r-- | lib/metadata/metadata.c | 16 | ||||
-rw-r--r-- | lib/metadata/metadata.h | 1 | ||||
-rw-r--r-- | lib/metadata/vg.c | 1 |
6 files changed, 20 insertions, 22 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; diff --git a/lib/display/display.h b/lib/display/display.h index 03cef416..fb000a25 100644 --- a/lib/display/display.h +++ b/lib/display/display.h @@ -57,6 +57,7 @@ void display_segtypes(const struct cmd_context *cmd); * Allocation policy display conversion routines. */ const char *get_alloc_string(alloc_policy_t alloc); +const char alloc_policy_char(alloc_policy_t alloc); alloc_policy_t get_alloc_from_string(const char *str); char yes_no_prompt(const char *prompt, ...) __attribute__ ((format(printf, 1, 2))); diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index b7a8700a..744b7b0c 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -15,6 +15,7 @@ #include "lib.h" #include "metadata.h" +#include "display.h" #include "activate.h" #include "toolcontext.h" #include "segtype.h" diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index aaf79d8a..e81f87fc 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -3957,22 +3957,6 @@ int pv_change_metadataignore(struct physical_volume *pv, uint32_t mda_ignored) return 1; } -char alloc_policy_char(alloc_policy_t alloc) -{ - switch (alloc) { - case ALLOC_CONTIGUOUS: - return 'c'; - case ALLOC_CLING: - return 'l'; - case ALLOC_NORMAL: - return 'n'; - case ALLOC_ANYWHERE: - return 'a'; - default: - return 'i'; - } -} - char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tags) { struct str_list *sl; diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index 8e950a9d..5aa9c193 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -412,7 +412,6 @@ int vg_mark_partial_lvs(struct volume_group *vg); int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton); uint64_t find_min_mda_size(struct dm_list *mdas); -char alloc_policy_char(alloc_policy_t alloc); char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tags); #endif diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c index 2c73861b..9d0d5dd7 100644 --- a/lib/metadata/vg.c +++ b/lib/metadata/vg.c @@ -15,6 +15,7 @@ #include "lib.h" #include "metadata.h" +#include "display.h" #include "activate.h" char *vg_fmt_dup(const struct volume_group *vg) |