]> err.no Git - linux-2.6/commitdiff
[PATCH] x86_64: Add compat_sys_vmsplice and use it in x86-64
authorAndi Kleen <ak@suse.de>
Mon, 1 May 2006 19:15:48 +0000 (12:15 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 2 May 2006 01:17:43 +0000 (18:17 -0700)
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/ia32/ia32entry.S
fs/compat.c

index 57fc37e0fb9c16d044156749c31157ef85a6302b..5a92fed2d1d5a853b8d04c4162ae6d3c15bf709b 100644 (file)
@@ -695,4 +695,5 @@ ia32_sys_call_table:
        .quad sys_splice
        .quad sys_sync_file_range
        .quad sys_tee
+       .quad compat_sys_vmsplice
 ia32_syscall_end:              
index 2e32bd3404748d94aed3fef0e053d822c69d0ef1..3f3e8f4d43d69230b7c4e36eb9a629e27221a22e 100644 (file)
@@ -1317,6 +1317,26 @@ out:
        return ret;
 }
 
+asmlinkage long
+compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
+                   unsigned int nr_segs, unsigned int flags)
+{
+       unsigned i;
+       struct iovec *iov;
+       if (nr_segs >= UIO_MAXIOV)
+               return -EINVAL;
+       iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec));
+       for (i = 0; i < nr_segs; i++) {
+               struct compat_iovec v;
+               if (get_user(v.iov_base, &iov32[i].iov_base) ||
+                   get_user(v.iov_len, &iov32[i].iov_len) ||
+                   put_user(compat_ptr(v.iov_base), &iov[i].iov_base) ||
+                   put_user(v.iov_len, &iov[i].iov_len))
+                       return -EFAULT;
+       }
+       return sys_vmsplice(fd, iov, nr_segs, flags);
+}
+
 /*
  * Exactly like fs/open.c:sys_open(), except that it doesn't set the
  * O_LARGEFILE flag.