[LTP] [PATCH] lapi: Split ficlone fallbacks from fs.h
Cyril Hrubis
chrubis@suse.cz
Thu Jul 25 11:43:00 CEST 2024
In the end splitting the ficlone fallbacks from fs.h is the easiest
solution we can do.
Fixes: 3acc96d4b3fa8 ("Add fallback definitions for lapi/fs.h")
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
Passes the CI https://github.com/metan-ucw/ltp/actions/runs/10091715692/job/27903833146
include/lapi/ficlone.h | 35 +++++++++++++++++++
include/lapi/fs.h | 18 ----------
.../kernel/syscalls/ioctl/ioctl_ficlone01.c | 2 +-
.../kernel/syscalls/ioctl/ioctl_ficlone02.c | 2 +-
.../kernel/syscalls/ioctl/ioctl_ficlone03.c | 2 +-
.../syscalls/ioctl/ioctl_ficlonerange01.c | 2 +-
.../syscalls/ioctl/ioctl_ficlonerange02.c | 2 +-
7 files changed, 40 insertions(+), 23 deletions(-)
create mode 100644 include/lapi/ficlone.h
diff --git a/include/lapi/ficlone.h b/include/lapi/ficlone.h
new file mode 100644
index 000000000..a973a8b21
--- /dev/null
+++ b/include/lapi/ficlone.h
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 Andrea Cervesato <andrea.cervesato@suse.com>
+ * Copyright (C) 2024 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef LAPI_FICLONE_H__
+#define LAPI_FICLONE_H__
+
+#include "config.h"
+
+#ifdef HAVE_LINUX_FS_H
+# include <linux/fs.h>
+#endif
+
+#include <stdint.h>
+
+#ifndef HAVE_STRUCT_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 FICLONE
+# define FICLONE _IOW(0x94, 9, int)
+#endif
+
+#ifndef FICLONERANGE
+# define FICLONERANGE _IOW(0x94, 13, struct file_clone_range)
+#endif
+
+#endif /* LAPI_FICLONE_H__ */
diff --git a/include/lapi/fs.h b/include/lapi/fs.h
index bea81aea1..635979b02 100644
--- a/include/lapi/fs.h
+++ b/include/lapi/fs.h
@@ -18,18 +18,8 @@
#include <sys/user.h>
#include <limits.h>
-#include <stdint.h>
#include "lapi/abisize.h"
-#ifndef HAVE_STRUCT_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
@@ -58,14 +48,6 @@ struct file_clone_range {
# 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.
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c
index bb3dc8c6c..57fdab374 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone01.c
@@ -19,7 +19,7 @@
*/
#include "tst_test.h"
-#include "lapi/fs.h"
+#include "lapi/ficlone.h"
#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c
index f6d492026..be3b01c29 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone02.c
@@ -12,7 +12,7 @@
*/
#include "tst_test.h"
-#include "lapi/fs.h"
+#include "lapi/ficlone.h"
#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
index 406b64cca..cd5cc6938 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
@@ -11,7 +11,7 @@
*/
#include "tst_test.h"
-#include "lapi/fs.h"
+#include "lapi/ficlone.h"
#define MNTPOINT "mnt"
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange01.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange01.c
index 78cf4bfea..cf7602a9a 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange01.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange01.c
@@ -19,7 +19,7 @@
*/
#include "tst_test.h"
-#include "lapi/fs.h"
+#include "lapi/ficlone.h"
#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange02.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange02.c
index 70dc46aa1..df9849b34 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange02.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlonerange02.c
@@ -13,7 +13,7 @@
*/
#include "tst_test.h"
-#include "lapi/fs.h"
+#include "lapi/ficlone.h"
#define MNTPOINT "mnt"
#define SRCPATH MNTPOINT "/file0"
--
2.44.2
More information about the ltp
mailing list