aboutsummaryrefslogtreecommitdiffstats
path: root/loopback_driver.h
diff options
context:
space:
mode:
authorMichele Paolino <m.paolino@virtualopensystems.com>2024-07-12 13:13:30 +0000
committerMichele Paolino <m.paolino@virtualopensystems.com>2024-07-25 13:38:07 +0000
commit78268b295615143255c9968087897226e9c16053 (patch)
tree2c82ff186c3efc2e7eaf76d7278ce363e7d46445 /loopback_driver.h
parentc434ed98e4269ac17456242c42a4a67bb05e24dd (diff)
virtio-loopback-driver fixes
Updates kernel version checks to successfully compile both on aws and AGL Ref Hardware v2: improve accuracy of the linux kernel versions Bug-AGL: SPEC-4834 Change-Id: Ibc75e3b1b8c1085afbcb02bd4976080b7dbc59cb Signed-off-by: Michele Paolino <m.paolino@virtualopensystems.com>
Diffstat (limited to 'loopback_driver.h')
-rw-r--r--loopback_driver.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/loopback_driver.h b/loopback_driver.h
index 1a767d9..bb713aa 100644
--- a/loopback_driver.h
+++ b/loopback_driver.h
@@ -24,6 +24,8 @@
#define DRIVER "LOOPBACK"
+#include <linux/version.h>
+
/* max Minor devices */
#define MAX_DEV 1
@@ -348,7 +350,12 @@ int mmap_communication_shared_space(struct file *filp, struct vm_area_struct *vm
uint64_t com_mmap_pfn = ((uint64_t)virt_to_phys(com_mmap_virt)) >> PAGE_SHIFT;
int ret;
- vm_flags_set(vma, VM_RESERVED);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,16,0)
+ vma->vm_flags |= VM_RESERVED;
+#else
+ vm_flags_set(vma, VM_RESERVED);
+#endif
+
ret = remap_pfn_range(vma, vma->vm_start, com_mmap_pfn, size, vma->vm_page_prot);
if (ret != 0) {