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