Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / mips / kernel / sysirix.c
index a456f78..59e2da8 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/socket.h>
 #include <linux/security.h>
 #include <linux/syscalls.h>
+#include <linux/resource.h>
 #include <linux/vs_cvirt.h>
 
 #include <asm/ptrace.h>
@@ -236,7 +237,6 @@ asmlinkage int irix_prctl(unsigned option, ...)
 #undef DEBUG_PROCGRPS
 
 extern unsigned long irix_mapelf(int fd, struct elf_phdr __user *user_phdrp, int cnt);
-extern int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
 extern char *prom_getenv(char *name);
 extern long prom_setenv(char *name, char *value);
 
@@ -583,7 +583,7 @@ out:
 
 asmlinkage int irix_getpid(struct pt_regs *regs)
 {
-       regs->regs[3] = current->real_parent->pid;
+       regs->regs[3] = current->parent->pid;
        return current->pid;
 }
 
@@ -695,7 +695,7 @@ asmlinkage int irix_statfs(const char __user *path,
        if (error)
                goto out;
 
-       error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
+       error = vfs_statfs(nd.dentry, &kbuf);
        if (error)
                goto dput_and_out;
 
@@ -733,7 +733,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf)
                goto out;
        }
 
-       error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
+       error = vfs_statfs(file->f_dentry, &kbuf);
        if (error)
                goto out_f;
 
@@ -1361,7 +1361,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
        error = user_path_walk(fname, &nd);
        if (error)
                goto out;
-       error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
+       error = vfs_statfs(nd.dentry, &kbuf);
        if (error)
                goto dput_and_out;
 
@@ -1407,7 +1407,7 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf)
                error = -EBADF;
                goto out;
        }
-       error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
+       error = vfs_statfs(file->f_dentry, &kbuf);
        if (error)
                goto out_f;
 
@@ -1612,7 +1612,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
        error = user_path_walk(fname, &nd);
        if (error)
                goto out;
-       error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
+       error = vfs_statfs(nd.dentry, &kbuf);
        if (error)
                goto dput_and_out;
 
@@ -1659,7 +1659,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf)
                error = -EBADF;
                goto out;
        }
-       error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
+       error = vfs_statfs(file->f_dentry, &kbuf);
        if (error)
                goto out_f;
 
@@ -1740,12 +1740,13 @@ struct irix_dirent32_callback {
 #define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
 
 static int irix_filldir32(void *__buf, const char *name,
-       int namlen, loff_t offset, ino_t ino, unsigned int d_type)
+       int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
        struct irix_dirent32 __user *dirent;
        struct irix_dirent32_callback *buf = __buf;
        unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1);
        int err = 0;
+       u32 d_ino;
 
 #ifdef DEBUG_GETDENTS
        printk("\nirix_filldir32[reclen<%d>namlen<%d>count<%d>]",
@@ -1754,12 +1755,15 @@ static int irix_filldir32(void *__buf, const char *name,
        buf->error = -EINVAL;   /* only used if we fail.. */
        if (reclen > buf->count)
                return -EINVAL;
+       d_ino = ino;
+       if (sizeof(d_ino) < sizeof(ino) && d_ino != ino)
+               return -EOVERFLOW;
        dirent = buf->previous;
        if (dirent)
                err = __put_user(offset, &dirent->d_off);
        dirent = buf->current_dir;
        err |= __put_user(dirent, &buf->previous);
-       err |= __put_user(ino, &dirent->d_ino);
+       err |= __put_user(d_ino, &dirent->d_ino);
        err |= __put_user(reclen, &dirent->d_reclen);
        err |= copy_to_user((char __user *)dirent->d_name, name, namlen) ? -EFAULT : 0;
        err |= __put_user(0, &dirent->d_name[namlen]);
@@ -1838,7 +1842,7 @@ struct irix_dirent64_callback {
 #define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
 
 static int irix_filldir64(void *__buf, const char *name,
-       int namlen, loff_t offset, ino_t ino, unsigned int d_type)
+       int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
        struct irix_dirent64 __user *dirent;
        struct irix_dirent64_callback * buf = __buf;