Skip to contentSkip to conversation

lapi/io_uring: Add IORING_OP_READ/WRITE constants

PATCH Superseded Martin Doucha 2 participants 2 messages Apr 20

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lapi/io_uring: Add IORING_OP_READ/WRITE constants

Add fallback definitions for IORING_OP_READ and IORING_OP_WRITE. These constants have been added in kernel v5.6 and older systems may lack them, which results in LTP build failures.

Fixes fcc4887e73 ("io_uring: Test IORING READ and WRITE operations")
---
 configure.ac            |  2 ++
 include/lapi/io_uring.h | 10 ++++++++++
 2 files changed, 12 insertions(+)
configure.ac +2 -0
index 812f17d8b..4b789bfe3 100644
@@ -46,6 +46,8 @@ AC_CHECK_DECLS([MADV_MERGEABLE],,,[#include <sys/mman.h>])
 AC_CHECK_DECLS([NFTA_CHAIN_ID, NFTA_VERDICT_CHAIN_ID],,,[#include <linux/netfilter/nf_tables.h>])
 AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ],,,[#include <sys/prctl.h>])
 AC_CHECK_DECLS([SEM_STAT_ANY],,,[#include <sys/sem.h>])
+AC_CHECK_DECLS([IORING_OP_READ],,,[#include <linux/io_uring.h>])
+AC_CHECK_DECLS([IORING_OP_WRITE],,,[#include <linux/io_uring.h>])
 
 AC_CHECK_HEADERS_ONCE([ \
     aio.h \
include/lapi/io_uring.h +10 -0
index c05517595..46168363d 100644
@@ -253,6 +253,16 @@ struct io_uring_probe {
 	struct io_uring_probe_op ops[0];
 };
 
+#else /* IOSQE_FIXED_FILE */
+
+#ifndef HAVE_IORING_OP_READ
+#define IORING_OP_READ 22
+#endif
+
+#ifndef HAVE_IORING_OP_WRITE
+#define IORING_OP_WRITE 23
+#endif
+
 #endif /* IOSQE_FIXED_FILE */
 
 #ifndef IOSQE_IO_HADRLINK
Signature · 5 lines
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Martin,

include/lapi/io_uring.h struct io_uring_probe { · line 264

Quoted 9 lines · Martin Doucha

lapi/io_uring: Add IORING_OP_READ/WRITE constants

include/lapi/io_uring.h +7 -0
+#ifndef HAVE_IORING_OP_READ
+#define IORING_OP_READ 22
+#endif
+
+#ifndef HAVE_IORING_OP_WRITE
+#define IORING_OP_WRITE 23
+#endif

AC_CHECK_DECLS() defines HAVE_DECL_IORING_OP_READ (to 0 or 1), not HAVE_IORING_OP_READ. The #ifndef guard is always entered, making the configure.ac checks dead code. Use #if !HAVE_DECL_IORING_OP_READ and #if !HAVE_DECL_IORING_OP_WRITE — see include/lapi/landlock.h for the established pattern.

---
Note:

Our agent completed the review of the patch. The full review can be found at: https://github.com/linux-test-project/ltp-agent/actions/runs/24682015063

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp