Blame view

include/linux/mount.h 3.18 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
  /*
   *
   * Definitions for mount interface. This describes the in the kernel build 
   * linkedlist with mounted filesystems.
   *
   * Author:  Marco van Wieringen <mvw@planets.elm.net>
   *
   * Version: $Id: mount.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
   *
   */
  #ifndef _LINUX_MOUNT_H
  #define _LINUX_MOUNT_H
  #ifdef __KERNEL__
d53d9f16e   Andrew Morton   [PATCH] name_to_d...
14
  #include <linux/types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
17
  #include <linux/list.h>
  #include <linux/spinlock.h>
  #include <asm/atomic.h>
726c33422   David Howells   [PATCH] VFS: Perm...
18
19
20
  struct super_block;
  struct vfsmount;
  struct dentry;
6b3286ed1   Kirill Korotaev   [PATCH] rename st...
21
  struct mnt_namespace;
726c33422   David Howells   [PATCH] VFS: Perm...
22

07b20889e   Ram Pai   [PATCH] beginning...
23
24
25
  #define MNT_NOSUID	0x01
  #define MNT_NODEV	0x02
  #define MNT_NOEXEC	0x04
fc33a7bb9   Christoph Hellwig   [PATCH] per-mount...
26
27
  #define MNT_NOATIME	0x08
  #define MNT_NODIRATIME	0x10
47ae32d6a   Valerie Henson   [PATCH] relative ...
28
  #define MNT_RELATIME	0x20
bf066c7db   Miklos Szeredi   [PATCH] shared mo...
29

5528f911b   Trond Myklebust   VFS: Add shrink_s...
30
  #define MNT_SHRINKABLE	0x100
fc33a7bb9   Christoph Hellwig   [PATCH] per-mount...
31
32
  #define MNT_SHARED	0x1000	/* if the vfsmount is a shared mount */
  #define MNT_UNBINDABLE	0x2000	/* if the vfsmount is a unbindable mount */
beb7dd86a   Robert P. J. Day   Fix misspellings ...
33
  #define MNT_PNODE_MASK	0x3000	/* propagation flag mask */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34

07b20889e   Ram Pai   [PATCH] beginning...
35
  struct vfsmount {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
36
37
38
39
40
41
42
  	struct list_head mnt_hash;
  	struct vfsmount *mnt_parent;	/* fs we are mounted on */
  	struct dentry *mnt_mountpoint;	/* dentry of mountpoint */
  	struct dentry *mnt_root;	/* root of the mounted tree */
  	struct super_block *mnt_sb;	/* pointer to superblock */
  	struct list_head mnt_mounts;	/* list of children, anchored here */
  	struct list_head mnt_child;	/* and going through their mnt_child */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
  	int mnt_flags;
4ba4d4c0c   Eric Dumazet   [PATCH] struct vf...
44
  	/* 4 bytes hole on 64bits arches */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
  	char *mnt_devname;		/* Name of device e.g. /dev/dsk/hda1 */
  	struct list_head mnt_list;
55e700b92   Miklos Szeredi   [PATCH] namespace...
47
  	struct list_head mnt_expire;	/* link in fs-specific expiry list */
03e06e68f   Ram Pai   [PATCH] introduce...
48
  	struct list_head mnt_share;	/* circular list of shared mounts */
a58b0eb8e   Ram Pai   [PATCH] introduce...
49
50
51
  	struct list_head mnt_slave_list;/* list of slave mounts */
  	struct list_head mnt_slave;	/* slave list entry */
  	struct vfsmount *mnt_master;	/* slave is on master->mnt_slave_list */
6b3286ed1   Kirill Korotaev   [PATCH] rename st...
52
  	struct mnt_namespace *mnt_ns;	/* containing namespace */
4ba4d4c0c   Eric Dumazet   [PATCH] struct vf...
53
54
55
56
57
58
59
  	/*
  	 * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount
  	 * to let these frequently modified fields in a separate cache line
  	 * (so that reads of mnt_flags wont ping-pong on SMP machines)
  	 */
  	atomic_t mnt_count;
  	int mnt_expiry_mark;		/* true if marked for expiry */
7b7b1ace2   Al Viro   [PATCH] saner han...
60
  	int mnt_pinned;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
62
63
64
65
66
67
68
  };
  
  static inline struct vfsmount *mntget(struct vfsmount *mnt)
  {
  	if (mnt)
  		atomic_inc(&mnt->mnt_count);
  	return mnt;
  }
7b7b1ace2   Al Viro   [PATCH] saner han...
69
70
71
  extern void mntput_no_expire(struct vfsmount *mnt);
  extern void mnt_pin(struct vfsmount *mnt);
  extern void mnt_unpin(struct vfsmount *mnt);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
73
74
75
76
  
  static inline void mntput(struct vfsmount *mnt)
  {
  	if (mnt) {
  		mnt->mnt_expiry_mark = 0;
751c404b8   Miklos Szeredi   [PATCH] namespace...
77
  		mntput_no_expire(mnt);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
80
81
82
83
84
  	}
  }
  
  extern void free_vfsmnt(struct vfsmount *mnt);
  extern struct vfsmount *alloc_vfsmnt(const char *name);
  extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
  				      const char *name, void *data);
bb4a58bf4   Trond Myklebust   VFS: Add GPL_EXPO...
85
86
87
88
  struct file_system_type;
  extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
  				      int flags, const char *name,
  				      void *data);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
89
90
91
92
93
94
  struct nameidata;
  
  extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
  			int mnt_flags, struct list_head *fslist);
  
  extern void mark_mounts_for_expiry(struct list_head *mounts);
5528f911b   Trond Myklebust   VFS: Add shrink_s...
95
  extern void shrink_submounts(struct vfsmount *mountpoint, struct list_head *mounts);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
96
97
  
  extern spinlock_t vfsmount_lock;
d53d9f16e   Andrew Morton   [PATCH] name_to_d...
98
  extern dev_t name_to_dev_t(char *name);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
99
100
101
  
  #endif
  #endif /* _LINUX_MOUNT_H */