summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorManuel Bentele2021-02-10 10:02:51 +0100
committerManuel Bentele2021-02-10 10:02:51 +0100
commit20e11dfb21ff12589ecc3df4301b333135e5a4fc (patch)
tree831e7fa97c22ae621ab37574a7792bd7c162a9e4 /src
parentAdd support of Linux LTS kernel 5.10.x (diff)
downloadxloop-20e11dfb21ff12589ecc3df4301b333135e5a4fc.tar.gz
xloop-20e11dfb21ff12589ecc3df4301b333135e5a4fc.tar.xz
xloop-20e11dfb21ff12589ecc3df4301b333135e5a4fc.zip
Add support for AlmaLinux 8
Diffstat (limited to 'src')
-rw-r--r--src/kernel/xloop_main.c13
1 files changed, 11 insertions, 2 deletions
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 <linux/uaccess.h>
+/* 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);