diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-02-21 15:59:00 +0900 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-02-27 17:30:37 +0000 |
commit | 2fd628fe25e1f3d07996b0dab728ea0702f81306 (patch) | |
tree | f57882e33f96141ba59f8f188e8797adb40e42b0 /arch/mips/kernel/linux32.c | |
parent | 92f22c183cd669c8575767fede8fe43bb4f7bce9 (diff) |
[MIPS] Use generic compat routines for readdir, getdents
Not just cleanup but also fixes O32 readdir(2) emulation.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/linux32.c')
-rw-r--r-- | arch/mips/kernel/linux32.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 5f68b220c26..e00e5f6e7fd 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -161,60 +161,6 @@ out: return error; } -struct dirent32 { - unsigned int d_ino; - unsigned int d_off; - unsigned short d_reclen; - char d_name[NAME_MAX + 1]; -}; - -static void -xlate_dirent(void *dirent64, void *dirent32, long n) -{ - long off; - struct dirent *dirp; - struct dirent32 *dirp32; - - off = 0; - while (off < n) { - dirp = (struct dirent *)(dirent64 + off); - dirp32 = (struct dirent32 *)(dirent32 + off); - off += dirp->d_reclen; - dirp32->d_ino = dirp->d_ino; - dirp32->d_off = (unsigned int)dirp->d_off; - dirp32->d_reclen = dirp->d_reclen; - strncpy(dirp32->d_name, dirp->d_name, dirp->d_reclen - ((3 * 4) + 2)); - } - return; -} - -asmlinkage long -sys32_getdents(unsigned int fd, void * dirent32, unsigned int count) -{ - long n; - void *dirent64; - - dirent64 = (void *)((unsigned long)(dirent32 + (sizeof(long) - 1)) & ~(sizeof(long) - 1)); - if ((n = sys_getdents(fd, dirent64, count - (dirent64 - dirent32))) < 0) - return(n); - xlate_dirent(dirent64, dirent32, n); - return(n); -} - -asmlinkage int old_readdir(unsigned int fd, void * dirent, unsigned int count); - -asmlinkage int -sys32_readdir(unsigned int fd, void * dirent32, unsigned int count) -{ - int n; - struct dirent dirent64; - - if ((n = old_readdir(fd, &dirent64, count)) < 0) - return(n); - xlate_dirent(&dirent64, dirent32, dirent64.d_reclen); - return(n); -} - asmlinkage int sys32_waitpid(compat_pid_t pid, unsigned int *stat_addr, int options) { |