pnode.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/fs/pnode.h
  4. *
  5. * (C) Copyright IBM Corporation 2005.
  6. */
  7. #ifndef _LINUX_PNODE_H
  8. #define _LINUX_PNODE_H
  9. #include <linux/list.h>
  10. #include "mount.h"
  11. #ifdef CONFIG_KDP_NS
  12. #include <linux/kdp.h>
  13. #endif
  14. #ifndef CONFIG_KDP_NS
  15. #define IS_MNT_SHARED(m) ((m)->mnt.mnt_flags & MNT_SHARED)
  16. #endif
  17. #define IS_MNT_SLAVE(m) ((m)->mnt_master)
  18. #define IS_MNT_NEW(m) (!(m)->mnt_ns || is_anon_ns((m)->mnt_ns))
  19. #ifndef CONFIG_KDP_NS
  20. #define CLEAR_MNT_SHARED(m) ((m)->mnt.mnt_flags &= ~MNT_SHARED)
  21. #define IS_MNT_UNBINDABLE(m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE)
  22. #define IS_MNT_MARKED(m) ((m)->mnt.mnt_flags & MNT_MARKED)
  23. #define SET_MNT_MARK(m) ((m)->mnt.mnt_flags |= MNT_MARKED)
  24. #define CLEAR_MNT_MARK(m) ((m)->mnt.mnt_flags &= ~MNT_MARKED)
  25. #define IS_MNT_LOCKED(m) ((m)->mnt.mnt_flags & MNT_LOCKED)
  26. #endif
  27. #define CL_EXPIRE 0x01
  28. #define CL_SLAVE 0x02
  29. #define CL_COPY_UNBINDABLE 0x04
  30. #define CL_MAKE_SHARED 0x08
  31. #define CL_PRIVATE 0x10
  32. #define CL_SHARED_TO_SLAVE 0x20
  33. #define CL_COPY_MNT_NS_FILE 0x40
  34. #define CL_COPY_ALL (CL_COPY_UNBINDABLE | CL_COPY_MNT_NS_FILE)
  35. #ifdef CONFIG_KDP_NS
  36. static inline void set_mnt_shared(struct mount *mnt)
  37. {
  38. int mnt_flags = ((struct kdp_mount *)mnt)->mnt->mnt_flags;
  39. mnt_flags &= ~MNT_SHARED_MASK;
  40. mnt_flags |= MNT_SHARED;
  41. kdp_assign_mnt_flags(((struct kdp_mount *)mnt)->mnt, mnt_flags);
  42. }
  43. #else
  44. static inline void set_mnt_shared(struct mount *mnt)
  45. {
  46. mnt->mnt.mnt_flags &= ~MNT_SHARED_MASK;
  47. mnt->mnt.mnt_flags |= MNT_SHARED;
  48. }
  49. #endif
  50. void change_mnt_propagation(struct mount *, int);
  51. int propagate_mnt(struct mount *, struct mountpoint *, struct mount *,
  52. struct hlist_head *);
  53. int propagate_umount(struct list_head *);
  54. int propagate_mount_busy(struct mount *, int);
  55. void propagate_mount_unlock(struct mount *);
  56. void mnt_release_group_id(struct mount *);
  57. int get_dominating_id(struct mount *mnt, const struct path *root);
  58. int mnt_get_count(struct mount *mnt);
  59. void mnt_set_mountpoint(struct mount *, struct mountpoint *,
  60. struct mount *);
  61. void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp,
  62. struct mount *mnt);
  63. struct mount *copy_tree(struct mount *, struct dentry *, int);
  64. bool is_path_reachable(struct mount *, struct dentry *,
  65. const struct path *root);
  66. int count_mounts(struct mnt_namespace *ns, struct mount *mnt);
  67. #endif /* _LINUX_PNODE_H */