mount.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include <linux/mount.h>
  2. #include <linux/seq_file.h>
  3. #include <linux/poll.h>
  4. struct mnt_namespace {
  5. atomic_t count;
  6. struct mount * root;
  7. struct list_head list;
  8. wait_queue_head_t poll;
  9. int event;
  10. };
  11. struct mnt_pcp {
  12. int mnt_count;
  13. int mnt_writers;
  14. };
  15. struct mount {
  16. struct list_head mnt_hash;
  17. struct mount *mnt_parent;
  18. struct dentry *mnt_mountpoint;
  19. struct vfsmount mnt;
  20. #ifdef CONFIG_SMP
  21. struct mnt_pcp __percpu *mnt_pcp;
  22. #else
  23. int mnt_count;
  24. int mnt_writers;
  25. #endif
  26. struct list_head mnt_mounts; /* list of children, anchored here */
  27. struct list_head mnt_child; /* and going through their mnt_child */
  28. struct list_head mnt_instance; /* mount instance on sb->s_mounts */
  29. const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
  30. struct list_head mnt_list;
  31. struct list_head mnt_expire; /* link in fs-specific expiry list */
  32. struct list_head mnt_share; /* circular list of shared mounts */
  33. struct list_head mnt_slave_list;/* list of slave mounts */
  34. struct list_head mnt_slave; /* slave list entry */
  35. struct mount *mnt_master; /* slave is on master->mnt_slave_list */
  36. struct mnt_namespace *mnt_ns; /* containing namespace */
  37. #ifdef CONFIG_FSNOTIFY
  38. struct hlist_head mnt_fsnotify_marks;
  39. __u32 mnt_fsnotify_mask;
  40. #endif
  41. int mnt_id; /* mount identifier */
  42. int mnt_group_id; /* peer group identifier */
  43. int mnt_expiry_mark; /* true if marked for expiry */
  44. int mnt_pinned;
  45. int mnt_ghosts;
  46. };
  47. #define MNT_NS_INTERNAL ERR_PTR(-EINVAL) /* distinct from any mnt_namespace */
  48. static inline struct mount *real_mount(struct vfsmount *mnt)
  49. {
  50. return container_of(mnt, struct mount, mnt);
  51. }
  52. static inline int mnt_has_parent(struct mount *mnt)
  53. {
  54. return mnt != mnt->mnt_parent;
  55. }
  56. static inline int is_mounted(struct vfsmount *mnt)
  57. {
  58. /* neither detached nor internal? */
  59. return !IS_ERR_OR_NULL(real_mount(mnt));
  60. }
  61. extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
  62. static inline void get_mnt_ns(struct mnt_namespace *ns)
  63. {
  64. atomic_inc(&ns->count);
  65. }
  66. struct proc_mounts {
  67. struct seq_file m;
  68. struct mnt_namespace *ns;
  69. struct path root;
  70. int (*show)(struct seq_file *, struct vfsmount *);
  71. };
  72. #define proc_mounts(p) (container_of((p), struct proc_mounts, m))
  73. extern const struct seq_operations mounts_op;