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