u2mfn: Make compatible with kernel versions >= 5.3.y

This commit is contained in:
M. Vefa Bicakci 2019-08-17 03:45:22 -04:00
parent 425f7f4f07
commit 5a83961a88
No known key found for this signature in database
GPG Key ID: 1DF87CE3B3A5DFAF

View File

@ -54,10 +54,17 @@ static inline unsigned long VIRT_TO_MFN(void *addr)
} }
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0)
static int u2mfn_get_mfn(pte_t *pte, unsigned long addr, void *data) {
*((unsigned long *) data) = pfn_to_mfn(pte_pfn(*pte));
return 0;
}
#else
static int u2mfn_get_mfn(pte_t *pte, pgtable_t token, unsigned long addr, void *data) { static int u2mfn_get_mfn(pte_t *pte, pgtable_t token, unsigned long addr, void *data) {
*((unsigned long *) data) = pfn_to_mfn(pte_pfn(*pte)); *((unsigned long *) data) = pfn_to_mfn(pte_pfn(*pte));
return 0; return 0;
} }
#endif
/// User virtual address to mfn translator /// User virtual address to mfn translator
/** /**