patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / fs / readdir.c
index f02cae6..fbea474 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/fs.h>
 #include <linux/dirent.h>
 #include <linux/security.h>
+#include <linux/unistd.h>
 
 #include <asm/uaccess.h>
 
@@ -49,10 +50,10 @@ EXPORT_SYMBOL(vfs_readdir);
  * anyway. Thus the special "fillonedir()" function for that
  * case (the low-level handlers don't need to care about this).
  */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 #define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
-#ifndef __ia64__
+#ifdef __ARCH_WANT_OLD_READDIR
 
 struct old_linux_dirent {
        unsigned long   d_ino;
@@ -76,7 +77,7 @@ static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset
                return -EINVAL;
        buf->result++;
        dirent = buf->dirent;
-       if (!access_ok(VERIFY_WRITE, (unsigned long)dirent,
+       if (!access_ok(VERIFY_WRITE, dirent,
                        (unsigned long)(dirent->d_name + namlen + 1) -
                                (unsigned long)dirent))
                goto efault;
@@ -115,7 +116,7 @@ out:
        return error;
 }
 
-#endif /* !__ia64__ */
+#endif /* __ARCH_WANT_OLD_READDIR */
 
 /*
  * New, all-improved, singing, dancing, iBCS2-compliant getdents()
@@ -159,7 +160,7 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
                goto efault;
        if (__put_user(0, dirent->d_name + namlen))
                goto efault;
-       if (__put_user(d_type, (char *) dirent + reclen - 1))
+       if (__put_user(d_type, (char __user *) dirent + reclen - 1))
                goto efault;
        buf->previous = dirent;
        dirent = (void __user *)dirent + reclen;