[LTP] [PATCH] lapi/io_uring.h: Add declaration of __kernel_rwf_t

Yang Xu xuyang2018.jy@cn.fujitsu.com
Fri Jul 17 12:32:58 CEST 2020


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




More information about the ltp mailing list