preadv/pwritev: create compat_writev()
Subsystems (3)
PATCH 142/166 preadv/pwritev: create compat_writev()
From: Gerd Hoffmann <[email protected]>
Factor out some code from compat_sys_writev() which can be shared with the upcoming compat_sys_pwritev().
Signed-off-by Gerd Hoffmann <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Al Viro <viro-RmSDqhL/[email protected]>
Cc <[email protected]>
Cc <[email protected]>
Cc Ralf Baechle <ralf-6z/[email protected]>
Signed-off-by Andrew Morton <akpm-de/[email protected]>
---
fs/compat.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
fs/compat.c renamed from fs/compat.c~preadv-pwritev-create-compat_writev +18 -7
@@ -1232,15 +1232,12 @@ compat_sys_readv(unsigned long fd, constreturn ret; } -asmlinkage ssize_t -compat_sys_writev (unsigned long fd,const struct compat_iovec __user *vec,unsigned long vlen) +static size_t compat_writev (struct file *file, +const struct compat_iovec __user *vec, +unsigned long vlen,loff_t *pos) { -struct file *file;ssize_t ret = -EBADF ; - file =fget (fd); -if (!file) -return -EBADF ;if (!(file->f_mode &FMODE_WRITE )) goto out;
@@ -1248,12 +1245,26 @@ compat_sys_writev(unsigned long fd, consif (!file->f_op || (!file->f_op->aio_write && !file->f_op->write)) goto out; - ret =compat_do_readv_writev (WRITE , file, vec, vlen, &file->f_pos); + ret =compat_do_readv_writev (WRITE , file, vec, vlen, pos); out:if (ret >0 )add_wchar (current, ret);inc_syscw (current); +return ret; +} + +asmlinkage ssize_t +compat_sys_writev (unsigned long fd,const struct compat_iovec __user *vec, +unsigned long vlen) +{ +struct file *file; +ssize_t ret; + + file =fget (fd); +if (!file) +return -EBADF ; + ret =compat_writev (file, vec, vlen, &file->f_pos);fput (file);return ret; }
_
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html