Refactoring: hide internal fields of ring buffer context
[lttng-ust.git] / liblttng-ust / lttng-ring-buffer-metadata-client.h
index 0911d37a04ae59512abd1f0c59a1b5bf7b0fd5ad..8a0fdc5c9dbfbccb34ddcd9c6d37bbaee5eed81c 100644 (file)
@@ -15,6 +15,7 @@
 #include "ust-compat.h"
 #include "lttng-tracer.h"
 #include "../libringbuffer/frontend_types.h"
+#include <urcu/tls-compat.h>
 
 struct metadata_packet_header {
        uint32_t magic;                 /* 0x75D11D57 */
@@ -36,6 +37,9 @@ struct metadata_record_header {
 
 static const struct lttng_ust_lib_ring_buffer_config client_config;
 
+/* No nested use supported for metadata ring buffer. */
+static DEFINE_URCU_TLS(struct lttng_ust_lib_ring_buffer_ctx_private, private_ctx);
+
 static inline uint64_t lib_ring_buffer_clock_read(struct lttng_ust_lib_ring_buffer_channel *chan)
 {
        return 0;
@@ -240,15 +244,19 @@ void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
 }
 
 static
-int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx, uint32_t event_id)
+int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx)
 {
        int ret;
 
+       memset(&private_ctx, 0, sizeof(private_ctx));
+       private_ctx.pub = ctx;
+       private_ctx.chan = ctx->client_priv;
+       ctx->priv = &private_ctx;
        ret = lib_ring_buffer_reserve(&client_config, ctx, NULL);
        if (ret)
                return ret;
        if (lib_ring_buffer_backend_get_pages(&client_config, ctx,
-                       &ctx->backend_pages))
+                       &ctx->priv->backend_pages))
                return -EPERM;
        return 0;
 }
@@ -260,9 +268,10 @@ void lttng_event_commit(struct lttng_ust_lib_ring_buffer_ctx *ctx)
 }
 
 static
-void lttng_event_write(struct lttng_ust_lib_ring_buffer_ctx *ctx, const void *src,
-                    size_t len)
+void lttng_event_write(struct lttng_ust_lib_ring_buffer_ctx *ctx,
+               const void *src, size_t len, size_t alignment)
 {
+       lttng_ust_lib_ring_buffer_align_ctx(ctx, alignment);
        lib_ring_buffer_write(&client_config, ctx, src, len);
 }
 
This page took 0.024957 seconds and 4 git commands to generate.