mount.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #include <linux/types.h>
  15. #include <linux/list.h>
  16. #include <linux/spinlock.h>
  17. #include <asm/atomic.h>
  18. #define MNT_NOSUID 0x01
  19. #define MNT_NODEV 0x02
  20. #define MNT_NOEXEC 0x04
  21. #define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */
  22. #define MNT_PNODE_MASK 0x30 /* propogation flag mask */
  23. struct vfsmount {
  24. struct list_head mnt_hash;
  25. struct vfsmount *mnt_parent; /* fs we are mounted on */
  26. struct dentry *mnt_mountpoint; /* dentry of mountpoint */
  27. struct dentry *mnt_root; /* root of the mounted tree */
  28. struct super_block *mnt_sb; /* pointer to superblock */
  29. struct list_head mnt_mounts; /* list of children, anchored here */
  30. struct list_head mnt_child; /* and going through their mnt_child */
  31. atomic_t mnt_count;
  32. int mnt_flags;
  33. int mnt_expiry_mark; /* true if marked for expiry */
  34. char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
  35. struct list_head mnt_list;
  36. struct list_head mnt_expire; /* link in fs-specific expiry list */
  37. struct list_head mnt_share; /* circular list of shared mounts */
  38. struct namespace *mnt_namespace; /* containing namespace */
  39. int mnt_pinned;
  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. extern void mntput_no_expire(struct vfsmount *mnt);
  48. extern void mnt_pin(struct vfsmount *mnt);
  49. extern void mnt_unpin(struct vfsmount *mnt);
  50. static inline void mntput(struct vfsmount *mnt)
  51. {
  52. if (mnt) {
  53. mnt->mnt_expiry_mark = 0;
  54. mntput_no_expire(mnt);
  55. }
  56. }
  57. extern void free_vfsmnt(struct vfsmount *mnt);
  58. extern struct vfsmount *alloc_vfsmnt(const char *name);
  59. extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
  60. const char *name, void *data);
  61. struct nameidata;
  62. extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
  63. int mnt_flags, struct list_head *fslist);
  64. extern void mark_mounts_for_expiry(struct list_head *mounts);
  65. extern spinlock_t vfsmount_lock;
  66. extern dev_t name_to_dev_t(char *name);
  67. #endif
  68. #endif /* _LINUX_MOUNT_H */