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

toolcontext: add a few comments for struct cmd_context and rename config_valid -> config_initialized

Just to make it more clear and also not to confuse
config_valid with check against config definition
(and its 'valid' flag within the config defintion tree).
This commit is contained in:
Peter Rajnoha 2013-06-26 12:29:19 +02:00
parent 0cd4794735
commit 8769033e07
4 changed files with 15 additions and 13 deletions

View File

@ -508,7 +508,7 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
DEBUGLOG("do_lock_lv: resource '%s', cmd = %s, flags = %s, critical_section = %d\n",
resource, decode_locking_cmd(command), decode_flags(lock_flags), critical_section());
if (!cmd->config_valid || config_files_changed(cmd)) {
if (!cmd->config_initialized || config_files_changed(cmd)) {
/* Reinitialise various settings inc. logging, filters */
if (do_refresh_cache()) {
log_error("Updated config file invalid. Aborting.");

View File

@ -1507,9 +1507,9 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
cmd->default_settings.cache_vgmetadata = 1;
cmd->current_settings = cmd->default_settings;
cmd->config_valid = 1;
cmd->config_initialized = 1;
out:
if (cmd->config_valid != 1) {
if (!cmd->config_initialized) {
destroy_toolcontext(cmd);
cmd = NULL;
}
@ -1624,7 +1624,7 @@ int refresh_toolcontext(struct cmd_context *cmd)
cft_cmdline = remove_config_tree_by_source(cmd, CONFIG_STRING);
_destroy_config(cmd);
cmd->config_valid = 0;
cmd->config_initialized = 0;
cmd->hosttags = 0;
@ -1681,7 +1681,7 @@ int refresh_toolcontext(struct cmd_context *cmd)
if (!_init_backup(cmd))
return 0;
cmd->config_valid = 1;
cmd->config_initialized = 1;
reset_lvm_errno(1);
return 1;

View File

@ -98,14 +98,16 @@ struct cmd_context {
struct dev_filter *lvmetad_filter;
int dump_filter; /* Dump filter when exiting? */
struct dm_list config_files;
int config_valid;
struct dm_config_tree *cft;
struct config_info default_settings;
struct config_info current_settings;
struct dm_hash_table *cft_def_hash; /* cft definition hash used for validity check */
struct dm_list config_files; /* master lvm config + any existing tag configs */
struct profile_params *profile_params; /* profile handling params including loaded profile configs */
struct dm_config_tree *cft; /* the whole cascade: CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES */
int config_initialized; /* used to reinitialize config if previous init was not successful */
struct dm_hash_table *cft_def_hash; /* config definition hash used for validity check (item type + item recognized) */
struct profile_params *profile_params;
/* selected settings with original default/configured value which can be changed during cmd processing */
struct config_info default_settings;
/* may contain changed values compared to default_settings */
struct config_info current_settings;
struct archive_params *archive_params;
struct backup_params *backup_params;

View File

@ -1080,7 +1080,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
goto_out;
}
if (arg_count(cmd, config_ARG) || !cmd->config_valid || config_files_changed(cmd)) {
if (arg_count(cmd, config_ARG) || !cmd->config_initialized || config_files_changed(cmd)) {
/* Reinitialise various settings inc. logging, filters */
if (!refresh_toolcontext(cmd)) {
old_cft = remove_config_tree_by_source(cmd, CONFIG_STRING);