Remove handle field from ring buffer context
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 26 Mar 2021 20:25:41 +0000 (16:25 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 26 Mar 2021 20:25:41 +0000 (16:25 -0400)
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 <mathieu.desnoyers@efficios.com>
Change-Id: I7baca38b86743ba88a55b9d336135df2256756d1

include/lttng/ringbuffer-context.h
include/lttng/ust-tracepoint-event.h
liblttng-ust-ctl/ustctl.c
libringbuffer/backend.h
libringbuffer/backend_internal.h
libringbuffer/frontend_api.h
libringbuffer/ring_buffer_frontend.c

index 53670d9313b2973694767889c055d50f5be43209..b335d81a8ed167cc7c19b38c02d6e8e0bc60a940 100644 (file)
@@ -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;
 }
 
index 971a83c887a9825f10c09ee5212898f58e4ac0a1..3f774d1f1178b06ad6085f9937ba61750fb0b217 100644 (file)
@@ -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)                                                \
index 394e14174f6985bd0798e77c0ef1a99ebc2770a0..f43170aebcad6f33672e2695e3663fbdbbe51171 100644 (file)
@@ -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");
index 698994c21881a78a7c7beb160c0daa3a47e689fe..2fe06cefd56f2c146b128762f9268c85101c5946 100644 (file)
@@ -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;
index 3bd588b9f891a6f500f38e79f21b5d5a65741b3a..68370c7edb18187c5c99301f3edee20b3203d694 100644 (file)
@@ -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;
index 96f79554b3764bb3cb40d140e34b5ebcebcc725e..7cbad40fe543e540a23197a6b1895147a1fb4956 100644 (file)
@@ -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);
index 83da122b80cf8d5e50fa8d99827ddf58b73b45b6..72ee4c9ce09d39afb1c38743a68021355e45cba7 100644 (file)
@@ -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;
This page took 0.031024 seconds and 4 git commands to generate.