aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 10:21:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-01 10:21:43 -0400
commit08d76760832993050ad8c25e63b56773ef2ca303 (patch)
treeabdcf148dfe43cd49f30f204f1dac6978107a508 /fs/open.c
parent5f56886521d6ddd3648777fae44d82382dd8c87f (diff)
parent99e621f796d7f0341a51e8cdf32b81663b10b448 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Pull compat cleanup from Al Viro: "Mostly about syscall wrappers this time; there will be another pile with patches in the same general area from various people, but I'd rather push those after both that and vfs.git pile are in." * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal: syscalls.h: slightly reduce the jungles of macros get rid of union semop in sys_semctl(2) arguments make do_mremap() static sparc: no need to sign-extend in sync_file_range() wrapper ppc compat wrappers for add_key(2) and request_key(2) are pointless x86: trim sys_ia32.h x86: sys32_kill and sys32_mprotect are pointless get rid of compat_sys_semctl() and friends in case of ARCH_WANT_OLD_COMPAT_IPC merge compat sys_ipc instances consolidate compat lookup_dcookie() convert vmsplice to COMPAT_SYSCALL_DEFINE switch getrusage() to COMPAT_SYSCALL_DEFINE switch epoll_pwait to COMPAT_SYSCALL_DEFINE convert sendfile{,64} to COMPAT_SYSCALL_DEFINE switch signalfd{,4}() to COMPAT_SYSCALL_DEFINE make SYSCALL_DEFINE<n>-generated wrappers do asmlinkage_protect make HAVE_SYSCALL_WRAPPERS unconditional consolidate cond_syscall and SYSCALL_ALIAS declarations teach SYSCALL_DEFINE<n> how to deal with long long/unsigned long long get rid of duplicate logics in __SC_....[1-6] definitions
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c52
1 files changed, 7 insertions, 45 deletions
diff --git a/fs/open.c b/fs/open.c
index 68354466879f..8c741002f947 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -197,10 +197,7 @@ out:
197 197
198SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length) 198SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
199{ 199{
200 long ret = do_sys_ftruncate(fd, length, 1); 200 return do_sys_ftruncate(fd, length, 1);
201 /* avoid REGPARM breakage on x86: */
202 asmlinkage_protect(2, ret, fd, length);
203 return ret;
204} 201}
205 202
206#ifdef CONFIG_COMPAT 203#ifdef CONFIG_COMPAT
@@ -212,32 +209,15 @@ COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_ulong_t, length)
212 209
213/* LFS versions of truncate are only needed on 32 bit machines */ 210/* LFS versions of truncate are only needed on 32 bit machines */
214#if BITS_PER_LONG == 32 211#if BITS_PER_LONG == 32
215SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length) 212SYSCALL_DEFINE2(truncate64, const char __user *, path, loff_t, length)
216{ 213{
217 return do_sys_truncate(path, length); 214 return do_sys_truncate(path, length);
218} 215}
219#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
220asmlinkage long SyS_truncate64(long path, loff_t length)
221{
222 return SYSC_truncate64((const char __user *) path, length);
223}
224SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
225#endif
226 216
227SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length) 217SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length)
228{ 218{
229 long ret = do_sys_ftruncate(fd, length, 0); 219 return do_sys_ftruncate(fd, length, 0);
230 /* avoid REGPARM breakage on x86: */
231 asmlinkage_protect(2, ret, fd, length);
232 return ret;
233}
234#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
235asmlinkage long SyS_ftruncate64(long fd, loff_t length)
236{
237 return SYSC_ftruncate64((unsigned int) fd, length);
238} 220}
239SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
240#endif
241#endif /* BITS_PER_LONG == 32 */ 221#endif /* BITS_PER_LONG == 32 */
242 222
243 223
@@ -299,7 +279,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
299 return ret; 279 return ret;
300} 280}
301 281
302SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) 282SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
303{ 283{
304 struct fd f = fdget(fd); 284 struct fd f = fdget(fd);
305 int error = -EBADF; 285 int error = -EBADF;
@@ -311,14 +291,6 @@ SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
311 return error; 291 return error;
312} 292}
313 293
314#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
315asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
316{
317 return SYSC_fallocate((int)fd, (int)mode, offset, len);
318}
319SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
320#endif
321
322/* 294/*
323 * access() needs to use the real uid/gid, not the effective uid/gid. 295 * access() needs to use the real uid/gid, not the effective uid/gid.
324 * We do this by temporarily clearing all FS-related capabilities and 296 * We do this by temporarily clearing all FS-related capabilities and
@@ -983,29 +955,19 @@ long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
983 955
984SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode) 956SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode)
985{ 957{
986 long ret;
987
988 if (force_o_largefile()) 958 if (force_o_largefile())
989 flags |= O_LARGEFILE; 959 flags |= O_LARGEFILE;
990 960
991 ret = do_sys_open(AT_FDCWD, filename, flags, mode); 961 return do_sys_open(AT_FDCWD, filename, flags, mode);
992 /* avoid REGPARM breakage on x86: */
993 asmlinkage_protect(3, ret, filename, flags, mode);
994 return ret;
995} 962}
996 963
997SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, 964SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
998 umode_t, mode) 965 umode_t, mode)
999{ 966{
1000 long ret;
1001
1002 if (force_o_largefile()) 967 if (force_o_largefile())
1003 flags |= O_LARGEFILE; 968 flags |= O_LARGEFILE;
1004 969
1005 ret = do_sys_open(dfd, filename, flags, mode); 970 return do_sys_open(dfd, filename, flags, mode);
1006 /* avoid REGPARM breakage on x86: */
1007 asmlinkage_protect(4, ret, dfd, filename, flags, mode);
1008 return ret;
1009} 971}
1010 972
1011#ifndef __alpha__ 973#ifndef __alpha__