Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[pandora-kernel.git] / kernel / pid_namespace.c
index bc6d6a8..a65ba13 100644 (file)
@@ -105,9 +105,10 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns
        if (ns->pid_cachep == NULL)
                goto out_free_map;
 
-       err = proc_alloc_inum(&ns->proc_inum);
+       err = ns_alloc_inum(&ns->ns);
        if (err)
                goto out_free_map;
+       ns->ns.ops = &pidns_operations;
 
        kref_init(&ns->kref);
        ns->level = level;
@@ -142,7 +143,7 @@ static void destroy_pid_namespace(struct pid_namespace *ns)
 {
        int i;
 
-       proc_free_inum(ns->proc_inum);
+       ns_free_inum(&ns->ns);
        for (i = 0; i < PIDMAP_ENTRIES; i++)
                kfree(ns->pidmap[i].page);
        put_user_ns(ns->user_ns);
@@ -333,7 +334,12 @@ int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
        return 0;
 }
 
-static void *pidns_get(struct task_struct *task)
+static inline struct pid_namespace *to_pid_ns(struct ns_common *ns)
+{
+       return container_of(ns, struct pid_namespace, ns);
+}
+
+static struct ns_common *pidns_get(struct task_struct *task)
 {
        struct pid_namespace *ns;
 
@@ -343,18 +349,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)
+static void pidns_put(struct ns_common *ns)
 {
-       put_pid_ns(ns);
+       put_pid_ns(to_pid_ns(ns));
 }
 
-static int pidns_install(struct nsproxy *nsproxy, void *ns)
+static int pidns_install(struct nsproxy *nsproxy, struct ns_common *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))
@@ -382,19 +388,12 @@ static int pidns_install(struct nsproxy *nsproxy, void *ns)
        return 0;
 }
 
-static unsigned int pidns_inum(void *ns)
-{
-       struct pid_namespace *pid_ns = ns;
-       return pid_ns->proc_inum;
-}
-
 const struct proc_ns_operations pidns_operations = {
        .name           = "pid",
        .type           = CLONE_NEWPID,
        .get            = pidns_get,
        .put            = pidns_put,
        .install        = pidns_install,
-       .inum           = pidns_inum,
 };
 
 static __init int pid_namespaces_init(void)