mount.h 2.3 KB

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