Import 2.3.25pre1
[davej-history.git] / include / linux / pipe_fs_i.h
blobeb2d9105417e9857b4a73f1bd49344f213a1844e
1 #ifndef _LINUX_PIPE_FS_I_H
2 #define _LINUX_PIPE_FS_I_H
4 struct pipe_inode_info {
5 wait_queue_head_t wait;
6 char *base;
7 unsigned int start;
8 unsigned int readers;
9 unsigned int writers;
12 /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
13 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
14 #define PIPE_SIZE PAGE_SIZE
16 #define PIPE_SEM(inode) (&(inode).i_sem)
17 #define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
18 #define PIPE_BASE(inode) ((inode).i_pipe->base)
19 #define PIPE_START(inode) ((inode).i_pipe->start)
20 #define PIPE_LEN(inode) ((inode).i_size)
21 #define PIPE_READERS(inode) ((inode).i_pipe->readers)
22 #define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
24 #define PIPE_EMPTY(inode) (PIPE_LEN(inode) == 0)
25 #define PIPE_FULL(inode) (PIPE_LEN(inode) == PIPE_SIZE)
26 #define PIPE_FREE(inode) (PIPE_SIZE - PIPE_LEN(inode))
27 #define PIPE_END(inode) ((PIPE_START(inode) + PIPE_LEN(inode)) & (PIPE_SIZE-1))
28 #define PIPE_MAX_RCHUNK(inode) (PIPE_SIZE - PIPE_START(inode))
29 #define PIPE_MAX_WCHUNK(inode) (PIPE_SIZE - PIPE_END(inode))
31 #endif