]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - fs/read_write.c
teach SYSCALL_DEFINE<n> how to deal with long long/unsigned long long
[mirror_ubuntu-hirsute-kernel.git] / fs / read_write.c
index bb34af315280328acedfd4122829b3c8125d8a6f..dcfd58d95f44757e2496f57aa3430c3989efa75b 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/syscalls.h>
 #include <linux/pagemap.h>
 #include <linux/splice.h>
+#include <linux/compat.h>
 #include "read_write.h"
 
 #include <asm/uaccess.h>
@@ -163,7 +164,7 @@ EXPORT_SYMBOL(no_llseek);
 
 loff_t default_llseek(struct file *file, loff_t offset, int whence)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
+       struct inode *inode = file_inode(file);
        loff_t retval;
 
        mutex_lock(&inode->i_mutex);
@@ -247,6 +248,13 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence)
        return retval;
 }
 
+#ifdef CONFIG_COMPAT
+COMPAT_SYSCALL_DEFINE3(lseek, unsigned int, fd, compat_off_t, offset, unsigned int, whence)
+{
+       return sys_lseek(fd, offset, whence);
+}
+#endif
+
 #ifdef __ARCH_WANT_SYS_LLSEEK
 SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
                unsigned long, offset_low, loff_t __user *, result,
@@ -278,7 +286,6 @@ out_putf:
 }
 #endif
 
-
 /*
  * rw_verify_area doesn't like huge counts. We limit
  * them to something that fits in "int" so that others
@@ -290,7 +297,7 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count
        loff_t pos;
        int retval = -EINVAL;
 
-       inode = file->f_path.dentry->d_inode;
+       inode = file_inode(file);
        if (unlikely((ssize_t) count < 0))
                return retval;
        pos = *ppos;
@@ -480,8 +487,8 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
        return ret;
 }
 
-SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
-                       size_t count, loff_t pos)
+SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
+                       size_t, count, loff_t, pos)
 {
        struct fd f;
        ssize_t ret = -EBADF;
@@ -499,17 +506,9 @@ SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
 
        return ret;
 }
-#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
-asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
-{
-       return SYSC_pread64((unsigned int) fd, (char __user *) buf,
-                           (size_t) count, pos);
-}
-SYSCALL_ALIAS(sys_pread64, SyS_pread64);
-#endif
 
-SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
-                        size_t count, loff_t pos)
+SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
+                        size_t, count, loff_t, pos)
 {
        struct fd f;
        ssize_t ret = -EBADF;
@@ -527,14 +526,6 @@ SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
 
        return ret;
 }
-#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
-asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos)
-{
-       return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf,
-                            (size_t) count, pos);
-}
-SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64);
-#endif
 
 /*
  * Reduce an iovec's length in-place.  Return the resulting number of segments
@@ -901,8 +892,8 @@ ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count,
        if (!(out.file->f_mode & FMODE_WRITE))
                goto fput_out;
        retval = -EINVAL;
-       in_inode = in.file->f_path.dentry->d_inode;
-       out_inode = out.file->f_path.dentry->d_inode;
+       in_inode = file_inode(in.file);
+       out_inode = file_inode(out.file);
        retval = rw_verify_area(WRITE, out.file, &out.file->f_pos, count);
        if (retval < 0)
                goto fput_out;