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