aboutsummaryrefslogtreecommitdiffstats
path: root/arch/score
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-11-30 17:37:04 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-11 06:44:29 -0500
commitf8b7256096a20436f6d0926747e3ac3d64c81d24 (patch)
tree18bcabd1de263bd2d0f8d6b763bde8b037716c5c /arch/score
parent0067bd8a55862ac9dd212bd1c4f6f5bff1ca1301 (diff)
Unify sys_mmap*
New helper - sys_mmap_pgoff(); switch syscalls to using it. Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/score')
-rw-r--r--arch/score/kernel/sys_score.c25
1 files changed, 3 insertions, 22 deletions
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
index 001249469866..3d6a67dd628c 100644
--- a/arch/score/kernel/sys_score.c
+++ b/arch/score/kernel/sys_score.c
@@ -36,34 +36,15 @@ asmlinkage long
36sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 36sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
37 unsigned long flags, unsigned long fd, unsigned long pgoff) 37 unsigned long flags, unsigned long fd, unsigned long pgoff)
38{ 38{
39 int error = -EBADF; 39 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
40 struct file *file = NULL;
41
42 if (pgoff & (~PAGE_MASK >> 12))
43 return -EINVAL;
44
45 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
46 if (!(flags & MAP_ANONYMOUS)) {
47 file = fget(fd);
48 if (!file)
49 return error;
50 }
51
52 down_write(&current->mm->mmap_sem);
53 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
54 up_write(&current->mm->mmap_sem);
55
56 if (file)
57 fput(file);
58
59 return error;
60} 40}
61 41
62asmlinkage long 42asmlinkage long
63sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, 43sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
64 unsigned long flags, unsigned long fd, off_t pgoff) 44 unsigned long flags, unsigned long fd, off_t pgoff)
65{ 45{
66 return sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 46 /* where's the alignment check? */
47 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
67} 48}
68 49
69asmlinkage long 50asmlinkage long