Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
#ifndef _LINUX_PIPE_FS_I_H
2
#define _LINUX_PIPE_FS_I_H
3
 
4
#define PIPEFS_MAGIC 0x50495045
5
struct pipe_inode_info {
6
        wait_queue_head_t wait;
7
        char *base;
8
        unsigned int len;
9
        unsigned int start;
10
        unsigned int readers;
11
        unsigned int writers;
12
        unsigned int waiting_writers;
13
        unsigned int r_counter;
14
        unsigned int w_counter;
15
        struct fasync_struct *fasync_readers;
16
        struct fasync_struct *fasync_writers;
17
};
18
 
19
/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
20
   memory allocation, whereas PIPE_BUF makes atomicity guarantees.  */
21
#define PIPE_SIZE               PAGE_SIZE
22
 
23
#define PIPE_SEM(inode)         (&(inode).i_sem)
24
#define PIPE_WAIT(inode)        (&(inode).i_pipe->wait)
25
#define PIPE_BASE(inode)        ((inode).i_pipe->base)
26
#define PIPE_START(inode)       ((inode).i_pipe->start)
27
#define PIPE_LEN(inode)         ((inode).i_pipe->len)
28
#define PIPE_READERS(inode)     ((inode).i_pipe->readers)
29
#define PIPE_WRITERS(inode)     ((inode).i_pipe->writers)
30
#define PIPE_WAITING_WRITERS(inode)     ((inode).i_pipe->waiting_writers)
31
#define PIPE_RCOUNTER(inode)    ((inode).i_pipe->r_counter)
32
#define PIPE_WCOUNTER(inode)    ((inode).i_pipe->w_counter)
33
#define PIPE_FASYNC_READERS(inode)     (&((inode).i_pipe->fasync_readers))
34
#define PIPE_FASYNC_WRITERS(inode)     (&((inode).i_pipe->fasync_writers))
35
 
36
#define PIPE_EMPTY(inode)       (PIPE_LEN(inode) == 0)
37
#define PIPE_FULL(inode)        (PIPE_LEN(inode) == PIPE_SIZE)
38
#define PIPE_FREE(inode)        (PIPE_SIZE - PIPE_LEN(inode))
39
#define PIPE_END(inode) ((PIPE_START(inode) + PIPE_LEN(inode)) & (PIPE_SIZE-1))
40
#define PIPE_MAX_RCHUNK(inode)  (PIPE_SIZE - PIPE_START(inode))
41
#define PIPE_MAX_WCHUNK(inode)  (PIPE_SIZE - PIPE_END(inode))
42
 
43
/* Drop the inode semaphore and wait for a pipe event, atomically */
44
void pipe_wait(struct inode * inode);
45
 
46
struct inode* pipe_new(struct inode* inode);
47
 
48
#endif