From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] constify pipe_buf_operations
Date: Mon, 11 Dec 2006 20:04:03 +0100 [thread overview]
Message-ID: <200612112004.04402.dada1@cosmosbay.com> (raw)
In-Reply-To: <200612111450.07722.dada1@cosmosbay.com>
[-- Attachment #1: Type: text/plain, Size: 189 bytes --]
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>
[-- Attachment #2: constify_pipe_buf_operations.patch --]
[-- Type: text/plain, Size: 3949 bytes --]
--- linux-2.6.19/include/linux/pipe_fs_i.h 2006-12-11 17:00:21.000000000 +0100
+++ linux-2.6.19-ed/include/linux/pipe_fs_i.h 2006-12-11 17:09:24.000000000 +0100
@@ -12,7 +12,7 @@
struct pipe_buffer {
struct page *page;
unsigned int offset, len;
- struct pipe_buf_operations *ops;
+ const struct pipe_buf_operations *ops;
unsigned int flags;
};
@@ -43,7 +43,6 @@ struct pipe_inode_info {
unsigned int nrbufs, curbuf;
struct pipe_buffer bufs[PIPE_BUFFERS];
struct page *tmp_page;
- unsigned int start;
unsigned int readers;
unsigned int writers;
unsigned int waiting_writers;
--- linux-2.6.19/fs/pipe.c 2006-12-11 17:04:00.000000000 +0100
+++ linux-2.6.19-ed/fs/pipe.c 2006-12-11 17:14:04.000000000 +0100
@@ -207,7 +207,7 @@ int generic_pipe_buf_pin(struct pipe_ino
return 0;
}
-static struct pipe_buf_operations anon_pipe_buf_ops = {
+static const struct pipe_buf_operations anon_pipe_buf_ops = {
.can_merge = 1,
.map = generic_pipe_buf_map,
.unmap = generic_pipe_buf_unmap,
@@ -243,7 +243,7 @@ pipe_read(struct kiocb *iocb, const stru
if (bufs) {
int curbuf = pipe->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;
size_t chars = buf->len;
int error, atomic;
@@ -365,7 +365,7 @@ pipe_write(struct kiocb *iocb, const str
int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) &
(PIPE_BUFFERS-1);
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;
if (ops->can_merge && offset + chars <= PAGE_SIZE) {
@@ -756,7 +756,7 @@ const struct file_operations rdwr_fifo_f
.fasync = pipe_rdwr_fasync,
};
-static struct file_operations read_pipe_fops = {
+static const struct file_operations read_pipe_fops = {
.llseek = no_llseek,
.read = do_sync_read,
.aio_read = pipe_read,
@@ -768,7 +768,7 @@ static struct file_operations read_pipe_
.fasync = pipe_read_fasync,
};
-static struct file_operations write_pipe_fops = {
+static const struct file_operations write_pipe_fops = {
.llseek = no_llseek,
.read = bad_pipe_r,
.write = do_sync_write,
@@ -780,7 +780,7 @@ static struct file_operations write_pipe
.fasync = pipe_write_fasync,
};
-static struct file_operations rdwr_pipe_fops = {
+static const struct file_operations rdwr_pipe_fops = {
.llseek = no_llseek,
.read = do_sync_read,
.aio_read = pipe_read,
--- linux-2.6.19/fs/splice.c 2006-12-11 17:04:00.000000000 +0100
+++ linux-2.6.19-ed/fs/splice.c 2006-12-11 17:09:24.000000000 +0100
@@ -42,7 +42,7 @@ struct splice_pipe_desc {
struct partial_page *partial; /* pages[] may not be contig */
int nr_pages; /* number of pages in map */
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 @@ error:
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,
.map = generic_pipe_buf_map,
.unmap = generic_pipe_buf_unmap,
@@ -159,7 +159,7 @@ static int user_page_pipe_buf_steal(stru
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,
.map = generic_pipe_buf_map,
.unmap = generic_pipe_buf_unmap,
@@ -724,7 +724,7 @@ static ssize_t __splice_from_pipe(struct
for (;;) {
if (pipe->nrbufs) {
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;
if (sd.len > sd.total_len)
next prev parent reply other threads:[~2006-12-11 19:03 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-11 8:27 [patch] pipe: Don't oops when pipe filesystem isn't mounted Chuck Ebbert
2006-12-11 8:55 ` Andrew Morton
2006-12-11 9:13 ` Andrew Morton
2006-12-11 9:21 ` Al Viro
2006-12-11 9:25 ` Andrew Morton
2006-12-11 9:33 ` Al Viro
2006-12-11 9:47 ` Andrew Morton
2006-12-11 10:03 ` Al Viro
2006-12-11 10:17 ` Andrew Morton
2006-12-11 10:22 ` Al Viro
2006-12-11 10:34 ` Andrew Morton
2006-12-11 10:47 ` Al Viro
2006-12-11 10:57 ` Jeff Garzik
2006-12-11 10:27 ` Andrew Morton
2006-12-11 10:45 ` Al Viro
2006-12-11 16:01 ` Linus Torvalds
2006-12-11 16:12 ` Al Viro
2006-12-11 16:40 ` Linus Torvalds
2006-12-12 0:33 ` Benjamin Herrenschmidt
2006-12-12 2:08 ` Andrew Morton
2006-12-12 2:17 ` Dominik Brodowski
2006-12-12 2:23 ` Linus Torvalds
2006-12-11 10:52 ` [PATCH] get rid of ARCH_HAVE_XTIME_LOCK Eric Dumazet
2006-12-11 13:50 ` [PATCH] Optimize calc_load() Eric Dumazet
2006-12-11 19:04 ` Eric Dumazet [this message]
2006-12-11 9:13 ` [patch] pipe: Don't oops when pipe filesystem isn't mounted Al Viro
2006-12-11 9:40 ` Michael Tokarev
2006-12-11 15:44 ` Linus Torvalds
2006-12-12 12:20 ` Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200612112004.04402.dada1@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox