diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/namespace.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/namespace.h')
-rw-r--r-- | include/linux/namespace.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/namespace.h b/include/linux/namespace.h new file mode 100644 index 000000000000..9eca1558d72f --- /dev/null +++ b/include/linux/namespace.h | |||
@@ -0,0 +1,42 @@ | |||
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 void umount_tree(struct vfsmount *); | ||
16 | extern int copy_namespace(int, struct task_struct *); | ||
17 | extern void __put_namespace(struct namespace *namespace); | ||
18 | |||
19 | static inline void put_namespace(struct namespace *namespace) | ||
20 | { | ||
21 | if (atomic_dec_and_test(&namespace->count)) | ||
22 | __put_namespace(namespace); | ||
23 | } | ||
24 | |||
25 | static inline void exit_namespace(struct task_struct *p) | ||
26 | { | ||
27 | struct namespace *namespace = p->namespace; | ||
28 | if (namespace) { | ||
29 | task_lock(p); | ||
30 | p->namespace = NULL; | ||
31 | task_unlock(p); | ||
32 | put_namespace(namespace); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | static inline void get_namespace(struct namespace *namespace) | ||
37 | { | ||
38 | atomic_inc(&namespace->count); | ||
39 | } | ||
40 | |||
41 | #endif | ||
42 | #endif | ||