summaryrefslogtreecommitdiff
path: root/ipc/namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-01 07:25:30 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-04 22:34:11 +0300
commit3c0411846118a578de3a979faf2da3ab5fb81179 (patch)
tree4609996bb8fdad235f21d0ec87bf1307da8738c0 /ipc/namespace.c
parentff24870f46d51d79fc74a241fd7c12ccb933c69f (diff)
downloadlinux-3c0411846118a578de3a979faf2da3ab5fb81179.tar.xz
switch the rest of proc_ns_operations to working with &...->ns
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc/namespace.c')
-rw-r--r--ipc/namespace.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c
index 177fa9db391d..3c1e8d3bd7d3 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -149,6 +149,11 @@ void put_ipc_ns(struct ipc_namespace *ns)
}
}
+static inline struct ipc_namespace *to_ipc_ns(struct ns_common *ns)
+{
+ return container_of(ns, struct ipc_namespace, ns);
+}
+
static void *ipcns_get(struct task_struct *task)
{
struct ipc_namespace *ns = NULL;
@@ -160,17 +165,17 @@ static void *ipcns_get(struct task_struct *task)
ns = get_ipc_ns(nsproxy->ipc_ns);
task_unlock(task);
- return ns;
+ return ns ? &ns->ns : NULL;
}
static void ipcns_put(void *ns)
{
- return put_ipc_ns(ns);
+ return put_ipc_ns(to_ipc_ns(ns));
}
static int ipcns_install(struct nsproxy *nsproxy, void *new)
{
- struct ipc_namespace *ns = new;
+ struct ipc_namespace *ns = to_ipc_ns(new);
if (!ns_capable(ns->user_ns, CAP_SYS_ADMIN) ||
!ns_capable(current_user_ns(), CAP_SYS_ADMIN))
return -EPERM;
@@ -184,9 +189,7 @@ static int ipcns_install(struct nsproxy *nsproxy, void *new)
static unsigned int ipcns_inum(void *vp)
{
- struct ipc_namespace *ns = vp;
-
- return ns->ns.inum;
+ return ((struct ns_common *)vp)->inum;
}
const struct proc_ns_operations ipcns_operations = {