X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=include%2Fringbuffer%2Ffrontend_internal.h;h=999a7bb9993273a94c18dd2f7e2f861e04bd72a9;hb=dc818cc2a12a7e075018024d88def68077f81bfb;hp=2624b4dc03683ff16a4eec4577488355398ecd93;hpb=8a57ec025ffbe56153748fd69b60118862707182;p=lttng-modules.git diff --git a/include/ringbuffer/frontend_internal.h b/include/ringbuffer/frontend_internal.h index 2624b4dc..999a7bb9 100644 --- a/include/ringbuffer/frontend_internal.h +++ b/include/ringbuffer/frontend_internal.h @@ -21,7 +21,7 @@ /* buf_trunc mask selects only the buffer number. */ static inline -unsigned long buf_trunc(unsigned long offset, struct channel *chan) +unsigned long buf_trunc(unsigned long offset, struct lttng_kernel_ring_buffer_channel *chan) { return offset & ~(chan->backend.buf_size - 1); @@ -29,35 +29,35 @@ unsigned long buf_trunc(unsigned long offset, struct channel *chan) /* Select the buffer number value (counter). */ static inline -unsigned long buf_trunc_val(unsigned long offset, struct channel *chan) +unsigned long buf_trunc_val(unsigned long offset, struct lttng_kernel_ring_buffer_channel *chan) { return buf_trunc(offset, chan) >> chan->backend.buf_size_order; } /* buf_offset mask selects only the offset within the current buffer. */ static inline -unsigned long buf_offset(unsigned long offset, struct channel *chan) +unsigned long buf_offset(unsigned long offset, struct lttng_kernel_ring_buffer_channel *chan) { return offset & (chan->backend.buf_size - 1); } /* subbuf_offset mask selects the offset within the current subbuffer. */ static inline -unsigned long subbuf_offset(unsigned long offset, struct channel *chan) +unsigned long subbuf_offset(unsigned long offset, struct lttng_kernel_ring_buffer_channel *chan) { return offset & (chan->backend.subbuf_size - 1); } /* subbuf_trunc mask selects the subbuffer number. */ static inline -unsigned long subbuf_trunc(unsigned long offset, struct channel *chan) +unsigned long subbuf_trunc(unsigned long offset, struct lttng_kernel_ring_buffer_channel *chan) { return offset & ~(chan->backend.subbuf_size - 1); } /* subbuf_align aligns the offset to the next subbuffer. */ static inline -unsigned long subbuf_align(unsigned long offset, struct channel *chan) +unsigned long subbuf_align(unsigned long offset, struct lttng_kernel_ring_buffer_channel *chan) { return (offset + chan->backend.subbuf_size) & ~(chan->backend.subbuf_size - 1); @@ -65,7 +65,7 @@ unsigned long subbuf_align(unsigned long offset, struct channel *chan) /* subbuf_index returns the index of the current subbuffer within the buffer. */ static inline -unsigned long subbuf_index(unsigned long offset, struct channel *chan) +unsigned long subbuf_index(unsigned long offset, struct lttng_kernel_ring_buffer_channel *chan) { return buf_offset(offset, chan) >> chan->backend.subbuf_size_order; } @@ -79,8 +79,8 @@ unsigned long subbuf_index(unsigned long offset, struct channel *chan) #if (BITS_PER_LONG == 32) static inline -void save_last_tsc(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, u64 tsc) +void save_last_tsc(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, u64 tsc) { if (config->tsc_bits == 0 || config->tsc_bits == 64) return; @@ -92,8 +92,8 @@ void save_last_tsc(const struct lib_ring_buffer_config *config, } static inline -int last_tsc_overflow(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, u64 tsc) +int last_tsc_overflow(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, u64 tsc) { unsigned long tsc_shifted; @@ -109,8 +109,8 @@ int last_tsc_overflow(const struct lib_ring_buffer_config *config, } #else static inline -void save_last_tsc(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, u64 tsc) +void save_last_tsc(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, u64 tsc) { if (config->tsc_bits == 0 || config->tsc_bits == 64) return; @@ -119,8 +119,8 @@ void save_last_tsc(const struct lib_ring_buffer_config *config, } static inline -int last_tsc_overflow(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, u64 tsc) +int last_tsc_overflow(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, u64 tsc) { if (config->tsc_bits == 0 || config->tsc_bits == 64) return 0; @@ -138,30 +138,30 @@ int lib_ring_buffer_reserve_slow(struct lttng_kernel_ring_buffer_ctx *ctx, void *client_ctx); extern -void lib_ring_buffer_switch_slow(struct lib_ring_buffer *buf, +void lib_ring_buffer_switch_slow(struct lttng_kernel_ring_buffer *buf, enum switch_mode mode); extern -void lib_ring_buffer_check_deliver_slow(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, - struct channel *chan, +void lib_ring_buffer_check_deliver_slow(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, + struct lttng_kernel_ring_buffer_channel *chan, unsigned long offset, unsigned long commit_count, unsigned long idx, - u64 tsc); + const struct lttng_kernel_ring_buffer_ctx *ctx); extern -void lib_ring_buffer_switch_remote(struct lib_ring_buffer *buf); +void lib_ring_buffer_switch_remote(struct lttng_kernel_ring_buffer *buf); extern -void lib_ring_buffer_switch_remote_empty(struct lib_ring_buffer *buf); +void lib_ring_buffer_switch_remote_empty(struct lttng_kernel_ring_buffer *buf); extern -void lib_ring_buffer_clear(struct lib_ring_buffer *buf); +void lib_ring_buffer_clear(struct lttng_kernel_ring_buffer *buf); /* Buffer write helpers */ static inline -void lib_ring_buffer_reserve_push_reader(struct lib_ring_buffer *buf, - struct channel *chan, +void lib_ring_buffer_reserve_push_reader(struct lttng_kernel_ring_buffer *buf, + struct lttng_kernel_ring_buffer_channel *chan, unsigned long offset) { unsigned long consumed_old, consumed_new; @@ -197,10 +197,10 @@ void lib_ring_buffer_reserve_push_reader(struct lib_ring_buffer *buf, * algorithm guarantees. */ static inline -void lib_ring_buffer_clear_reader(struct lib_ring_buffer *buf, - struct channel *chan) +void lib_ring_buffer_clear_reader(struct lttng_kernel_ring_buffer *buf, + struct lttng_kernel_ring_buffer_channel *chan) { - const struct lib_ring_buffer_config *config = &chan->backend.config; + const struct lttng_kernel_ring_buffer_config *config = &chan->backend.config; unsigned long offset, consumed_old, consumed_new; do { @@ -215,16 +215,16 @@ void lib_ring_buffer_clear_reader(struct lib_ring_buffer *buf, } static inline -int lib_ring_buffer_pending_data(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, - struct channel *chan) +int lib_ring_buffer_pending_data(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, + struct lttng_kernel_ring_buffer_channel *chan) { return !!subbuf_offset(v_read(config, &buf->offset), chan); } static inline -unsigned long lib_ring_buffer_get_data_size(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, +unsigned long lib_ring_buffer_get_data_size(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, unsigned long idx) { return subbuffer_get_data_size(config, &buf->backend, idx); @@ -236,9 +236,9 @@ unsigned long lib_ring_buffer_get_data_size(const struct lib_ring_buffer_config * This is a very specific ftrace use-case, so we keep this as "internal" API. */ static inline -int lib_ring_buffer_reserve_committed(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, - struct channel *chan) +int lib_ring_buffer_reserve_committed(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, + struct lttng_kernel_ring_buffer_channel *chan) { unsigned long offset, idx, commit_count; @@ -271,13 +271,13 @@ int lib_ring_buffer_reserve_committed(const struct lib_ring_buffer_config *confi * timestamp of the following subbuffers. */ static inline -void lib_ring_buffer_check_deliver(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, - struct channel *chan, +void lib_ring_buffer_check_deliver(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, + struct lttng_kernel_ring_buffer_channel *chan, unsigned long offset, unsigned long commit_count, unsigned long idx, - u64 tsc) + const struct lttng_kernel_ring_buffer_ctx *ctx) { unsigned long old_commit_count = commit_count - chan->backend.subbuf_size; @@ -286,7 +286,7 @@ void lib_ring_buffer_check_deliver(const struct lib_ring_buffer_config *config, if (unlikely((buf_trunc(offset, chan) >> chan->backend.num_subbuf_order) - (old_commit_count & chan->commit_count_mask) == 0)) lib_ring_buffer_check_deliver_slow(config, buf, chan, offset, - commit_count, idx, tsc); + commit_count, idx, ctx); } /* @@ -298,9 +298,9 @@ void lib_ring_buffer_check_deliver(const struct lib_ring_buffer_config *config, * useful for crash dump. */ static inline -void lib_ring_buffer_write_commit_counter(const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *buf, - struct channel *chan, +void lib_ring_buffer_write_commit_counter(const struct lttng_kernel_ring_buffer_config *config, + struct lttng_kernel_ring_buffer *buf, + struct lttng_kernel_ring_buffer_channel *chan, unsigned long buf_offset, unsigned long commit_count, struct commit_counters_hot *cc_hot) @@ -324,9 +324,9 @@ void lib_ring_buffer_write_commit_counter(const struct lib_ring_buffer_config *c v_set(config, &cc_hot->seq, commit_count); } -extern int lib_ring_buffer_create(struct lib_ring_buffer *buf, +extern int lib_ring_buffer_create(struct lttng_kernel_ring_buffer *buf, struct channel_backend *chanb, int cpu); -extern void lib_ring_buffer_free(struct lib_ring_buffer *buf); +extern void lib_ring_buffer_free(struct lttng_kernel_ring_buffer *buf); /* Keep track of trap nesting inside ring buffer code */ DECLARE_PER_CPU(unsigned int, lib_ring_buffer_nesting);