1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: API get/set fixes

This commit is contained in:
Zdenek Kabelac 2014-11-08 01:28:38 +01:00
parent 8d7340b7a1
commit 2e0c926d56
9 changed files with 13 additions and 13 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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") &&

View File

@ -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",

View File

@ -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;

View File

@ -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;