This commit was manufactured by cvs2svn to create tag
[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
23 #define MNT_NOATIME     16
24 #define MNT_NODIRATIME  32
25
26 struct vfsmount
27 {
28         struct list_head mnt_hash;
29         struct vfsmount *mnt_parent;    /* fs we are mounted on */
30         struct dentry *mnt_mountpoint;  /* dentry of mountpoint */
31         struct dentry *mnt_root;        /* root of the mounted tree */
32         struct super_block *mnt_sb;     /* pointer to superblock */
33         struct list_head mnt_mounts;    /* list of children, anchored here */
34         struct list_head mnt_child;     /* and going through their mnt_child */
35         atomic_t mnt_count;
36         int mnt_flags;
37         int mnt_expiry_mark;            /* true if marked for expiry */
38         char *mnt_devname;              /* Name of device e.g. /dev/dsk/hda1 */
39         struct list_head mnt_list;
40         struct list_head mnt_fslink;    /* link in fs-specific expiry list */
41         struct namespace *mnt_namespace; /* containing namespace */
42 };
43
44 #define MNT_IS_RDONLY(m)        ((m) && ((m)->mnt_flags & MNT_RDONLY))
45 #define MNT_IS_NOATIME(m)       ((m) && ((m)->mnt_flags & MNT_NOATIME))
46 #define MNT_IS_NODIRATIME(m)    ((m) && ((m)->mnt_flags & MNT_NODIRATIME))
47
48 static inline struct vfsmount *mntget(struct vfsmount *mnt)
49 {
50         if (mnt)
51                 atomic_inc(&mnt->mnt_count);
52         return mnt;
53 }
54
55 extern void __mntput(struct vfsmount *mnt);
56
57 static inline void _mntput(struct vfsmount *mnt)
58 {
59         if (mnt) {
60                 if (atomic_dec_and_test(&mnt->mnt_count))
61                         __mntput(mnt);
62         }
63 }
64
65 static inline void mntput(struct vfsmount *mnt)
66 {
67         if (mnt) {
68                 mnt->mnt_expiry_mark = 0;
69                 _mntput(mnt);
70         }
71 }
72
73 extern void free_vfsmnt(struct vfsmount *mnt);
74 extern struct vfsmount *alloc_vfsmnt(const char *name);
75 extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
76                                       const char *name, void *data);
77
78 struct nameidata;
79
80 extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
81                         int mnt_flags, struct list_head *fslist);
82
83 extern void mark_mounts_for_expiry(struct list_head *mounts);
84
85 extern spinlock_t vfsmount_lock;
86
87 #endif
88 #endif /* _LINUX_MOUNT_H */