public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] lapi/io_uring: Add fallback definitions for OP_READ(WRITE)
@ 2026-04-16 12:41 Sachin Sant
  2026-04-16 13:35 ` [LTP] " linuxtestproject.agent
  2026-04-16 16:18 ` [LTP] [PATCH] " Martin Doucha
  0 siblings, 2 replies; 3+ messages in thread
From: Sachin Sant @ 2026-04-16 12:41 UTC (permalink / raw)
  To: ltp

Add fallback definitions for IORING_OP_READ and IORING_OP_WRITE
opcodes to support building on older distributions with kernel
headers between v5.1 and v5.5.

These opcodes were introduced in kernel v5.6, but some distros
may have io_uring support from v5.1+ without these newer
operation codes.

Fixes: fcc4887e73ca (io_uring: Test IORING READ and WRITE operations)
Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Sachin Sant <sachinp@linux.ibm.com>
---
 include/lapi/io_uring.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index c05517595..d95a4cd59 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -267,6 +267,16 @@ struct io_uring_probe {
 #define IOSQE_ASYNC		(1U << IOSQE_ASYNC_BIT)
 #endif /* IOSQE_ASYNC */
 
+#ifndef IORING_OP_READ
+/* Added in kernel v5.6 */
+#define IORING_OP_READ		22
+#endif /* IORING_OP_READ */
+
+#ifndef IORING_OP_WRITE
+/* Added in kernel v5.6 */
+#define IORING_OP_WRITE		23
+#endif /* IORING_OP_WRITE */
+
 #ifndef HAVE_IO_URING_REGISTER
 static inline int io_uring_register(int fd, unsigned int opcode, void *arg,
 	unsigned int nr_args)
-- 
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] lapi/io_uring: Add fallback definitions for OP_READ(WRITE)
  2026-04-16 12:41 [LTP] [PATCH] lapi/io_uring: Add fallback definitions for OP_READ(WRITE) Sachin Sant
@ 2026-04-16 13:35 ` linuxtestproject.agent
  2026-04-16 16:18 ` [LTP] [PATCH] " Martin Doucha
  1 sibling, 0 replies; 3+ messages in thread
From: linuxtestproject.agent @ 2026-04-16 13:35 UTC (permalink / raw)
  To: Sachin Sant; +Cc: ltp, LTP AI Reviewer

Hi Sachin,

On Thu, 16 Apr 2026 18:11:44 +0530, Sachin Sant wrote:
> lapi/io_uring: Add fallback definitions for OP_READ(WRITE)

> +#ifndef IORING_OP_READ
> +/* Added in kernel v5.6 */
> +#define IORING_OP_READ		22
> +#endif /* IORING_OP_READ */
> +
> +#ifndef IORING_OP_WRITE
> +/* Added in kernel v5.6 */
> +#define IORING_OP_WRITE		23
> +#endif /* IORING_OP_WRITE */

Looks good.

Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com>

---
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/24513031465

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] lapi/io_uring: Add fallback definitions for OP_READ(WRITE)
  2026-04-16 12:41 [LTP] [PATCH] lapi/io_uring: Add fallback definitions for OP_READ(WRITE) Sachin Sant
  2026-04-16 13:35 ` [LTP] " linuxtestproject.agent
@ 2026-04-16 16:18 ` Martin Doucha
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Doucha @ 2026-04-16 16:18 UTC (permalink / raw)
  To: Sachin Sant, ltp

Hi,
while this patch fixes compilation on older system lacking these 
constant definitions, the #ifndef macro is incorrect and always true.

The system constants are defined using an enum so they're not directly 
visible to the C preprocessor. The correct way to check for these two 
constants is through AC_CHECK_DECLS() in configure.ac.

On 4/16/26 14:41, Sachin Sant wrote:
> Add fallback definitions for IORING_OP_READ and IORING_OP_WRITE
> opcodes to support building on older distributions with kernel
> headers between v5.1 and v5.5.
> 
> These opcodes were introduced in kernel v5.6, but some distros
> may have io_uring support from v5.1+ without these newer
> operation codes.
> 
> Fixes: fcc4887e73ca (io_uring: Test IORING READ and WRITE operations)
> Reported-by: Martin Doucha <mdoucha@suse.cz>
> Signed-off-by: Sachin Sant <sachinp@linux.ibm.com>
> ---
>   include/lapi/io_uring.h | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
> index c05517595..d95a4cd59 100644
> --- a/include/lapi/io_uring.h
> +++ b/include/lapi/io_uring.h
> @@ -267,6 +267,16 @@ struct io_uring_probe {
>   #define IOSQE_ASYNC		(1U << IOSQE_ASYNC_BIT)
>   #endif /* IOSQE_ASYNC */
>   
> +#ifndef IORING_OP_READ
> +/* Added in kernel v5.6 */
> +#define IORING_OP_READ		22
> +#endif /* IORING_OP_READ */
> +
> +#ifndef IORING_OP_WRITE
> +/* Added in kernel v5.6 */
> +#define IORING_OP_WRITE		23
> +#endif /* IORING_OP_WRITE */
> +
>   #ifndef HAVE_IO_URING_REGISTER
>   static inline int io_uring_register(int fd, unsigned int opcode, void *arg,
>   	unsigned int nr_args)


-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-16 16:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16 12:41 [LTP] [PATCH] lapi/io_uring: Add fallback definitions for OP_READ(WRITE) Sachin Sant
2026-04-16 13:35 ` [LTP] " linuxtestproject.agent
2026-04-16 16:18 ` [LTP] [PATCH] " Martin Doucha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox