[1/6] actions: Move scripts list into .c file

Submitted by Pavel Emelianov on April 21, 2016, 12:55 p.m.

Details

Message ID 5718CDCF.5050108@virtuozzo.com
State Accepted
Series "Cleanup action scripts"
Commit 122b504154c5706b061f852436014c708a1de9b9
Headers show

Commit Message

Pavel Emelianov April 21, 2016, 12:55 p.m.
It's used purely inside action-scripts.c, so move
it there not to pollute the global opts.

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/action-scripts.c     | 8 +++++---
 criu/crtools.c            | 1 -
 criu/include/cr_options.h | 1 -
 3 files changed, 5 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

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;