#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>
'''
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,
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,
};
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,
};
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,
};
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,
};
* @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
#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);
}
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,
};