Merge sys_clone()/sys_unshare() nsproxy and namespace handling
[safe/jmp/linux-2.6] / include / linux / nsproxy.h
index 9c2e0ad..189e0dc 100644 (file)
@@ -4,8 +4,10 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 
-struct namespace;
+struct mnt_namespace;
 struct uts_namespace;
+struct ipc_namespace;
+struct pid_namespace;
 
 /*
  * A structure to contain pointers to all per-process
@@ -23,14 +25,17 @@ struct nsproxy {
        atomic_t count;
        spinlock_t nslock;
        struct uts_namespace *uts_ns;
-       struct namespace *namespace;
+       struct ipc_namespace *ipc_ns;
+       struct mnt_namespace *mnt_ns;
+       struct pid_namespace *pid_ns;
 };
 extern struct nsproxy init_nsproxy;
 
-struct nsproxy *dup_namespaces(struct nsproxy *orig);
 int copy_namespaces(int flags, struct task_struct *tsk);
 void get_task_namespaces(struct task_struct *tsk);
 void free_nsproxy(struct nsproxy *ns);
+int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
+       struct fs_struct *);
 
 static inline void put_nsproxy(struct nsproxy *ns)
 {
@@ -43,8 +48,10 @@ static inline void exit_task_namespaces(struct task_struct *p)
 {
        struct nsproxy *ns = p->nsproxy;
        if (ns) {
-               put_nsproxy(ns);
+               task_lock(p);
                p->nsproxy = NULL;
+               task_unlock(p);
+               put_nsproxy(ns);
        }
 }
 #endif