File 0004-oracleasm-Kernel-interface-tweaks-for-5.3.patch of Package oracleasm.28233
diff -ur oracleasm-2.0.8.orig/source/drivers/block/oracleasm/driver.c oracleasm-2.0.8/source/drivers/block/oracleasm/driver.c
--- oracleasm-2.0.8.orig/source/drivers/block/oracleasm/driver.c 2019-08-08 15:57:49.466645854 +0200
+++ oracleasm-2.0.8/source/drivers/block/oracleasm/driver.c 2019-08-08 19:14:21.942683135 +0200
@@ -72,6 +72,7 @@
#include <linux/log2.h>
#include <linux/bug.h>
#include <linux/uio.h>
+#include <linux/timer.h>
#include <asm/uaccess.h>
#include <linux/spinlock.h>
@@ -146,9 +147,13 @@
void asm_bio_unmap(struct bio *bio)
{
struct bio_vec *bvec;
- int i;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
+ int iter_all;
+#else
+ struct bvec_iter_all iter_all;
+#endif
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all(bvec, bio, iter_all) {
if (bio_data_dir(bio) == READ)
set_page_dirty_lock(bvec->bv_page);
@@ -322,7 +327,6 @@
}
}
-
static struct super_operations asmdisk_sops = {
.statfs = simple_statfs,
.alloc_inode = asmdisk_alloc_inode,
@@ -331,16 +335,32 @@
.evict_inode = asmdisk_evict_inode,
};
-
+#define AMDISK_MAGIC 0x61736D64
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
static struct dentry * asmdisk_mount(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data)
{
- return mount_pseudo(fs_type, "asmdisk:", &asmdisk_sops, NULL, 0x61736D64);
+ return mount_pseudo(fs_type, "asmdisk:", &asmdisk_sops, NULL, AMDISK_MAGIC);
+}
+#else
+#include <linux/pseudo_fs.h>
+static int amdisk_init_fs_context(struct fs_context *fc)
+{
+ struct pseudo_fs_context *ctx = init_pseudo(fc, AMDISK_MAGIC);
+ if (!ctx)
+ return -ENOMEM;
+ ctx->ops = &asmdisk_sops;
+ return 0;
}
+#endif
static struct file_system_type asmdisk_type = {
.name = "asmdisk",
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0)
.mount = asmdisk_mount,
+#else
+ .init_fs_context= amdisk_init_fs_context,
+#endif
.kill_sb = kill_anon_super,
};
@@ -852,9 +872,15 @@
wait_queue_head_t wait;
};
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
static void timeout_func(unsigned long data)
{
struct timeout *to = (struct timeout *)data;
+#else
+static void timeout_func(struct timer_list *t)
+{
+ struct timeout *to = from_timer(to, t, timer);
+#endif
to->timed_out = 1;
wake_up(&to->wait);
@@ -862,9 +888,13 @@
static inline void init_timeout(struct timeout *to)
{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
init_timer(&to->timer);
to->timer.data = (unsigned long)to;
to->timer.function = timeout_func;
+#else
+ timer_setup(&to->timer, timeout_func, (unsigned long)to);
+#endif
to->timed_out = 0;
init_waitqueue_head(&to->wait);
}
@@ -1746,8 +1776,7 @@
/* We open-code get_compat_timespec() because it's not exported */
if (bpl == ASM_BPL_32)
- return (!access_ok(VERIFY_READ, cut,
- sizeof(*cut)) ||
+ return (!read_ok(cut, sizeof(*cut)) ||
__get_user(ts->tv_sec, &cut->tv_sec) ||
__get_user(ts->tv_nsec, &cut->tv_nsec)) ? -EFAULT : 0;
@@ -2382,9 +2411,6 @@
.getattr = simple_getattr,
};
-/* See init_asmfs_dir_operations() */
-static struct file_operations asmfs_dir_operations = {0, };
-
static struct inode_operations asmfs_disk_dir_inode_operations = {
.lookup = simple_lookup,
.unlink = simple_unlink,
Only in oracleasm-2.0.8/source/drivers/block/oracleasm: driver.c~
diff -ur oracleasm-2.0.8.orig/source/include/linux/oracleasm/kernel.h oracleasm-2.0.8/source/include/linux/oracleasm/kernel.h
--- oracleasm-2.0.8.orig/source/include/linux/oracleasm/kernel.h 2017-09-19 01:07:50.000000000 +0200
+++ oracleasm-2.0.8/source/include/linux/oracleasm/kernel.h 2019-08-08 18:15:33.985267181 +0200
@@ -45,6 +45,14 @@
#ifdef __KERNEL__
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) && defined(VERIFY_WRITE)
+ #define write_ok(addr, size) access_ok(VERIFY_WRITE, addr, size)
+ #define read_ok(addr, size) access_ok(VERIFY_READ, addr, size)
+#else
+ #define write_ok(addr, size) access_ok(addr, size)
+ #define read_ok(addr, size) access_ok(addr, size)
+#endif
+
/*
* ASM Defines
*/