summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2024-03-15 14:52:09 +0100
committerSimon Rettberg2024-03-15 14:52:09 +0100
commit513c0878607e9cf6fdb3b851a5686f7dd252ddd5 (patch)
treeffc73b4ce0678da780202281beeefcc3e9514347 /src
parent[KERNEL] Fix build on Alma/RHEL/Rocky 9.2 (diff)
downloadxloop-513c0878607e9cf6fdb3b851a5686f7dd252ddd5.tar.gz
xloop-513c0878607e9cf6fdb3b851a5686f7dd252ddd5.tar.xz
xloop-513c0878607e9cf6fdb3b851a5686f7dd252ddd5.zip
[KERNEL] Fix build on CentOS/Rocky/Alma 9.4
Diffstat (limited to 'src')
-rw-r--r--src/kernel/xloop_main_rhel_9.0.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/kernel/xloop_main_rhel_9.0.c b/src/kernel/xloop_main_rhel_9.0.c
index 66f6884..0d82b79 100644
--- a/src/kernel/xloop_main_rhel_9.0.c
+++ b/src/kernel/xloop_main_rhel_9.0.c
@@ -101,6 +101,12 @@ static DEFINE_IDR(xloop_index_idr);
static DEFINE_MUTEX(xloop_ctl_mutex);
static DEFINE_MUTEX(xloop_validate_mutex);
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 4)
+#define FMODE_EXCL BLK_OPEN_EXCL
+// This is ugly as fmode_t still exists but since it's unused here just do this :)
+#define fmode_t blk_mode_t
+#endif
+
/**
* xloop_global_lock_killable() - take locks for safe xloop_validate_file() test
*
@@ -911,7 +917,11 @@ static int xloop_configure(struct xloop_device *xlo, fmode_t mode,
* here to avoid changing device under exclusive owner.
*/
if (!(mode & FMODE_EXCL)) {
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 4)
+ error = bd_prepare_to_claim(bdev, xloop_configure, NULL);
+#else
error = bd_prepare_to_claim(bdev, xloop_configure);
+#endif
if (error)
goto out_putf;
}
@@ -1753,9 +1763,15 @@ static int xlo_compat_ioctl(struct block_device *bdev, fmode_t mode,
}
#endif
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 4)
+static int xlo_open(struct gendisk *disk, blk_mode_t mode)
+{
+ struct xloop_device *xlo = disk->private_data;
+#else
static int xlo_open(struct block_device *bdev, fmode_t mode)
{
struct xloop_device *xlo = bdev->bd_disk->private_data;
+#endif
int err;
err = mutex_lock_killable(&xlo->xlo_mutex);
@@ -1769,7 +1785,11 @@ static int xlo_open(struct block_device *bdev, fmode_t mode)
return err;
}
+#if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 4)
+static void xlo_release(struct gendisk *disk)
+#else
static void xlo_release(struct gendisk *disk, fmode_t mode)
+#endif
{
struct xloop_device *xlo = disk->private_data;