]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/linux/mnt_namespace.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jk/spufs
[mirror_ubuntu-artful-kernel.git] / include / linux / mnt_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 #include <linux/nsproxy.h>
8 #include <linux/seq_file.h>
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
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
25 extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
26 struct fs_struct *);
27 extern void __put_mnt_ns(struct mnt_namespace *ns);
28
29 static inline void put_mnt_ns(struct mnt_namespace *ns)
30 {
31 if (atomic_dec_and_lock(&ns->count, &vfsmount_lock))
32 /* releases vfsmount_lock */
33 __put_mnt_ns(ns);
34 }
35
36 static inline void exit_mnt_ns(struct task_struct *p)
37 {
38 struct mnt_namespace *ns = p->nsproxy->mnt_ns;
39 if (ns)
40 put_mnt_ns(ns);
41 }
42
43 static inline void get_mnt_ns(struct mnt_namespace *ns)
44 {
45 atomic_inc(&ns->count);
46 }
47
48 extern const struct seq_operations mounts_op;
49 extern const struct seq_operations mountinfo_op;
50 extern const struct seq_operations mountstats_op;
51
52 #endif
53 #endif