Commit a9c08642 authored by Pavel Emelyanov's avatar Pavel Emelyanov

actions: Move scripts list into .c file

It's used purely inside action-scripts.c, so move
it there not to pollute the global opts.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent eb53f9be
...@@ -24,6 +24,8 @@ static const char *action_names[ACT_MAX] = { ...@@ -24,6 +24,8 @@ static const char *action_names[ACT_MAX] = {
[ ACT_POST_RESUME ] = "post-resume", [ ACT_POST_RESUME ] = "post-resume",
}; };
static LIST_HEAD(scripts);
int run_scripts(enum script_actions act) int run_scripts(enum script_actions act)
{ {
struct script *script; struct script *script;
...@@ -34,7 +36,7 @@ int run_scripts(enum script_actions act) ...@@ -34,7 +36,7 @@ int run_scripts(enum script_actions act)
pr_debug("Running %s scripts\n", action); pr_debug("Running %s scripts\n", action);
if (unlikely(list_empty(&opts.scripts))) if (unlikely(list_empty(&scripts)))
return 0; return 0;
if (setenv("CRTOOLS_SCRIPT_ACTION", action, 1)) { if (setenv("CRTOOLS_SCRIPT_ACTION", action, 1)) {
...@@ -56,7 +58,7 @@ int run_scripts(enum script_actions act) ...@@ -56,7 +58,7 @@ int run_scripts(enum script_actions act)
} }
} }
list_for_each_entry(script, &opts.scripts, node) { list_for_each_entry(script, &scripts, node) {
if (script->path == SCRIPT_RPC_NOTIFY) { if (script->path == SCRIPT_RPC_NOTIFY) {
pr_debug("\tRPC\n"); pr_debug("\tRPC\n");
ret |= send_criu_rpc_script(act, (char *)action, script->arg); ret |= send_criu_rpc_script(act, (char *)action, script->arg);
...@@ -82,7 +84,7 @@ int add_script(char *path, int arg) ...@@ -82,7 +84,7 @@ int add_script(char *path, int arg)
script->path = path; script->path = path;
script->arg = arg; script->arg = arg;
list_add(&script->node, &opts.scripts); list_add(&script->node, &scripts);
return 0; return 0;
} }
...@@ -56,7 +56,6 @@ void init_opts(void) ...@@ -56,7 +56,6 @@ void init_opts(void)
opts.final_state = TASK_DEAD; opts.final_state = TASK_DEAD;
INIT_LIST_HEAD(&opts.ext_unixsk_ids); INIT_LIST_HEAD(&opts.ext_unixsk_ids);
INIT_LIST_HEAD(&opts.veth_pairs); INIT_LIST_HEAD(&opts.veth_pairs);
INIT_LIST_HEAD(&opts.scripts);
INIT_LIST_HEAD(&opts.ext_mounts); INIT_LIST_HEAD(&opts.ext_mounts);
INIT_LIST_HEAD(&opts.inherit_fds); INIT_LIST_HEAD(&opts.inherit_fds);
INIT_LIST_HEAD(&opts.external); INIT_LIST_HEAD(&opts.external);
......
...@@ -78,7 +78,6 @@ struct cr_options { ...@@ -78,7 +78,6 @@ struct cr_options {
char *pidfile; char *pidfile;
char *freeze_cgroup; char *freeze_cgroup;
struct list_head veth_pairs; struct list_head veth_pairs;
struct list_head scripts;
struct list_head ext_mounts; struct list_head ext_mounts;
struct list_head inherit_fds; struct list_head inherit_fds;
struct list_head external; struct list_head external;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment