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/parisc/kernel | |
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/parisc/kernel')
-rw-r--r-- | arch/parisc/kernel/sys_parisc.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index 71b31957c8f1..9147391afb03 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c | |||
@@ -110,37 +110,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, | |||
110 | return addr; | 110 | return addr; |
111 | } | 111 | } |
112 | 112 | ||
113 | static unsigned long do_mmap2(unsigned long addr, unsigned long len, | ||
114 | unsigned long prot, unsigned long flags, unsigned long fd, | ||
115 | unsigned long pgoff) | ||
116 | { | ||
117 | struct file * file = NULL; | ||
118 | unsigned long error = -EBADF; | ||
119 | if (!(flags & MAP_ANONYMOUS)) { | ||
120 | file = fget(fd); | ||
121 | if (!file) | ||
122 | goto out; | ||
123 | } | ||
124 | |||
125 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
126 | |||
127 | down_write(¤t->mm->mmap_sem); | ||
128 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
129 | up_write(¤t->mm->mmap_sem); | ||
130 | |||
131 | if (file != NULL) | ||
132 | fput(file); | ||
133 | out: | ||
134 | return error; | ||
135 | } | ||
136 | |||
137 | asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, | 113 | asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, |
138 | unsigned long prot, unsigned long flags, unsigned long fd, | 114 | unsigned long prot, unsigned long flags, unsigned long fd, |
139 | unsigned long pgoff) | 115 | unsigned long pgoff) |
140 | { | 116 | { |
141 | /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE | 117 | /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE |
142 | we have. */ | 118 | we have. */ |
143 | return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12)); | 119 | return sys_mmap_pgoff(addr, len, prot, flags, fd, |
120 | pgoff >> (PAGE_SHIFT - 12)); | ||
144 | } | 121 | } |
145 | 122 | ||
146 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | 123 | asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, |
@@ -148,7 +125,8 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, | |||
148 | unsigned long offset) | 125 | unsigned long offset) |
149 | { | 126 | { |
150 | if (!(offset & ~PAGE_MASK)) { | 127 | if (!(offset & ~PAGE_MASK)) { |
151 | return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); | 128 | return sys_mmap_pgoff(addr, len, prot, flags, fd, |
129 | offset >> PAGE_SHIFT); | ||
152 | } else { | 130 | } else { |
153 | return -EINVAL; | 131 | return -EINVAL; |
154 | } | 132 | } |