| 1 |
#include <linux/mm.h> |
| 2 |
|
| 3 |
// |
| 4 |
// The following kernel commit changed the get_user_pages() function signature |
| 5 |
// on linux-4.4.y: |
| 6 |
// |
| 7 |
// commit 8e50b8b07f462ab4b91bc1491b1c91bd75e4ad40 |
| 8 |
// Author: Lorenzo Stoakes <[email protected]> |
| 9 |
// Date: Thu Oct 13 01:20:16 2016 +0100 |
| 10 |
// |
| 11 |
// mm: replace get_user_pages() write/force parameters with gup_flags |
| 12 |
// |
| 13 |
// commit 768ae309a96103ed02eb1e111e838c87854d8b51 upstream. |
| 14 |
// |
| 15 |
// This removes the 'write' and 'force' from get_user_pages() and replaces |
| 16 |
// them with 'gup_flags' to make the use of FOLL_FORCE explicit in callers |
| 17 |
// as use of this flag can result in surprising behaviour (and hence bugs) |
| 18 |
// within the mm subsystem. |
| 19 |
// |
| 20 |
// This changed the function signature from: |
| 21 |
// |
| 22 |
// long get_user_pages(struct task_struct *tsk, struct mm_struct *mm, |
| 23 |
// unsigned long start, unsigned long nr_pages, |
| 24 |
// int write, int force, struct page **pages, |
| 25 |
// struct vm_area_struct **vmas); |
| 26 |
// |
| 27 |
// to: |
| 28 |
// |
| 29 |
// long get_user_pages(struct task_struct *tsk, struct mm_struct *mm, |
| 30 |
// unsigned long start, unsigned long nr_pages, |
| 31 |
// unsigned int gup_flags, struct page **pages, |
| 32 |
// struct vm_area_struct **vmas); |
| 33 |
// |
| 34 |
|
| 35 |
long gupr_wrapper(struct task_struct *tsk, struct mm_struct *mm, |
| 36 |
unsigned long start, unsigned long nr_pages, |
| 37 |
unsigned int gup_flags, struct page **pages, |
| 38 |
struct vm_area_struct **vmas); |
| 39 |
|
| 40 |
long gupr_wrapper(struct task_struct *tsk, struct mm_struct *mm, |
| 41 |
unsigned long start, unsigned long nr_pages, |
| 42 |
unsigned int gup_flags, struct page **pages, |
| 43 |
struct vm_area_struct **vmas) |
| 44 |
{ |
| 45 |
return get_user_pages(tsk, mm, start, nr_pages, gup_flags, pages, vmas); |
| 46 |
} |