lapi/io_uring: Add fallback definitions for OP_READ(WRITE)
PATCH 1/1 lapi/io_uring: Add fallback definitions for OP_READ(WRITE)
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.
--- include/lapi/io_uring.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/lapi/io_uring.h +10 -0
@@ -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)
Signature · 5 lines
2.39.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Sachin,
include/lapi/io_uring.h struct io_uring_probe { · line 278
Quoted 11 lines · Sachin Sant
lapi/io_uring: Add fallback definitions for
OP_READ(WRITE)include/lapi/io_uring.h +9
-0+#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.
---
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
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/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.
Quoted 36 lines · Sachin Sant
Add fallback definitions for
IORING_OP_READandIORING_OP_WRITEopcodes 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_uringsupport from v5.1+ without these newer operation codes.Fixes fcc4887e73ca (io_uring: Test IORING READ and WRITE operations)Reported-by Martin Doucha <[email protected]>Signed-off-by Sachin Sant <[email protected]>--- include/lapi/io_uring.h | 10 ++++++++++ 1 file changed, 10 insertions(+)include/lapi/io_uring.h +10
-0@@ -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)
Signature · 10 lines
Martin Doucha [email protected] 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
Quoted 5 lines · Martin Doucha
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.
Thanks Martin for the feedback.
For some reason I did not receive this email until today.
I also see that you have already posted an updated patch to mailing list. Let me know if you want me to send an updated patch based on the feedback.
Signature · 7 lines
Thanks - Sachin -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 6 lines · Sachin Sant
Thanks Martin for the feedback.
For some reason I did not receive this email until today.I also see that you have already posted an updated patch to mailing list. Let me know if you want me to send an updated patch based on the feedback.
Hi,
let's wait for my patch to be reviewed. You don't need to send another fix unless this one gets rejected.
Signature · 10 lines
Martin Doucha [email protected] 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