summaryrefslogtreecommitdiffstats
path: root/kernel/pid_namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-01 00:25:30 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-04 14:34:11 -0500
commit3c0411846118a578de3a979faf2da3ab5fb81179 (patch)
tree4609996bb8fdad235f21d0ec87bf1307da8738c0 /kernel/pid_namespace.c
parentff24870f46d51d79fc74a241fd7c12ccb933c69f (diff)
downloadlinux-3c0411846118a578de3a979faf2da3ab5fb81179.tar.bz2
switch the rest of proc_ns_operations to working with &...->ns
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/pid_namespace.c')
-rw-r--r--kernel/pid_namespace.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index 99e27e5bf906..dd961ad86fbd 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -313,6 +313,11 @@ int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
return 0;
}
+static inline struct pid_namespace *to_pid_ns(struct ns_common *ns)
+{
+ return container_of(ns, struct pid_namespace, ns);
+}
+
static void *pidns_get(struct task_struct *task)
{
struct pid_namespace *ns;
@@ -323,18 +328,18 @@ static void *pidns_get(struct task_struct *task)
get_pid_ns(ns);
rcu_read_unlock();
- return ns;
+ return ns ? &ns->ns : NULL;
}
static void pidns_put(void *ns)
{
- put_pid_ns(ns);
+ put_pid_ns(to_pid_ns(ns));
}
static int pidns_install(struct nsproxy *nsproxy, void *ns)
{
struct pid_namespace *active = task_active_pid_ns(current);
- struct pid_namespace *ancestor, *new = ns;
+ struct pid_namespace *ancestor, *new = to_pid_ns(ns);
if (!ns_capable(new->user_ns, CAP_SYS_ADMIN) ||
!ns_capable(current_user_ns(), CAP_SYS_ADMIN))
@@ -364,8 +369,7 @@ static int pidns_install(struct nsproxy *nsproxy, void *ns)
static unsigned int pidns_inum(void *ns)
{
- struct pid_namespace *pid_ns = ns;
- return pid_ns->ns.inum;
+ return ((struct ns_common *)ns)->inum;
}
const struct proc_ns_operations pidns_operations = {