[CRIU] [PATCH] opts: Add -n "all" option

Cyrill Gorcunov gorcunov at openvz.org
Tue May 28 11:25:36 EDT 2013


It accumulates all ns options we can handle.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Documentation/criu.txt | 2 ++
 crtools.c              | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/Documentation/criu.txt b/Documentation/criu.txt
index 7d8ca2b..57425c7 100644
--- a/Documentation/criu.txt
+++ b/Documentation/criu.txt
@@ -65,6 +65,8 @@ OPTIONS
 *-n*, *--namespaces* 'ns'[,'ns'...]::
     Checkpoint namespaces. Namespaces must be separated by comma.
     Currently supported namespaces: *uts*, *ipc*, *mnt*, *pid*, *net*.
+    If all supported namespaces are to be checkpointed the option
+    argument can be shortened with *all* keyword.
 
 *-r*, *--root* 'path'::
     Change the root filesystem (when run in mount namespace).
diff --git a/crtools.c b/crtools.c
index ea31e94..dcc04a5 100644
--- a/crtools.c
+++ b/crtools.c
@@ -35,6 +35,7 @@ struct cr_options opts;
 
 static int parse_ns_string(const char *ptr)
 {
+	const unsigned int all = (-1u) & ~CLONE_NEWUSER;
 	const char *end = ptr + strlen(ptr);
 
 	do {
@@ -50,6 +51,8 @@ static int parse_ns_string(const char *ptr)
 			opts.rst_namespaces_flags |= CLONE_NEWPID;
 		else if (!strncmp(ptr, "net", 3))
 			opts.rst_namespaces_flags |= CLONE_NEWNET;
+		else if (!strncmp(ptr, "all", 3))
+			opts.rst_namespaces_flags  = all;
 		else
 			goto bad_ns;
 		ptr += 4;
-- 
1.8.1.4



More information about the CRIU mailing list