aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/pipe.c12
-rw-r--r--fs/splice.c8
-rw-r--r--include/linux/pipe_fs_i.h3
3 files changed, 11 insertions, 12 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index f8b6bdcb879a..9a06e8e48e8d 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -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
210static struct pipe_buf_operations anon_pipe_buf_ops = { 210static 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
759static struct file_operations read_pipe_fops = { 759static 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
771static struct file_operations write_pipe_fops = { 771static 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
783static struct file_operations rdwr_pipe_fops = { 783static 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
142static struct pipe_buf_operations page_cache_pipe_buf_ops = { 142static 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
162static struct pipe_buf_operations user_page_pipe_buf_ops = { 162static 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 @@
12struct pipe_buffer { 12struct 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;