From: Christian Brauner Date: Wed, 10 Aug 2022 10:18:49 +0000 (+0200) Subject: tree-wide: use struct open_how directly X-Git-Tag: v6.0.0~103^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4181%2Fhead;p=thirdparty%2Flxc.git tree-wide: use struct open_how directly Signed-off-by: Christian Brauner (Microsoft) --- diff --git a/meson.build b/meson.build index d10e82ab8..5881d1463 100644 --- a/meson.build +++ b/meson.build @@ -580,9 +580,7 @@ decl_headers = ''' #include #include #include -#include #include -#include #include ''' diff --git a/src/lxc/file_utils.c b/src/lxc/file_utils.c index ca31690e4..38f056766 100644 --- a/src/lxc/file_utils.c +++ b/src/lxc/file_utils.c @@ -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, diff --git a/src/lxc/mount_utils.c b/src/lxc/mount_utils.c index 88dd73ee3..5763afafc 100644 --- a/src/lxc/mount_utils.c +++ b/src/lxc/mount_utils.c @@ -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, }; diff --git a/src/lxc/syscall_wrappers.h b/src/lxc/syscall_wrappers.h index 22ce536b4..0710e0803 100644 --- a/src/lxc/syscall_wrappers.h +++ b/src/lxc/syscall_wrappers.h @@ -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); } diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 390c56d54..0e2a7188b 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -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, };