]> err.no Git - linux-2.6/commitdiff
[MIPS] Use generic compat routines for readdir, getdents
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Tue, 21 Feb 2006 06:59:00 +0000 (15:59 +0900)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 27 Feb 2006 17:30:37 +0000 (17:30 +0000)
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>
arch/mips/kernel/linux32.c
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-o32.S

index 5f68b220c26d6c806dc1ccc6ad323c0c69d30d79..e00e5f6e7fdd784d2d067dc4e6ccffcdc2eea009 100644 (file)
@@ -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)
 {
index d87b5446fa135c30c6b12415e8e442f0680e630c..02c8267e45e73fb5d5fed93497ef9f40124d2cb2 100644 (file)
@@ -195,7 +195,7 @@ EXPORT(sysn32_call_table)
        PTR     sys_fdatasync
        PTR     sys_truncate
        PTR     sys_ftruncate                   /* 6075 */
-       PTR     sys32_getdents
+       PTR     compat_sys_getdents
        PTR     sys_getcwd
        PTR     sys_chdir
        PTR     sys_fchdir
index 5b0414018c9a14802fee22fe8ed2994835912a4b..797e0d87488930fc4c453066a41eb3b4cf67a5f9 100644 (file)
@@ -293,7 +293,7 @@ sys_call_table:
        PTR     sys_uselib
        PTR     sys_swapon
        PTR     sys_reboot
-       PTR     sys32_readdir
+       PTR     compat_sys_old_readdir
        PTR     old_mmap                        /* 4090 */
        PTR     sys_munmap
        PTR     sys_truncate
@@ -345,7 +345,7 @@ sys_call_table:
        PTR     sys_setfsuid
        PTR     sys_setfsgid
        PTR     sys32_llseek                    /* 4140 */
-       PTR     sys32_getdents
+       PTR     compat_sys_getdents
        PTR     compat_sys_select
        PTR     sys_flock
        PTR     sys_msync