[CRIU] [PATCH 1/6] actions: Move scripts list into .c file
Pavel Emelyanov
xemul at virtuozzo.com
Thu Apr 21 05:55:43 PDT 2016
It's used purely inside action-scripts.c, so move
it there not to pollute the global opts.
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/action-scripts.c | 8 +++++---
criu/crtools.c | 1 -
criu/include/cr_options.h | 1 -
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index addc833..5a49de9 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -24,6 +24,8 @@ static const char *action_names[ACT_MAX] = {
[ ACT_POST_RESUME ] = "post-resume",
};
+static LIST_HEAD(scripts);
+
int run_scripts(enum script_actions act)
{
struct script *script;
@@ -34,7 +36,7 @@ int run_scripts(enum script_actions act)
pr_debug("Running %s scripts\n", action);
- if (unlikely(list_empty(&opts.scripts)))
+ if (unlikely(list_empty(&scripts)))
return 0;
if (setenv("CRTOOLS_SCRIPT_ACTION", action, 1)) {
@@ -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) {
pr_debug("\tRPC\n");
ret |= send_criu_rpc_script(act, (char *)action, script->arg);
@@ -82,7 +84,7 @@ int add_script(char *path, int arg)
script->path = path;
script->arg = arg;
- list_add(&script->node, &opts.scripts);
+ list_add(&script->node, &scripts);
return 0;
}
diff --git a/criu/crtools.c b/criu/crtools.c
index 93ca90b..de1f00c 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -57,7 +57,6 @@ void init_opts(void)
opts.final_state = TASK_DEAD;
INIT_LIST_HEAD(&opts.ext_unixsk_ids);
INIT_LIST_HEAD(&opts.veth_pairs);
- INIT_LIST_HEAD(&opts.scripts);
INIT_LIST_HEAD(&opts.ext_mounts);
INIT_LIST_HEAD(&opts.inherit_fds);
INIT_LIST_HEAD(&opts.external);
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index b6ae3a1..551ca70 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -79,7 +79,6 @@ struct cr_options {
char *pidfile;
char *freeze_cgroup;
struct list_head veth_pairs;
- struct list_head scripts;
struct list_head ext_mounts;
struct list_head inherit_fds;
struct list_head external;
--
2.1.4
More information about the CRIU
mailing list