[LTP] [PATCH v5 1/2] lapi: Add io_uring_clone_buffers and RDS_CMSG_ZCOPY_COOKIE fallbacks

Sebastian Chlad sebastianchlad@gmail.com
Thu Jun 4 18:38:29 CEST 2026


Add IORING_REGISTER_CLONE_BUFFERS opcode and struct io_uring_clone_buffers
to lapi/io_uring.h for kernels/headers that predate the clone-buffers API.
Add lapi/rds.h with a fallback for RDS_CMSG_ZCOPY_COOKIE, which is absent
in older userspace headers (e.g. openSUSE Leap 42.2).

Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
---
 configure.ac            |  1 +
 include/lapi/io_uring.h | 17 +++++++++++++++++
 include/lapi/rds.h      | 16 ++++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 include/lapi/rds.h

diff --git a/configure.ac b/configure.ac
index 0653d7793..3a1283ac3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,6 +255,7 @@ AC_CHECK_TYPES([struct __kernel_old_timeval, struct __kernel_old_timespec, struc
                 struct __kernel_old_itimerval],,,[#include <sys/socket.h>])
 
 AC_CHECK_TYPES([struct futex_waitv],,,[#include <linux/futex.h>])
+AC_CHECK_TYPES([struct io_uring_clone_buffers],,,[#include <linux/io_uring.h>])
 AC_CHECK_TYPES([struct mount_attr],,,[
 #ifdef HAVE_MOUNT_SETATTR
 # include <sys/mount.h>
diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 2026863a2..afc32c247 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -265,6 +265,23 @@ struct io_uring_probe {
 
 #endif /* IOSQE_FIXED_FILE */
 
+/* linux/io_uring.h: IORING_REGISTER_CLONE_BUFFERS = 30 */
+#ifndef IORING_REGISTER_CLONE_BUFFERS
+# define IORING_REGISTER_CLONE_BUFFERS	30
+#endif
+
+/* Argument for IORING_REGISTER_CLONE_BUFFERS (linux/io_uring.h) */
+#ifndef HAVE_STRUCT_IO_URING_CLONE_BUFFERS
+struct io_uring_clone_buffers {
+	uint32_t src_fd;
+	uint32_t flags;
+	uint32_t src_off;
+	uint32_t dst_off;
+	uint32_t nr;
+	uint32_t pad[3];
+};
+#endif
+
 #ifndef IOSQE_IO_HADRLINK
 /* like LINK, but stronger */
 #define IOSQE_IO_HARDLINK_BIT	3
diff --git a/include/lapi/rds.h b/include/lapi/rds.h
new file mode 100644
index 000000000..7405a7f37
--- /dev/null
+++ b/include/lapi/rds.h
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2026 SUSE LLC Sebastian Chlad <sebastian.chlad@suse.com>
+ */
+
+#ifndef LAPI_RDS_H__
+#define LAPI_RDS_H__
+
+#include <linux/rds.h>
+
+/* Fallback for older userspace headers (e.g. openSUSE Leap 42.2). */
+#ifndef RDS_CMSG_ZCOPY_COOKIE
+# define RDS_CMSG_ZCOPY_COOKIE	12
+#endif
+
+#endif /* LAPI_RDS_H__ */
-- 
2.51.0



More information about the ltp mailing list