From 20e11dfb21ff12589ecc3df4301b333135e5a4fc Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Wed, 10 Feb 2021 10:02:51 +0100 Subject: Add support for AlmaLinux 8 --- README.md | 13 +++++++++++++ src/kernel/xloop_main.c | 13 +++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc8f0b6..043b85b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ and the user space utility **xlosetup** to configure xloop devices. The xloop Li - Ubuntu 20.04 with **Linux kernel 5.4.x** - Ubuntu 18.04 with **Linux kernel 4.19.x** - CentOS 8 with **Linux kernel 4.18.x** + - AlmaLinux 8 with **Linux kernel 4.18.x** ## Build @@ -79,6 +80,18 @@ yum install git \ rpm-build ``` +#### AlmaLinux 8 with Linux kernel 4.18.x +```shell +yum install git \ + make \ + cmake \ + gcc \ + kernel-devel \ + elfutils-libelf-devel \ + libcap-devel \ # required only in Debug build configuration + rpm-build +``` + ### Preparation Before a build takes place, you should create a `build` directory inside the root folder of the repository. After that, change your working directory to that new directory as follows: diff --git a/src/kernel/xloop_main.c b/src/kernel/xloop_main.c index 441282a..aa75c41 100644 --- a/src/kernel/xloop_main.c +++ b/src/kernel/xloop_main.c @@ -95,6 +95,13 @@ #include +/* define RHEL_CHECK_VERSION macro to check CentOS version */ +#if defined(RHEL_RELEASE_CODE) && defined(RHEL_RELEASE_VERSION) + #define RHEL_CHECK_VERSION(CONDITION) (CONDITION) +#else + #define RHEL_CHECK_VERSION(CONDITION) (0) +#endif + static DEFINE_IDR(xloop_index_idr); static DEFINE_MUTEX(xloop_ctl_mutex); @@ -358,7 +365,8 @@ static void xloop_reread_partitions(struct xloop_device *xlo, { int rc; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0)) || \ + RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 3)) mutex_lock(&bdev->bd_mutex); rc = bdev_disk_changed(bdev, false); mutex_unlock(&bdev->bd_mutex); @@ -1035,7 +1043,8 @@ out_unlock: * must be at least one and it can only become zero when the * current holder is released. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) || \ + RHEL_CHECK_VERSION(RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 3)) if (!release) mutex_lock(&bdev->bd_mutex); err = bdev_disk_changed(bdev, false); -- cgit v1.2.3-55-g7522