summaryrefslogtreecommitdiffstats
path: root/kernel/utsname.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-01 05:25:30 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-04 20:34:11 +0100
commit3c0411846118a578de3a979faf2da3ab5fb81179 (patch)
tree4609996bb8fdad235f21d0ec87bf1307da8738c0 /kernel/utsname.c
parentnetns: switch ->get()/->put()/->install()/->inum() to working with &net->ns (diff)
downloadlinux-3c0411846118a578de3a979faf2da3ab5fb81179.tar.xz
linux-3c0411846118a578de3a979faf2da3ab5fb81179.zip
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/utsname.c')
-rw-r--r--kernel/utsname.c15
1 files changed, 9 insertions, 6 deletions
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 = {