[CRIU] [PATCH 2/2] criu: Warn about --namespaces deprecation

Pavel Emelyanov xemul at virtuozzo.com
Tue Mar 29 05:27:16 PDT 2016


The option was in use when we didn't have the /proc/pid/ns links
and thus ns ids. Later we used it at restore time to tell which
namespaces to restore the pstree into. Right now ids are always
generated and this option has no effect (and meaning).

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/crtools.c            | 31 +------------------------------
 criu/include/cr_options.h |  1 -
 2 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/criu/crtools.c b/criu/crtools.c
index 6785c78..c50c77e 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -71,34 +71,6 @@ void init_opts(void)
 	opts.empty_ns = 0;
 }
 
-static int parse_ns_string(const char *ptr)
-{
-	const char *end = ptr + strlen(ptr);
-
-	do {
-		if (ptr[3] != ',' && ptr[3] != '\0')
-			goto bad_ns;
-		if (!strncmp(ptr, "uts", 3))
-			opts.rst_namespaces_flags |= CLONE_NEWUTS;
-		else if (!strncmp(ptr, "ipc", 3))
-			opts.rst_namespaces_flags |= CLONE_NEWIPC;
-		else if (!strncmp(ptr, "mnt", 3))
-			opts.rst_namespaces_flags |= CLONE_NEWNS;
-		else if (!strncmp(ptr, "pid", 3))
-			opts.rst_namespaces_flags |= CLONE_NEWPID;
-		else if (!strncmp(ptr, "net", 3))
-			opts.rst_namespaces_flags |= CLONE_NEWNET;
-		else
-			goto bad_ns;
-		ptr += 4;
-	} while (ptr < end);
-	return 0;
-
-bad_ns:
-	pr_msg("Error: unknown namespace: %s\n", ptr);
-	return -1;
-}
-
 static int parse_unshare_arg(char *opt)
 {
 	while (1) {
@@ -413,8 +385,7 @@ int main(int argc, char *argv[], char *envp[])
 			opts.output = optarg;
 			break;
 		case 'n':
-			if (parse_ns_string(optarg))
-				goto bad_arg;
+			pr_warn("The -n|--namespaces option has no effect and will soon be removed.\n");
 			break;
 		case 'v':
 			if (log_level == LOG_UNSET)
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index 4853bea..d370221 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -71,7 +71,6 @@ struct cr_options {
 	bool			tcp_established_ok;
 	bool			evasive_devices;
 	bool			link_remap_ok;
-	unsigned int		rst_namespaces_flags;
 	unsigned long		unshare_flags;
 	bool			log_file_per_pid;
 	bool			swrk_restore;
-- 
2.5.0



More information about the CRIU mailing list