From 3c0411846118a578de3a979faf2da3ab5fb81179 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 1 Nov 2014 00:25:30 -0400 Subject: switch the rest of proc_ns_operations to working with &...->ns Signed-off-by: Al Viro --- kernel/utsname.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'kernel/utsname.c') diff --git a/kernel/utsname.c b/kernel/utsname.c index b1cd00b828f2..1917f74be8ec 100644 --- a/kernel/utsname.c +++ b/kernel/utsname.c @@ -88,6 +88,11 @@ void free_uts_ns(struct kref *kref) kfree(ns); } +static inline struct uts_namespace *to_uts_ns(struct ns_common *ns) +{ + return container_of(ns, struct uts_namespace, ns); +} + static void *utsns_get(struct task_struct *task) { struct uts_namespace *ns = NULL; @@ -101,17 +106,17 @@ static void *utsns_get(struct task_struct *task) } task_unlock(task); - return ns; + return ns ? &ns->ns : NULL; } static void utsns_put(void *ns) { - put_uts_ns(ns); + put_uts_ns(to_uts_ns(ns)); } static int utsns_install(struct nsproxy *nsproxy, void *new) { - struct uts_namespace *ns = new; + struct uts_namespace *ns = to_uts_ns(new); if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) || !ns_capable(current_user_ns(), CAP_SYS_ADMIN)) @@ -125,9 +130,7 @@ static int utsns_install(struct nsproxy *nsproxy, void *new) static unsigned int utsns_inum(void *vp) { - struct uts_namespace *ns = vp; - - return ns->ns.inum; + return ((struct ns_common *)vp)->inum; } const struct proc_ns_operations utsns_operations = { -- cgit v1.2.3-58-ga151