]> sourceware.org Git - lvm2.git/commitdiff
Remove archive_enable() calls after create_toolcontext() calls.
authorDave Wysochanski <dwysocha@redhat.com>
Thu, 11 Dec 2008 03:32:56 +0000 (03:32 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Thu, 11 Dec 2008 03:32:56 +0000 (03:32 +0000)
_init_backup() calls archive_init(), which originally set 'enabled' to
a hardcoded '1' value.  This seems incorrect based on my read of other
areas of the code so here we add a 'enabled' paramter to archive_init().
We pass in cmd->default_settings.archive, which is obtained from the
config tree.  Later in create_toolcontext, cmd->current_settings is
set to cmd->default_settings.  The archive_enable() call we remove
here was using cmd->current_settings to set the 'archive' enable
value.  The final value of cmd->archive_params->enabled should thus
be equivalent to the original code.

daemons/clvmd/lvm-functions.c
lib/commands/toolcontext.c
lib/format_text/archiver.c
lib/format_text/archiver.h
tools/lvmcmdline.c

index 9da99dd7ce02303e8e45399bb1a31a5393263b06..ef4953b3b0cbfba8b060275b4a7acc65cf1ed4a6 100644 (file)
@@ -733,7 +733,6 @@ int init_lvm(int using_gulm)
        init_syslog(LOG_DAEMON);
        openlog("clvmd", LOG_PID, LOG_DAEMON);
        set_activation(cmd->current_settings.activation);
-       archive_enable(cmd, cmd->current_settings.archive);
        backup_enable(cmd, cmd->current_settings.backup);
        cmd->cmd_line = (char *)"clvmd";
 
index b240dc24c53f2a83f845e42f24c42efd130fe1c0..0fd096357b0be2ebcb08a6294a81b7cde8e1aa91 100644 (file)
@@ -926,7 +926,7 @@ static int _init_backup(struct cmd_context *cmd)
        if (!cmd->sys_dir) {
                log_warn("WARNING: Metadata changes will NOT be backed up");
                backup_init(cmd, "");
-               archive_init(cmd, "", 0, 0);
+               archive_init(cmd, "", 0, 0, 0);
                return 1;
        }
 
@@ -952,7 +952,8 @@ static int _init_backup(struct cmd_context *cmd)
        dir = find_config_tree_str(cmd, "backup/archive_dir",
                              default_dir);
 
-       if (!archive_init(cmd, dir, days, min)) {
+       if (!archive_init(cmd, dir, days, min,
+                         cmd->default_settings.archive)) {
                log_debug("backup_init failed.");
                return 0;
        }
index ba9a5abe3702ecd15aff24cac5cf850446eaf4f8..e0f3af327e0fb517ff96e1b67c819b9927d618df 100644 (file)
@@ -36,7 +36,8 @@ struct backup_params {
 };
 
 int archive_init(struct cmd_context *cmd, const char *dir,
-                unsigned int keep_days, unsigned int keep_min)
+                unsigned int keep_days, unsigned int keep_min,
+                int enabled)
 {
        if (!(cmd->archive_params = dm_pool_zalloc(cmd->libmem,
                                                sizeof(*cmd->archive_params)))) {
@@ -56,7 +57,7 @@ int archive_init(struct cmd_context *cmd, const char *dir,
 
        cmd->archive_params->keep_days = keep_days;
        cmd->archive_params->keep_number = keep_min;
-       cmd->archive_params->enabled = 1;
+       archive_enable(cmd, enabled);
 
        return 1;
 }
index 931aaa41e2335e07bc073a920385331db51ed4bc..835d677d229d2ddaf0f0768b3cb99a403dc19cb1 100644 (file)
@@ -32,7 +32,8 @@
  */
 
 int archive_init(struct cmd_context *cmd, const char *dir,
-                unsigned int keep_days, unsigned int keep_min);
+                unsigned int keep_days, unsigned int keep_min,
+                int enabled);
 void archive_exit(struct cmd_context *cmd);
 
 void archive_enable(struct cmd_context *cmd, int flag);
index a55c5086884850088ff2cc61374f2e00aee60d05..0bd875ee773e80b97aeec85fb5e828bfaf83abfb 100644 (file)
@@ -1097,7 +1097,6 @@ struct cmd_context *init_lvm(unsigned is_static)
        init_msg_prefix(cmd->default_settings.msg_prefix);
        init_cmd_name(cmd->default_settings.cmd_name);
 
-       archive_enable(cmd, cmd->current_settings.archive);
        backup_enable(cmd, cmd->current_settings.backup);
 
        set_activation(cmd->current_settings.activation);
This page took 0.048725 seconds and 5 git commands to generate.