master - config: add profile arg to find_config_tree_int64
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dbea545ffbfa08c799c35b85417e42684bc550e2 Commit: dbea545ffbfa08c799c35b85417e42684bc550e2 Parent: 50bf2c0db14400d80b08afabe917deee51f32ac8 Author: Peter Rajnoha <[email protected]> AuthorDate: Tue Jun 25 12:31:24 2013 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_int64
--- lib/commands/toolcontext.c | 2 +- lib/config/config.c | 14 ++++++++++++-- lib/config/config.h | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-)
lib/commands/toolcontext.c +1 -1
@@ -400,7 +400,7 @@ static int _process_config(struct cmd_context *cmd) cmd->metadata_read_only =find_config_tree_bool (cmd, global_metadata_read_only_CFG); - pv_min_kb =find_config_tree_int64 (cmd, devices_pv_min_size_CFG); + pv_min_kb =find_config_tree_int64 (cmd, devices_pv_min_size_CFG,NULL );if (pv_min_kb <PV_MIN_SIZE_KB ) {log_warn ("Ignoring too small pv_min_size %" PRId64"KB, using default %dKB." , pv_min_kb,PV_MIN_SIZE_KB );
lib/config/config.c +12 -2
@@ -865,15 +865,25 @@ int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profilreturn i; } -int64_t find_config_tree_int64 (struct cmd_context *cmd,int id) +int64_t find_config_tree_int64 (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 ; +int i64;if (item->type !=CFG_TYPE_INT )log_error (INTERNAL_ERROR "%s cfg tree element not declared as integer." , path); -return dm_config_tree_find_int64 (cmd->cft, path,cfg_def_get_default_value (item,CFG_TYPE_INT )); +if (profile && !cmd->profile_params->global_profile) + profile_applied =override_config_tree_from_profile (cmd, profile); + + i64 =dm_config_tree_find_int64 (cmd->cft, path,cfg_def_get_default_value (item,CFG_TYPE_INT )); + +if (profile_applied) +remove_config_tree_by_source (cmd,CONFIG_PROFILE ); + +return i64; }float find_config_tree_float (struct cmd_context *cmd,int id)
lib/config/config.h +1 -1
@@ -168,7 +168,7 @@ const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, intconst char *find_config_tree_str (struct cmd_context *cmd,int id,struct profile *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); +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);int find_config_tree_bool (struct cmd_context *cmd,int id);