From a85aeb7fd0665053a24d7a29c0d8cfebfe1361b1 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 9 Dec 2015 14:57:49 +0300 Subject: [PATCH] ns: Remove __rst_new_ns_id There's only one user of it, so better to reshuffle the arg set. Signed-off-by: Pavel Emelyanov Signed-off-by: Pavel Emelyanov --- 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 953b8748a..bb2ac1e4c 100644 --- a/include/namespaces.h +++ b/include/namespaces.h @@ -79,7 +79,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 d286a0a2f..2e1122376 100644 --- a/mount.c +++ b/mount.c @@ -2678,11 +2678,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; @@ -3104,7 +3104,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 a874fb19d..8279368ed 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;