aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/char/mem.c2
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/read_write.c2
-rw-r--r--fs/splice.c26
-rw-r--r--include/linux/pipe_fs_i.h41
-rw-r--r--include/linux/splice.h72
-rw-r--r--kernel/relay.c2
9 files changed, 83 insertions, 68 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 87d84e7d5432..08f53df03e8c 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -74,7 +74,7 @@
74#include <linux/highmem.h> 74#include <linux/highmem.h>
75#include <linux/gfp.h> 75#include <linux/gfp.h>
76#include <linux/kthread.h> 76#include <linux/kthread.h>
77#include <linux/pipe_fs_i.h> 77#include <linux/splice.h>
78 78
79#include <asm/uaccess.h> 79#include <asm/uaccess.h>
80 80
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index cc9a9d0df979..d2e4cfd79f27 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -24,7 +24,7 @@
24#include <linux/crash_dump.h> 24#include <linux/crash_dump.h>
25#include <linux/backing-dev.h> 25#include <linux/backing-dev.h>
26#include <linux/bootmem.h> 26#include <linux/bootmem.h>
27#include <linux/pipe_fs_i.h> 27#include <linux/splice.h>
28#include <linux/pfn.h> 28#include <linux/pfn.h>
29 29
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 15471a9efe0e..8176fbf5c006 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -23,7 +23,7 @@
23#include <linux/file.h> 23#include <linux/file.h>
24#include <linux/mount.h> 24#include <linux/mount.h>
25#include <linux/major.h> 25#include <linux/major.h>
26#include <linux/pipe_fs_i.h> 26#include <linux/splice.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/stat.h> 28#include <linux/stat.h>
29#include <linux/fcntl.h> 29#include <linux/fcntl.h>
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index ed1ffa70cc38..44c2e2afa465 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -31,7 +31,7 @@
31#include <linux/pagemap.h> 31#include <linux/pagemap.h>
32#include <linux/uio.h> 32#include <linux/uio.h>
33#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/pipe_fs_i.h> 34#include <linux/splice.h>
35#include <linux/mount.h> 35#include <linux/mount.h>
36#include <linux/writeback.h> 36#include <linux/writeback.h>
37 37
diff --git a/fs/read_write.c b/fs/read_write.c
index 47da8a4a0fbe..2527cf035b0e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -15,7 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/syscalls.h> 16#include <linux/syscalls.h>
17#include <linux/pagemap.h> 17#include <linux/pagemap.h>
18#include <linux/pipe_fs_i.h> 18#include <linux/splice.h>
19#include "read_write.h" 19#include "read_write.h"
20 20
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
diff --git a/fs/splice.c b/fs/splice.c
index 13846f723d72..bea9f1581ca0 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -20,7 +20,7 @@
20#include <linux/fs.h> 20#include <linux/fs.h>
21#include <linux/file.h> 21#include <linux/file.h>
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23#include <linux/pipe_fs_i.h> 23#include <linux/splice.h>
24#include <linux/mm_inline.h> 24#include <linux/mm_inline.h>
25#include <linux/swap.h> 25#include <linux/swap.h>
26#include <linux/writeback.h> 26#include <linux/writeback.h>
@@ -29,22 +29,6 @@
29#include <linux/syscalls.h> 29#include <linux/syscalls.h>
30#include <linux/uio.h> 30#include <linux/uio.h>
31 31
32struct partial_page {
33 unsigned int offset;
34 unsigned int len;
35};
36
37/*
38 * Passed to splice_to_pipe
39 */
40struct splice_pipe_desc {
41 struct page **pages; /* page map */
42 struct partial_page *partial; /* pages[] may not be contig */
43 int nr_pages; /* number of pages in map */
44 unsigned int flags; /* splice flags */
45 const struct pipe_buf_operations *ops;/* ops associated with output pipe */
46};
47
48/* 32/*
49 * Attempt to steal a page from a pipe buffer. This should perhaps go into 33 * Attempt to steal a page from a pipe buffer. This should perhaps go into
50 * a vm helper function, it's already simplified quite a bit by the 34 * a vm helper function, it's already simplified quite a bit by the
@@ -170,11 +154,11 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = {
170}; 154};
171 155
172/* 156/*
173 * Pipe output worker. This sets up our pipe format with the page cache 157 * Pipe output worker. This fills a pipe with the information contained
174 * pipe buffer operations. Otherwise very similar to the regular pipe_writev(). 158 * from splice_pipe_desc().
175 */ 159 */
176static ssize_t splice_to_pipe(struct pipe_inode_info *pipe, 160ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
177 struct splice_pipe_desc *spd) 161 struct splice_pipe_desc *spd)
178{ 162{
179 unsigned int spd_pages = spd->nr_pages; 163 unsigned int spd_pages = spd->nr_pages;
180 int ret, do_wakeup, page_nr; 164 int ret, do_wakeup, page_nr;
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index f277a9cdb50d..7ba228d52f58 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -71,45 +71,4 @@ void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
71int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *); 71int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *);
72int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 72int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
73 73
74/*
75 * splice is tied to pipes as a transport (at least for now), so we'll just
76 * add the splice flags here.
77 */
78#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
79#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
80 /* we may still block on the fd we splice */
81 /* from/to, of course */
82#define SPLICE_F_MORE (0x04) /* expect more data */
83#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
84
85/*
86 * Passed to the actors
87 */
88struct splice_desc {
89 unsigned int len, total_len; /* current and remaining length */
90 unsigned int flags; /* splice flags */
91 /*
92 * actor() private data
93 */
94 union {
95 void __user *userptr; /* memory to write to */
96 struct file *file; /* file to read/write */
97 void *data; /* cookie */
98 } u;
99 loff_t pos; /* file position */
100};
101
102typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,
103 struct splice_desc *);
104typedef int (splice_direct_actor)(struct pipe_inode_info *,
105 struct splice_desc *);
106
107extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
108 loff_t *, size_t, unsigned int,
109 splice_actor *);
110extern ssize_t __splice_from_pipe(struct pipe_inode_info *,
111 struct splice_desc *, splice_actor *);
112extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
113 splice_direct_actor *);
114
115#endif 74#endif
diff --git a/include/linux/splice.h b/include/linux/splice.h
new file mode 100644
index 000000000000..f8cc97f71cd0
--- /dev/null
+++ b/include/linux/splice.h
@@ -0,0 +1,72 @@
1/*
2 * Function declerations and data structures related to the splice
3 * implementation.
4 *
5 * Copyright (C) 2007 Jens Axboe <jens.axboe@oracle.com>
6 *
7 */
8#ifndef SPLICE_H
9#define SPLICE_H
10
11#include <linux/pipe_fs_i.h>
12
13/*
14 * splice is tied to pipes as a transport (at least for now), so we'll just
15 * add the splice flags here.
16 */
17#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
18#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
19 /* we may still block on the fd we splice */
20 /* from/to, of course */
21#define SPLICE_F_MORE (0x04) /* expect more data */
22#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
23
24/*
25 * Passed to the actors
26 */
27struct splice_desc {
28 unsigned int len, total_len; /* current and remaining length */
29 unsigned int flags; /* splice flags */
30 /*
31 * actor() private data
32 */
33 union {
34 void __user *userptr; /* memory to write to */
35 struct file *file; /* file to read/write */
36 void *data; /* cookie */
37 } u;
38 loff_t pos; /* file position */
39};
40
41struct partial_page {
42 unsigned int offset;
43 unsigned int len;
44};
45
46/*
47 * Passed to splice_to_pipe
48 */
49struct splice_pipe_desc {
50 struct page **pages; /* page map */
51 struct partial_page *partial; /* pages[] may not be contig */
52 int nr_pages; /* number of pages in map */
53 unsigned int flags; /* splice flags */
54 const struct pipe_buf_operations *ops;/* ops associated with output pipe */
55};
56
57typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,
58 struct splice_desc *);
59typedef int (splice_direct_actor)(struct pipe_inode_info *,
60 struct splice_desc *);
61
62extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
63 loff_t *, size_t, unsigned int,
64 splice_actor *);
65extern ssize_t __splice_from_pipe(struct pipe_inode_info *,
66 struct splice_desc *, splice_actor *);
67extern ssize_t splice_to_pipe(struct pipe_inode_info *,
68 struct splice_pipe_desc *);
69extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
70 splice_direct_actor *);
71
72#endif
diff --git a/kernel/relay.c b/kernel/relay.c
index d1d1920f2800..951f29b24e58 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -21,7 +21,7 @@
21#include <linux/vmalloc.h> 21#include <linux/vmalloc.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/cpu.h> 23#include <linux/cpu.h>
24#include <linux/pipe_fs_i.h> 24#include <linux/splice.h>
25 25
26/* list of open channels, for cpu hotplug */ 26/* list of open channels, for cpu hotplug */
27static DEFINE_MUTEX(relay_channels_mutex); 27static DEFINE_MUTEX(relay_channels_mutex);