lapi/io_uring.h: Add declaration of __kernel_rwf_t
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
Since kernel commit ddef7ed2b5cb ("annotate RWF_... flags"), fs.h introduced
__kernel_rwf_t data type in 4.14-rc1.
Fix build error on old kernel.
In file included from io_uring01.c:20:../../../../include/lapi/io_uring.h:38: error: expected specifier-qualifier-list before ?__kernel_rwf_t? io_uring01.c:266: warning: missing initializer
io_uring01.c:266: warning: (near initialization for ?(anonymous)[1].ptr?) io_uring01.c:268: warning: missing initializer
io_uring01.c:268: warning: (near initialization for ?test.caps?)
make: *** [io_uring01] Error 1
--- include/lapi/io_uring.h | 5 +++++ 1 file changed, 5 insertions(+)
include/lapi/io_uring.h +5 -0
@@ -12,6 +12,7 @@#include <unistd.h> #include <fcntl.h> #include <sys/types.h> +#include <linux/types.h> #include <sys/uio.h> #include <stdlib.h> #include <linux/fs.h>
@@ -20,6 +21,10 @@#ifndef IOSQE_FIXED_FILE +#ifndef __kernel_rwf_t +typedef int __bitwise __kernel_rwf_t ; +#endif +/* * IO submission data structure (Submission Queue Entry) */
Signature · 1 line
2.23.0
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
Hi Xu,
Quoted 2 lines
Since kernel commit
ddef7ed2b5cb("annotateRWF_... flags"),fs.hintroduced
__kernel_rwf_tdata type in 4.14-rc1.
Thanks for the fix.
Going to merge it, just wait for travis verification.
Kind regards,
Petr
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
Quoted 8 lines
Quoted 4 lines
Since kernel commit
ddef7ed2b5cb("annotateRWF_... flags"),fs.hintroduced
__kernel_rwf_tdata type in 4.14-rc1.Fix build error on old kernel.
Reviewed-by Petr Vorel <[email protected]>Thanks for the fix.
Going to merge it, just wait for travis verification.
BTW the regression was caused by my changes to the lapi header in 95399bc87 ("lapi/io_uring: Preparation for io_uring tests") - I updated the header.
We might consider not including <linux/types.h>, it's needed just for __kernel_rwf_t. I'm against these optimisations (as the definition can change), but I remember Jan asked me to avoid including kernel header just for single use [1], but maybe this is a different case.
Kind regards,
Petr
[1] https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/#2281586
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
Hi Petr
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Since kernel commit
ddef7ed2b5cb("annotateRWF_... flags"),fs.hintroduced
__kernel_rwf_tdata type in 4.14-rc1.Fix build error on old kernel.
Reviewed-by Petr Vorel <[email protected]>Thanks for the fix.
Going to merge it, just wait for travis verification.
Quoted 7 lines
BTW the regression was caused by my changes to the lapi header in
95399bc87("lapi/io_uring: Preparation forio_uringtests") - I updated the header.We might consider not including <
linux/types.h>, it's needed just for__kernel_rwf_t. I'm against these optimisations (as the definition can change), but I remember Jan asked me to avoid including kernel header just for single use [1], but maybe this is a different case.
I still remember the similar case when clean up quotactl code(commit c4bf6f66 lapi/quotactl.h: Use libc headers instead kernel uapi) last year.
how about the follwing change
+#ifdef __CHECKER__
+#define __bitwise__ __attribute__((bitwise))
+#else
+#define __bitwise__
+#endif
+#define __bitwise __bitwise__
+
+#ifndef __kernel_rwf_t
+typedef int __bitwise __kernel_rwf_t;
+#endif
Also, I think we should replace _u32 with uint32 in lapi/loop.h if we don't want to include linux kernel header for single use.
Quoted 7 lines
Kind regards,
Petr[1] https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/#2281586
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
Hi!
Quoted 13 lines
how about the follwing change
(quoted diff) +10
-0+#ifdef __CHECKER__ +#define __bitwise__ __attribute__((bitwise)) +#else +#define __bitwise__ +#endif +#define __bitwise __bitwise__ + +#ifndef __kernel_rwf_t +typedef int __bitwise __kernel_rwf_t; +#endif
Quoted 2 lines
Also, I think we should replace
_u32with uint32 inlapi/loop.hif we don't want to include linux kernel header for single use.
The whole __bitwise is used only by a sparse checker, there is no point to include it in LTP. So we can just typedef the __kernel_rwf_t to int.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
Hi,
Quoted 13 lines
Quoted 12 lines
how about the follwing change
(quoted diff) +10
-0+#ifdef __CHECKER__ +#define __bitwise__ __attribute__((bitwise)) +#else +#define __bitwise__ +#endif +#define __bitwise __bitwise__ + +#ifndef __kernel_rwf_t +typedef int __bitwise __kernel_rwf_t; +#endif
Quoted 5 lines
Quoted 2 lines
Also, I think we should replace
_u32with uint32 inlapi/loop.hif we don't want to include linux kernel header for single use.The whole
__bitwiseis used only by a sparse checker, there is no point to include it in LTP. So we can just typedef the__kernel_rwf_tto int.
Make sense, going to push this variant.
Kind regards,
Petr
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
In reply to Cyril HrubisHi,
Quoted 5 lines
Quoted 2 lines
Also, I think we should replace
_u32with uint32 inlapi/loop.hif we don't want to include linux kernel header for single use.The whole
__bitwiseis used only by a sparse checker, there is no point to include it in LTP. So we can just typedef the__kernel_rwf_tto int.
Merged. Thanks both of you for your comments.
Kind regards,
Petr
PATCH 1/1 lapi/io_uring.h: Add declaration of __kernel_rwf_t
----- Original Message -----
Quoted 7 lines
Hi,
Quoted 5 lines
Quoted 2 lines
Also, I think we should replace
_u32with uint32 inlapi/loop.hif we don't want to include linux kernel header for single use.The whole
__bitwiseis used only by a sparse checker, there is no point to include it in LTP. So we can just typedef the__kernel_rwf_tto int.
+1
Quoted 1 line
Merged. Thanks both of you for your comments.
Thanks. Sorry for late/no response, I have some time off with limited access to email.