Fix build for RHEL 9 kernels

RHEL 9 is using the 5.14 kernel, but they have picked up a patch from
5.15 that broke the api for us:

  https://github.com/linux-apfs/linux-apfs-rw/issues/26

They don't seem to provide a macro to check the exact kernel version in
use, so treat all 5.14 RHEL kernels as 5.15. This will of course break
the build for RHEL users who haven't updated their kernels, but I don't
know of a better way to handle the problem.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
This commit is contained in:
Ernesto A. Fernández
2022-07-19 19:00:20 -03:00
parent 3c8f1b7dd4
commit 1a0b9fb8af
+3 -3
View File
@@ -1080,10 +1080,10 @@ static int apfs_setup_bdi(struct super_block *sb)
struct backing_dev_info *bdi_dev = NULL, *bdi_sb = NULL;
int err;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)
bdi_dev = nxi->nx_bdev->bd_bdi;
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0) || (defined(RHEL_RELEASE) && LINUX_VERSION_CODE == KERNEL_VERSION(5, 14, 0))
bdi_dev = nxi->nx_bdev->bd_disk->bdi;
#else
bdi_dev = nxi->nx_bdev->bd_bdi;
#endif
err = super_setup_bdi(sb);