[lxc-devel] [lxc/master] Fix 907

tych0 on Github lxc-bot at linuxcontainers.org
Tue Mar 22 15:28:09 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 300 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160322/6007d81d/attachment.bin>
-------------- next part --------------
From fa25c39a4465ca75a352d8d03b8ec2fb80438771 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 22 Mar 2016 09:22:39 -0600
Subject: [PATCH 1/2] lxc-checkpoint: make things static when they can be

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/lxc_checkpoint.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lxc/lxc_checkpoint.c b/src/lxc/lxc_checkpoint.c
index 3e5de4a..7130245 100644
--- a/src/lxc/lxc_checkpoint.c
+++ b/src/lxc/lxc_checkpoint.c
@@ -121,7 +121,7 @@ Options :\n\
 	.checker   = my_checker,
 };
 
-bool checkpoint(struct lxc_container *c)
+static bool checkpoint(struct lxc_container *c)
 {
 	bool ret;
 
@@ -142,7 +142,7 @@ bool checkpoint(struct lxc_container *c)
 	return true;
 }
 
-bool restore_finalize(struct lxc_container *c)
+static bool restore_finalize(struct lxc_container *c)
 {
 	bool ret = c->restore(c, checkpoint_dir, verbose);
 	if (!ret) {
@@ -153,7 +153,7 @@ bool restore_finalize(struct lxc_container *c)
 	return ret;
 }
 
-bool restore(struct lxc_container *c)
+static bool restore(struct lxc_container *c)
 {
 	if (c->is_running(c)) {
 		fprintf(stderr, "%s is running, not restoring.\n", my_args.name);

From b7088add705cfda0f63aaf00535f246c68d8cdc8 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 22 Mar 2016 09:24:01 -0600
Subject: [PATCH 2/2] c/r: rename restore & friends to __criu_restore

Hopefully this will avoid name collisions with any user binaries, since
criu is just an implementation detail.

Closes #907

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/criu.c         | 6 +++---
 src/lxc/criu.h         | 6 +++---
 src/lxc/lxccontainer.c | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 16449bc..75ae4e2 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -868,12 +868,12 @@ static bool do_dump(struct lxc_container *c, char *mode, char *directory,
 	}
 }
 
-bool pre_dump(struct lxc_container *c, char *directory, bool verbose, char *predump_dir)
+bool __criu_pre_dump(struct lxc_container *c, char *directory, bool verbose, char *predump_dir)
 {
 	return do_dump(c, "pre-dump", directory, false, verbose, predump_dir);
 }
 
-bool dump(struct lxc_container *c, char *directory, bool stop, bool verbose, char *predump_dir)
+bool __criu_dump(struct lxc_container *c, char *directory, bool stop, bool verbose, char *predump_dir)
 {
 	char path[PATH_MAX];
 	int ret;
@@ -890,7 +890,7 @@ bool dump(struct lxc_container *c, char *directory, bool stop, bool verbose, cha
 	return do_dump(c, "dump", directory, stop, verbose, predump_dir);
 }
 
-bool restore(struct lxc_container *c, char *directory, bool verbose)
+bool __criu_restore(struct lxc_container *c, char *directory, bool verbose)
 {
 	pid_t pid;
 	int status, nread;
diff --git a/src/lxc/criu.h b/src/lxc/criu.h
index d5491a6..c110246 100644
--- a/src/lxc/criu.h
+++ b/src/lxc/criu.h
@@ -27,8 +27,8 @@
 
 #include <lxc/lxccontainer.h>
 
-bool pre_dump(struct lxc_container *c, char *directory, bool verbose, char *predump_dir);
-bool dump(struct lxc_container *c, char *directory, bool stop, bool verbose, char *predump_dir);
-bool restore(struct lxc_container *c, char *directory, bool verbose);
+bool __criu_pre_dump(struct lxc_container *c, char *directory, bool verbose, char *predump_dir);
+bool __criu_dump(struct lxc_container *c, char *directory, bool stop, bool verbose, char *predump_dir);
+bool __criu_restore(struct lxc_container *c, char *directory, bool verbose);
 
 #endif
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index c11ffe0..ab48fb5 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -3960,13 +3960,13 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
 
 	switch (cmd) {
 	case MIGRATE_PRE_DUMP:
-		ret = !pre_dump(c, opts->directory, opts->verbose, opts->predump_dir);
+		ret = !__criu_pre_dump(c, opts->directory, opts->verbose, opts->predump_dir);
 		break;
 	case MIGRATE_DUMP:
-		ret = !dump(c, opts->directory, opts->stop, opts->verbose, opts->predump_dir);
+		ret = !__criu_dump(c, opts->directory, opts->stop, opts->verbose, opts->predump_dir);
 		break;
 	case MIGRATE_RESTORE:
-		ret = !restore(c, opts->directory, opts->verbose);
+		ret = !__criu_restore(c, opts->directory, opts->verbose);
 		break;
 	default:
 		ERROR("invalid migrate command %u", cmd);


More information about the lxc-devel mailing list