* [PATCH] Fix PIPE_LEN definition in 2.6.12
@ 2005-07-31 7:55 霍志刚
2005-07-31 8:08 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: 霍志刚 @ 2005-07-31 7:55 UTC (permalink / raw)
To: linux-kernel; +Cc: trivial
With the introduction of the new "struct pipe_inode_info"in 2.6.11,
the definition of PIPE_LEN, PIPE_BASE, PIPE_START all become
obsolete. The new definition of PIPE_LEN is attached.
Signed-off-by: Zhigang Huo <zghuo@ncic.ac.cn>
================================================
--- pipe_fs_i.h~ 2005-07-31 13:45:38.000000000 +0800
+++ pipe_fs_i.h 2005-07-31 14:41:53.000000000 +0800
@@ -33,6 +33,25 @@
struct fasync_struct *fasync_writers;
};
+static inline unsigned int pipe_len(struct inode inode)
+{
+ struct pipe_inode_info *info = inode.i_pipe;
+ int bufs = info->nrbufs;
+ int curbuf = info->curbuf;
+ unsigned int ret;
+
+ ret = 0;
+ while(bufs--) {
+ struct pipe_buffer *buf = info->bufs + curbuf;
+ size_t chars = buf->len;
+
+ ret += chars;
+ bufs--;
+ curbuf = (curbuf + 1) & (PIPE_BUFFERS-1);
+ }
+ return ret;
+}
+
/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
#define PIPE_SIZE PAGE_SIZE
@@ -41,7 +60,7 @@
#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
#define PIPE_BASE(inode) ((inode).i_pipe->base)
#define PIPE_START(inode) ((inode).i_pipe->start)
-#define PIPE_LEN(inode) ((inode).i_pipe->len)
+#define PIPE_LEN(inode) pipe_len(inode)
#define PIPE_READERS(inode) ((inode).i_pipe->readers)
#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
#define PIPE_WAITING_WRITERS(inode)
((inode).i_pipe->waiting_writers)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix PIPE_LEN definition in 2.6.12
2005-07-31 7:55 [PATCH] Fix PIPE_LEN definition in 2.6.12 霍志刚
@ 2005-07-31 8:08 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2005-07-31 8:08 UTC (permalink / raw)
To: zghuo; +Cc: linux-kernel, trivial
_________ <zghuo@ncic.ac.cn> wrote:
>
> With the introduction of the new "struct pipe_inode_info"in 2.6.11,
> the definition of PIPE_LEN, PIPE_BASE, PIPE_START all become
> obsolete. The new definition of PIPE_LEN is attached.
bix:/usr/src/linux-2.6.13-rc4> grep -r PIPE_LEN .
./include/linux/pipe_fs_i.h:#define PIPE_LEN(inode) ((inode).i_pipe->len)
bix:/usr/src/linux-2.6.13-rc4>
We can just kill it, can't we?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-07-31 8:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-31 7:55 [PATCH] Fix PIPE_LEN definition in 2.6.12 霍志刚
2005-07-31 8:08 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®