]> git.proxmox.com Git - mirror_lxc.git/commitdiff
mount: move mount utilities from syscall_wrappers.h into mount_utils.h
authorChristian Brauner <brauner@kernel.org>
Wed, 17 Aug 2022 07:44:34 +0000 (09:44 +0200)
committerChristian Brauner (Microsoft) <christian.brauner@ubuntu.com>
Wed, 17 Aug 2022 07:44:34 +0000 (09:44 +0200)
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
src/lxc/conf.h
src/lxc/mount_utils.h
src/lxc/syscall_wrappers.h

index 772479f9e1be5f973c82736b02f053343120bd7d..82cb66a7767c225a523db56560c3a22cdff59d15 100644 (file)
@@ -21,6 +21,7 @@
 #include "list.h"
 #include "lxcseccomp.h"
 #include "memory_utils.h"
+#include "mount_utils.h"
 #include "namespace.h"
 #include "ringbuf.h"
 #include "start.h"
index dc30d4ad3e0ee3ac0f71699c6540e99b419f8c31..a76f7bd1ff54acdf878b78839203d4c18925ec23 100644 (file)
@@ -176,6 +176,90 @@ struct lxc_rootfs;
 #define MOUNT_ATTR_IDMAP 0x00100000
 #endif
 
+#if !HAVE_MOVE_MOUNT
+static inline int move_mount_lxc(int from_dfd, const char *from_pathname,
+                                int to_dfd, const char *to_pathname,
+                                unsigned int flags)
+{
+       return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd,
+                      to_pathname, flags);
+}
+#define move_mount move_mount_lxc
+#else
+extern int move_mount(int from_dfd, const char *from_pathname, int to_dfd,
+                     const char *to_pathname, unsigned int flags);
+#endif
+
+#if !HAVE_OPEN_TREE
+static inline int open_tree_lxc(int dfd, const char *filename, unsigned int flags)
+{
+       return syscall(__NR_open_tree, dfd, filename, flags);
+}
+#define open_tree open_tree_lxc
+#else
+extern int open_tree(int dfd, const char *filename, unsigned int flags);
+#endif
+
+#if !HAVE_FSOPEN
+static inline int fsopen_lxc(const char *fs_name, unsigned int flags)
+{
+       return syscall(__NR_fsopen, fs_name, flags);
+}
+#define fsopen fsopen_lxc
+#else
+extern int fsopen(const char *fs_name, unsigned int flags);
+#endif
+
+#if !HAVE_FSPICK
+static inline int fspick_lxc(int dfd, const char *path, unsigned int flags)
+{
+       return syscall(__NR_fspick, dfd, path, flags);
+}
+#define fspick fspick_lxc
+#else
+extern int fspick(int dfd, const char *path, unsigned int flags);
+#endif
+
+#if !HAVE_FSCONFIG
+static inline int fsconfig_lxc(int fd, unsigned int cmd, const char *key, const void *value, int aux)
+{
+       return syscall(__NR_fsconfig, fd, cmd, key, value, aux);
+}
+#define fsconfig fsconfig_lxc
+#else
+extern int fsconfig(int fd, unsigned int cmd, const char *key, const void *value, int aux);
+#endif
+
+#if !HAVE_FSMOUNT
+static inline int fsmount_lxc(int fs_fd, unsigned int flags, unsigned int attr_flags)
+{
+       return syscall(__NR_fsmount, fs_fd, flags, attr_flags);
+}
+#define fsmount fsmount_lxc
+#else
+extern int fsmount(int fs_fd, unsigned int flags, unsigned int attr_flags);
+#endif
+
+/*
+ * mount_setattr()
+ */
+#if !HAVE_STRUCT_MOUNT_ATTR
+struct mount_attr {
+       __u64 attr_set;
+       __u64 attr_clr;
+       __u64 propagation;
+       __u64 userns_fd;
+};
+#endif
+
+#if !HAVE_MOUNT_SETATTR
+static inline int mount_setattr(int dfd, const char *path, unsigned int flags,
+                               struct mount_attr *attr, size_t size)
+{
+       return syscall(__NR_mount_setattr, dfd, path, flags, attr, size);
+}
+#endif
+
 __hidden extern int mnt_attributes_new(unsigned int old_flags, unsigned int *new_flags);
 
 __hidden extern int mnt_attributes_old(unsigned int new_flags, unsigned int *old_flags);
