[CRIU] [PATCH 02/12] namespace: move struct ns_id into namespace.h

Andrey Vagin avagin at openvz.org
Fri Jan 10 05:49:56 PST 2014


It's going to be used for restoring namespaces. For example we need to
enumirate the ns_ids list for restoring mount namespaces.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 include/namespaces.h |  9 +++++++++
 namespaces.c         | 10 +---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/namespaces.h b/include/namespaces.h
index 163de8e..40bc2d9 100644
--- a/include/namespaces.h
+++ b/include/namespaces.h
@@ -9,6 +9,15 @@ struct ns_desc {
 	size_t		len;
 };
 
+struct ns_id {
+	unsigned int kid;
+	unsigned int id;
+	pid_t pid;
+	struct ns_desc *nd;
+	struct ns_id *next;
+};
+extern struct ns_id *ns_ids;
+
 #define NS_DESC_ENTRY(_cflag, _str)			\
 	{						\
 		.cflag		= _cflag,		\
diff --git a/namespaces.c b/namespaces.c
index 5d7f6a2..970ddfa 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -113,15 +113,7 @@ int restore_ns(int rst, struct ns_desc *nd)
 	return ret;
 }
 
-struct ns_id {
-	unsigned int kid;
-	unsigned int id;
-	pid_t pid;
-	struct ns_desc *nd;
-	struct ns_id *next;
-};
-
-static struct ns_id *ns_ids;
+struct ns_id *ns_ids = NULL;
 static unsigned int ns_next_id = 1;
 unsigned long current_ns_mask = 0;
 
-- 
1.8.3.1



More information about the CRIU mailing list