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> |
Miklos Szeredi | a1a2c40 | 2008-03-27 13:06:24 +0100 | [diff] [blame] | 8 | #include <linux/seq_file.h> |
Kirill Korotaev | 6b3286e | 2006-12-08 02:37:56 -0800 | [diff] [blame] | 9 | |
| 10 | struct mnt_namespace { |
| 11 | atomic_t count; |
| 12 | struct vfsmount * root; |
| 13 | struct list_head list; |
| 14 | wait_queue_head_t poll; |
| 15 | int event; |
| 16 | }; |
| 17 | |
Miklos Szeredi | a1a2c40 | 2008-03-27 13:06:24 +0100 | [diff] [blame] | 18 | struct proc_mounts { |
| 19 | struct seq_file m; /* must be the first element */ |
| 20 | struct mnt_namespace *ns; |
| 21 | struct path root; |
| 22 | int event; |
| 23 | }; |
| 24 | |
Al Viro | 5ad4e53 | 2009-03-29 19:50:06 -0400 | [diff] [blame] | 25 | struct fs_struct; |
| 26 | |
Eric W. Biederman | 213dd26 | 2007-07-15 23:41:15 -0700 | [diff] [blame] | 27 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, |
Kirill Korotaev | 6b3286e | 2006-12-08 02:37:56 -0800 | [diff] [blame] | 28 | struct fs_struct *); |
Badari Pulavarty | e3222c4 | 2007-05-08 00:25:21 -0700 | [diff] [blame] | 29 | extern void __put_mnt_ns(struct mnt_namespace *ns); |
Kirill Korotaev | 6b3286e | 2006-12-08 02:37:56 -0800 | [diff] [blame] | 30 | |
| 31 | static inline void put_mnt_ns(struct mnt_namespace *ns) |
| 32 | { |
| 33 | if (atomic_dec_and_lock(&ns->count, &vfsmount_lock)) |
| 34 | /* releases vfsmount_lock */ |
| 35 | __put_mnt_ns(ns); |
| 36 | } |
| 37 | |
| 38 | static inline void exit_mnt_ns(struct task_struct *p) |
| 39 | { |
| 40 | struct mnt_namespace *ns = p->nsproxy->mnt_ns; |
| 41 | if (ns) |
| 42 | put_mnt_ns(ns); |
| 43 | } |
| 44 | |
| 45 | static inline void get_mnt_ns(struct mnt_namespace *ns) |
| 46 | { |
| 47 | atomic_inc(&ns->count); |
| 48 | } |
| 49 | |
Miklos Szeredi | a1a2c40 | 2008-03-27 13:06:24 +0100 | [diff] [blame] | 50 | extern const struct seq_operations mounts_op; |
Ram Pai | 2d4d486 | 2008-03-27 13:06:25 +0100 | [diff] [blame] | 51 | extern const struct seq_operations mountinfo_op; |
Miklos Szeredi | a1a2c40 | 2008-03-27 13:06:24 +0100 | [diff] [blame] | 52 | extern const struct seq_operations mountstats_op; |
| 53 | |
Kirill Korotaev | 6b3286e | 2006-12-08 02:37:56 -0800 | [diff] [blame] | 54 | #endif |
| 55 | #endif |