linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / mips / kernel / sysirix.c
index 3371005..fc36083 100644 (file)
@@ -31,7 +31,6 @@
 #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>
@@ -237,6 +236,7 @@ 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);
 
@@ -646,7 +646,27 @@ static inline void getitimer_real(struct itimerval *value)
 
 asmlinkage unsigned int irix_alarm(unsigned int seconds)
 {
-       return alarm_setitimer(seconds);
+       struct itimerval it_new, it_old;
+       unsigned int oldalarm;
+
+       if (!seconds) {
+               getitimer_real(&it_old);
+               del_timer(&current->real_timer);
+       } else {
+               it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0;
+               it_new.it_value.tv_sec = seconds;
+               it_new.it_value.tv_usec = 0;
+               do_setitimer(ITIMER_REAL, &it_new, &it_old);
+       }
+       oldalarm = it_old.it_value.tv_sec;
+       /*
+        * ehhh.. We can't return 0 if we have an alarm pending ...
+        * And we'd better return too much than too little anyway
+        */
+       if (it_old.it_value.tv_usec)
+               oldalarm++;
+
+       return oldalarm;
 }
 
 asmlinkage int irix_pause(void)
@@ -695,7 +715,7 @@ asmlinkage int irix_statfs(const char __user *path,
        if (error)
                goto out;
 
-       error = vfs_statfs(nd.dentry, &kbuf);
+       error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
        if (error)
                goto dput_and_out;
 
@@ -733,7 +753,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs __user *buf)
                goto out;
        }
 
-       error = vfs_statfs(file->f_dentry, &kbuf);
+       error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
        if (error)
                goto out_f;
 
@@ -1361,7 +1381,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, &kbuf);
+       error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
        if (error)
                goto dput_and_out;
 
@@ -1407,7 +1427,7 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs __user *buf)
                error = -EBADF;
                goto out;
        }
-       error = vfs_statfs(file->f_dentry, &kbuf);
+       error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
        if (error)
                goto out_f;
 
@@ -1612,7 +1632,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, &kbuf);
+       error = vfs_statfs(nd.dentry->d_inode->i_sb, &kbuf);
        if (error)
                goto dput_and_out;
 
@@ -1659,7 +1679,7 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs __user *buf)
                error = -EBADF;
                goto out;
        }
-       error = vfs_statfs(file->f_dentry, &kbuf);
+       error = vfs_statfs(file->f_dentry->d_inode->i_sb, &kbuf);
        if (error)
                goto out_f;
 
@@ -1740,13 +1760,12 @@ 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, u64 ino, unsigned int d_type)
+       int namlen, loff_t offset, ino_t 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>]",
@@ -1755,15 +1774,12 @@ 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(d_ino, &dirent->d_ino);
+       err |= __put_user(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]);
@@ -1842,7 +1858,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, u64 ino, unsigned int d_type)
+       int namlen, loff_t offset, ino_t ino, unsigned int d_type)
 {
        struct irix_dirent64 __user *dirent;
        struct irix_dirent64_callback * buf = __buf;