1 #ifndef _LINUX_PIPE_FS_I_H
2 #define _LINUX_PIPE_FS_I_H
4 #define PIPEFS_MAGIC 0x50495045
6 #define PIPE_BUFFERS (16)
8 #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
9 #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
10 #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
14 unsigned int offset
, len
;
15 const struct pipe_buf_operations
*ops
;
17 unsigned long private;
20 struct pipe_inode_info
{
21 wait_queue_head_t wait
;
22 unsigned int nrbufs
, curbuf
;
23 struct page
*tmp_page
;
26 unsigned int waiting_writers
;
27 unsigned int r_counter
;
28 unsigned int w_counter
;
29 struct fasync_struct
*fasync_readers
;
30 struct fasync_struct
*fasync_writers
;
32 struct pipe_buffer bufs
[PIPE_BUFFERS
];
36 * Note on the nesting of these functions:
45 * That is, ->map() must be called on a confirmed buffer,
46 * same goes for ->steal().
48 struct pipe_buf_operations
{
50 void * (*map
)(struct pipe_inode_info
*, struct pipe_buffer
*, int);
51 void (*unmap
)(struct pipe_inode_info
*, struct pipe_buffer
*, void *);
52 int (*confirm
)(struct pipe_inode_info
*, struct pipe_buffer
*);
53 void (*release
)(struct pipe_inode_info
*, struct pipe_buffer
*);
54 int (*steal
)(struct pipe_inode_info
*, struct pipe_buffer
*);
55 void (*get
)(struct pipe_inode_info
*, struct pipe_buffer
*);
58 /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
59 memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
60 #define PIPE_SIZE PAGE_SIZE
62 /* Drop the inode semaphore and wait for a pipe event, atomically */
63 void pipe_wait(struct pipe_inode_info
*pipe
);
65 struct pipe_inode_info
* alloc_pipe_info(struct inode
* inode
);
66 void free_pipe_info(struct inode
* inode
);
67 void __free_pipe_info(struct pipe_inode_info
*);
69 /* Generic pipe buffer ops functions */
70 void *generic_pipe_buf_map(struct pipe_inode_info
*, struct pipe_buffer
*, int);
71 void generic_pipe_buf_unmap(struct pipe_inode_info
*, struct pipe_buffer
*, void *);
72 void generic_pipe_buf_get(struct pipe_inode_info
*, struct pipe_buffer
*);
73 int generic_pipe_buf_confirm(struct pipe_inode_info
*, struct pipe_buffer
*);
74 int generic_pipe_buf_steal(struct pipe_inode_info
*, struct pipe_buffer
*);