From ad76f84e1cc764a40bbbaf7e745e6d8ccc79002c Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 25 Aug 2025 21:38:04 +0300 Subject: [PATCH] Fix compat.h for even older kernel headers --- src/liburing/include/liburing/compat.h | 30 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/liburing/include/liburing/compat.h b/src/liburing/include/liburing/compat.h index f82cb26b..64822286 100644 --- a/src/liburing/include/liburing/compat.h +++ b/src/liburing/include/liburing/compat.h @@ -4,24 +4,40 @@ #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0) #include +#else +struct __kernel_timespec { + int64_t tv_sec; + int64_t tv_nsec; +}; +#endif + /* is included above and not needed again */ #define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H 1 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) #include +#else +struct open_how { + uint64_t flags; + uint16_t mode; + uint16_t __padding[3]; + uint64_t resolve; +}; +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +typedef int __kernel_rwf_t; +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0) - #include - #else - #include - #ifndef BLOCK_URING_CMD_DISCARD -#define BLOCK_URING_CMD_DISCARD _IO(0x12, 0) -#endif - +#define BLOCK_URING_CMD_DISCARD _IO(0x12, 0) +#endif #endif #endif