- update bind mount patch to patch-2.6.11-rc5-bme0.06.1.diff
[linux-2.6.git] / include / linux / mount.h
1 /*
2  *
3  * Definitions for mount interface. This describes the in the kernel build 
4  * linkedlist with mounted filesystems.
5  *
6  * Author:  Marco van Wieringen <mvw@planets.elm.net>
7  *
8  * Version: $Id: mount.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
9  *
10  */
11 #ifndef _LINUX_MOUNT_H
12 #define _LINUX_MOUNT_H
13 #ifdef __KERNEL__
14
15 #include <linux/list.h>
16 #include <linux/spinlock.h>
17 #include <asm/atomic.h>
18
19 #define MNT_NOSUID      1
20 #define MNT_NODEV       2
21 #define MNT_NOEXEC      4
22 #define MNT_RDONLY      8  /* MEF @ PlanetLab: bme patch */
23 #define MNT_NOATIME     16 /* MEF @ PlanetLab: bme patch */
24 #define MNT_NODIRATIME  32 /* MEF @ PlanetLab: bme patch */
25 #define MNT_XID         256
26
27 struct vfsmount
28 {
29         struct list_head mnt_hash;
30         struct vfsmount *mnt_parent;    /* fs we are mounted on */
31         struct dentry *mnt_mountpoint;  /* dentry of mountpoint */
32         struct dentry *mnt_root;        /* root of the mounted tree */
33         struct super_block *mnt_sb;     /* pointer to superblock */
34         struct list_head mnt_mounts;    /* list of children, anchored here */
35         struct list_head mnt_child;     /* and going through their mnt_child */
36         atomic_t mnt_count;
37         int mnt_flags;
38         int mnt_expiry_mark;            /* true if marked for expiry */
39         char *mnt_devname;              /* Name of device e.g. /dev/dsk/hda1 */
40         struct list_head mnt_list;
41         struct list_head mnt_fslink;    /* link in fs-specific expiry list */
42         struct namespace *mnt_namespace; /* containing namespace */
43         xid_t mnt_xid;                  /* xid tagging used for vfsmount */
44 };
45
46 #define MNT_IS_RDONLY(m)        ((m) && ((m)->mnt_flags & MNT_RDONLY))
47 #define MNT_IS_NOATIME(m)       ((m) && ((m)->mnt_flags & MNT_NOATIME))
48 #define MNT_IS_NODIRATIME(m)    ((m) && ((m)->mnt_flags & MNT_NODIRATIME))
49
50 #define MNT_IS_RDONLY(m)        ((m) && ((m)->mnt_flags & MNT_RDONLY))
51 #define MNT_IS_NOATIME(m)       ((m) && ((m)->mnt_flags & MNT_NOATIME))
52 #define MNT_IS_NODIRATIME(m)    ((m) && ((m)->mnt_flags & MNT_NODIRATIME))
53
54 static inline struct vfsmount *mntget(struct vfsmount *mnt)
55 {
56         if (mnt)
57                 atomic_inc(&mnt->mnt_count);
58         return mnt;
59 }
60
61 extern void __mntput(struct vfsmount *mnt);
62
63 static inline void _mntput(struct vfsmount *mnt)
64 {
65         if (mnt) {
66                 if (atomic_dec_and_test(&mnt->mnt_count))
67                         __mntput(mnt);
68         }
69 }
70
71 static inline void mntput(struct vfsmount *mnt)
72 {
73         if (mnt) {
74                 mnt->mnt_expiry_mark = 0;
75                 _mntput(mnt);
76         }
77 }
78
79 extern void free_vfsmnt(struct vfsmount *mnt);
80 extern struct vfsmount *alloc_vfsmnt(const char *name);
81 extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
82                                       const char *name, void *data);
83
84 struct nameidata;
85
86 extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
87                         int mnt_flags, struct list_head *fslist);
88
89 extern void mark_mounts_for_expiry(struct list_head *mounts);
90
91 extern spinlock_t vfsmount_lock;
92
93 #endif
94 #endif /* _LINUX_MOUNT_H */