summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-06-25 21:31:57 +0200
committerPaul Mundt <lethal@linux-sh.org>2009-06-25 21:31:57 +0200
commitdfc2f91ac29f5ef50e74bf15a1a6b6aa6b952e62 (patch)
tree0b3eb3ae6b7b21226cf8e1410aa6dd6d0e07a110 /mm
parentsh: Kill off unused DEBUG_BOOTMEM symbol. (diff)
downloadlinux-dfc2f91ac29f5ef50e74bf15a1a6b6aa6b952e62.tar.xz
linux-dfc2f91ac29f5ef50e74bf15a1a6b6aa6b952e62.zip
nommu: provide follow_pfn().
With the introduction of follow_pfn() as an exported symbol, modules have begun making use of it. Unfortunately this was not reflected on nommu at the time, so the in-tree users have subsequently all blown up with link errors there. This provides a simple follow_pfn() that just returns addr >> PAGE_SHIFT, which will do the right thing on nommu. There is no need to do range checking within the vma, as the find_vma() case will already take care of this. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/nommu.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index 2fd2ad5da98e..598bc871487a 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -240,6 +240,27 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
}
EXPORT_SYMBOL(get_user_pages);
+/**
+ * follow_pfn - look up PFN at a user virtual address
+ * @vma: memory mapping
+ * @address: user virtual address
+ * @pfn: location to store found PFN
+ *
+ * Only IO mappings and raw PFN mappings are allowed.
+ *
+ * Returns zero and the pfn at @pfn on success, -ve otherwise.
+ */
+int follow_pfn(struct vm_area_struct *vma, unsigned long address,
+ unsigned long *pfn)
+{
+ if (!(vma->vm_flags & (VM_IO | VM_PFNMAP)))
+ return -EINVAL;
+
+ *pfn = address >> PAGE_SHIFT;
+ return 0;
+}
+EXPORT_SYMBOL(follow_pfn);
+
DEFINE_RWLOCK(vmlist_lock);
struct vm_struct *vmlist;