Commit 0765fa5d authored by Juan David González Cobas's avatar Juan David González Cobas Committed by Federico Vaga

use appropriate address for vm_fault

struct vm_fault changed its definition before kernel 4.10, at commit
1a29d85eb0 to be more precise. This makes code compatible with pre- and
post- 4.10 kernels.

Signed-off by: Juan David Gonzalez Cobas <dcobas@cern.ch>
parent f2cf96d9
......@@ -8,6 +8,7 @@
* what changes.
*/
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
......@@ -24,6 +25,12 @@
#include <linux/zio-buffer.h>
#include <linux/zio-trigger.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
#define address_of(vmf) ((void*)(vmf)->address)
#else
#define address_of(vmf) ((vmf)->virtual_address)
#endif
/*
* We export a linear buffer to user space, for a single mmap call.
* The circular buffer is managed by the ZIO first-fit allocator
......@@ -460,7 +467,7 @@ static int zbk_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
addr = zbki->data + off;
pr_debug("%s: uaddr %p, off %li: kaddr %p\n", __func__,
vmf->virtual_address, off, addr);
address_of(vmf), off, addr);
p = vmalloc_to_page(addr);
get_page(p);
vmf->page = p;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment