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

config: add profile arg to find_config_tree_float

This commit is contained in:
Peter Rajnoha 2013-06-25 12:31:36 +02:00
parent dbea545ffb
commit aeffa4cb5b
2 changed files with 13 additions and 3 deletions

View File

@ -886,15 +886,25 @@ int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *
return i64;
}
float find_config_tree_float(struct cmd_context *cmd, int id)
float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item);
int profile_applied = 0;
float f;
if (item->type != CFG_TYPE_FLOAT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as float.", path);
return dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_FLOAT));
if (profile && !cmd->profile_params->global_profile)
profile_applied = override_config_tree_from_profile(cmd, profile);
f = dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_FLOAT));
if (profile_applied)
remove_config_tree_by_source(cmd, CONFIG_PROFILE);
return f;
}
int find_config_tree_bool(struct cmd_context *cmd, int id)

View File

@ -169,7 +169,7 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile);
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile);
int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile);
float find_config_tree_float(struct cmd_context *cmd, int id);
float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile);
int find_config_tree_bool(struct cmd_context *cmd, int id);
#endif