diff options
author | Christoph Hellwig <hch@lst.de> | 2008-08-16 13:57:30 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-08-18 00:22:35 -0400 |
commit | 50d0b17645a26d2877c9d5538114498c3f82adac (patch) | |
tree | 3b08efbc5cc2b4dbc5ed6ca4edc5733e224aaf35 /arch | |
parent | d9178f4c14c3215fec66d326fcaff74262336aed (diff) |
powerpc: Use generic compat_sys_old_readdir
Use the generic compat_sys_old_readdir instead of the powerpc one which
is almost the same except for the almost complete lack of error
handling.
Note that we can't just use SYSCALL() in systbl.h because the native
syscall is named old_readdir, not sys_old_readdir.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/systbl.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/sys_ppc32.c | 57 |
2 files changed, 1 insertions, 58 deletions
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index e084272ed1c2..f6cc7a43b4fa 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -92,7 +92,7 @@ COMPAT_SYS_SPU(readlink) | |||
92 | SYSCALL(uselib) | 92 | SYSCALL(uselib) |
93 | SYSCALL(swapon) | 93 | SYSCALL(swapon) |
94 | SYSCALL(reboot) | 94 | SYSCALL(reboot) |
95 | SYSX(sys_ni_syscall,old32_readdir,old_readdir) | 95 | SYSX(sys_ni_syscall,compat_sys_old_readdir,old_readdir) |
96 | SYSCALL_SPU(mmap) | 96 | SYSCALL_SPU(mmap) |
97 | SYSCALL_SPU(munmap) | 97 | SYSCALL_SPU(munmap) |
98 | SYSCALL_SPU(truncate) | 98 | SYSCALL_SPU(truncate) |
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 709f8cb8bfca..d98634c76060 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
@@ -52,63 +52,6 @@ | |||
52 | #include <asm/ppc-pci.h> | 52 | #include <asm/ppc-pci.h> |
53 | #include <asm/syscalls.h> | 53 | #include <asm/syscalls.h> |
54 | 54 | ||
55 | struct old_linux_dirent32 { | ||
56 | u32 d_ino; | ||
57 | u32 d_offset; | ||
58 | unsigned short d_namlen; | ||
59 | char d_name[1]; | ||
60 | }; | ||
61 | |||
62 | struct readdir_callback32 { | ||
63 | struct old_linux_dirent32 __user * dirent; | ||
64 | int count; | ||
65 | }; | ||
66 | |||
67 | static int fillonedir(void * __buf, const char * name, int namlen, | ||
68 | off_t offset, u64 ino, unsigned int d_type) | ||
69 | { | ||
70 | struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf; | ||
71 | struct old_linux_dirent32 __user * dirent; | ||
72 | ino_t d_ino; | ||
73 | |||
74 | if (buf->count) | ||
75 | return -EINVAL; | ||
76 | d_ino = ino; | ||
77 | if (sizeof(d_ino) < sizeof(ino) && d_ino != ino) | ||
78 | return -EOVERFLOW; | ||
79 | buf->count++; | ||
80 | dirent = buf->dirent; | ||
81 | put_user(d_ino, &dirent->d_ino); | ||
82 | put_user(offset, &dirent->d_offset); | ||
83 | put_user(namlen, &dirent->d_namlen); | ||
84 | copy_to_user(dirent->d_name, name, namlen); | ||
85 | put_user(0, dirent->d_name + namlen); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count) | ||
90 | { | ||
91 | int error = -EBADF; | ||
92 | struct file * file; | ||
93 | struct readdir_callback32 buf; | ||
94 | |||
95 | file = fget(fd); | ||
96 | if (!file) | ||
97 | goto out; | ||
98 | |||
99 | buf.count = 0; | ||
100 | buf.dirent = dirent; | ||
101 | |||
102 | error = vfs_readdir(file, (filldir_t)fillonedir, &buf); | ||
103 | if (error < 0) | ||
104 | goto out_putf; | ||
105 | error = buf.count; | ||
106 | |||
107 | out_putf: | ||
108 | fput(file); | ||
109 | out: | ||
110 | return error; | ||
111 | } | ||
112 | 55 | ||
113 | asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp, | 56 | asmlinkage long ppc32_select(u32 n, compat_ulong_t __user *inp, |
114 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, | 57 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, |