diff options
-rw-r--r-- | Documentation/DocBook/kernel-api.tmpl | 16 | ||||
-rw-r--r-- | kernel/relay.c | 36 |
2 files changed, 38 insertions, 14 deletions
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index f8fe882e33dc..ea6f375475b8 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -202,6 +202,22 @@ X!Ilib/string.c | |||
202 | </sect1> | 202 | </sect1> |
203 | </chapter> | 203 | </chapter> |
204 | 204 | ||
205 | <chapter id="relayfs"> | ||
206 | <title>relay interface support</title> | ||
207 | |||
208 | <para> | ||
209 | Relay interface support | ||
210 | is designed to provide an efficient mechanism for tools and | ||
211 | facilities to relay large amounts of data from kernel space to | ||
212 | user space. | ||
213 | </para> | ||
214 | |||
215 | <sect1><title>relay interface</title> | ||
216 | !Ekernel/relay.c | ||
217 | !Ikernel/relay.c | ||
218 | </sect1> | ||
219 | </chapter> | ||
220 | |||
205 | <chapter id="vfs"> | 221 | <chapter id="vfs"> |
206 | <title>The Linux VFS</title> | 222 | <title>The Linux VFS</title> |
207 | <sect1><title>The Filesystem types</title> | 223 | <sect1><title>The Filesystem types</title> |
diff --git a/kernel/relay.c b/kernel/relay.c index 85786ff2a4f9..1d63ecddfa70 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -95,7 +95,7 @@ int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma) | |||
95 | * @buf: the buffer struct | 95 | * @buf: the buffer struct |
96 | * @size: total size of the buffer | 96 | * @size: total size of the buffer |
97 | * | 97 | * |
98 | * Returns a pointer to the resulting buffer, NULL if unsuccessful. The | 98 | * Returns a pointer to the resulting buffer, %NULL if unsuccessful. The |
99 | * passed in size will get page aligned, if it isn't already. | 99 | * passed in size will get page aligned, if it isn't already. |
100 | */ | 100 | */ |
101 | static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size) | 101 | static void *relay_alloc_buf(struct rchan_buf *buf, size_t *size) |
@@ -132,10 +132,9 @@ depopulate: | |||
132 | 132 | ||
133 | /** | 133 | /** |
134 | * relay_create_buf - allocate and initialize a channel buffer | 134 | * relay_create_buf - allocate and initialize a channel buffer |
135 | * @alloc_size: size of the buffer to allocate | 135 | * @chan: the relay channel |
136 | * @n_subbufs: number of sub-buffers in the channel | ||
137 | * | 136 | * |
138 | * Returns channel buffer if successful, NULL otherwise | 137 | * Returns channel buffer if successful, %NULL otherwise. |
139 | */ | 138 | */ |
140 | struct rchan_buf *relay_create_buf(struct rchan *chan) | 139 | struct rchan_buf *relay_create_buf(struct rchan *chan) |
141 | { | 140 | { |
@@ -163,6 +162,7 @@ free_buf: | |||
163 | 162 | ||
164 | /** | 163 | /** |
165 | * relay_destroy_channel - free the channel struct | 164 | * relay_destroy_channel - free the channel struct |
165 | * @kref: target kernel reference that contains the relay channel | ||
166 | * | 166 | * |
167 | * Should only be called from kref_put(). | 167 | * Should only be called from kref_put(). |
168 | */ | 168 | */ |
@@ -194,6 +194,7 @@ void relay_destroy_buf(struct rchan_buf *buf) | |||
194 | 194 | ||
195 | /** | 195 | /** |
196 | * relay_remove_buf - remove a channel buffer | 196 | * relay_remove_buf - remove a channel buffer |
197 | * @kref: target kernel reference that contains the relay buffer | ||
197 | * | 198 | * |
198 | * Removes the file from the fileystem, which also frees the | 199 | * Removes the file from the fileystem, which also frees the |
199 | * rchan_buf_struct and the channel buffer. Should only be called from | 200 | * rchan_buf_struct and the channel buffer. Should only be called from |
@@ -374,7 +375,7 @@ void relay_reset(struct rchan *chan) | |||
374 | } | 375 | } |
375 | EXPORT_SYMBOL_GPL(relay_reset); | 376 | EXPORT_SYMBOL_GPL(relay_reset); |
376 | 377 | ||
377 | /** | 378 | /* |
378 | * relay_open_buf - create a new relay channel buffer | 379 | * relay_open_buf - create a new relay channel buffer |
379 | * | 380 | * |
380 | * Internal - used by relay_open(). | 381 | * Internal - used by relay_open(). |
@@ -448,12 +449,12 @@ static inline void setup_callbacks(struct rchan *chan, | |||
448 | /** | 449 | /** |
449 | * relay_open - create a new relay channel | 450 | * relay_open - create a new relay channel |
450 | * @base_filename: base name of files to create | 451 | * @base_filename: base name of files to create |
451 | * @parent: dentry of parent directory, NULL for root directory | 452 | * @parent: dentry of parent directory, %NULL for root directory |
452 | * @subbuf_size: size of sub-buffers | 453 | * @subbuf_size: size of sub-buffers |
453 | * @n_subbufs: number of sub-buffers | 454 | * @n_subbufs: number of sub-buffers |
454 | * @cb: client callback functions | 455 | * @cb: client callback functions |
455 | * | 456 | * |
456 | * Returns channel pointer if successful, NULL otherwise. | 457 | * Returns channel pointer if successful, %NULL otherwise. |
457 | * | 458 | * |
458 | * Creates a channel buffer for each cpu using the sizes and | 459 | * Creates a channel buffer for each cpu using the sizes and |
459 | * attributes specified. The created channel buffer files | 460 | * attributes specified. The created channel buffer files |
@@ -585,7 +586,7 @@ EXPORT_SYMBOL_GPL(relay_switch_subbuf); | |||
585 | * subbufs_consumed should be the number of sub-buffers newly consumed, | 586 | * subbufs_consumed should be the number of sub-buffers newly consumed, |
586 | * not the total consumed. | 587 | * not the total consumed. |
587 | * | 588 | * |
588 | * NOTE: kernel clients don't need to call this function if the channel | 589 | * NOTE: Kernel clients don't need to call this function if the channel |
589 | * mode is 'overwrite'. | 590 | * mode is 'overwrite'. |
590 | */ | 591 | */ |
591 | void relay_subbufs_consumed(struct rchan *chan, | 592 | void relay_subbufs_consumed(struct rchan *chan, |
@@ -641,7 +642,7 @@ EXPORT_SYMBOL_GPL(relay_close); | |||
641 | * relay_flush - close the channel | 642 | * relay_flush - close the channel |
642 | * @chan: the channel | 643 | * @chan: the channel |
643 | * | 644 | * |
644 | * Flushes all channel buffers i.e. forces buffer switch. | 645 | * Flushes all channel buffers, i.e. forces buffer switch. |
645 | */ | 646 | */ |
646 | void relay_flush(struct rchan *chan) | 647 | void relay_flush(struct rchan *chan) |
647 | { | 648 | { |
@@ -729,7 +730,7 @@ static int relay_file_release(struct inode *inode, struct file *filp) | |||
729 | return 0; | 730 | return 0; |
730 | } | 731 | } |
731 | 732 | ||
732 | /** | 733 | /* |
733 | * relay_file_read_consume - update the consumed count for the buffer | 734 | * relay_file_read_consume - update the consumed count for the buffer |
734 | */ | 735 | */ |
735 | static void relay_file_read_consume(struct rchan_buf *buf, | 736 | static void relay_file_read_consume(struct rchan_buf *buf, |
@@ -756,7 +757,7 @@ static void relay_file_read_consume(struct rchan_buf *buf, | |||
756 | } | 757 | } |
757 | } | 758 | } |
758 | 759 | ||
759 | /** | 760 | /* |
760 | * relay_file_read_avail - boolean, are there unconsumed bytes available? | 761 | * relay_file_read_avail - boolean, are there unconsumed bytes available? |
761 | */ | 762 | */ |
762 | static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) | 763 | static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) |
@@ -793,6 +794,8 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos) | |||
793 | 794 | ||
794 | /** | 795 | /** |
795 | * relay_file_read_subbuf_avail - return bytes available in sub-buffer | 796 | * relay_file_read_subbuf_avail - return bytes available in sub-buffer |
797 | * @read_pos: file read position | ||
798 | * @buf: relay channel buffer | ||
796 | */ | 799 | */ |
797 | static size_t relay_file_read_subbuf_avail(size_t read_pos, | 800 | static size_t relay_file_read_subbuf_avail(size_t read_pos, |
798 | struct rchan_buf *buf) | 801 | struct rchan_buf *buf) |
@@ -818,6 +821,8 @@ static size_t relay_file_read_subbuf_avail(size_t read_pos, | |||
818 | 821 | ||
819 | /** | 822 | /** |
820 | * relay_file_read_start_pos - find the first available byte to read | 823 | * relay_file_read_start_pos - find the first available byte to read |
824 | * @read_pos: file read position | ||
825 | * @buf: relay channel buffer | ||
821 | * | 826 | * |
822 | * If the read_pos is in the middle of padding, return the | 827 | * If the read_pos is in the middle of padding, return the |
823 | * position of the first actually available byte, otherwise | 828 | * position of the first actually available byte, otherwise |
@@ -844,6 +849,9 @@ static size_t relay_file_read_start_pos(size_t read_pos, | |||
844 | 849 | ||
845 | /** | 850 | /** |
846 | * relay_file_read_end_pos - return the new read position | 851 | * relay_file_read_end_pos - return the new read position |
852 | * @read_pos: file read position | ||
853 | * @buf: relay channel buffer | ||
854 | * @count: number of bytes to be read | ||
847 | */ | 855 | */ |
848 | static size_t relay_file_read_end_pos(struct rchan_buf *buf, | 856 | static size_t relay_file_read_end_pos(struct rchan_buf *buf, |
849 | size_t read_pos, | 857 | size_t read_pos, |
@@ -865,7 +873,7 @@ static size_t relay_file_read_end_pos(struct rchan_buf *buf, | |||
865 | return end_pos; | 873 | return end_pos; |
866 | } | 874 | } |
867 | 875 | ||
868 | /** | 876 | /* |
869 | * subbuf_read_actor - read up to one subbuf's worth of data | 877 | * subbuf_read_actor - read up to one subbuf's worth of data |
870 | */ | 878 | */ |
871 | static int subbuf_read_actor(size_t read_start, | 879 | static int subbuf_read_actor(size_t read_start, |
@@ -890,7 +898,7 @@ static int subbuf_read_actor(size_t read_start, | |||
890 | return ret; | 898 | return ret; |
891 | } | 899 | } |
892 | 900 | ||
893 | /** | 901 | /* |
894 | * subbuf_send_actor - send up to one subbuf's worth of data | 902 | * subbuf_send_actor - send up to one subbuf's worth of data |
895 | */ | 903 | */ |
896 | static int subbuf_send_actor(size_t read_start, | 904 | static int subbuf_send_actor(size_t read_start, |
@@ -933,7 +941,7 @@ typedef int (*subbuf_actor_t) (size_t read_start, | |||
933 | read_descriptor_t *desc, | 941 | read_descriptor_t *desc, |
934 | read_actor_t actor); | 942 | read_actor_t actor); |
935 | 943 | ||
936 | /** | 944 | /* |
937 | * relay_file_read_subbufs - read count bytes, bridging subbuf boundaries | 945 | * relay_file_read_subbufs - read count bytes, bridging subbuf boundaries |
938 | */ | 946 | */ |
939 | static inline ssize_t relay_file_read_subbufs(struct file *filp, | 947 | static inline ssize_t relay_file_read_subbufs(struct file *filp, |