* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
@ 2020-07-17 4:13 Yang Xu
2020-07-17 7:38 ` Petr Vorel
0 siblings, 1 reply; 8+ messages in thread
From: Yang Xu @ 2020-07-17 4:13 UTC (permalink / raw)
To: ltp
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
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
---
include/lapi/io_uring.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 8e47501a5..4a8978e87 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -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)
*/
--
2.23.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
2020-07-17 4:13 [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t Yang Xu
@ 2020-07-17 7:38 ` Petr Vorel
2020-07-17 8:08 ` Petr Vorel
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2020-07-17 7:38 UTC (permalink / raw)
To: ltp
Hi Xu,
> Since kernel commit ddef7ed2b5cb ("annotate RWF_... flags"), fs.h introduced
> __kernel_rwf_t data type in 4.14-rc1.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Thanks for the fix.
Going to merge it, just wait for travis verification.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
2020-07-17 7:38 ` Petr Vorel
@ 2020-07-17 8:08 ` Petr Vorel
2020-07-17 10:32 ` Yang Xu
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2020-07-17 8:08 UTC (permalink / raw)
To: ltp
> > 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.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 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/20191016211501.3777-1-petr.vorel@gmail.com/#2281586
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
2020-07-17 8:08 ` Petr Vorel
@ 2020-07-17 10:32 ` Yang Xu
2020-07-17 10:38 ` Cyril Hrubis
0 siblings, 1 reply; 8+ messages in thread
From: Yang Xu @ 2020-07-17 10:32 UTC (permalink / raw)
To: ltp
Hi Petr
>>> 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.
>
>> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>> 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.
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.
>
> Kind regards,
> Petr
>
> [1] https://patchwork.ozlabs.org/project/ltp/patch/20191016211501.3777-1-petr.vorel@gmail.com/#2281586
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
2020-07-17 10:32 ` Yang Xu
@ 2020-07-17 10:38 ` Cyril Hrubis
2020-07-17 11:04 ` Petr Vorel
2020-07-17 11:29 ` Petr Vorel
0 siblings, 2 replies; 8+ messages in thread
From: Cyril Hrubis @ 2020-07-17 10:38 UTC (permalink / raw)
To: ltp
Hi!
> 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.
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.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
2020-07-17 10:38 ` Cyril Hrubis
@ 2020-07-17 11:04 ` Petr Vorel
2020-07-17 11:29 ` Petr Vorel
1 sibling, 0 replies; 8+ messages in thread
From: Petr Vorel @ 2020-07-17 11:04 UTC (permalink / raw)
To: ltp
Hi,
> > 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.
> 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.
Make sense, going to push this variant.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
2020-07-17 10:38 ` Cyril Hrubis
2020-07-17 11:04 ` Petr Vorel
@ 2020-07-17 11:29 ` Petr Vorel
2020-07-19 17:26 ` Jan Stancek
1 sibling, 1 reply; 8+ messages in thread
From: Petr Vorel @ 2020-07-17 11:29 UTC (permalink / raw)
To: ltp
Hi,
> > 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.
> 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.
Merged. Thanks both of you for your comments.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t
2020-07-17 11:29 ` Petr Vorel
@ 2020-07-19 17:26 ` Jan Stancek
0 siblings, 0 replies; 8+ messages in thread
From: Jan Stancek @ 2020-07-19 17:26 UTC (permalink / raw)
To: ltp
----- Original Message -----
> Hi,
>
> > > 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.
>
> > 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.
+1
> Merged. Thanks both of you for your comments.
Thanks. Sorry for late/no response, I have some time off with limited access to email.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-07-19 17:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-17 4:13 [LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t Yang Xu
2020-07-17 7:38 ` Petr Vorel
2020-07-17 8:08 ` Petr Vorel
2020-07-17 10:32 ` Yang Xu
2020-07-17 10:38 ` Cyril Hrubis
2020-07-17 11:04 ` Petr Vorel
2020-07-17 11:29 ` Petr Vorel
2020-07-19 17:26 ` Jan Stancek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.