diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-11-30 17:37:04 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-11 06:44:29 -0500 |
commit | f8b7256096a20436f6d0926747e3ac3d64c81d24 (patch) | |
tree | 18bcabd1de263bd2d0f8d6b763bde8b037716c5c /arch/microblaze | |
parent | 0067bd8a55862ac9dd212bd1c4f6f5bff1ca1301 (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/microblaze')
-rw-r--r-- | arch/microblaze/kernel/sys_microblaze.c | 38 | ||||
-rw-r--r-- | arch/microblaze/kernel/syscall_table.S | 2 |
2 files changed, 4 insertions, 36 deletions
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c index 07cabed4b947..9f3c205fb75b 100644 --- a/arch/microblaze/kernel/sys_microblaze.c +++ b/arch/microblaze/kernel/sys_microblaze.c | |||
@@ -62,46 +62,14 @@ out: | |||
62 | return error; | 62 | return error; |
63 | } | 63 | } |
64 | 64 | ||
65 | asmlinkage long | ||
66 | sys_mmap2(unsigned long addr, unsigned long len, | ||
67 | unsigned long prot, unsigned long flags, | ||
68 | unsigned long fd, unsigned long pgoff) | ||
69 | { | ||
70 | struct file *file = NULL; | ||
71 | int ret = -EBADF; | ||
72 | |||
73 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
74 | if (!(flags & MAP_ANONYMOUS)) { | ||
75 | file = fget(fd); | ||
76 | if (!file) { | ||
77 | printk(KERN_INFO "no fd in mmap\r\n"); | ||
78 | goto out; | ||
79 | } | ||
80 | } | ||
81 | |||
82 | down_write(¤t->mm->mmap_sem); | ||
83 | ret = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
84 | up_write(¤t->mm->mmap_sem); | ||
85 | if (file) | ||
86 | fput(file); | ||
87 | out: | ||
88 | return ret; | ||
89 | } | ||
90 | |||
91 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, | 65 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, |
92 | unsigned long prot, unsigned long flags, | 66 | unsigned long prot, unsigned long flags, |
93 | unsigned long fd, off_t pgoff) | 67 | unsigned long fd, off_t pgoff) |
94 | { | 68 | { |
95 | int err = -EINVAL; | 69 | if (pgoff & ~PAGE_MASK) |
96 | 70 | return -EINVAL; | |
97 | if (pgoff & ~PAGE_MASK) { | ||
98 | printk(KERN_INFO "no pagemask in mmap\r\n"); | ||
99 | goto out; | ||
100 | } | ||
101 | 71 | ||
102 | err = sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); | 72 | return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); |
103 | out: | ||
104 | return err; | ||
105 | } | 73 | } |
106 | 74 | ||
107 | /* | 75 | /* |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index c1ab1dc10898..b96f365ea6b1 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -196,7 +196,7 @@ ENTRY(sys_call_table) | |||
196 | .long sys_ni_syscall /* reserved for streams2 */ | 196 | .long sys_ni_syscall /* reserved for streams2 */ |
197 | .long sys_vfork /* 190 */ | 197 | .long sys_vfork /* 190 */ |
198 | .long sys_getrlimit | 198 | .long sys_getrlimit |
199 | .long sys_mmap2 /* mmap2 */ | 199 | .long sys_mmap_pgoff /* mmap2 */ |
200 | .long sys_truncate64 | 200 | .long sys_truncate64 |
201 | .long sys_ftruncate64 | 201 | .long sys_ftruncate64 |
202 | .long sys_stat64 /* 195 */ | 202 | .long sys_stat64 /* 195 */ |