u2mfn: build for both 4.6+ and older kernels
This commit is contained in:
parent
79cb426825
commit
98aed38ec5
@ -75,8 +75,13 @@ static long u2mfn_ioctl(struct file *f, unsigned int cmd,
|
|||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case U2MFN_GET_MFN_FOR_PAGE:
|
case U2MFN_GET_MFN_FOR_PAGE:
|
||||||
down_read(¤t->mm->mmap_sem);
|
down_read(¤t->mm->mmap_sem);
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
|
||||||
ret = get_user_pages
|
ret = get_user_pages
|
||||||
(data, 1, 1, 0, &user_page, 0);
|
(data, 1, 1, 0, &user_page, 0);
|
||||||
|
#else
|
||||||
|
ret = get_user_pages
|
||||||
|
(current, current->mm, data, 1, 1, 0, &user_page, 0);
|
||||||
|
#endif
|
||||||
up_read(¤t->mm->mmap_sem);
|
up_read(¤t->mm->mmap_sem);
|
||||||
if (ret != 1) {
|
if (ret != 1) {
|
||||||
printk("U2MFN_GET_MFN_FOR_PAGE: get_user_pages failed, ret=0x%lx\n", ret);
|
printk("U2MFN_GET_MFN_FOR_PAGE: get_user_pages failed, ret=0x%lx\n", ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user