Fix signature of ->page_mkwrite() for before 4.11

On ->page_mkwrite(), newer kernels need to retrieve the vm_area_struct
pointer from the vm_fault. For older kernels this would not have been
possible, and the vm_area_struct was passed as an argument instead.
Use macros to get all versions to build.

This problem was reported by Luflosi here:

  https://github.com/linux-apfs/linux-apfs-rw/issues/19#issuecomment-918033297

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
This commit is contained in:
Ernesto A. Fernández
2021-09-13 13:25:28 -03:00
parent f279e25de4
commit 7a94546cb7
+5
View File
@@ -9,9 +9,14 @@
typedef int vm_fault_t;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
static vm_fault_t apfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{
#else
static vm_fault_t apfs_page_mkwrite(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
#endif
struct page *page = vmf->page;
struct inode *inode = file_inode(vmf->vma->vm_file);
struct super_block *sb = inode->i_sb;