Commit 7b97ebfb authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'splice' of git://brick.kernel.dk/data/git/linux-2.6-block

* 'splice' of git://brick.kernel.dk/data/git/linux-2.6-block:
  [PATCH] splice: add ->splice_write support for /dev/null
  [PATCH] splice: rearrange moving to/from pipe helpers
  [PATCH] Add support for the sys_vmsplice syscall
  [PATCH] splice: fix offset problems
  [PATCH] splice: fix min() warning
parents 07db8696 1ebd32fc
...@@ -1610,5 +1610,6 @@ sys_call_table: ...@@ -1610,5 +1610,6 @@ sys_call_table:
data8 sys_get_robust_list data8 sys_get_robust_list
data8 sys_sync_file_range // 1300 data8 sys_sync_file_range // 1300
data8 sys_tee data8 sys_tee
data8 sys_vmsplice
.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
...@@ -324,6 +324,7 @@ COMPAT_SYS(ppoll) ...@@ -324,6 +324,7 @@ COMPAT_SYS(ppoll)
SYSCALL(unshare) SYSCALL(unshare)
SYSCALL(splice) SYSCALL(splice)
SYSCALL(tee) SYSCALL(tee)
SYSCALL(vmsplice)
/* /*
* please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c * please add new calls to arch/powerpc/platforms/cell/spu_callbacks.c
......
...@@ -318,6 +318,7 @@ void *spu_syscall_table[] = { ...@@ -318,6 +318,7 @@ void *spu_syscall_table[] = {
[__NR_unshare] sys_unshare, [__NR_unshare] sys_unshare,
[__NR_splice] sys_splice, [__NR_splice] sys_splice,
[__NR_tee] sys_tee, [__NR_tee] sys_tee,
[__NR_vmsplice] sys_vmsplice,
}; };
long spu_sys_callback(struct spu_syscall_block *s) long spu_sys_callback(struct spu_syscall_block *s)
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/crash_dump.h> #include <linux/crash_dump.h>
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/pipe_fs_i.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -578,6 +579,18 @@ static ssize_t write_null(struct file * file, const char __user * buf, ...@@ -578,6 +579,18 @@ static ssize_t write_null(struct file * file, const char __user * buf,
return count; return count;
} }
static int pipe_to_null(struct pipe_inode_info *info, struct pipe_buffer *buf,
struct splice_desc *sd)
{
return sd->len;
}
static ssize_t splice_write_null(struct pipe_inode_info *pipe,struct file *out,
loff_t *ppos, size_t len, unsigned int flags)
{
return splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_null);
}
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
/* /*
* For fun, we are using the MMU for this. * For fun, we are using the MMU for this.
...@@ -785,6 +798,7 @@ static struct file_operations null_fops = { ...@@ -785,6 +798,7 @@ static struct file_operations null_fops = {
.llseek = null_lseek, .llseek = null_lseek,
.read = read_null, .read = read_null,
.write = write_null, .write = write_null,
.splice_write = splice_write_null,
}; };
#if defined(CONFIG_ISA) || !defined(__mc68000__) #if defined(CONFIG_ISA) || !defined(__mc68000__)
......
This diff is collapsed.
...@@ -321,8 +321,9 @@ ...@@ -321,8 +321,9 @@
#define __NR_splice 313 #define __NR_splice 313
#define __NR_sync_file_range 314 #define __NR_sync_file_range 314
#define __NR_tee 315 #define __NR_tee 315
#define __NR_vmsplice 316
#define NR_syscalls 316 #define NR_syscalls 317
/* /*
* user-visible error numbers are in the range -1 - -128: see * user-visible error numbers are in the range -1 - -128: see
......
...@@ -290,12 +290,13 @@ ...@@ -290,12 +290,13 @@
#define __NR_get_robust_list 1299 #define __NR_get_robust_list 1299
#define __NR_sync_file_range 1300 #define __NR_sync_file_range 1300
#define __NR_tee 1301 #define __NR_tee 1301
#define __NR_vmsplice 1302
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/config.h> #include <linux/config.h>
#define NR_syscalls 278 /* length of syscall table */ #define NR_syscalls 279 /* length of syscall table */
#define __ARCH_WANT_SYS_RT_SIGACTION #define __ARCH_WANT_SYS_RT_SIGACTION
......
...@@ -303,8 +303,9 @@ ...@@ -303,8 +303,9 @@
#define __NR_unshare 282 #define __NR_unshare 282
#define __NR_splice 283 #define __NR_splice 283
#define __NR_tee 284 #define __NR_tee 284
#define __NR_vmsplice 285
#define __NR_syscalls 285 #define __NR_syscalls 286
#ifdef __KERNEL__ #ifdef __KERNEL__
#define __NR__exit __NR_exit #define __NR__exit __NR_exit
......
...@@ -615,8 +615,10 @@ __SYSCALL(__NR_splice, sys_splice) ...@@ -615,8 +615,10 @@ __SYSCALL(__NR_splice, sys_splice)
__SYSCALL(__NR_tee, sys_tee) __SYSCALL(__NR_tee, sys_tee)
#define __NR_sync_file_range 277 #define __NR_sync_file_range 277
__SYSCALL(__NR_sync_file_range, sys_sync_file_range) __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
#define __NR_vmsplice 278
__SYSCALL(__NR_vmsplice, sys_vmsplice)
#define __NR_syscall_max __NR_sync_file_range #define __NR_syscall_max __NR_vmsplice
#ifndef __NO_STUBS #ifndef __NO_STUBS
......
...@@ -61,4 +61,21 @@ void __free_pipe_info(struct pipe_inode_info *); ...@@ -61,4 +61,21 @@ void __free_pipe_info(struct pipe_inode_info *);
/* from/to, of course */ /* from/to, of course */
#define SPLICE_F_MORE (0x04) /* expect more data */ #define SPLICE_F_MORE (0x04) /* expect more data */
/*
* Passed to the actors
*/
struct splice_desc {
unsigned int len, total_len; /* current and remaining length */
unsigned int flags; /* splice flags */
struct file *file; /* file to read/write */
loff_t pos; /* file position */
};
typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,
struct splice_desc *);
extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
loff_t *, size_t, unsigned int,
splice_actor *);
#endif #endif
...@@ -574,6 +574,9 @@ asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, ...@@ -574,6 +574,9 @@ asmlinkage long sys_splice(int fd_in, loff_t __user *off_in,
int fd_out, loff_t __user *off_out, int fd_out, loff_t __user *off_out,
size_t len, unsigned int flags); size_t len, unsigned int flags);
asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
unsigned long nr_segs, unsigned int flags);
asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags); asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags);
asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment