Merge upstream (approx. 2.6.12-git8) into 'janitor' branch of netdev-2.6.
[deliverable/linux.git] / include / linux / namespace.h
1 #ifndef _NAMESPACE_H_
2 #define _NAMESPACE_H_
3 #ifdef __KERNEL__
4
5 #include <linux/mount.h>
6 #include <linux/sched.h>
7
8 struct namespace {
9 atomic_t count;
10 struct vfsmount * root;
11 struct list_head list;
12 struct rw_semaphore sem;
13 };
14
15 extern int copy_namespace(int, struct task_struct *);
16 extern void __put_namespace(struct namespace *namespace);
17
18 static inline void put_namespace(struct namespace *namespace)
19 {
20 if (atomic_dec_and_test(&namespace->count))
21 __put_namespace(namespace);
22 }
23
24 static inline void exit_namespace(struct task_struct *p)
25 {
26 struct namespace *namespace = p->namespace;
27 if (namespace) {
28 task_lock(p);
29 p->namespace = NULL;
30 task_unlock(p);
31 put_namespace(namespace);
32 }
33 }
34
35 static inline void get_namespace(struct namespace *namespace)
36 {
37 atomic_inc(&namespace->count);
38 }
39
40 #endif
41 #endif
This page took 0.0326340000000001 seconds and 6 git commands to generate.