aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/kernel
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/cris/kernel
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/cris/kernel')
-rw-r--r--arch/cris/kernel/sys_cris.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 2ad962c7e88e..c2bbb1ac98a9 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -26,31 +26,6 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/segment.h> 27#include <asm/segment.h>
28 28
29/* common code for old and new mmaps */
30static inline long
31do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
32 unsigned long flags, unsigned long fd, unsigned long pgoff)
33{
34 int error = -EBADF;
35 struct file * file = NULL;
36
37 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
38 if (!(flags & MAP_ANONYMOUS)) {
39 file = fget(fd);
40 if (!file)
41 goto out;
42 }
43
44 down_write(&current->mm->mmap_sem);
45 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
46 up_write(&current->mm->mmap_sem);
47
48 if (file)
49 fput(file);
50out:
51 return error;
52}
53
54asmlinkage unsigned long old_mmap(unsigned long __user *args) 29asmlinkage unsigned long old_mmap(unsigned long __user *args)
55{ 30{
56 unsigned long buffer[6]; 31 unsigned long buffer[6];
@@ -63,7 +38,7 @@ asmlinkage unsigned long old_mmap(unsigned long __user *args)
63 if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */ 38 if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */
64 goto out; 39 goto out;
65 40
66 err = do_mmap2(buffer[0], buffer[1], buffer[2], buffer[3], 41 err = sys_mmap_pgoff(buffer[0], buffer[1], buffer[2], buffer[3],
67 buffer[4], buffer[5] >> PAGE_SHIFT); 42 buffer[4], buffer[5] >> PAGE_SHIFT);
68out: 43out:
69 return err; 44 return err;
@@ -73,7 +48,8 @@ asmlinkage long
73sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 48sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
74 unsigned long flags, unsigned long fd, unsigned long pgoff) 49 unsigned long flags, unsigned long fd, unsigned long pgoff)
75{ 50{
76 return do_mmap2(addr, len, prot, flags, fd, pgoff); 51 /* bug(?): 8Kb pages here */
52 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
77} 53}
78 54
79/* 55/*