mount.h 2.0 KB

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