1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
--- a/backport-include/linux/mm.h
+++ b/backport-include/linux/mm.h
@@ -39,8 +39,20 @@ static inline
long backport_get_user_pages_locked(unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages, int *locked)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,4,168))
return get_user_pages_locked(current, current->mm, start, nr_pages,
write, force, pages, locked);
+#else
+ int flags = 0;
+
+ if (write)
+ flags |= FOLL_WRITE;
+ if (force)
+ flags |= FOLL_FORCE;
+
+ return get_user_pages_locked(current, current->mm, start, nr_pages,
+ flags, pages, locked);
+#endif
}
#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked)
@@ -48,8 +60,20 @@ static inline
long backport_get_user_pages_unlocked(unsigned long start, unsigned long nr_pages,
int write, int force, struct page **pages)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,4,168))
return get_user_pages_unlocked(current, current->mm, start, nr_pages,
write, force, pages);
+#else
+ int flags = 0;
+
+ if (write)
+ flags |= FOLL_WRITE;
+ if (force)
+ flags |= FOLL_FORCE;
+
+ return get_user_pages_unlocked(current, current->mm, start, nr_pages,
+ pages, flags);
+#endif
}
#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked)
#endif
@@ -60,8 +84,20 @@ long backport_get_user_pages(unsigned lo
int write, int force, struct page **pages,
struct vm_area_struct **vmas)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,4,168))
return get_user_pages(current, current->mm, start, nr_pages,
write, force, pages, vmas);
+#else
+ int flags = 0;
+
+ if (write)
+ flags |= FOLL_WRITE;
+ if (force)
+ flags |= FOLL_FORCE;
+
+ return get_user_pages(current, current->mm, start, nr_pages,
+ flags, pages, vmas);
+#endif
}
#define get_user_pages LINUX_BACKPORT(get_user_pages)
#endif
|