[CRIU] [PATCH 2/6] ns: Remove __rst_new_ns_id
Pavel Emelyanov
xemul at parallels.com
Wed Dec 9 03:57:49 PST 2015
There's only one user of it, so better to reshuffle the arg set.
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
include/namespaces.h | 2 +-
mount.c | 6 +++---
namespaces.c | 9 ++-------
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/include/namespaces.h b/include/namespaces.h
index c655890..8add51d 100644
--- a/include/namespaces.h
+++ b/include/namespaces.h
@@ -78,7 +78,7 @@ extern int restore_ns(int rst, struct ns_desc *nd);
extern int dump_task_ns_ids(struct pstree_item *);
extern int predump_task_ns_ids(struct pstree_item *);
-extern struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd);
+extern struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd, enum ns_type t);
extern int rst_add_ns_id(unsigned int id, struct pstree_item *, struct ns_desc *nd);
extern struct ns_id *lookup_ns_by_id(unsigned int id, struct ns_desc *nd);
diff --git a/mount.c b/mount.c
index f85afbe..7d45765 100644
--- a/mount.c
+++ b/mount.c
@@ -2665,11 +2665,11 @@ out:
return exit_code;
}
-static int rst_collect_local_mntns(void)
+static int rst_collect_local_mntns(enum ns_type typ)
{
struct ns_id *nsid;
- nsid = rst_new_ns_id(0, getpid(), &mnt_ns_desc);
+ nsid = rst_new_ns_id(0, getpid(), &mnt_ns_desc, typ);
if (!nsid)
return -1;
@@ -3089,7 +3089,7 @@ int prepare_mnt_ns(void)
struct ns_id *nsid;
if (!(root_ns_mask & CLONE_NEWNS))
- return rst_collect_local_mntns();
+ return rst_collect_local_mntns(NS_CRIU);
pr_info("Restoring mount namespace\n");
diff --git a/namespaces.c b/namespaces.c
index a874fb1..8279368 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -135,7 +135,7 @@ static void nsid_add(struct ns_id *ns, struct ns_desc *nd, unsigned int id, pid_
pr_info("Add %s ns %d pid %d\n", nd->str, ns->id, ns->ns_pid);
}
-static struct ns_id *__rst_new_ns_id(unsigned int id, pid_t pid,
+struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid,
struct ns_desc *nd, enum ns_type type)
{
struct ns_id *nsid;
@@ -150,11 +150,6 @@ static struct ns_id *__rst_new_ns_id(unsigned int id, pid_t pid,
return nsid;
}
-struct ns_id *rst_new_ns_id(unsigned int id, pid_t pid, struct ns_desc *nd)
-{
- return __rst_new_ns_id(id, pid, nd, NS_CRIU);
-}
-
int rst_add_ns_id(unsigned int id, struct pstree_item *i, struct ns_desc *nd)
{
pid_t pid = i->pid.virt;
@@ -167,7 +162,7 @@ int rst_add_ns_id(unsigned int id, struct pstree_item *i, struct ns_desc *nd)
return 0;
}
- nsid = __rst_new_ns_id(id, pid, nd,
+ nsid = rst_new_ns_id(id, pid, nd,
i == root_item ? NS_ROOT : NS_OTHER);
if (nsid == NULL)
return -1;
--
1.9.3
More information about the CRIU
mailing list