summaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
commit33263fc5f9ac8e8cb2b22d06af3ce5ac1dd815e4 (patch)
tree2d1b86a40bef0958a68cf1a2eafbeb0667a70543 /mm/mmap.c
parent216f5f51aa02f8b113aa620ebc14a9631a217a00 (diff)
Merge with Linux 2.3.32.
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 99e86653d..bdad63233 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -14,7 +14,7 @@
#include <linux/file.h>
#include <asm/uaccess.h>
-#include <asm/pgtable.h>
+#include <asm/pgalloc.h>
/* description of effects of mapping type and prot in current implementation.
* this is due to the limited x86 page protection hardware. The expected
@@ -160,8 +160,8 @@ static inline unsigned long vm_flags(unsigned long prot, unsigned long flags)
#undef _trans
}
-unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
- unsigned long prot, unsigned long flags, unsigned long off)
+unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len,
+ unsigned long prot, unsigned long flags, unsigned long pgoff)
{
struct mm_struct * mm = current->mm;
struct vm_area_struct * vma;
@@ -176,15 +176,10 @@ unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
if (len > TASK_SIZE || addr > TASK_SIZE-len)
return -EINVAL;
- if (off & ~PAGE_MASK)
- return -EINVAL;
-
/* offset overflow? */
- if (off + len < off)
+ if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
return -EINVAL;
- off = off >> PAGE_SHIFT;
-
/* Too many mappings? */
if (mm->map_count > MAX_MAP_COUNT)
return -ENOMEM;
@@ -274,7 +269,7 @@ unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
vma->vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
vma->vm_page_prot = protection_map[vma->vm_flags & 0x0f];
vma->vm_ops = NULL;
- vma->vm_pgoff = off;
+ vma->vm_pgoff = pgoff;
vma->vm_file = NULL;
vma->vm_private_data = NULL;
@@ -550,8 +545,7 @@ static struct vm_area_struct * unmap_fixup(struct vm_area_struct *area,
mpnt->vm_page_prot = area->vm_page_prot;
mpnt->vm_flags = area->vm_flags;
mpnt->vm_ops = area->vm_ops;
- mpnt->vm_pgoff = area->vm_pgoff;
- area->vm_pgoff += (end - area->vm_start) >> PAGE_SHIFT;
+ mpnt->vm_pgoff = area->vm_pgoff + ((end - area->vm_start) >> PAGE_SHIFT);
mpnt->vm_file = area->vm_file;
mpnt->vm_private_data = area->vm_private_data;
if (mpnt->vm_file)