diff options
Diffstat (limited to 'include/linux/pipe_fs_i.h')
-rw-r--r-- | include/linux/pipe_fs_i.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index 0008d4bd4059..ea4f7cd7bfd8 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h | |||
@@ -5,8 +5,9 @@ | |||
5 | 5 | ||
6 | #define PIPE_BUFFERS (16) | 6 | #define PIPE_BUFFERS (16) |
7 | 7 | ||
8 | #define PIPE_BUF_FLAG_STOLEN 0x01 | 8 | #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ |
9 | #define PIPE_BUF_FLAG_LRU 0x02 | 9 | #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ |
10 | #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */ | ||
10 | 11 | ||
11 | struct pipe_buffer { | 12 | struct pipe_buffer { |
12 | struct page *page; | 13 | struct page *page; |
@@ -15,10 +16,23 @@ struct pipe_buffer { | |||
15 | unsigned int flags; | 16 | unsigned int flags; |
16 | }; | 17 | }; |
17 | 18 | ||
19 | /* | ||
20 | * Note on the nesting of these functions: | ||
21 | * | ||
22 | * ->pin() | ||
23 | * ->steal() | ||
24 | * ... | ||
25 | * ->map() | ||
26 | * ... | ||
27 | * ->unmap() | ||
28 | * | ||
29 | * That is, ->map() must be called on a pinned buffer, same goes for ->steal(). | ||
30 | */ | ||
18 | struct pipe_buf_operations { | 31 | struct pipe_buf_operations { |
19 | int can_merge; | 32 | int can_merge; |
20 | void * (*map)(struct file *, struct pipe_inode_info *, struct pipe_buffer *); | 33 | void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int); |
21 | void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *); | 34 | void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *); |
35 | int (*pin)(struct pipe_inode_info *, struct pipe_buffer *); | ||
22 | void (*release)(struct pipe_inode_info *, struct pipe_buffer *); | 36 | void (*release)(struct pipe_inode_info *, struct pipe_buffer *); |
23 | int (*steal)(struct pipe_inode_info *, struct pipe_buffer *); | 37 | int (*steal)(struct pipe_inode_info *, struct pipe_buffer *); |
24 | void (*get)(struct pipe_inode_info *, struct pipe_buffer *); | 38 | void (*get)(struct pipe_inode_info *, struct pipe_buffer *); |
@@ -51,6 +65,13 @@ struct pipe_inode_info * alloc_pipe_info(struct inode * inode); | |||
51 | void free_pipe_info(struct inode * inode); | 65 | void free_pipe_info(struct inode * inode); |
52 | void __free_pipe_info(struct pipe_inode_info *); | 66 | void __free_pipe_info(struct pipe_inode_info *); |
53 | 67 | ||
68 | /* Generic pipe buffer ops functions */ | ||
69 | void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); | ||
70 | void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *); | ||
71 | void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); | ||
72 | int generic_pipe_buf_pin(struct pipe_inode_info *, struct pipe_buffer *); | ||
73 | int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); | ||
74 | |||
54 | /* | 75 | /* |
55 | * splice is tied to pipes as a transport (at least for now), so we'll just | 76 | * splice is tied to pipes as a transport (at least for now), so we'll just |
56 | * add the splice flags here. | 77 | * add the splice flags here. |
@@ -60,6 +81,7 @@ void __free_pipe_info(struct pipe_inode_info *); | |||
60 | /* we may still block on the fd we splice */ | 81 | /* we may still block on the fd we splice */ |
61 | /* from/to, of course */ | 82 | /* from/to, of course */ |
62 | #define SPLICE_F_MORE (0x04) /* expect more data */ | 83 | #define SPLICE_F_MORE (0x04) /* expect more data */ |
84 | #define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */ | ||
63 | 85 | ||
64 | /* | 86 | /* |
65 | * Passed to the actors | 87 | * Passed to the actors |