diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2006-12-13 03:34:04 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-13 12:05:47 -0500 |
commit | d4c3cca941b64a938eaa9734585a93547c6be323 (patch) | |
tree | 48b78bda9d4da9c3bdfb30548cb65f0bc4015733 | |
parent | 426d62e2158c2fd3aa1ed1fd62122afd2ccb89ae (diff) |
[PATCH] constify pipe_buf_operations
- pipe/splice should use const pipe_buf_operations and file_operations
- struct pipe_inode_info has an unused field "start" : get rid of it.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/pipe.c | 12 | ||||
-rw-r--r-- | fs/splice.c | 8 | ||||
-rw-r--r-- | include/linux/pipe_fs_i.h | 3 |
3 files changed, 11 insertions, 12 deletions
@@ -207,7 +207,7 @@ int generic_pipe_buf_pin(struct pipe_inode_info *info, struct pipe_buffer *buf) | |||
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
210 | static struct pipe_buf_operations anon_pipe_buf_ops = { | 210 | static const struct pipe_buf_operations anon_pipe_buf_ops = { |
211 | .can_merge = 1, | 211 | .can_merge = 1, |
212 | .map = generic_pipe_buf_map, | 212 | .map = generic_pipe_buf_map, |
213 | .unmap = generic_pipe_buf_unmap, | 213 | .unmap = generic_pipe_buf_unmap, |
@@ -243,7 +243,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |||
243 | if (bufs) { | 243 | if (bufs) { |
244 | int curbuf = pipe->curbuf; | 244 | int curbuf = pipe->curbuf; |
245 | struct pipe_buffer *buf = pipe->bufs + curbuf; | 245 | struct pipe_buffer *buf = pipe->bufs + curbuf; |
246 | struct pipe_buf_operations *ops = buf->ops; | 246 | const struct pipe_buf_operations *ops = buf->ops; |
247 | void *addr; | 247 | void *addr; |
248 | size_t chars = buf->len; | 248 | size_t chars = buf->len; |
249 | int error, atomic; | 249 | int error, atomic; |
@@ -365,7 +365,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, | |||
365 | int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) & | 365 | int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) & |
366 | (PIPE_BUFFERS-1); | 366 | (PIPE_BUFFERS-1); |
367 | struct pipe_buffer *buf = pipe->bufs + lastbuf; | 367 | struct pipe_buffer *buf = pipe->bufs + lastbuf; |
368 | struct pipe_buf_operations *ops = buf->ops; | 368 | const struct pipe_buf_operations *ops = buf->ops; |
369 | int offset = buf->offset + buf->len; | 369 | int offset = buf->offset + buf->len; |
370 | 370 | ||
371 | if (ops->can_merge && offset + chars <= PAGE_SIZE) { | 371 | if (ops->can_merge && offset + chars <= PAGE_SIZE) { |
@@ -756,7 +756,7 @@ const struct file_operations rdwr_fifo_fops = { | |||
756 | .fasync = pipe_rdwr_fasync, | 756 | .fasync = pipe_rdwr_fasync, |
757 | }; | 757 | }; |
758 | 758 | ||
759 | static struct file_operations read_pipe_fops = { | 759 | static const struct file_operations read_pipe_fops = { |
760 | .llseek = no_llseek, | 760 | .llseek = no_llseek, |
761 | .read = do_sync_read, | 761 | .read = do_sync_read, |
762 | .aio_read = pipe_read, | 762 | .aio_read = pipe_read, |
@@ -768,7 +768,7 @@ static struct file_operations read_pipe_fops = { | |||
768 | .fasync = pipe_read_fasync, | 768 | .fasync = pipe_read_fasync, |
769 | }; | 769 | }; |
770 | 770 | ||
771 | static struct file_operations write_pipe_fops = { | 771 | static const struct file_operations write_pipe_fops = { |
772 | .llseek = no_llseek, | 772 | .llseek = no_llseek, |
773 | .read = bad_pipe_r, | 773 | .read = bad_pipe_r, |
774 | .write = do_sync_write, | 774 | .write = do_sync_write, |
@@ -780,7 +780,7 @@ static struct file_operations write_pipe_fops = { | |||
780 | .fasync = pipe_write_fasync, | 780 | .fasync = pipe_write_fasync, |
781 | }; | 781 | }; |
782 | 782 | ||
783 | static struct file_operations rdwr_pipe_fops = { | 783 | static const struct file_operations rdwr_pipe_fops = { |
784 | .llseek = no_llseek, | 784 | .llseek = no_llseek, |
785 | .read = do_sync_read, | 785 | .read = do_sync_read, |
786 | .aio_read = pipe_read, | 786 | .aio_read = pipe_read, |
diff --git a/fs/splice.c b/fs/splice.c index bbd0aeb3f68e..2fca6ebf4cc2 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -42,7 +42,7 @@ struct splice_pipe_desc { | |||
42 | struct partial_page *partial; /* pages[] may not be contig */ | 42 | struct partial_page *partial; /* pages[] may not be contig */ |
43 | int nr_pages; /* number of pages in map */ | 43 | int nr_pages; /* number of pages in map */ |
44 | unsigned int flags; /* splice flags */ | 44 | unsigned int flags; /* splice flags */ |
45 | struct pipe_buf_operations *ops;/* ops associated with output pipe */ | 45 | const struct pipe_buf_operations *ops;/* ops associated with output pipe */ |
46 | }; | 46 | }; |
47 | 47 | ||
48 | /* | 48 | /* |
@@ -139,7 +139,7 @@ error: | |||
139 | return err; | 139 | return err; |
140 | } | 140 | } |
141 | 141 | ||
142 | static struct pipe_buf_operations page_cache_pipe_buf_ops = { | 142 | static const struct pipe_buf_operations page_cache_pipe_buf_ops = { |
143 | .can_merge = 0, | 143 | .can_merge = 0, |
144 | .map = generic_pipe_buf_map, | 144 | .map = generic_pipe_buf_map, |
145 | .unmap = generic_pipe_buf_unmap, | 145 | .unmap = generic_pipe_buf_unmap, |
@@ -159,7 +159,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe, | |||
159 | return generic_pipe_buf_steal(pipe, buf); | 159 | return generic_pipe_buf_steal(pipe, buf); |
160 | } | 160 | } |
161 | 161 | ||
162 | static struct pipe_buf_operations user_page_pipe_buf_ops = { | 162 | static const struct pipe_buf_operations user_page_pipe_buf_ops = { |
163 | .can_merge = 0, | 163 | .can_merge = 0, |
164 | .map = generic_pipe_buf_map, | 164 | .map = generic_pipe_buf_map, |
165 | .unmap = generic_pipe_buf_unmap, | 165 | .unmap = generic_pipe_buf_unmap, |
@@ -724,7 +724,7 @@ static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, | |||
724 | for (;;) { | 724 | for (;;) { |
725 | if (pipe->nrbufs) { | 725 | if (pipe->nrbufs) { |
726 | struct pipe_buffer *buf = pipe->bufs + pipe->curbuf; | 726 | struct pipe_buffer *buf = pipe->bufs + pipe->curbuf; |
727 | struct pipe_buf_operations *ops = buf->ops; | 727 | const struct pipe_buf_operations *ops = buf->ops; |
728 | 728 | ||
729 | sd.len = buf->len; | 729 | sd.len = buf->len; |
730 | if (sd.len > sd.total_len) | 730 | if (sd.len > sd.total_len) |
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index ea4f7cd7bfd8..cc902d242c41 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -12,7 +12,7 @@ | |||
12 | struct pipe_buffer { | 12 | struct pipe_buffer { |
13 | struct page *page; | 13 | struct page *page; |
14 | unsigned int offset, len; | 14 | unsigned int offset, len; |
15 | struct pipe_buf_operations *ops; | 15 | const struct pipe_buf_operations *ops; |
16 | unsigned int flags; | 16 | unsigned int flags; |
17 | }; | 17 | }; |
18 | 18 | ||
@@ -43,7 +43,6 @@ struct pipe_inode_info { | |||
43 | unsigned int nrbufs, curbuf; | 43 | unsigned int nrbufs, curbuf; |
44 | struct pipe_buffer bufs[PIPE_BUFFERS]; | 44 | struct pipe_buffer bufs[PIPE_BUFFERS]; |
45 | struct page *tmp_page; | 45 | struct page *tmp_page; |
46 | unsigned int start; | ||
47 | unsigned int readers; | 46 | unsigned int readers; |
48 | unsigned int writers; | 47 | unsigned int writers; |
49 | unsigned int waiting_writers; | 48 | unsigned int waiting_writers; |