Commit d4c3cca9 authored by Eric Dumazet's avatar Eric Dumazet Committed by Linus Torvalds

[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: default avatarEric Dumazet <dada1@cosmosbay.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 426d62e2
...@@ -207,7 +207,7 @@ int generic_pipe_buf_pin(struct pipe_inode_info *info, struct pipe_buffer *buf) ...@@ -207,7 +207,7 @@ int generic_pipe_buf_pin(struct pipe_inode_info *info, struct pipe_buffer *buf)
return 0; return 0;
} }
static struct pipe_buf_operations anon_pipe_buf_ops = { static const struct pipe_buf_operations anon_pipe_buf_ops = {
.can_merge = 1, .can_merge = 1,
.map = generic_pipe_buf_map, .map = generic_pipe_buf_map,
.unmap = generic_pipe_buf_unmap, .unmap = generic_pipe_buf_unmap,
...@@ -243,7 +243,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, ...@@ -243,7 +243,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
if (bufs) { if (bufs) {
int curbuf = pipe->curbuf; int curbuf = pipe->curbuf;
struct pipe_buffer *buf = pipe->bufs + curbuf; struct pipe_buffer *buf = pipe->bufs + curbuf;
struct pipe_buf_operations *ops = buf->ops; const struct pipe_buf_operations *ops = buf->ops;
void *addr; void *addr;
size_t chars = buf->len; size_t chars = buf->len;
int error, atomic; int error, atomic;
...@@ -365,7 +365,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, ...@@ -365,7 +365,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) & int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) &
(PIPE_BUFFERS-1); (PIPE_BUFFERS-1);
struct pipe_buffer *buf = pipe->bufs + lastbuf; struct pipe_buffer *buf = pipe->bufs + lastbuf;
struct pipe_buf_operations *ops = buf->ops; const struct pipe_buf_operations *ops = buf->ops;
int offset = buf->offset + buf->len; int offset = buf->offset + buf->len;
if (ops->can_merge && offset + chars <= PAGE_SIZE) { if (ops->can_merge && offset + chars <= PAGE_SIZE) {
...@@ -756,7 +756,7 @@ const struct file_operations rdwr_fifo_fops = { ...@@ -756,7 +756,7 @@ const struct file_operations rdwr_fifo_fops = {
.fasync = pipe_rdwr_fasync, .fasync = pipe_rdwr_fasync,
}; };
static struct file_operations read_pipe_fops = { static const struct file_operations read_pipe_fops = {
.llseek = no_llseek, .llseek = no_llseek,
.read = do_sync_read, .read = do_sync_read,
.aio_read = pipe_read, .aio_read = pipe_read,
...@@ -768,7 +768,7 @@ static struct file_operations read_pipe_fops = { ...@@ -768,7 +768,7 @@ static struct file_operations read_pipe_fops = {
.fasync = pipe_read_fasync, .fasync = pipe_read_fasync,
}; };
static struct file_operations write_pipe_fops = { static const struct file_operations write_pipe_fops = {
.llseek = no_llseek, .llseek = no_llseek,
.read = bad_pipe_r, .read = bad_pipe_r,
.write = do_sync_write, .write = do_sync_write,
...@@ -780,7 +780,7 @@ static struct file_operations write_pipe_fops = { ...@@ -780,7 +780,7 @@ static struct file_operations write_pipe_fops = {
.fasync = pipe_write_fasync, .fasync = pipe_write_fasync,
}; };
static struct file_operations rdwr_pipe_fops = { static const struct file_operations rdwr_pipe_fops = {
.llseek = no_llseek, .llseek = no_llseek,
.read = do_sync_read, .read = do_sync_read,
.aio_read = pipe_read, .aio_read = pipe_read,
......
...@@ -42,7 +42,7 @@ struct splice_pipe_desc { ...@@ -42,7 +42,7 @@ struct splice_pipe_desc {
struct partial_page *partial; /* pages[] may not be contig */ struct partial_page *partial; /* pages[] may not be contig */
int nr_pages; /* number of pages in map */ int nr_pages; /* number of pages in map */
unsigned int flags; /* splice flags */ unsigned int flags; /* splice flags */
struct pipe_buf_operations *ops;/* ops associated with output pipe */ const struct pipe_buf_operations *ops;/* ops associated with output pipe */
}; };
/* /*
...@@ -139,7 +139,7 @@ static int page_cache_pipe_buf_pin(struct pipe_inode_info *pipe, ...@@ -139,7 +139,7 @@ static int page_cache_pipe_buf_pin(struct pipe_inode_info *pipe,
return err; return err;
} }
static struct pipe_buf_operations page_cache_pipe_buf_ops = { static const struct pipe_buf_operations page_cache_pipe_buf_ops = {
.can_merge = 0, .can_merge = 0,
.map = generic_pipe_buf_map, .map = generic_pipe_buf_map,
.unmap = generic_pipe_buf_unmap, .unmap = generic_pipe_buf_unmap,
...@@ -159,7 +159,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe, ...@@ -159,7 +159,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
return generic_pipe_buf_steal(pipe, buf); return generic_pipe_buf_steal(pipe, buf);
} }
static struct pipe_buf_operations user_page_pipe_buf_ops = { static const struct pipe_buf_operations user_page_pipe_buf_ops = {
.can_merge = 0, .can_merge = 0,
.map = generic_pipe_buf_map, .map = generic_pipe_buf_map,
.unmap = generic_pipe_buf_unmap, .unmap = generic_pipe_buf_unmap,
...@@ -724,7 +724,7 @@ static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, ...@@ -724,7 +724,7 @@ static ssize_t __splice_from_pipe(struct pipe_inode_info *pipe,
for (;;) { for (;;) {
if (pipe->nrbufs) { if (pipe->nrbufs) {
struct pipe_buffer *buf = pipe->bufs + pipe->curbuf; struct pipe_buffer *buf = pipe->bufs + pipe->curbuf;
struct pipe_buf_operations *ops = buf->ops; const struct pipe_buf_operations *ops = buf->ops;
sd.len = buf->len; sd.len = buf->len;
if (sd.len > sd.total_len) if (sd.len > sd.total_len)
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
struct pipe_buffer { struct pipe_buffer {
struct page *page; struct page *page;
unsigned int offset, len; unsigned int offset, len;
struct pipe_buf_operations *ops; const struct pipe_buf_operations *ops;
unsigned int flags; unsigned int flags;
}; };
...@@ -43,7 +43,6 @@ struct pipe_inode_info { ...@@ -43,7 +43,6 @@ struct pipe_inode_info {
unsigned int nrbufs, curbuf; unsigned int nrbufs, curbuf;
struct pipe_buffer bufs[PIPE_BUFFERS]; struct pipe_buffer bufs[PIPE_BUFFERS];
struct page *tmp_page; struct page *tmp_page;
unsigned int start;
unsigned int readers; unsigned int readers;
unsigned int writers; unsigned int writers;
unsigned int waiting_writers; unsigned int waiting_writers;
......
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