master - config: use mempool for config paths used in find_config_tree_* functions
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e2870c94cf501f15ff9b1201bf468b40c1efd6d3 Commit: e2870c94cf501f15ff9b1201bf468b40c1efd6d3 Parent: c5a4e60c112893b5624cede0dac89bd5de7e14a4 Author: Peter Rajnoha <[email protected]> AuthorDate: Mon Mar 3 12:29:25 2014 +0100 Committer: Peter Rajnoha <[email protected]> CommitterDate: Thu Mar 6 10:50:47 2014 +0100
config: use mempool for config paths used in find_config_tree_* functions
Using mempool is much safer than using the global static variable. The global variable would be rewritten on each find_config_tree_* call and we need to be very careful not to get into this problem (we don't do now, but we can with the patches for "runtime defaults" that will follow).
--- lib/commands/toolcontext.c | 10 +++--- lib/config/config.c | 68 +++++++++++++++++++++++++++++-------------- 2 files changed, 51 insertions(+), 27 deletions(-)
lib/commands/toolcontext.c +5 -5
@@ -1479,6 +1479,11 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived, goto out; } +if (!(cmd->mem =dm_pool_create ("command" ,4 *1024 ))) { +log_error ("Command memory pool creation failed" ); + goto out; + } +if (!_init_lvm_conf (cmd)) goto_out;
@@ -1512,11 +1517,6 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,if (!_init_filters (cmd,1 )) goto_out; -if (!(cmd->mem =dm_pool_create ("command" ,4 *1024 ))) { -log_error ("Command memory pool creation failed" ); - goto out; - } -memlock_init (cmd);if (!_init_formats (cmd))
lib/config/config.c +46 -22
248 lines not on this page · raw message