diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index 016f299d6..4ee751c04 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -130,7 +130,7 @@ char *lvseg_discards_dup(struct dm_pool *mem, const struct lv_segment *seg) char *lvseg_cachemode_dup(struct dm_pool *mem, const struct lv_segment *seg) { - return dm_pool_strdup(mem, get_cachepool_cachemode_name(seg)); + return dm_pool_strdup(mem, get_cache_pool_cachemode_name(seg)); } #ifdef DMEVENTD diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 713b3b652..9afce3573 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -763,8 +763,8 @@ int update_thin_pool_params(const struct segment_type *segtype, uint32_t *pool_metadata_extents, int *chunk_size_calc_method, uint32_t *chunk_size, thin_discards_t *discards, int *zero); -int get_pool_discards(const char *str, thin_discards_t *discards); const char *get_pool_discards_name(thin_discards_t discards); +int set_pool_discards(thin_discards_t *discards, const char *str); struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv, const char *name, uint32_t read_ahead, uint32_t stripes, uint32_t stripe_size, @@ -1011,8 +1011,8 @@ int lv_remove_mirrors(struct cmd_context *cmd, struct logical_volume *lv, uint32_t mirrors, uint32_t log_count, int (*is_removable)(struct logical_volume *, void *), void *removable_baton, uint64_t status_mask); -int get_mirror_log_count(const char *mirrorlog, int *log_count); const char *get_mirror_log_name(int log_count); +int set_mirror_log_count(int *log_count, const char *mirrorlog); int is_temporary_mirror_layer(const struct logical_volume *lv); struct logical_volume * find_temporary_mirror(const struct logical_volume *lv); diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index a943ac4bb..ba3ff6baa 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -2273,7 +2273,7 @@ int lv_remove_mirrors(struct cmd_context *cmd __attribute__((unused)), return remove_mirrors_from_segments(lv, new_mirrors, status_mask); } -int get_mirror_log_count(const char *mirrorlog, int *log_count) +int set_mirror_log_count(int *log_count, const char *mirrorlog) { if (!strcmp("core", mirrorlog)) *log_count = MIRROR_LOG_CORE; @@ -2297,6 +2297,6 @@ const char *get_mirror_log_name(int log_count) case MIRROR_LOG_MIRRORED: return "mirrored"; default: log_error(INTERNAL_ERROR "Unknown mirror log count %d.", log_count); - return "unknown"; + return NULL; } } diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c index 50354cc82..b4aec731c 100644 --- a/lib/metadata/thin_manip.c +++ b/lib/metadata/thin_manip.c @@ -436,7 +436,7 @@ int update_thin_pool_params(const struct segment_type *segtype, log_error(INTERNAL_ERROR "Could not find configuration."); return 0; } - if (!get_pool_discards(str, discards)) + if (!set_pool_discards(discards, str)) return_0; } @@ -512,7 +512,7 @@ int update_thin_pool_params(const struct segment_type *segtype, return 1; } -int get_pool_discards(const char *str, thin_discards_t *discards) +int set_pool_discards(thin_discards_t *discards, const char *str) { if (!strcasecmp(str, "passdown")) *discards = THIN_DISCARDS_PASSDOWN; diff --git a/lib/report/report.c b/lib/report/report.c index 4f505e751..262b376d5 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -784,7 +784,7 @@ static int _cachemode_disp(struct dm_report *rh, struct dm_pool *mem, seg = first_seg(seg->pool_lv); if (seg_is_cache_pool(seg)) { - cachemode_str = get_cachepool_cachemode_name(seg); + cachemode_str = get_cache_pool_cachemode_name(seg); return dm_report_field_string(rh, field, &cachemode_str); } diff --git a/lib/thin/thin.c b/lib/thin/thin.c index f921befb8..f27f24007 100644 --- a/lib/thin/thin.c +++ b/lib/thin/thin.c @@ -115,7 +115,7 @@ static int _thin_pool_text_import(struct lv_segment *seg, if (!discards_str) seg->discards = THIN_DISCARDS_IGNORE; - else if (!get_pool_discards(discards_str, &seg->discards)) + else if (!set_pool_discards(&seg->discards, discards_str)) return SEG_LOG_ERROR("Discards option unsupported for"); if (dm_config_has_node(sn, "low_water_mark") && diff --git a/tools/lvconvert.c b/tools/lvconvert.c index fcec8e176..8b09ee6b9 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -267,7 +267,7 @@ static int _read_pool_params(struct cmd_context *cmd, int *pargc, char ***pargv, if (!cachemode) cachemode = find_config_tree_str(cmd, allocation_cache_pool_cachemode_CFG, NULL); - if (!get_cache_mode(cachemode, &lp->feature_flags)) + if (!set_cache_pool_feature(&lp->feature_flags, cachemode)) return_0; } else { if (arg_from_list_is_set(cmd, "is valid only with cache pools", diff --git a/tools/lvcreate.c b/tools/lvcreate.c index cf2a07cb8..af00fee5b 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -567,7 +567,7 @@ static int _read_cache_params(struct cmd_context *cmd, if (!(cachemode = arg_str_value(cmd, cachemode_ARG, NULL))) cachemode = find_config_tree_str(cmd, allocation_cache_pool_cachemode_CFG, NULL); - if (!get_cache_mode(cachemode, &lp->feature_flags)) + if (!set_cache_pool_feature(&lp->feature_flags, cachemode)) return_0; return 1; diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 1d3e993ad..ce45eb440 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -319,7 +319,7 @@ int discards_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_val { thin_discards_t discards; - if (!get_pool_discards(av->value, &discards)) + if (!set_pool_discards(&discards, av->value)) return_0; av->i_value = discards; @@ -332,7 +332,7 @@ int mirrorlog_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_va { int log_count; - if (!get_mirror_log_count(av->value, &log_count)) + if (!set_mirror_log_count(&log_count, av->value)) return_0; av->i_value = log_count;