[PATCH] get rid of the PIPE_*() macros
[safe/jmp/linux-2.6] / include / linux / pipe_fs_i.h
1 #ifndef _LINUX_PIPE_FS_I_H
2 #define _LINUX_PIPE_FS_I_H
3
4 #define PIPEFS_MAGIC 0x50495045
5
6 #define PIPE_BUFFERS (16)
7
8 #define PIPE_BUF_FLAG_STOLEN    0x01
9 #define PIPE_BUF_FLAG_LRU       0x02
10
11 struct pipe_buffer {
12         struct page *page;
13         unsigned int offset, len;
14         struct pipe_buf_operations *ops;
15         unsigned int flags;
16 };
17
18 struct pipe_buf_operations {
19         int can_merge;
20         void * (*map)(struct file *, struct pipe_inode_info *, struct pipe_buffer *);
21         void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *);
22         void (*release)(struct pipe_inode_info *, struct pipe_buffer *);
23         int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);
24 };
25
26 struct pipe_inode_info {
27         wait_queue_head_t wait;
28         unsigned int nrbufs, curbuf;
29         struct pipe_buffer bufs[PIPE_BUFFERS];
30         struct page *tmp_page;
31         unsigned int start;
32         unsigned int readers;
33         unsigned int writers;
34         unsigned int waiting_writers;
35         unsigned int r_counter;
36         unsigned int w_counter;
37         struct fasync_struct *fasync_readers;
38         struct fasync_struct *fasync_writers;
39         struct inode *inode;
40 };
41
42 /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
43    memory allocation, whereas PIPE_BUF makes atomicity guarantees.  */
44 #define PIPE_SIZE               PAGE_SIZE
45
46 /* Drop the inode semaphore and wait for a pipe event, atomically */
47 void pipe_wait(struct pipe_inode_info *pipe);
48
49 struct pipe_inode_info * alloc_pipe_info(struct inode * inode);
50 void free_pipe_info(struct inode * inode);
51 void __free_pipe_info(struct pipe_inode_info *);
52
53 /*
54  * splice is tied to pipes as a transport (at least for now), so we'll just
55  * add the splice flags here.
56  */
57 #define SPLICE_F_MOVE   (0x01)  /* move pages instead of copying */
58 #define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
59                                  /* we may still block on the fd we splice */
60                                  /* from/to, of course */
61 #define SPLICE_F_MORE   (0x04)  /* expect more data */
62
63 #endif