X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=include%2Fringbuffer%2Fiterator.h;h=db9f7820b25a001e62dc63443c68113c3a592487;hb=843fbaddbacb3fa9fb910f9fa6fb76b0652cac3f;hp=a006ed00e1bb34b66da9f7552a2f8435605a4702;hpb=2459130397d7e7eecc44a5f06a39d65c78257eef;p=lttng-modules.git diff --git a/include/ringbuffer/iterator.h b/include/ringbuffer/iterator.h index a006ed00..db9f7820 100644 --- a/include/ringbuffer/iterator.h +++ b/include/ringbuffer/iterator.h @@ -20,8 +20,17 @@ * currently no data available, or -ENODATA if no data is available and buffer * is finalized. */ -extern ssize_t lib_ring_buffer_get_next_record(struct channel *chan, - struct lib_ring_buffer *buf); +extern ssize_t lib_ring_buffer_get_next_record(struct lttng_kernel_ring_buffer_channel *chan, + struct lttng_kernel_ring_buffer *buf); + +/* + * Ensure that the current subbuffer is put after client code has read the + * payload of the current record. Has an effect when the end of subbuffer is + * reached. It is not required if get_next_record is called successively. + * However, it should be invoked before returning data to user-space to ensure + * that the get/put subbuffer state is quiescent. + */ +extern void lib_ring_buffer_put_current_record(struct lttng_kernel_ring_buffer *buf); /* * channel_get_next_record advances the buffer read position to the next record. @@ -30,8 +39,8 @@ extern ssize_t lib_ring_buffer_get_next_record(struct channel *chan, * finalized. * Returns the current buffer in ret_buf. */ -extern ssize_t channel_get_next_record(struct channel *chan, - struct lib_ring_buffer **ret_buf); +extern ssize_t channel_get_next_record(struct lttng_kernel_ring_buffer_channel *chan, + struct lttng_kernel_ring_buffer **ret_buf); /** * read_current_record - copy the buffer current record into dest. @@ -41,16 +50,16 @@ extern ssize_t channel_get_next_record(struct channel *chan, * dest should be large enough to contain the record. Returns the number of * bytes copied. */ -static inline size_t read_current_record(struct lib_ring_buffer *buf, void *dest) +static inline size_t read_current_record(struct lttng_kernel_ring_buffer *buf, void *dest) { return lib_ring_buffer_read(&buf->backend, buf->iter.read_offset, dest, buf->iter.payload_len); } -extern int lib_ring_buffer_iterator_open(struct lib_ring_buffer *buf); -extern void lib_ring_buffer_iterator_release(struct lib_ring_buffer *buf); -extern int channel_iterator_open(struct channel *chan); -extern void channel_iterator_release(struct channel *chan); +extern int lib_ring_buffer_iterator_open(struct lttng_kernel_ring_buffer *buf); +extern void lib_ring_buffer_iterator_release(struct lttng_kernel_ring_buffer *buf); +extern int channel_iterator_open(struct lttng_kernel_ring_buffer_channel *chan); +extern void channel_iterator_release(struct lttng_kernel_ring_buffer_channel *chan); extern const struct file_operations channel_payload_file_operations; extern const struct file_operations lib_ring_buffer_payload_file_operations; @@ -58,10 +67,10 @@ extern const struct file_operations lib_ring_buffer_payload_file_operations; /* * Used internally. */ -int channel_iterator_init(struct channel *chan); -void channel_iterator_unregister_notifiers(struct channel *chan); -void channel_iterator_free(struct channel *chan); -void channel_iterator_reset(struct channel *chan); -void lib_ring_buffer_iterator_reset(struct lib_ring_buffer *buf); +int channel_iterator_init(struct lttng_kernel_ring_buffer_channel *chan); +void channel_iterator_unregister_notifiers(struct lttng_kernel_ring_buffer_channel *chan); +void channel_iterator_free(struct lttng_kernel_ring_buffer_channel *chan); +void channel_iterator_reset(struct lttng_kernel_ring_buffer_channel *chan); +void lib_ring_buffer_iterator_reset(struct lttng_kernel_ring_buffer *buf); #endif /* _LIB_RING_BUFFER_ITERATOR_H */