Skip to content

Commit

Permalink
Fix compilation on RHEL <9.x
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Baldyga <[email protected]>
  • Loading branch information
robertbaldyga committed Jul 11, 2024
1 parent 0cf71d4 commit 4b693a5
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions modules/cas_cache/exp_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,26 @@ static inline void bd_release_from_disk(struct block_device *bdev,
return bd_unlink_disk_holder(bdev, disk);
}

#ifdef RHEL_MAJOR
#if RHEL_MAJOR >= 9
#define KRETURN(x) return
#define MAKE_RQ_RET_TYPE void
#endif
#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
#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
#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
#if RHEL_MAJOR >= 9
#define KRETURN(x) return
#define MAKE_RQ_RET_TYPE void
#endif
#endif

int __init cas_init_exp_objs(void)
Expand Down

0 comments on commit 4b693a5

Please sign in to comment.