[PATCH] sysctl: Allow /proc/sys without sys_sysctl
[linux-2.6-microblaze.git] / arch / mips / kernel / linux32.c
index f33e779..43b1162 100644 (file)
@@ -5,7 +5,6 @@
  * Written by Ulf Carlsson (ulfc@engr.sgi.com)
  * sys32_execve from ia64/ia32 code, Feb 2000, Kanoj Sarcar (kanoj@sgi.com)
  */
-#include <linux/config.h>
 #include <linux/compiler.h>
 #include <linux/mm.h>
 #include <linux/errno.h>
@@ -30,7 +29,6 @@
 #include <linux/utime.h>
 #include <linux/utsname.h>
 #include <linux/personality.h>
-#include <linux/timex.h>
 #include <linux/dnotify.h>
 #include <linux/module.h>
 #include <linux/binfmts.h>
@@ -357,73 +355,13 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
 asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf,
                               size_t count, u32 unused, u64 a4, u64 a5)
 {
-       ssize_t ret;
-       struct file * file;
-       ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
-       loff_t pos;
-
-       ret = -EBADF;
-       file = fget(fd);
-       if (!file)
-               goto bad_file;
-       if (!(file->f_mode & FMODE_READ))
-               goto out;
-       pos = merge_64(a4, a5);
-       ret = rw_verify_area(READ, file, &pos, count);
-       if (ret < 0)
-               goto out;
-       ret = -EINVAL;
-       if (!file->f_op || !(read = file->f_op->read))
-               goto out;
-       if (pos < 0)
-               goto out;
-       ret = -ESPIPE;
-       if (!(file->f_mode & FMODE_PREAD))
-               goto out;
-       ret = read(file, buf, count, &pos);
-       if (ret > 0)
-               dnotify_parent(file->f_dentry, DN_ACCESS);
-out:
-       fput(file);
-bad_file:
-       return ret;
+       return sys_pread64(fd, buf, count, merge_64(a4, a5));
 }
 
 asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf,
                                size_t count, u32 unused, u64 a4, u64 a5)
 {
-       ssize_t ret;
-       struct file * file;
-       ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *);
-       loff_t pos;
-
-       ret = -EBADF;
-       file = fget(fd);
-       if (!file)
-               goto bad_file;
-       if (!(file->f_mode & FMODE_WRITE))
-               goto out;
-       pos = merge_64(a4, a5);
-       ret = rw_verify_area(WRITE, file, &pos, count);
-       if (ret < 0)
-               goto out;
-       ret = -EINVAL;
-       if (!file->f_op || !(write = file->f_op->write))
-               goto out;
-       if (pos < 0)
-               goto out;
-
-       ret = -ESPIPE;
-       if (!(file->f_mode & FMODE_PWRITE))
-               goto out;
-
-       ret = write(file, buf, count, &pos);
-       if (ret > 0)
-               dnotify_parent(file->f_dentry, DN_MODIFY);
-out:
-       fput(file);
-bad_file:
-       return ret;
+       return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
 }
 
 asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
@@ -1053,7 +991,7 @@ struct sysctl_args32
        unsigned int __unused[4];
 };
 
-#ifdef CONFIG_SYSCTL
+#ifdef CONFIG_SYSCTL_SYSCALL
 
 asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
 {
@@ -1094,7 +1032,7 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
        return error;
 }
 
-#endif /* CONFIG_SYSCTL */
+#endif /* CONFIG_SYSCTL_SYSCALL */
 
 asmlinkage long sys32_newuname(struct new_utsname __user * name)
 {
@@ -1157,66 +1095,6 @@ out:
        return err;
 }
 
