diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-02 10:19:56 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-03 22:59:48 -0500 |
commit | 76b021d053ed0b8de9689eefca5e8f53dade7fd7 (patch) | |
tree | 702ea1adb4d4295dcd95968e9e42d910ab22f807 /fs/splice.c | |
parent | 8d2d5c4a251924e4f70657e96a2a3f87647544f0 (diff) |
convert vmsplice to COMPAT_SYSCALL_DEFINE
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/splice.c b/fs/splice.c index 718bd0056384..23ade0e5c559 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/security.h> | 31 | #include <linux/security.h> |
32 | #include <linux/gfp.h> | 32 | #include <linux/gfp.h> |
33 | #include <linux/socket.h> | 33 | #include <linux/socket.h> |
34 | #include <linux/compat.h> | ||
34 | 35 | ||
35 | /* | 36 | /* |
36 | * Attempt to steal a page from a pipe buffer. This should perhaps go into | 37 | * Attempt to steal a page from a pipe buffer. This should perhaps go into |
@@ -1688,6 +1689,27 @@ SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov, | |||
1688 | return error; | 1689 | return error; |
1689 | } | 1690 | } |
1690 | 1691 | ||
1692 | #ifdef CONFIG_COMPAT | ||
1693 | COMPAT_SYSCALL_DEFINE4(vmsplice, int, fd, const struct compat_iovec __user *, iov32, | ||
1694 | unsigned int, nr_segs, unsigned int, flags) | ||
1695 | { | ||
1696 | unsigned i; | ||
1697 | struct iovec __user *iov; | ||
1698 | if (nr_segs > UIO_MAXIOV) | ||
1699 | return -EINVAL; | ||
1700 | iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec)); | ||
1701 | for (i = 0; i < nr_segs; i++) { | ||
1702 | struct compat_iovec v; | ||
1703 | if (get_user(v.iov_base, &iov32[i].iov_base) || | ||
1704 | get_user(v.iov_len, &iov32[i].iov_len) || | ||
1705 | put_user(compat_ptr(v.iov_base), &iov[i].iov_base) || | ||
1706 | put_user(v.iov_len, &iov[i].iov_len)) | ||
1707 | return -EFAULT; | ||
1708 | } | ||
1709 | return sys_vmsplice(fd, iov, nr_segs, flags); | ||
1710 | } | ||
1711 | #endif | ||
1712 | |||
1691 | SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in, | 1713 | SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in, |
1692 | int, fd_out, loff_t __user *, off_out, | 1714 | int, fd_out, loff_t __user *, off_out, |
1693 | size_t, len, unsigned int, flags) | 1715 | size_t, len, unsigned int, flags) |