blob: 8eed44f8ca732877dc1bbf5d4c15c7fcc1f1a568 [file] [log] [blame]
Kirill Korotaev6b3286e2006-12-08 02:37:56 -08001#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
9struct 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. Biederman213dd262007-07-15 23:41:15 -070017extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
Kirill Korotaev6b3286e2006-12-08 02:37:56 -080018 struct fs_struct *);
Badari Pulavartye3222c42007-05-08 00:25:21 -070019extern void __put_mnt_ns(struct mnt_namespace *ns);
Kirill Korotaev6b3286e2006-12-08 02:37:56 -080020
21static 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
28static 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
35static inline void get_mnt_ns(struct mnt_namespace *ns)
36{
37 atomic_inc(&ns->count);
38}
39
40#endif
41#endif