-/* Handle adjtimex compatibility. */
-
-extern int do_adjtimex(struct timex *);
-
-asmlinkage int sys32_adjtimex(struct compat_timex __user *utp)
-{
-       struct timex txc;
-       int ret;
-
-       memset(&txc, 0, sizeof(struct timex));
-
-       if (get_user(txc.modes, &utp->modes) ||
-          __get_user(txc.offset, &utp->offset) ||
-          __get_user(txc.freq, &utp->freq) ||
-          __get_user(txc.maxerror, &utp->maxerror) ||
-          __get_user(txc.esterror, &utp->esterror) ||
-          __get_user(txc.status, &utp->status) ||
-          __get_user(txc.constant, &utp->constant) ||
-          __get_user(txc.precision, &utp->precision) ||
-          __get_user(txc.tolerance, &utp->tolerance) ||
-          __get_user(txc.time.tv_sec, &utp->time.tv_sec) ||
-          __get_user(txc.time.tv_usec, &utp->time.tv_usec) ||
-          __get_user(txc.tick, &utp->tick) ||
-          __get_user(txc.ppsfreq, &utp->ppsfreq) ||
-          __get_user(txc.jitter, &utp->jitter) ||
-          __get_user(txc.shift, &utp->shift) ||
-          __get_user(txc.stabil, &utp->stabil) ||
-          __get_user(txc.jitcnt, &utp->jitcnt) ||
-          __get_user(txc.calcnt, &utp->calcnt) ||
-          __get_user(txc.errcnt, &utp->errcnt) ||
-          __get_user(txc.stbcnt, &utp->stbcnt))
-               return -EFAULT;
-
-       ret = do_adjtimex(&txc);
-
-       if (put_user(txc.modes, &utp->modes) ||
-          __put_user(txc.offset, &utp->offset) ||
-          __put_user(txc.freq, &utp->freq) ||
-          __put_user(txc.maxerror, &utp->maxerror) ||
-          __put_user(txc.esterror, &utp->esterror) ||
-          __put_user(txc.status, &utp->status) ||
-          __put_user(txc.constant, &utp->constant) ||
-          __put_user(txc.precision, &utp->precision) ||
-          __put_user(txc.tolerance, &utp->tolerance) ||
-          __put_user(txc.time.tv_sec, &utp->time.tv_sec) ||
-          __put_user(txc.time.tv_usec, &utp->time.tv_usec) ||
-          __put_user(txc.tick, &utp->tick) ||
-          __put_user(txc.ppsfreq, &utp->ppsfreq) ||
-          __put_user(txc.jitter, &utp->jitter) ||
-          __put_user(txc.shift, &utp->shift) ||
-          __put_user(txc.stabil, &utp->stabil) ||
-          __put_user(txc.jitcnt, &utp->jitcnt) ||
-          __put_user(txc.calcnt, &utp->calcnt) ||
-          __put_user(txc.errcnt, &utp->errcnt) ||
-          __put_user(txc.stbcnt, &utp->stbcnt))
-               ret = -EFAULT;
-
-       return ret;
-}
-
 asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
        s32 count)
 {
@@ -1243,6 +1121,16 @@ asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
        return sys_readahead(fd, merge_64(a2, a3), count);
 }
 
+asmlinkage long sys32_sync_file_range(int fd, int __pad,
+       unsigned long a2, unsigned long a3,
+       unsigned long a4, unsigned long a5,
+       int flags)
+{
+       return sys_sync_file_range(fd,
+                       merge_64(a2, a3), merge_64(a4, a5),
+                       flags);
+}
+
 /* Argument list sizes for sys_socketcall */
 #define AL(x) ((x) * sizeof(unsigned int))
 static unsigned char socketcall_nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
@@ -1408,9 +1296,3 @@ _sys32_clone(nabi_no_regargs struct pt_regs regs)
        return do_fork(clone_flags, newsp, &regs, 0,
                       parent_tidptr, child_tidptr);
 }
-
-extern asmlinkage void sys_set_thread_area(u32 addr);
-asmlinkage void sys32_set_thread_area(u32 addr)
-{
-       sys_set_thread_area(AA(addr));
-}