[LTP] [PATCH v2 1/7] Add fallback definitions for lapi/fs.h
Andrea Cervesato
andrea.cervesato@suse.de
Tue Jul 23 09:15:01 CEST 2024
From: Andrea Cervesato <andrea.cervesato@suse.com>
This patch adds "struct file_clone_range" and FICLONERANGE fallback
definitions.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
configure.ac | 1 +
include/lapi/fs.h | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/configure.ac b/configure.ac
index 1f8796c87..4d466f052 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,7 @@ AC_CHECK_TYPES([struct acct_v3],,,[#include <sys/acct.h>])
AC_CHECK_TYPES([struct af_alg_iv, struct sockaddr_alg],,,[# include <linux/if_alg.h>])
AC_CHECK_TYPES([struct fanotify_event_info_fid, struct fanotify_event_info_error,
struct fanotify_event_info_header, struct fanotify_event_info_pidfd],,,[#include <sys/fanotify.h>])
+AC_CHECK_TYPES([struct file_clone_range],,,[#include <linux/fs.h>])
AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>])
AC_CHECK_TYPES([struct file_handle],,,[
diff --git a/include/lapi/fs.h b/include/lapi/fs.h
index 635979b02..0e8d646d8 100644
--- a/include/lapi/fs.h
+++ b/include/lapi/fs.h
@@ -20,6 +20,15 @@
#include <limits.h>
#include "lapi/abisize.h"
+#ifndef HAVE_FILE_CLONE_RANGE
+struct file_clone_range {
+ int64_t src_fd;
+ uint64_t src_offset;
+ uint64_t src_length;
+ uint64_t dest_offset;
+};
+#endif
+
#ifndef FS_IOC_GETFLAGS
# define FS_IOC_GETFLAGS _IOR('f', 1, long)
#endif
@@ -48,6 +57,14 @@
# define FS_VERITY_FL 0x00100000 /* Verity protected inode */
#endif
+#ifndef FICLONE
+# define FICLONE _IOW(0x94, 9, int)
+#endif
+
+#ifndef FICLONERANGE
+# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
+#endif
+
/*
* Helper function to get MAX_LFS_FILESIZE.
* Missing PAGE_SHIFT on some libc prevents defining MAX_LFS_FILESIZE.
--
2.43.0
More information about the ltp
mailing list