aboutsummaryrefslogtreecommitdiffstats
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)
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)
313 return 0; 313 return 0;
314} 314}
315 315
316static inline struct pid_namespace *to_pid_ns(struct ns_common *ns)
317{
318 return container_of(ns, struct pid_namespace, ns);
319}
320
316static void *pidns_get(struct task_struct *task) 321static void *pidns_get(struct task_struct *task)
317{ 322{
318 struct pid_namespace *ns; 323 struct pid_namespace *ns;
@@ -323,18 +328,18 @@ static void *pidns_get(struct task_struct *task)
323 get_pid_ns(ns); 328 get_pid_ns(ns);
324 rcu_read_unlock(); 329 rcu_read_unlock();
325 330
326 return ns; 331 return ns ? &ns->ns : NULL;
327} 332}
328 333
329static void pidns_put(void *ns) 334static void pidns_put(void *ns)
330{ 335{
331 put_pid_ns(ns); 336 put_pid_ns(to_pid_ns(ns));
332} 337}
333 338
334static int pidns_install(struct nsproxy *nsproxy, void *ns) 339static int pidns_install(struct nsproxy *nsproxy, void *ns)
335{ 340{
336 struct pid_namespace *active = task_active_pid_ns(current); 341 struct pid_namespace *active = task_active_pid_ns(current);
337 struct pid_namespace *ancestor, *new = ns; 342 struct pid_namespace *ancestor, *new = to_pid_ns(ns);
338 343
339 if (!ns_capable(new->user_ns, CAP_SYS_ADMIN) || 344 if (!ns_capable(new->user_ns, CAP_SYS_ADMIN) ||
340 !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) 345 !ns_capable(current_user_ns(), CAP_SYS_ADMIN))
@@ -364,8 +369,7 @@ static int pidns_install(struct nsproxy *nsproxy, void *ns)
364 369
365static unsigned int pidns_inum(void *ns) 370static unsigned int pidns_inum(void *ns)
366{ 371{
367 struct pid_namespace *pid_ns = ns; 372 return ((struct ns_common *)ns)->inum;
368 return pid_ns->ns.inum;
369} 373}
370 374
371const struct proc_ns_operations pidns_operations = { 375const struct proc_ns_operations pidns_operations = {