[PATCH] dquot: add proper locking when using current->signal->tty
[usb.git] / include / linux / namespace.h
blob3abc8e3b4879a5eac2dd54374f0fb9b37ca9f3a7
1 #ifndef _NAMESPACE_H_
2 #define _NAMESPACE_H_
3 #ifdef __KERNEL__
5 #include <linux/mount.h>
6 #include <linux/sched.h>
8 struct namespace {
9 atomic_t count;
10 struct vfsmount * root;
11 struct list_head list;
12 wait_queue_head_t poll;
13 int event;
16 extern int copy_namespace(int, struct task_struct *);
17 extern void __put_namespace(struct namespace *namespace);
18 extern struct namespace *dup_namespace(struct task_struct *, struct fs_struct *);
20 static inline void put_namespace(struct namespace *namespace)
22 if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock))
23 /* releases vfsmount_lock */
24 __put_namespace(namespace);
27 static inline void exit_namespace(struct task_struct *p)
29 struct namespace *namespace = p->namespace;
30 if (namespace) {
31 task_lock(p);
32 p->namespace = NULL;
33 task_unlock(p);
34 put_namespace(namespace);
38 static inline void get_namespace(struct namespace *namespace)
40 atomic_inc(&namespace->count);
43 #endif
44 #endif