*参照元 [#ub18603a]
#backlinks

*説明 [#qa639f91]
-パス: [[linux-2.6.33/mm/nommu.c]]

-FIXME: これは何?
--説明


**引数 [#c69109e4]
-struct task_struct *tsk
--
--[[linux-2.6.33/task_struct]]
-struct mm_struct *mm
--
--[[linux-2.6.33/mm_struct]]
-unsigned long start
--
-int nr_pages
-unsigned int foll_flags
--
-int write
--
-int force
--
-struct page **pages
--
--[[linux-2.6.33/page]]
-struct vm_area_struct **vmas
-
--[[linux-2.6.33/vm_area_struct]]


**返り値 [#g83da4ba]
-int
--


**参考 [#k6d846df]


*実装 [#rd1bf7c9]
 int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
 		     unsigned long start, int nr_pages, unsigned int foll_flags,
 		     struct page **pages, struct vm_area_struct **vmas)
 {
 	struct vm_area_struct *vma;
 	unsigned long vm_flags;
 	int i;
 
 	/* calculate required read or write permissions.
 	 * If FOLL_FORCE is set, we only require the "MAY" flags.
 	 */
 	vm_flags  = (foll_flags & FOLL_WRITE) ?
 			(VM_WRITE | VM_MAYWRITE) : (VM_READ | VM_MAYREAD);
 	vm_flags &= (foll_flags & FOLL_FORCE) ?
 			(VM_MAYREAD | VM_MAYWRITE) : (VM_READ | VM_WRITE);
 
-
--[[linux-2.6.33/FOLL_WRITE]]
-
--[[linux-2.6.33/FOLL_FORCE]]
-
--[[linux-2.6.33/VM_WRITE]]
-
--[[linux-2.6.33/VM_MAYWRITE]]
-
--[[linux-2.6.33/VM_READ]]
-
--[[linux-2.6.33/VM_MAYREAD]]

 	for (i = 0; i < nr_pages; i++) {
 		vma = find_vma(mm, start);
 		if (!vma)
 			goto finish_or_fault;
 
-
--[[linux-2.6.33/find_vma()]]

 		/* protect what we can, including chardevs */
 		if ((vma->vm_flags & (VM_IO | VM_PFNMAP)) ||
 		    !(vm_flags & vma->vm_flags))
 			goto finish_or_fault;
 
-
--[[linux-2.6.33/VM_IO]]
-
--[[linux-2.6.33/VM_PFNMAP]]

 		if (pages) {
 			pages[i] = virt_to_page(start);
 			if (pages[i])
 				page_cache_get(pages[i]);
 		}
-
--[[linux-2.6.33/virt_to_page()]]
-
--[[linux-2.6.33/page_cache_get()]]

 		if (vmas)
 			vmas[i] = vma;
 		start += PAGE_SIZE;
 	}
 
 	return i;
 
 finish_or_fault:
 	return i ? : -EFAULT;
 }


*コメント [#u4c0e316]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS