| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Andrew Morton | d53d9f1 | 2005-07-12 13:58:07 -0700 | [diff] [blame] | 15 | #include <linux/types.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/list.h> | 
|  | 17 | #include <linux/spinlock.h> | 
|  | 18 | #include <asm/atomic.h> | 
|  | 19 |  | 
|  | 20 | #define MNT_NOSUID	1 | 
|  | 21 | #define MNT_NODEV	2 | 
|  | 22 | #define MNT_NOEXEC	4 | 
|  | 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; | 
| Miklos Szeredi | 55e700b | 2005-07-07 17:57:30 -0700 | [diff] [blame] | 38 | struct list_head mnt_expire;	/* link in fs-specific expiry list */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | struct namespace *mnt_namespace; /* containing namespace */ | 
| Al Viro | 7b7b1ac | 2005-11-07 17:13:39 -0500 | [diff] [blame^] | 40 | int mnt_pinned; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | }; | 
|  | 42 |  | 
|  | 43 | static inline struct vfsmount *mntget(struct vfsmount *mnt) | 
|  | 44 | { | 
|  | 45 | if (mnt) | 
|  | 46 | atomic_inc(&mnt->mnt_count); | 
|  | 47 | return mnt; | 
|  | 48 | } | 
|  | 49 |  | 
| Al Viro | 7b7b1ac | 2005-11-07 17:13:39 -0500 | [diff] [blame^] | 50 | extern void mntput_no_expire(struct vfsmount *mnt); | 
|  | 51 | extern void mnt_pin(struct vfsmount *mnt); | 
|  | 52 | extern void mnt_unpin(struct vfsmount *mnt); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 |  | 
|  | 54 | static inline void mntput(struct vfsmount *mnt) | 
|  | 55 | { | 
|  | 56 | if (mnt) { | 
|  | 57 | mnt->mnt_expiry_mark = 0; | 
| Miklos Szeredi | 751c404 | 2005-07-07 17:57:30 -0700 | [diff] [blame] | 58 | mntput_no_expire(mnt); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | } | 
|  | 60 | } | 
|  | 61 |  | 
|  | 62 | extern void free_vfsmnt(struct vfsmount *mnt); | 
|  | 63 | extern struct vfsmount *alloc_vfsmnt(const char *name); | 
|  | 64 | extern struct vfsmount *do_kern_mount(const char *fstype, int flags, | 
|  | 65 | const char *name, void *data); | 
|  | 66 |  | 
|  | 67 | struct nameidata; | 
|  | 68 |  | 
|  | 69 | extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, | 
|  | 70 | int mnt_flags, struct list_head *fslist); | 
|  | 71 |  | 
|  | 72 | extern void mark_mounts_for_expiry(struct list_head *mounts); | 
|  | 73 |  | 
|  | 74 | extern spinlock_t vfsmount_lock; | 
| Andrew Morton | d53d9f1 | 2005-07-12 13:58:07 -0700 | [diff] [blame] | 75 | extern dev_t name_to_dev_t(char *name); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 |  | 
|  | 77 | #endif | 
|  | 78 | #endif /* _LINUX_MOUNT_H */ |