summaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/mount.h
diff options
context:
space:
mode:
authorAl Viro2018-11-05 18:40:30 +0100
committerAl Viro2019-03-20 23:49:06 +0100
commita07b20004793d8926f78d63eb5980559f7813404 (patch)
tree08f7516cbd8ef036fac64b225fd480c2bec3758f /include/uapi/linux/mount.h
parentLinux 5.1-rc1 (diff)
downloadkernel-qcow2-linux-a07b20004793d8926f78d63eb5980559f7813404.tar.gz
kernel-qcow2-linux-a07b20004793d8926f78d63eb5980559f7813404.tar.xz
kernel-qcow2-linux-a07b20004793d8926f78d63eb5980559f7813404.zip
vfs: syscall: Add open_tree(2) to reference or clone a mount
open_tree(dfd, pathname, flags) Returns an O_PATH-opened file descriptor or an error. dfd and pathname specify the location to open, in usual fashion (see e.g. fstatat(2)). flags should be an OR of some of the following: * AT_PATH_EMPTY, AT_NO_AUTOMOUNT, AT_SYMLINK_NOFOLLOW - same meanings as usual * OPEN_TREE_CLOEXEC - make the resulting descriptor close-on-exec * OPEN_TREE_CLONE or OPEN_TREE_CLONE | AT_RECURSIVE - instead of opening the location in question, create a detached mount tree matching the subtree rooted at location specified by dfd/pathname. With AT_RECURSIVE the entire subtree is cloned, without it - only the part within in the mount containing the location in question. In other words, the same as mount --rbind or mount --bind would've taken. The detached tree will be dissolved on the final close of obtained file. Creation of such detached trees requires the same capabilities as doing mount --bind. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-api@vger.kernel.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/uapi/linux/mount.h')
-rw-r--r--include/uapi/linux/mount.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/uapi/linux/mount.h b/include/uapi/linux/mount.h
index 3f9ec42510b0..fd7ae2e7eccf 100644
--- a/include/uapi/linux/mount.h
+++ b/include/uapi/linux/mount.h
@@ -55,4 +55,10 @@
#define MS_MGC_VAL 0xC0ED0000
#define MS_MGC_MSK 0xffff0000
+/*
+ * open_tree() flags.
+ */
+#define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */
+#define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
+
#endif /* _UAPI_LINUX_MOUNT_H */