aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2005-09-06 18:18:25 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:43 -0400
commite922efc342d565a38eed3af377ff403f52148864 (patch)
treeb9996a96ed1bbb6e387f7ba8216f8e43ca640398 /arch
parentab8d11beb46f0bd0617e04205c01f5c1fe845b61 (diff)
[PATCH] remove duplicated sys_open32() code from 64bit archs
64 bit architectures all implement their own compatibility sys_open(), when in fact the difference is simply not forcing the O_LARGEFILE flag. So use the a common function instead. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Cc: <viro@parcelfarce.linux.theplanet.co.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/ia32/sys_ia32.c31
-rw-r--r--arch/ppc64/kernel/misc.S2
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c31
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c24
-rw-r--r--arch/x86_64/ia32/ia32entry.S2
-rw-r--r--arch/x86_64/ia32/sys_ia32.c26
7 files changed, 4 insertions, 114 deletions
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index 829a6d80711c..0708edb06cc4 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -215,7 +215,7 @@ ia32_syscall_table:
215 data8 sys32_fork 215 data8 sys32_fork
216 data8 sys_read 216 data8 sys_read
217 data8 sys_write 217 data8 sys_write
218 data8 sys32_open /* 5 */ 218 data8 compat_sys_open /* 5 */
219 data8 sys_close 219 data8 sys_close
220 data8 sys32_waitpid 220 data8 sys32_waitpid
221 data8 sys_creat 221 data8 sys_creat
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index c1e20d65dd6c..e29a8a55486a 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2359,37 +2359,6 @@ sys32_brk (unsigned int brk)
2359 return ret; 2359 return ret;
2360} 2360}
2361 2361
2362/*
2363 * Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag.
2364 */
2365asmlinkage long
2366sys32_open (const char __user * filename, int flags, int mode)
2367{
2368 char * tmp;
2369 int fd, error;
2370
2371 tmp = getname(filename);
2372 fd = PTR_ERR(tmp);
2373 if (!IS_ERR(tmp)) {
2374 fd = get_unused_fd();
2375 if (fd >= 0) {
2376 struct file *f = filp_open(tmp, flags, mode);
2377 error = PTR_ERR(f);
2378 if (IS_ERR(f))
2379 goto out_error;
2380 fd_install(fd, f);
2381 }
2382out:
2383 putname(tmp);
2384 }
2385 return fd;
2386
2387out_error:
2388 put_unused_fd(fd);
2389 fd = error;
2390 goto out;
2391}
2392
2393/* Structure for ia32 emulation on ia64 */ 2362/* Structure for ia32 emulation on ia64 */
2394struct epoll_event32 2363struct epoll_event32
2395{ 2364{
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index 474df0a862bf..2164bd7b4ef6 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -957,7 +957,7 @@ _GLOBAL(sys_call_table32)
957 .llong .ppc_fork 957 .llong .ppc_fork
958 .llong .sys_read 958 .llong .sys_read
959 .llong .sys_write 959 .llong .sys_write
960 .llong .sys32_open /* 5 */ 960 .llong .compat_sys_open /* 5 */
961 .llong .sys_close 961 .llong .sys_close
962 .llong .sys32_waitpid 962 .llong .sys32_waitpid
963 .llong .sys32_creat 963 .llong .sys32_creat
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 206619080e66..214914a95a50 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -867,37 +867,6 @@ off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin)
867 return sys_lseek(fd, (int)offset, origin); 867 return sys_lseek(fd, (int)offset, origin);
868} 868}
869 869
870/*
871 * This is just a version for 32-bit applications which does
872 * not force O_LARGEFILE on.
873 */
874asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
875{
876 char * tmp;
877 int fd, error;
878
879 tmp = getname(filename);
880 fd = PTR_ERR(tmp);
881 if (!IS_ERR(tmp)) {
882 fd = get_unused_fd();
883 if (fd >= 0) {
884 struct file * f = filp_open(tmp, flags, mode);
885 error = PTR_ERR(f);
886 if (IS_ERR(f))
887 goto out_error;
888 fd_install(fd, f);
889 }
890out:
891 putname(tmp);
892 }
893 return fd;
894
895out_error:
896 put_unused_fd(fd);
897 fd = error;
898 goto out;
899}
900
901/* Note: it is necessary to treat bufsiz as an unsigned int, 870/* Note: it is necessary to treat bufsiz as an unsigned int,
902 * with the corresponding cast to a signed int to insure that the 871 * with the corresponding cast to a signed int to insure that the
903 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 872 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 1d3aa588df8a..7f6239ed2521 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -1002,29 +1002,7 @@ asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
1002asmlinkage long sparc32_open(const char __user *filename, 1002asmlinkage long sparc32_open(const char __user *filename,
1003 int flags, int mode) 1003 int flags, int mode)
1004{ 1004{
1005 char * tmp; 1005 return do_sys_open(filename, flags, mode);
1006 int fd, error;
1007
1008 tmp = getname(filename);
1009 fd = PTR_ERR(tmp);
1010 if (!IS_ERR(tmp)) {
1011 fd = get_unused_fd();
1012 if (fd >= 0) {
1013 struct file * f = filp_open(tmp, flags, mode);
1014 error = PTR_ERR(f);
1015 if (IS_ERR(f))
1016 goto out_error;
1017 fd_install(fd, f);
1018 }
1019out:
1020 putname(tmp);
1021 }
1022 return fd;
1023
1024out_error:
1025 put_unused_fd(fd);
1026 fd = error;
1027 goto out;
1028} 1006}
1029 1007
1030extern unsigned long do_mremap(unsigned long addr, 1008extern unsigned long do_mremap(unsigned long addr,
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index c45d6a05b984..f174083d5567 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -307,7 +307,7 @@ ia32_sys_call_table:
307 .quad stub32_fork 307 .quad stub32_fork
308 .quad sys_read 308 .quad sys_read
309 .quad sys_write 309 .quad sys_write
310 .quad sys32_open /* 5 */ 310 .quad compat_sys_open /* 5 */
311 .quad sys_close 311 .quad sys_close
312 .quad sys32_waitpid 312 .quad sys32_waitpid
313 .quad sys_creat 313 .quad sys_creat
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index be996d1b691e..04d80406ce4f 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -969,32 +969,6 @@ long sys32_kill(int pid, int sig)
969 return sys_kill(pid, sig); 969 return sys_kill(pid, sig);
970} 970}
971 971
972asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
973{
974 char * tmp;
975 int fd, error;
976
977 /* don't force O_LARGEFILE */
978 tmp = getname(filename);
979 fd = PTR_ERR(tmp);
980 if (!IS_ERR(tmp)) {
981 fd = get_unused_fd();
982 if (fd >= 0) {
983 struct file *f = filp_open(tmp, flags, mode);
984 error = PTR_ERR(f);
985 if (IS_ERR(f)) {
986 put_unused_fd(fd);
987 fd = error;
988 } else {
989 fsnotify_open(f->f_dentry);
990 fd_install(fd, f);
991 }
992 }
993 putname(tmp);
994 }
995 return fd;
996}
997
998extern asmlinkage long 972extern asmlinkage long
999sys_timer_create(clockid_t which_clock, 973sys_timer_create(clockid_t which_clock,
1000 struct sigevent __user *timer_event_spec, 974 struct sigevent __user *timer_event_spec,