Merge pull request #1476 from robertbaldyga/fix-compilation-on-older-rhel

Fix compilation on RHEL <9.x
This commit is contained in:
Robert Baldyga 2024-07-12 11:54:35 +02:00 committed by GitHub
commit eb97598e48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,25 +31,26 @@ static inline void bd_release_from_disk(struct block_device *bdev,
return bd_unlink_disk_holder(bdev, disk); return bd_unlink_disk_holder(bdev, disk);
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#define KRETURN(x) return
#define MAKE_RQ_RET_TYPE void
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
#define KRETURN(x) ({ return (x); })
#define MAKE_RQ_RET_TYPE blk_qc_t
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
#define KRETURN(x) return
#define MAKE_RQ_RET_TYPE void
#else
#define KRETURN(x) ({ return (x); })
#define MAKE_RQ_RET_TYPE int
#endif
/* For RHEL 9.x we assume backport from kernel 5.18+ */
#ifdef RHEL_MAJOR #ifdef RHEL_MAJOR
#if RHEL_MAJOR >= 9 #if RHEL_MAJOR >= 9
#define KRETURN(x) return #define KRETURN(x) return
#define MAKE_RQ_RET_TYPE void #define MAKE_RQ_RET_TYPE void
#endif #endif
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#define KRETURN(x) return
#define MAKE_RQ_RET_TYPE void
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
#define KRETURN(x) ({ return (x); })
#define MAKE_RQ_RET_TYPE blk_qc_t
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
#define KRETURN(x) return
#define MAKE_RQ_RET_TYPE void
#else
#define KRETURN(x) ({ return (x); })
#define MAKE_RQ_RET_TYPE int
#endif
#endif #endif
int __init cas_init_exp_objs(void) int __init cas_init_exp_objs(void)