diff options
author | Hugh Dickins <hugh.dickins@tiscali.co.uk> | 2009-09-21 20:03:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:17:40 -0400 |
commit | 58fa879e1e640a1856f736b418984ebeccee1c95 (patch) | |
tree | dc37bce8379e29c46e79f105cc71d137b14965cf /mm/nommu.c | |
parent | a13ea5b759645a0779edc6dbfec9abfd83220844 (diff) |
mm: FOLL flags for GUP flags
__get_user_pages() has been taking its own GUP flags, then processing
them into FOLL flags for follow_page(). Though oddly named, the FOLL
flags are more widely used, so pass them to __get_user_pages() now.
Sorry, VM flags, VM_FAULT flags and FAULT_FLAGs are still distinct.
(The patch to __get_user_pages() looks peculiar, with both gup_flags
and foll_flags: the gup_flags remain constant; but as before there's
an exceptional case, out of scope of the patch, in which foll_flags
per page have FOLL_WRITE masked off.)
Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Rik van Riel <riel@redhat.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index 386443e9d2c6..2d02ca17ce18 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -168,20 +168,20 @@ unsigned int kobjsize(const void *objp) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | 170 | int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, |
171 | unsigned long start, int nr_pages, int flags, | 171 | unsigned long start, int nr_pages, int foll_flags, |
172 | struct page **pages, struct vm_area_struct **vmas) | 172 | struct page **pages, struct vm_area_struct **vmas) |
173 | { | 173 | { |
174 | struct vm_area_struct *vma; | 174 | struct vm_area_struct *vma; |
175 | unsigned long vm_flags; | 175 | unsigned long vm_flags; |
176 | int i; | 176 | int i; |
177 | int write = !!(flags & GUP_FLAGS_WRITE); | ||
178 | int force = !!(flags & GUP_FLAGS_FORCE); | ||
179 | 177 | ||
180 | /* calculate required read or write permissions. | 178 | /* calculate required read or write permissions. |
181 | * - if 'force' is set, we only require the "MAY" flags. | 179 | * If FOLL_FORCE is set, we only require the "MAY" flags. |
182 | */ | 180 | */ |
183 | vm_flags = write ? (VM_WRITE | VM_MAYWRITE) : (VM_READ | VM_MAYREAD); | 181 | vm_flags = (foll_flags & FOLL_WRITE) ? |
184 | vm_flags &= force ? (VM_MAYREAD | VM_MAYWRITE) : (VM_READ | VM_WRITE); | 182 | (VM_WRITE | VM_MAYWRITE) : (VM_READ | VM_MAYREAD); |
183 | vm_flags &= (foll_flags & FOLL_FORCE) ? | ||
184 | (VM_MAYREAD | VM_MAYWRITE) : (VM_READ | VM_WRITE); | ||
185 | 185 | ||
186 | for (i = 0; i < nr_pages; i++) { | 186 | for (i = 0; i < nr_pages; i++) { |
187 | vma = find_vma(mm, start); | 187 | vma = find_vma(mm, start); |
@@ -223,9 +223,9 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
223 | int flags = 0; | 223 | int flags = 0; |
224 | 224 | ||
225 | if (write) | 225 | if (write) |
226 | flags |= GUP_FLAGS_WRITE; | 226 | flags |= FOLL_WRITE; |
227 | if (force) | 227 | if (force) |
228 | flags |= GUP_FLAGS_FORCE; | 228 | flags |= FOLL_FORCE; |
229 | 229 | ||
230 | return __get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas); | 230 | return __get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas); |
231 | } | 231 | } |