aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-05-30 20:11:57 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-06-01 10:37:17 -0400
commitdc982501d9643ab0c117e7d87562857ce234652d (patch)
tree6783ecec372875f18f8050f97fbb86f72b8bb890 /mm
parente3fc629d7bb70848fbf479688a66d4e76dff46ac (diff)
kill do_mmap() completely
just pull into vm_mmap() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c16
-rw-r--r--mm/nommu.c16
2 files changed, 10 insertions, 22 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index f7786542c59d..538c905d6d9b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1102,28 +1102,22 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1102 return mmap_region(file, addr, len, flags, vm_flags, pgoff); 1102 return mmap_region(file, addr, len, flags, vm_flags, pgoff);
1103} 1103}
1104 1104
1105static unsigned long do_mmap(struct file *file, unsigned long addr, 1105unsigned long vm_mmap(struct file *file, unsigned long addr,
1106 unsigned long len, unsigned long prot, 1106 unsigned long len, unsigned long prot,
1107 unsigned long flag, unsigned long offset) 1107 unsigned long flag, unsigned long offset)
1108{ 1108{
1109 unsigned long ret;
1110 struct mm_struct *mm = current->mm;
1111
1109 if (unlikely(offset + PAGE_ALIGN(len) < offset)) 1112 if (unlikely(offset + PAGE_ALIGN(len) < offset))
1110 return -EINVAL; 1113 return -EINVAL;
1111 if (unlikely(offset & ~PAGE_MASK)) 1114 if (unlikely(offset & ~PAGE_MASK))
1112 return -EINVAL; 1115 return -EINVAL;
1113 return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1114}
1115
1116unsigned long vm_mmap(struct file *file, unsigned long addr,
1117 unsigned long len, unsigned long prot,
1118 unsigned long flag, unsigned long offset)
1119{
1120 unsigned long ret;
1121 struct mm_struct *mm = current->mm;
1122 1116
1123 ret = security_mmap_file(file, prot, flag); 1117 ret = security_mmap_file(file, prot, flag);
1124 if (!ret) { 1118 if (!ret) {
1125 down_write(&mm->mmap_sem); 1119 down_write(&mm->mmap_sem);
1126 ret = do_mmap(file, addr, len, prot, flag, offset); 1120 ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1127 up_write(&mm->mmap_sem); 1121 up_write(&mm->mmap_sem);
1128 } 1122 }
1129 return ret; 1123 return ret;
diff --git a/mm/nommu.c b/mm/nommu.c
index a1792ed2cb1a..e6123a5b2cc1 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1470,28 +1470,22 @@ error_getting_region:
1470 return -ENOMEM; 1470 return -ENOMEM;
1471} 1471}
1472 1472
1473static unsigned long do_mmap(struct file *file, unsigned long addr, 1473unsigned long vm_mmap(struct file *file, unsigned long addr,
1474 unsigned long len, unsigned long prot, 1474 unsigned long len, unsigned long prot,
1475 unsigned long flag, unsigned long offset) 1475 unsigned long flag, unsigned long offset)
1476{ 1476{
1477 unsigned long ret;
1478 struct mm_struct *mm = current->mm;
1479
1477 if (unlikely(offset + PAGE_ALIGN(len) < offset)) 1480 if (unlikely(offset + PAGE_ALIGN(len) < offset))
1478 return -EINVAL; 1481 return -EINVAL;
1479 if (unlikely(offset & ~PAGE_MASK)) 1482 if (unlikely(offset & ~PAGE_MASK))
1480 return -EINVAL; 1483 return -EINVAL;
1481 return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1482}
1483
1484unsigned long vm_mmap(struct file *file, unsigned long addr,
1485 unsigned long len, unsigned long prot,
1486 unsigned long flag, unsigned long offset)
1487{
1488 unsigned long ret;
1489 struct mm_struct *mm = current->mm;
1490 1484
1491 ret = security_mmap_file(file, prot, flag); 1485 ret = security_mmap_file(file, prot, flag);
1492 if (!ret) { 1486 if (!ret) {
1493 down_write(&mm->mmap_sem); 1487 down_write(&mm->mmap_sem);
1494 ret = do_mmap(file, addr, len, prot, flag, offset); 1488 ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1495 up_write(&mm->mmap_sem); 1489 up_write(&mm->mmap_sem);
1496 } 1490 }
1497 return ret; 1491 return ret;