Kirill Korotaev | 6b3286e | 2006-12-08 02:37:56 -0800 | [diff] [blame] | 1 | #ifndef _NAMESPACE_H_ |
| 2 | #define _NAMESPACE_H_ |
| 3 | #ifdef __KERNEL__ |
| 4 | |
| 5 | #include <linux/mount.h> |
| 6 | #include <linux/sched.h> |
| 7 | #include <linux/nsproxy.h> |
| 8 | |
| 9 | struct mnt_namespace { |
| 10 | atomic_t count; |
| 11 | struct vfsmount * root; |
| 12 | struct list_head list; |
| 13 | wait_queue_head_t poll; |
| 14 | int event; |
| 15 | }; |
| 16 | |
Eric W. Biederman | 213dd26 | 2007-07-15 23:41:15 -0700 | [diff] [blame] | 17 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, |
Kirill Korotaev | 6b3286e | 2006-12-08 02:37:56 -0800 | [diff] [blame] | 18 | struct fs_struct *); |
Badari Pulavarty | e3222c4 | 2007-05-08 00:25:21 -0700 | [diff] [blame] | 19 | extern void __put_mnt_ns(struct mnt_namespace *ns); |
Kirill Korotaev | 6b3286e | 2006-12-08 02:37:56 -0800 | [diff] [blame] | 20 | |
| 21 | static inline void put_mnt_ns(struct mnt_namespace *ns) |
| 22 | { |
| 23 | if (atomic_dec_and_lock(&ns->count, &vfsmount_lock)) |
| 24 | /* releases vfsmount_lock */ |
| 25 | __put_mnt_ns(ns); |
| 26 | } |
| 27 | |
| 28 | static inline void exit_mnt_ns(struct task_struct *p) |
| 29 | { |
| 30 | struct mnt_namespace *ns = p->nsproxy->mnt_ns; |
| 31 | if (ns) |
| 32 | put_mnt_ns(ns); |
| 33 | } |
| 34 | |
| 35 | static inline void get_mnt_ns(struct mnt_namespace *ns) |
| 36 | { |
| 37 | atomic_inc(&ns->count); |
| 38 | } |
| 39 | |
| 40 | #endif |
| 41 | #endif |