added a lot of printk output to ease writing of emulator
[linux-2.4.21-pre4.git] / include / linux / namespace.h
1 #ifndef _NAMESPACE_H_
2 #define _NAMESPACE_H_
3 #ifdef __KERNEL__
4
5 struct namespace {
6         atomic_t                count;
7         struct vfsmount *       root;
8         struct list_head        list;
9         struct rw_semaphore     sem;
10 };
11
12 extern void umount_tree(struct vfsmount *);
13
14 static inline void put_namespace(struct namespace *namespace)
15 {
16         if (atomic_dec_and_test(&namespace->count)) {
17                 down_write(&namespace->sem);
18                 spin_lock(&dcache_lock);
19                 umount_tree(namespace->root);
20                 spin_unlock(&dcache_lock);
21                 up_write(&namespace->sem);
22                 kfree(namespace);
23         }
24 }
25
26 static inline void exit_namespace(struct task_struct *p)
27 {
28         struct namespace *namespace = p->namespace;
29         if (namespace) {
30                 task_lock(p);
31                 p->namespace = NULL;
32                 task_unlock(p);
33                 put_namespace(namespace);
34         }
35 }
36 extern int copy_namespace(int, struct task_struct *);
37
38 static inline void get_namespace(struct namespace *namespace)
39 {
40         atomic_inc(&namespace->count);
41 }
42
43 #endif
44 #endif