···2929#include <linux/syscalls.h>3030#include <linux/uio.h>31313232-/*3333- * Passed to the actors3434- */3535-struct splice_desc {3636- unsigned int len, total_len; /* current and remaining length */3737- unsigned int flags; /* splice flags */3838- struct file *file; /* file to read/write */3939- loff_t pos; /* file position */4040-};4141-4232struct partial_page {4333 unsigned int offset;4434 unsigned int len;4535};46364737/*4848- * Passed to move_to_pipe3838+ * Passed to splice_to_pipe4939 */5040struct splice_pipe_desc {5141 struct page **pages; /* page map */···182192 * Pipe output worker. This sets up our pipe format with the page cache183193 * pipe buffer operations. Otherwise very similar to the regular pipe_writev().184194 */185185-static ssize_t move_to_pipe(struct pipe_inode_info *pipe,186186- struct splice_pipe_desc *spd)195195+static ssize_t splice_to_pipe(struct pipe_inode_info *pipe,196196+ struct splice_pipe_desc *spd)187197{188198 int ret, do_wakeup, page_nr;189199···422432 }423433424434 if (spd.nr_pages)425425- return move_to_pipe(pipe, &spd);435435+ return splice_to_pipe(pipe, &spd);426436427437 return error;428438}···656666 return ret;657667}658668659659-typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,660660- struct splice_desc *);661661-662669/*663670 * Pipe input worker. Most of this logic works like a regular pipe, the664671 * key here is the 'actor' worker passed in that actually moves the data665672 * to the wanted destination. See pipe_to_file/pipe_to_sendpage above.666673 */667667-static ssize_t move_from_pipe(struct pipe_inode_info *pipe, struct file *out,668668- loff_t *ppos, size_t len, unsigned int flags,669669- splice_actor *actor)674674+ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out,675675+ loff_t *ppos, size_t len, unsigned int flags,676676+ splice_actor *actor)670677{671678 int ret, do_wakeup, err;672679 struct splice_desc sd;···782795 struct address_space *mapping = out->f_mapping;783796 ssize_t ret;784797785785- ret = move_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);798798+ ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);786799 if (ret > 0) {787800 struct inode *inode = mapping->host;788801···824837ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, struct file *out,825838 loff_t *ppos, size_t len, unsigned int flags)826839{827827- return move_from_pipe(pipe, out, ppos, len, flags, pipe_to_sendpage);840840+ return splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_sendpage);828841}829842830843EXPORT_SYMBOL(generic_splice_sendpage);···911924912925 /*913926 * We don't have an immediate reader, but we'll read the stuff914914- * out of the pipe right after the move_to_pipe(). So set927927+ * out of the pipe right after the splice_to_pipe(). So set915928 * PIPE_READERS appropriately.916929 */917930 pipe->readers = 1;···11971210 if (spd.nr_pages <= 0)11981211 return spd.nr_pages;1199121212001200- return move_to_pipe(pipe, &spd);12131213+ return splice_to_pipe(pipe, &spd);12011214}1202121512031216asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
+17
include/linux/pipe_fs_i.h
···6161 /* from/to, of course */6262#define SPLICE_F_MORE (0x04) /* expect more data */63636464+/*6565+ * Passed to the actors6666+ */6767+struct splice_desc {6868+ unsigned int len, total_len; /* current and remaining length */6969+ unsigned int flags; /* splice flags */7070+ struct file *file; /* file to read/write */7171+ loff_t pos; /* file position */7272+};7373+7474+typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,7575+ struct splice_desc *);7676+7777+extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,7878+ loff_t *, size_t, unsigned int,7979+ splice_actor *);8080+6481#endif