From: Mathieu Desnoyers Date: Fri, 26 Mar 2021 20:25:41 +0000 (-0400) Subject: Remove handle field from ring buffer context X-Git-Tag: v2.13.0-rc1~201 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=aab8b172425eb52f2cd5bd71ce03f8a5624f83df;p=lttng-ust.git Remove handle field from ring buffer context The ring buffer handle is available in the struct lttng_ust_lib_ring_buffer_channel, therefore passing it through the ring buffer context is redundant. Signed-off-by: Mathieu Desnoyers Change-Id: I7baca38b86743ba88a55b9d336135df2256756d1 --- diff --git a/include/lttng/ringbuffer-context.h b/include/lttng/ringbuffer-context.h index 53670d93..b335d81a 100644 --- a/include/lttng/ringbuffer-context.h +++ b/include/lttng/ringbuffer-context.h @@ -45,7 +45,6 @@ struct lttng_ust_lib_ring_buffer_ctx { /* input received by lib_ring_buffer_reserve(), saved here. */ struct lttng_ust_lib_ring_buffer_channel *chan; /* channel */ void *priv; /* client private data */ - struct lttng_ust_shm_handle *handle; /* shared-memory handle */ size_t data_size; /* size of payload */ int largest_align; /* * alignment of the largest element @@ -85,13 +84,11 @@ struct lttng_ust_lib_ring_buffer_ctx { static inline lttng_ust_notrace void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, struct lttng_ust_lib_ring_buffer_channel *chan, - void *priv, size_t data_size, int largest_align, - struct lttng_ust_shm_handle *handle); + void *priv, size_t data_size, int largest_align); static inline void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, struct lttng_ust_lib_ring_buffer_channel *chan, - void *priv, size_t data_size, int largest_align, - struct lttng_ust_shm_handle *handle) + void *priv, size_t data_size, int largest_align) { ctx->struct_size = sizeof(struct lttng_ust_lib_ring_buffer_ctx); ctx->chan = chan; @@ -100,7 +97,6 @@ void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx, ctx->reserve_cpu = -1; ctx->largest_align = largest_align; ctx->rflags = 0; - ctx->handle = handle; ctx->ip = 0; } diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 971a83c8..3f774d1f 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -853,7 +853,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \ __lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx); \ __lttng_ctx.event_recorder = __event_recorder; \ lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_ctx, __event_len, \ - __event_align, __chan->handle); \ + __event_align); \ __ctx.ip = _TP_IP_PARAM(TP_IP_PARAM); \ __ret = __chan->ops->event_reserve(&__ctx, __event_recorder->id); \ if (__ret < 0) \ diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 394e1417..f43170ae 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1353,8 +1353,7 @@ int ustctl_write_metadata_to_channel( reserve_len = min_t(size_t, lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle), len - pos); - lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, - sizeof(char), lttng_chan_buf->handle); + lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char)); /* * We don't care about metadata buffer's records lost * count, because we always retry here. Report error if @@ -1400,8 +1399,7 @@ ssize_t ustctl_write_one_packet_to_channel( reserve_len = min_t(ssize_t, lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle), len); - lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, - sizeof(char), lttng_chan_buf->handle); + lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char)); ret = lttng_chan_buf->ops->event_reserve(&ctx, 0); if (ret != 0) { DBG("LTTng: event reservation failed"); diff --git a/libringbuffer/backend.h b/libringbuffer/backend.h index 698994c2..2fe06cef 100644 --- a/libringbuffer/backend.h +++ b/libringbuffer/backend.h @@ -69,7 +69,7 @@ void lib_ring_buffer_write(const struct lttng_ust_lib_ring_buffer_config *config const void *src, size_t len) { struct channel_backend *chanb = &ctx->chan->backend; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; size_t offset = ctx->buf_offset; struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; void *p; @@ -140,7 +140,7 @@ void lib_ring_buffer_strcpy(const struct lttng_ust_lib_ring_buffer_config *confi const char *src, size_t len, char pad) { struct channel_backend *chanb = &ctx->chan->backend; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; size_t count; size_t offset = ctx->buf_offset; struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; @@ -204,7 +204,7 @@ void lib_ring_buffer_pstrcpy(const struct lttng_ust_lib_ring_buffer_config *conf const char *src, size_t len, char pad) { struct channel_backend *chanb = &ctx->chan->backend; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; size_t count; size_t offset = ctx->buf_offset; struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages; diff --git a/libringbuffer/backend_internal.h b/libringbuffer/backend_internal.h index 3bd588b9..68370c7e 100644 --- a/libringbuffer/backend_internal.h +++ b/libringbuffer/backend_internal.h @@ -209,7 +209,7 @@ int lib_ring_buffer_backend_get_pages(const struct lttng_ust_lib_ring_buffer_con { struct lttng_ust_lib_ring_buffer_backend *bufb = &ctx->buf->backend; struct channel_backend *chanb = &ctx->chan->backend; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; size_t sbidx; size_t offset = ctx->buf_offset; struct lttng_ust_lib_ring_buffer_backend_subbuffer *wsb; diff --git a/libringbuffer/frontend_api.h b/libringbuffer/frontend_api.h index 96f79554..7cbad40f 100644 --- a/libringbuffer/frontend_api.h +++ b/libringbuffer/frontend_api.h @@ -134,7 +134,7 @@ int lib_ring_buffer_reserve(const struct lttng_ust_lib_ring_buffer_config *confi void *client_ctx) { struct lttng_ust_lib_ring_buffer_channel *chan = ctx->chan; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; struct lttng_ust_lib_ring_buffer *buf; unsigned long o_begin, o_end, o_old; size_t before_hdr_pad = 0; @@ -228,7 +228,7 @@ void lib_ring_buffer_commit(const struct lttng_ust_lib_ring_buffer_config *confi const struct lttng_ust_lib_ring_buffer_ctx *ctx) { struct lttng_ust_lib_ring_buffer_channel *chan = ctx->chan; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; struct lttng_ust_lib_ring_buffer *buf = ctx->buf; unsigned long offset_end = ctx->buf_offset; unsigned long endidx = subbuf_index(offset_end - 1, chan); diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c index 83da122b..72ee4c9c 100644 --- a/libringbuffer/ring_buffer_frontend.c +++ b/libringbuffer/ring_buffer_frontend.c @@ -2125,7 +2125,7 @@ int lib_ring_buffer_try_reserve_slow(struct lttng_ust_lib_ring_buffer *buf, void *client_ctx) { const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; unsigned long reserve_commit_diff, offset_cmp; int timeout_left_ms = lttng_ust_ringbuffer_get_timeout(chan); @@ -2314,7 +2314,7 @@ int lib_ring_buffer_reserve_slow(struct lttng_ust_lib_ring_buffer_ctx *ctx, void *client_ctx) { struct lttng_ust_lib_ring_buffer_channel *chan = ctx->chan; - struct lttng_ust_shm_handle *handle = ctx->handle; + struct lttng_ust_shm_handle *handle = ctx->chan->handle; const struct lttng_ust_lib_ring_buffer_config *config = &chan->backend.config; struct lttng_ust_lib_ring_buffer *buf; struct switch_offsets offsets;