index 0710e08038fecbbada3e4dbb9df7f17f2db24724..d5b7c3bf0efccbd3e5b5e48ecfe65c0af818167c 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/keyctl.h>
 #include <sched.h>
 #include <stdint.h>
-#include <sys/mount.h>
 #include <sys/prctl.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
@@ -144,90 +143,6 @@ static int faccessat(int __fd, const char *__file, int __type, int __flag)
 }
 #endif
 
-#if !HAVE_MOVE_MOUNT
-static inline int move_mount_lxc(int from_dfd, const char *from_pathname,
-                                int to_dfd, const char *to_pathname,
-                                unsigned int flags)
-{
-       return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd,
-                      to_pathname, flags);
-}
-#define move_mount move_mount_lxc
-#else
-extern int move_mount(int from_dfd, const char *from_pathname, int to_dfd,
-                     const char *to_pathname, unsigned int flags);
-#endif
-
-#if !HAVE_OPEN_TREE
-static inline int open_tree_lxc(int dfd, const char *filename, unsigned int flags)
-{
-       return syscall(__NR_open_tree, dfd, filename, flags);
-}
-#define open_tree open_tree_lxc
-#else
-extern int open_tree(int dfd, const char *filename, unsigned int flags);
-#endif
-
-#if !HAVE_FSOPEN
-static inline int fsopen_lxc(const char *fs_name, unsigned int flags)
-{
-       return syscall(__NR_fsopen, fs_name, flags);
-}
-#define fsopen fsopen_lxc
-#else
-extern int fsopen(const char *fs_name, unsigned int flags);
-#endif
-
-#if !HAVE_FSPICK
-static inline int fspick_lxc(int dfd, const char *path, unsigned int flags)
-{
-       return syscall(__NR_fspick, dfd, path, flags);
-}
-#define fspick fspick_lxc
-#else
-extern int fspick(int dfd, const char *path, unsigned int flags);
-#endif
-
-#if !HAVE_FSCONFIG
-static inline int fsconfig_lxc(int fd, unsigned int cmd, const char *key, const void *value, int aux)
-{
-       return syscall(__NR_fsconfig, fd, cmd, key, value, aux);
-}
-#define fsconfig fsconfig_lxc
-#else
-extern int fsconfig(int fd, unsigned int cmd, const char *key, const void *value, int aux);
-#endif
-
-#if !HAVE_FSMOUNT
-static inline int fsmount_lxc(int fs_fd, unsigned int flags, unsigned int attr_flags)
-{
-       return syscall(__NR_fsmount, fs_fd, flags, attr_flags);
-}
-#define fsmount fsmount_lxc
-#else
-extern int fsmount(int fs_fd, unsigned int flags, unsigned int attr_flags);
-#endif
-
-/*
- * mount_setattr()
- */
-#if !HAVE_STRUCT_MOUNT_ATTR
-struct mount_attr {
-       __u64 attr_set;
-       __u64 attr_clr;
-       __u64 propagation;
-       __u64 userns_fd;
-};
-#endif
-
-#if !HAVE_MOUNT_SETATTR
-static inline int mount_setattr(int dfd, const char *path, unsigned int flags,
-                               struct mount_attr *attr, size_t size)
-{
-       return syscall(__NR_mount_setattr, dfd, path, flags, attr, size);
-}
-#endif
-
 /*
  * Arguments for how openat2(2) should open the target path. If only @flags and
  * @mode are non-zero, then openat2(2) operates very similarly to openat(2).