159bd9dedSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
207b20889SRam Pai /*
307b20889SRam Pai * linux/fs/pnode.h
407b20889SRam Pai *
507b20889SRam Pai * (C) Copyright IBM Corporation 2005.
607b20889SRam Pai */
707b20889SRam Pai #ifndef _LINUX_PNODE_H
807b20889SRam Pai #define _LINUX_PNODE_H
907b20889SRam Pai
1007b20889SRam Pai #include <linux/list.h>
11b2dba1afSAl Viro #include "mount.h"
1203e06e68SRam Pai
13fc7be130SAl Viro #define IS_MNT_SHARED(m) ((m)->mnt.mnt_flags & MNT_SHARED)
14fc7be130SAl Viro #define IS_MNT_SLAVE(m) ((m)->mnt_master)
15ee2e3f50SChristian Brauner #define IS_MNT_NEW(m) (!(m)->mnt_ns || is_anon_ns((m)->mnt_ns))
16fc7be130SAl Viro #define CLEAR_MNT_SHARED(m) ((m)->mnt.mnt_flags &= ~MNT_SHARED)
17fc7be130SAl Viro #define IS_MNT_UNBINDABLE(m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE)
18f2ebb3a9SAl Viro #define IS_MNT_MARKED(m) ((m)->mnt.mnt_flags & MNT_MARKED)
19f2ebb3a9SAl Viro #define SET_MNT_MARK(m) ((m)->mnt.mnt_flags |= MNT_MARKED)
20f2ebb3a9SAl Viro #define CLEAR_MNT_MARK(m) ((m)->mnt.mnt_flags &= ~MNT_MARKED)
210c56fe31SEric W. Biederman #define IS_MNT_LOCKED(m) ((m)->mnt.mnt_flags & MNT_LOCKED)
2203e06e68SRam Pai
23b90fa9aeSRam Pai #define CL_EXPIRE 0x01
24a58b0eb8SRam Pai #define CL_SLAVE 0x02
254ce5d2b1SEric W. Biederman #define CL_COPY_UNBINDABLE 0x04
26b90fa9aeSRam Pai #define CL_MAKE_SHARED 0x08
27796a6b52SAl Viro #define CL_PRIVATE 0x10
287a472ef4SEric W. Biederman #define CL_SHARED_TO_SLAVE 0x20
293bd045ccSAl Viro #define CL_COPY_MNT_NS_FILE 0x40
304ce5d2b1SEric W. Biederman
314ce5d2b1SEric W. Biederman #define CL_COPY_ALL (CL_COPY_UNBINDABLE | CL_COPY_MNT_NS_FILE)
32b90fa9aeSRam Pai
set_mnt_shared(struct mount * mnt)330f0afb1dSAl Viro static inline void set_mnt_shared(struct mount *mnt)
34b90fa9aeSRam Pai {
350f0afb1dSAl Viro mnt->mnt.mnt_flags &= ~MNT_SHARED_MASK;
360f0afb1dSAl Viro mnt->mnt.mnt_flags |= MNT_SHARED;
37b90fa9aeSRam Pai }
38b90fa9aeSRam Pai
390f0afb1dSAl Viro void change_mnt_propagation(struct mount *, int);
4084d17192SAl Viro int propagate_mnt(struct mount *, struct mountpoint *, struct mount *,
4138129a13SAl Viro struct hlist_head *);
42c003b26fSEric W. Biederman int propagate_umount(struct list_head *);
431ab59738SAl Viro int propagate_mount_busy(struct mount *, int);
445d88457eSEric W. Biederman void propagate_mount_unlock(struct mount *);
454b8b21f4SAl Viro void mnt_release_group_id(struct mount *);
466fc7871fSAl Viro int get_dominating_id(struct mount *mnt, const struct path *root);
47edf7ddbfSEric Biggers int mnt_get_count(struct mount *mnt);
4884d17192SAl Viro void mnt_set_mountpoint(struct mount *, struct mountpoint *,
4944d964d6SAl Viro struct mount *);
501064f874SEric W. Biederman void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp,
511064f874SEric W. Biederman struct mount *mnt);
5287129cc0SAl Viro struct mount *copy_tree(struct mount *, struct dentry *, int);
53643822b4SAl Viro bool is_path_reachable(struct mount *, struct dentry *,
54afac7cbaSAl Viro const struct path *root);
55d2921684SEric W. Biederman int count_mounts(struct mnt_namespace *ns, struct mount *mnt);
56*6ac39281SChristian Brauner bool propagation_would_overmount(const struct mount *from,
57*6ac39281SChristian Brauner const struct mount *to,
58*6ac39281SChristian Brauner const struct mountpoint *mp);
5907b20889SRam Pai #endif /* _LINUX_PNODE_H */
60