]> git.proxmox.com Git - mirror_lxc.git/commitdiff
tree-wide: use struct open_how directly
authorChristian Brauner <brauner@kernel.org>
Wed, 10 Aug 2022 10:18:49 +0000 (12:18 +0200)
committerChristian Brauner (Microsoft) <christian.brauner@ubuntu.com>
Wed, 10 Aug 2022 10:18:49 +0000 (12:18 +0200)
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
meson.build
src/lxc/file_utils.c
src/lxc/mount_utils.c
src/lxc/syscall_wrappers.h
src/lxc/utils.c

index d10e82ab8ccad79cf794079496ecbd5c9f2a44b8..5881d1463f52092e9c33aaf3d33e8dfcc2885ff0 100644 (file)
@@ -580,9 +580,7 @@ decl_headers = '''
 #include <uchar.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
-#include <linux/fs.h>
 #include <linux/if_link.h>
-#include <linux/openat2.h>
 #include <linux/types.h>
 '''
 
index ca31690e4460cbb6dbeac953d9468636fc3f5f1b..38f056766c88934ec01c3e29afb45f400a770f7e 100644 (file)
@@ -652,7 +652,7 @@ int open_at(int dfd, const char *path, unsigned int o_flags,
            unsigned int resolve_flags, mode_t mode)
 {
        __do_close int fd = -EBADF;
-       struct lxc_open_how how = {
+       struct open_how how = {
                .flags          = o_flags,
                .mode           = mode,
                .resolve        = resolve_flags,
index 88dd73ee36b2b8e8c6ac95b80fed2fbba7d1961e..5763afafcb232b6667dd72bd5746e429ecb63b1d 100644 (file)
@@ -186,7 +186,7 @@ int fs_prepare(const char *fs_name,
        int fd_from;
 
        if (!is_empty_string(path_from)) {
-               struct lxc_open_how how = {
+               struct open_how how = {
                        .flags          = o_flags_from,
                        .resolve        = resolve_flags_from,
                };
@@ -237,7 +237,7 @@ int fs_attach(int fd_fs,
        int fd_to, ret;
 
        if (!is_empty_string(path_to)) {
-               struct lxc_open_how how = {
+               struct open_how how = {
                        .flags          = o_flags_to,
                        .resolve        = resolve_flags_to,
                };
@@ -308,7 +308,7 @@ int move_detached_mount(int dfd_from, int dfd_to, const char *path_to,
        int fd_to, ret;
 
        if (!is_empty_string(path_to)) {
-               struct lxc_open_how how = {
+               struct open_how how = {
                        .flags          = o_flags_to,
                        .resolve        = resolve_flags_to,
                };
@@ -348,7 +348,7 @@ int __fd_bind_mount(int dfd_from, const char *path_from, __u64 o_flags_from,
        set_atime(&attr);
 
        if (!is_empty_string(path_from)) {
-               struct lxc_open_how how = {
+               struct open_how how = {
                        .flags          = o_flags_from,
                        .resolve        = resolve_flags_from,
                };
index 22ce536b44d5e929c7e5d370388138e9305a7e14..0710e08038fecbbada3e4dbb9df7f17f2db24724 100644 (file)
@@ -240,11 +240,13 @@ static inline int mount_setattr(int dfd, const char *path, unsigned int flags,
  * @mode: O_CREAT/O_TMPFILE file mode.
  * @resolve: RESOLVE_* flags.
  */
-struct lxc_open_how {
+#if !HAVE_STRUCT_OPEN_HOW
+struct open_how {
        __u64 flags;
        __u64 mode;
        __u64 resolve;
 };
+#endif
 
 /* how->resolve flags for openat2(2). */
 #ifndef RESOLVE_NO_XDEV
@@ -296,7 +298,7 @@ struct lxc_open_how {
 #define PROTECT_OPEN_RW (O_CLOEXEC | O_NOCTTY | O_RDWR | O_NOFOLLOW)
 
 #if !HAVE_OPENAT2
-static inline int openat2(int dfd, const char *filename, struct lxc_open_how *how, size_t size)
+static inline int openat2(int dfd, const char *filename, struct open_how *how, size_t size)
 {
        return syscall(__NR_openat2, dfd, filename, how, size);
 }
index 390c56d54fced9f399ac9f2818ecfd72f082074a..0e2a7188bba72cfcffd90da0cae0cc44b9b404a9 100644 (file)
@@ -1095,7 +1095,7 @@ int __safe_mount_beneath_at(int beneath_fd, const char *src, const char *dst, co
                            unsigned int flags, const void *data)
 {
        __do_close int source_fd = -EBADF, target_fd = -EBADF;
-       struct lxc_open_how how = {
+       struct open_how how = {
                .flags          = PROTECT_OPATH_DIRECTORY,
                .resolve        = PROTECT_LOOKUP_BENEATH_WITH_MAGICLINKS,
        };