Refactoring: Channel structures
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 18 Mar 2021 15:44:30 +0000 (11:44 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 18 Mar 2021 19:31:33 +0000 (15:31 -0400)
Now that struct lttng_channel is separate from the consumer daemon
channel config message ABI layout, we can perform a significant amount
of refactoring:

- Namespace theses structures with lttng_ust_ prefix,
- Use struct_size extensibility scheme.
- Split fields into public/private structures,
- Split public and private structures into a child (ring buffer)
  and parent (common). This will allow introducing other channel
  children types in the future (e.g. counters).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6acec4e4ffff721e6ea5698e64a063045e1c1022

35 files changed:
include/lttng/ust-events.h
include/lttng/ust-tracepoint-event.h
include/ust-context-provider.h
liblttng-ust-ctl/ustctl.c
liblttng-ust/context-provider-internal.h
liblttng-ust/lttng-context-cgroup-ns.c
liblttng-ust/lttng-context-cpu-id.c
liblttng-ust/lttng-context-ip.c
liblttng-ust/lttng-context-ipc-ns.c
liblttng-ust/lttng-context-mnt-ns.c
liblttng-ust/lttng-context-net-ns.c
liblttng-ust/lttng-context-perf-counters.c
liblttng-ust/lttng-context-pid-ns.c
liblttng-ust/lttng-context-procname.c
liblttng-ust/lttng-context-pthread-id.c
liblttng-ust/lttng-context-time-ns.c
liblttng-ust/lttng-context-user-ns.c
liblttng-ust/lttng-context-uts-ns.c
liblttng-ust/lttng-context-vegid.c
liblttng-ust/lttng-context-veuid.c
liblttng-ust/lttng-context-vgid.c
liblttng-ust/lttng-context-vpid.c
liblttng-ust/lttng-context-vsgid.c
liblttng-ust/lttng-context-vsuid.c
liblttng-ust/lttng-context-vtid.c
liblttng-ust/lttng-context-vuid.c
liblttng-ust/lttng-context.c
liblttng-ust/lttng-events.c
liblttng-ust/lttng-ring-buffer-client.h
liblttng-ust/lttng-ring-buffer-metadata-client.h
liblttng-ust/lttng-tracer-core.h
liblttng-ust/lttng-ust-abi.c
liblttng-ust/ust-core.c
liblttng-ust/ust-events-internal.h
tests/compile/test-app-ctx/hello.c

index 59446c4b783c77715e8048f85546a8846f03874e..4ef3301c12ae42c807aa67b94b51056ffcc150df 100644 (file)
@@ -36,7 +36,7 @@ extern "C" {
 #define LTTNG_UST_PROVIDER_MAJOR       2
 #define LTTNG_UST_PROVIDER_MINOR       0
 
-struct lttng_channel;
+struct lttng_ust_channel_buffer;
 struct lttng_ust_session;
 struct lttng_ust_lib_ring_buffer_ctx;
 struct lttng_ust_event_field;
@@ -405,7 +405,7 @@ struct lttng_ust_event_recorder {
        struct lttng_ust_event_recorder_private *priv;  /* Private event record interface */
 
        unsigned int id;
-       struct lttng_channel *chan;
+       struct lttng_ust_channel_buffer *chan;
        struct lttng_ust_ctx *ctx;
 
        /* End of base ABI. Fields below should be used after checking struct_size. */
@@ -441,7 +441,6 @@ struct lttng_ust_event_notifier {
 };
 
 struct lttng_ust_lib_ring_buffer_channel;
-struct lttng_ust_shm_handle;
 struct lttng_ust_channel_ops_private;
 
 /*
@@ -469,34 +468,58 @@ struct lttng_ust_channel_ops {
        /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
+enum lttng_ust_channel_type {
+       LTTNG_UST_CHANNEL_TYPE_BUFFER = 0,
+};
+
+struct lttng_ust_channel_common_private;
+
 /*
  * IMPORTANT: this structure is part of the ABI between the probe and
  * UST. Fields need to be only added at the end, never reordered, never
  * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
  */
-struct lttng_channel {
-       /*
-        * The pointers located in this private data are NOT safe to be
-        * dereferenced by the consumer. The only operations the
-        * consumer process is designed to be allowed to do is to read
-        * and perform subbuffer flush.
-        */
-       struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
+struct lttng_ust_channel_common {
+       uint32_t struct_size;                           /* Size of this structure. */
+
+       struct lttng_ust_channel_common_private *priv;  /* Private channel interface */
+
+       enum lttng_ust_channel_type type;
+       void *child;                                    /* Pointer to child, for inheritance by aggregation. */
+
        int enabled;
-       struct lttng_ust_ctx *ctx;
-       /* Event ID management */
        struct lttng_ust_session *session;
-       int objd;                       /* Object associated to channel */
-       struct cds_list_head node;      /* Channel list in session */
+
+       /* End of base ABI. Fields below should be used after checking struct_size. */
+};
+
+struct lttng_ust_channel_buffer_private;
+
+/*
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+struct lttng_ust_channel_buffer {
+       uint32_t struct_size;                           /* Size of this structure. */
+
+       struct lttng_ust_channel_common *parent;        /* Inheritance by aggregation. */
+       struct lttng_ust_channel_buffer_private *priv;  /* Private channel buffer interface */
+
+       struct lttng_ust_ctx *ctx;
        struct lttng_ust_channel_ops *ops;
-       int header_type;                /* 0: unset, 1: compact, 2: large */
-       struct lttng_ust_shm_handle *handle;    /* shared-memory handle */
+       struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
+       struct lttng_ust_shm_handle *handle;            /* shared-memory handle */
 
-       /* Channel ID */
-       unsigned int id;
-       enum lttng_ust_abi_chan_type type;
-       unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
-       int tstate:1;                   /* Transient enable state */
+       /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
 /*
index 33aa8d2d073d9ffb8ba8576423a35a1a92e8ccfb..9bf4eeadc1df9a6d581d4ddbc1bf05fa35ab6a43 100644 (file)
@@ -803,13 +803,14 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))         \
        case LTTNG_UST_EVENT_TYPE_RECORDER:                                   \
        {                                                                     \
                struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
-               struct lttng_channel *__chan = __event_recorder->chan;        \
+               struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
+               struct lttng_ust_channel_common *__chan_common = __chan->parent; \
                                                                              \
-               if (!_TP_SESSION_CHECK(session, __chan->session))             \
+               if (!_TP_SESSION_CHECK(session, __chan_common->session))      \
                        return;                                               \
-               if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active)))  \
+               if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->session->active))) \
                        return;                                               \
-               if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled)))          \
+               if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->enabled)))   \
                        return;                                               \
                break;                                                        \
        }                                                                     \
@@ -841,7 +842,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))           \
        {                                                                     \
                size_t __event_len, __event_align;                            \
                struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
-               struct lttng_channel *__chan = __event_recorder->chan;        \
+               struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
                struct lttng_ust_lib_ring_buffer_ctx __ctx;                   \
                struct lttng_ust_stack_ctx __lttng_ctx;                       \
                                                                              \
@@ -851,7 +852,7 @@ void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args))           \
                memset(&__lttng_ctx, 0, sizeof(__lttng_ctx));                 \
                __lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx);     \
                __lttng_ctx.event_recorder = __event_recorder;                \
-               __lttng_ctx.chan_ctx = tp_rcu_dereference(__chan->ctx);       \
+               __lttng_ctx.chan_ctx = tp_rcu_dereference(__chan->ctx);   \
                __lttng_ctx.event_ctx = tp_rcu_dereference(__event_recorder->ctx); \
                lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_ctx, __event_len, \
                                         __event_align, -1, __chan->handle); \
index 637bc0c2a29329a93a6d6b5b9b09ef2fd20eab44..094e9fd97ed5b359a9e2d41b71e22860be34459f 100644 (file)
@@ -57,7 +57,7 @@ struct lttng_ust_ctx_field {
        size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset);
        void (*record)(struct lttng_ust_ctx_field *field,
                       struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                      struct lttng_channel *chan);
+                      struct lttng_ust_channel_buffer *chan);
        void (*get_value)(struct lttng_ust_ctx_field *field,
                         struct lttng_ust_ctx_value *value);
        void (*destroy)(struct lttng_ust_ctx_field *field);
@@ -107,7 +107,7 @@ struct lttng_ust_context_provider {
        size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset);
        void (*record)(struct lttng_ust_ctx_field *field,
                       struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                      struct lttng_channel *chan);
+                      struct lttng_ust_channel_buffer *chan);
        void (*get_value)(struct lttng_ust_ctx_field *field,
                         struct lttng_ust_ctx_value *value);
        struct cds_hlist_node node;
@@ -122,7 +122,7 @@ void lttng_ust_context_set_session_provider(const char *name,
                size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
                void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                       struct lttng_channel *chan),
+                       struct lttng_ust_channel_buffer *chan),
                void (*get_value)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_ctx_value *value));
 
@@ -132,7 +132,7 @@ int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx,
                size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
                void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                       struct lttng_channel *chan),
+                       struct lttng_ust_channel_buffer *chan),
                void (*get_value)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_ctx_value *value));
 
index adf23af64a952cc9444776541c4ea07bfba5a900..a4a3313a570aa101bfcb1d8fbbdab0f4230ec5bb 100644 (file)
@@ -45,7 +45,7 @@
  * Channel representation within consumer.
  */
 struct ustctl_consumer_channel {
-       struct lttng_channel *chan;             /* lttng channel buffers */
+       struct lttng_ust_channel_buffer *chan;  /* lttng channel buffers */
 
        /* initial attributes */
        struct ustctl_consumer_channel_attr attr;
@@ -1344,17 +1344,17 @@ int ustctl_write_metadata_to_channel(
                size_t len)                     /* metadata length */
 {
        struct lttng_ust_lib_ring_buffer_ctx ctx;
-       struct lttng_channel *chan = channel->chan;
+       struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
        const char *str = metadata_str;
        int ret = 0, waitret;
        size_t reserve_len, pos;
 
        for (pos = 0; pos < len; pos += reserve_len) {
                reserve_len = min_t(size_t,
-                               chan->ops->priv->packet_avail_size(chan->chan, chan->handle),
+                               lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle),
                                len - pos);
-               lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len,
-                                        sizeof(char), -1, chan->handle);
+               lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len,
+                                        sizeof(char), -1, lttng_chan_buf->handle);
                /*
                 * We don't care about metadata buffer's records lost
                 * count, because we always retry here. Report error if
@@ -1363,7 +1363,7 @@ int ustctl_write_metadata_to_channel(
                 */
                waitret = wait_cond_interruptible_timeout(
                        ({
-                               ret = chan->ops->event_reserve(&ctx, 0);
+                               ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
                                ret != -ENOBUFS || !ret;
                        }),
                        LTTNG_METADATA_TIMEOUT_MSEC);
@@ -1375,8 +1375,8 @@ int ustctl_write_metadata_to_channel(
                                ret = waitret;
                        goto end;
                }
-               chan->ops->event_write(&ctx, &str[pos], reserve_len);
-               chan->ops->event_commit(&ctx);
+               lttng_chan_buf->ops->event_write(&ctx, &str[pos], reserve_len);
+               lttng_chan_buf->ops->event_commit(&ctx);
        }
 end:
        return ret;
@@ -1392,25 +1392,25 @@ ssize_t ustctl_write_one_packet_to_channel(
                size_t len)                     /* metadata length */
 {
        struct lttng_ust_lib_ring_buffer_ctx ctx;
-       struct lttng_channel *chan = channel->chan;
+       struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
        const char *str = metadata_str;
        ssize_t reserve_len;
        int ret;
 
        reserve_len = min_t(ssize_t,
-                       chan->ops->priv->packet_avail_size(chan->chan, chan->handle),
+                       lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle),
                        len);
-       lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len,
-                       sizeof(char), -1, chan->handle);
-       ret = chan->ops->event_reserve(&ctx, 0);
+       lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len,
+                       sizeof(char), -1, lttng_chan_buf->handle);
+       ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
        if (ret != 0) {
                DBG("LTTng: event reservation failed");
                assert(ret < 0);
                reserve_len = ret;
                goto end;
        }
-       chan->ops->event_write(&ctx, str, reserve_len);
-       chan->ops->event_commit(&ctx);
+       lttng_chan_buf->ops->event_write(&ctx, str, reserve_len);
+       lttng_chan_buf->ops->event_commit(&ctx);
 
 end:
        return reserve_len;
index 96343d900befad9e718b18c6bab99ab9c4ab6df8..1454b3979c48890025703958732a28622000c772 100644 (file)
@@ -15,7 +15,7 @@ void lttng_ust_context_set_event_notifier_group_provider(const char *name,
                size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
                void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                       struct lttng_channel *chan),
+                       struct lttng_ust_channel_buffer *chan),
                void (*get_value)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_ctx_value *value));
 
index 65c5306cc9cbca17e63a908b8e11258d41a1cae0..8d32cdb44adf7bde906cb87ddb61628fe0b9e050 100644 (file)
@@ -102,7 +102,7 @@ size_t cgroup_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void cgroup_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t cgroup_ns;
 
index 9c553828a389529d41541d8351c4ac403d3af3ec..a3fdb9c6dd0b18a5ff1f4f7fcc1a0ba510f8e331 100644 (file)
@@ -36,7 +36,7 @@ size_t cpu_id_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void cpu_id_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        int cpu;
 
index d7a65905d8328e3caf98ab35abc7d2d4e123acb2..b56e0db157e43cafd57a64e2e04e415cb84f7595 100644 (file)
@@ -29,7 +29,7 @@ size_t ip_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void ip_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        void *ip;
 
index b2c5e27da32a3af59faa97a1f9db7695e1286be2..30a9c59950e239825f37bbc198ab0f71212e8e00 100644 (file)
@@ -101,7 +101,7 @@ size_t ipc_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void ipc_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t ipc_ns;
 
index 2606ff3ce486ce8fc74ed0ef2969bfd7e810cf64..60c4805753b78272a958acfaa4e9a9ab27b4b973 100644 (file)
@@ -84,7 +84,7 @@ size_t mnt_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void mnt_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t mnt_ns;
 
index 1512fc27cc297a9193f0b1080ce8e32358654d06..d9293a6b287936a83318f07d908ec260c8242df3 100644 (file)
@@ -101,7 +101,7 @@ size_t net_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void net_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t net_ns;
 
index f8241c392872ff53230c55b7201589794a8c323b..593930843986b315144f45459fc0cbadb3b8559b 100644 (file)
@@ -438,7 +438,7 @@ uint64_t wrapper_perf_counter_read(struct lttng_ust_ctx_field *field)
 static
 void perf_counter_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        uint64_t value;
 
index 1c45d7f2edde338b933098cc52baa09420bb6482..25210e92b7237cceeacdc7cd9c0972c547d2d119 100644 (file)
@@ -87,7 +87,7 @@ size_t pid_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void pid_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t pid_ns;
 
index 1221298ec24eb6efe41e447fefb471f0493d7567..00a79355a577ce234b4ec1d5c9a11b9f576cdd88 100644 (file)
@@ -73,7 +73,7 @@ size_t procname_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void procname_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        char *procname;
 
index b25dc7aee5c4a803a35f71b247ababe451a2be87..59a6f3815ed26822fcf9baa024d06b0a429254d5 100644 (file)
@@ -28,7 +28,7 @@ size_t pthread_id_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void pthread_id_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        unsigned long pthread_id;
 
index 6534ce728e579849c72b3c20535616cb3918aaaf..fa85b5da6be9b6d9afa9a42a891d246945b1efab 100644 (file)
@@ -100,7 +100,7 @@ size_t time_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void time_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t time_ns;
 
index ee1cf73991025035734961b0d3add930588dc6e6..e4bb1dd2e6f49dcb341aa5ccda6f428298d98db6 100644 (file)
@@ -84,7 +84,7 @@ size_t user_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void user_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t user_ns;
 
index e22011c9c7156f969b2c8a266da32e24e1045ae3..3037d084b52d285a6aa75b32e2aa8afb69826820 100644 (file)
@@ -102,7 +102,7 @@ size_t uts_ns_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void uts_ns_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        ino_t uts_ns;
 
index 488bfdd814a731fac011985d02c09fbe677d6975..ca0555e3d099ab879cd298e037a56c1796b14a77 100644 (file)
@@ -73,7 +73,7 @@ size_t vegid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void vegid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        gid_t vegid;
 
index 22c09c8214d7955964c388ea4c78704310ca79d9..8cd29acecb6ca9b6b12139364ea384dc025bd60d 100644 (file)
@@ -73,7 +73,7 @@ size_t veuid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void veuid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        uid_t veuid;
 
index a7b5dbfdee384295236556ebf6d3c0e65a1a5ef9..7536d382a6242ca9a73f82ae26d236d2f6f432a4 100644 (file)
@@ -73,7 +73,7 @@ size_t vgid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void vgid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        gid_t vgid;
 
index 3594e52919c6a37f00f9f9c9e56fb44626709378..0c532ddf3ebd55d7b118df5aa8c11cfe6280b3b7 100644 (file)
@@ -57,7 +57,7 @@ size_t vpid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void vpid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        pid_t vpid = wrapper_getvpid();
 
index f49d7f79e2ab792aea90fab7dc804b8bdab0014f..a63c190117b153c6242765fe148c54b7f04c978f 100644 (file)
@@ -77,7 +77,7 @@ size_t vsgid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void vsgid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        gid_t vsgid;
 
index aa8f755ed8952c62c7dd51fb5d1ae9de4171d4e3..3413c3a9cb3147f7fe0f12e0f1db4b58be2ce4cd 100644 (file)
@@ -77,7 +77,7 @@ size_t vsuid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void vsuid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        uid_t vsuid;
 
index 543e0498f512f0c3bbeae85f31c2f54293af525c..1648d8db83f9c676ac90639f73429ab9717f9c9e 100644 (file)
@@ -61,7 +61,7 @@ pid_t wrapper_getvtid(void)
 static
 void vtid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        pid_t vtid = wrapper_getvtid();
 
index 438b4222da0226c3c28ce7c39d6d12322cbf7913..b2edf870bc541fcfe181f88bd3649e246799189b 100644 (file)
@@ -73,7 +73,7 @@ size_t vuid_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void vuid_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        uid_t vuid;
 
index e97b688ad8f74d282ae41a0031d64a62d524ba7c..8bc9998774b52dbba3a2198c50fa4b71b2136ed6 100644 (file)
@@ -296,7 +296,7 @@ int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx,
                size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
                void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                       struct lttng_channel *chan),
+                       struct lttng_ust_channel_buffer *chan),
                void (*get_value)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_ctx_value *value))
 {
index d5fd9fee2f04b5636a4288e590a901ff8adf72d7..9c1a9da1145433919434784c501247b68e7de198 100644 (file)
@@ -230,16 +230,18 @@ struct lttng_event_notifier_group *lttng_event_notifier_group_create(void)
  * Only used internally at session destruction.
  */
 static
-void _lttng_channel_unmap(struct lttng_channel *lttng_chan)
+void _lttng_channel_unmap(struct lttng_ust_channel_buffer *lttng_chan)
 {
        struct lttng_ust_lib_ring_buffer_channel *chan;
        struct lttng_ust_shm_handle *handle;
 
-       cds_list_del(&lttng_chan->node);
+       cds_list_del(&lttng_chan->priv->node);
        lttng_destroy_context(lttng_chan->ctx);
        chan = lttng_chan->chan;
        handle = lttng_chan->handle;
        channel_destroy(chan, handle, 0);
+       free(lttng_chan->parent);
+       free(lttng_chan->priv);
        free(lttng_chan);
 }
 
@@ -284,7 +286,7 @@ void _lttng_event_unregister(struct lttng_ust_event_common *event)
 
 void lttng_session_destroy(struct lttng_ust_session *session)
 {
-       struct lttng_channel *chan, *tmpchan;
+       struct lttng_ust_channel_buffer_private *chan, *tmpchan;
        struct lttng_ust_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
        struct lttng_enum *_enum, *tmp_enum;
        struct lttng_event_enabler *event_enabler, *event_tmpenabler;
@@ -305,7 +307,7 @@ void lttng_session_destroy(struct lttng_ust_session *session)
                        &session->priv->enums_head, node)
                _lttng_enum_destroy(_enum);
        cds_list_for_each_entry_safe(chan, tmpchan, &session->priv->chan_head, node)
-               _lttng_channel_unmap(chan);
+               _lttng_channel_unmap(chan->pub);
        cds_list_del(&session->priv->node);
        lttng_destroy_context(session->priv->ctx);
        free(session->priv);
@@ -544,7 +546,7 @@ int lttng_session_statedump(struct lttng_ust_session *session)
 int lttng_session_enable(struct lttng_ust_session *session)
 {
        int ret = 0;
-       struct lttng_channel *chan;
+       struct lttng_ust_channel_buffer_private *chan;
        int notify_socket;
 
        if (session->active) {
@@ -575,7 +577,7 @@ int lttng_session_enable(struct lttng_ust_session *session)
                /* don't change it if session stop/restart */
                if (chan->header_type)
                        continue;
-               ctx = chan->ctx;
+               ctx = chan->pub->ctx;
                if (ctx) {
                        nr_fields = ctx->nr_fields;
                        fields = ctx->fields;
@@ -589,7 +591,7 @@ int lttng_session_enable(struct lttng_ust_session *session)
                ret = ustcomm_register_channel(notify_socket,
                        session,
                        session->priv->objd,
-                       chan->objd,
+                       chan->parent.objd,
                        nr_fields,
                        fields,
                        &chan_id,
@@ -634,36 +636,36 @@ end:
        return ret;
 }
 
-int lttng_channel_enable(struct lttng_channel *channel)
+int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel)
 {
        int ret = 0;
 
-       if (channel->enabled) {
+       if (lttng_channel->enabled) {
                ret = -EBUSY;
                goto end;
        }
        /* Set transient enabler state to "enabled" */
-       channel->tstate = 1;
-       lttng_session_sync_event_enablers(channel->session);
+       lttng_channel->priv->tstate = 1;
+       lttng_session_sync_event_enablers(lttng_channel->session);
        /* Set atomically the state to "enabled" */
-       CMM_ACCESS_ONCE(channel->enabled) = 1;
+       CMM_ACCESS_ONCE(lttng_channel->enabled) = 1;
 end:
        return ret;
 }
 
-int lttng_channel_disable(struct lttng_channel *channel)
+int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel)
 {
        int ret = 0;
 
-       if (!channel->enabled) {
+       if (!lttng_channel->enabled) {
                ret = -EBUSY;
                goto end;
        }
        /* Set atomically the state to "disabled" */
-       CMM_ACCESS_ONCE(channel->enabled) = 0;
+       CMM_ACCESS_ONCE(lttng_channel->enabled) = 0;
        /* Set transient enabler state to "enabled" */
-       channel->tstate = 0;
-       lttng_session_sync_event_enablers(channel->session);
+       lttng_channel->priv->tstate = 0;
+       lttng_session_sync_event_enablers(lttng_channel->session);
 end:
        return ret;
 }
@@ -690,17 +692,17 @@ struct cds_hlist_head *borrow_hash_table_bucket(
  */
 static
 int lttng_event_recorder_create(struct lttng_ust_event_desc *desc,
-               struct lttng_channel *chan)
+               struct lttng_ust_channel_buffer *chan)
 {
        struct lttng_ust_event_recorder *event_recorder;
        struct lttng_ust_event_recorder_private *event_recorder_priv;
-       struct lttng_ust_session *session = chan->session;
+       struct lttng_ust_session *session = chan->parent->session;
        struct cds_hlist_head *head;
        int ret = 0;
        int notify_socket, loglevel;
        const char *uri;
 
-       head = borrow_hash_table_bucket(chan->session->priv->events_ht.table,
+       head = borrow_hash_table_bucket(chan->parent->session->priv->events_ht.table,
                LTTNG_UST_EVENT_HT_SIZE, desc);
 
        notify_socket = lttng_get_notify_socket(session->priv->owner);
@@ -767,7 +769,7 @@ int lttng_event_recorder_create(struct lttng_ust_event_desc *desc,
        ret = ustcomm_register_event(notify_socket,
                session,
                session->priv->objd,
-               chan->objd,
+               chan->priv->parent.objd,
                desc->name,
                loglevel,
                desc->signature,
@@ -780,7 +782,7 @@ int lttng_event_recorder_create(struct lttng_ust_event_desc *desc,
                goto sessiond_register_error;
        }
 
-       cds_list_add(&event_recorder_priv->node, &chan->session->priv->events_head);
+       cds_list_add(&event_recorder_priv->node, &chan->parent->session->priv->events_head);
        cds_hlist_add_head(&event_recorder_priv->hlist, head);
        return 0;
 
@@ -1001,7 +1003,7 @@ struct lttng_enabler_ref *lttng_enabler_ref(
 static
 void lttng_create_event_recorder_if_missing(struct lttng_event_enabler *event_enabler)
 {
-       struct lttng_ust_session *session = event_enabler->chan->session;
+       struct lttng_ust_session *session = event_enabler->chan->parent->session;
        struct lttng_ust_probe_desc *probe_desc;
        struct lttng_ust_event_desc *desc;
        struct lttng_ust_event_recorder_private *event_recorder_priv;
@@ -1132,7 +1134,7 @@ void _event_enum_destroy(struct lttng_ust_event_common *event)
        case LTTNG_UST_EVENT_TYPE_RECORDER:
        {
                struct lttng_ust_event_recorder *event_recorder = event->child;
-               struct lttng_ust_session *session = event_recorder->chan->session;
+               struct lttng_ust_session *session = event_recorder->chan->parent->session;
                unsigned int i;
 
                /* Destroy enums of the current event. */
@@ -1199,7 +1201,7 @@ void lttng_probe_provider_unregister_events(
 static
 int lttng_event_enabler_ref_event_recorders(struct lttng_event_enabler *event_enabler)
 {
-       struct lttng_ust_session *session = event_enabler->chan->session;
+       struct lttng_ust_session *session = event_enabler->chan->parent->session;
        struct lttng_ust_event_recorder_private *event_recorder_priv;
 
        if (!lttng_event_enabler_as_enabler(event_enabler)->enabled)
@@ -1366,7 +1368,7 @@ void lttng_ust_abi_events_exit(void)
 struct lttng_event_enabler *lttng_event_enabler_create(
                enum lttng_enabler_format_type format_type,
                struct lttng_ust_abi_event *event_param,
-               struct lttng_channel *chan)
+               struct lttng_ust_channel_buffer *chan)
 {
        struct lttng_event_enabler *event_enabler;
 
@@ -1381,8 +1383,8 @@ struct lttng_event_enabler *lttng_event_enabler_create(
        event_enabler->chan = chan;
        /* ctx left NULL */
        event_enabler->base.enabled = 0;
-       cds_list_add(&event_enabler->node, &event_enabler->chan->session->priv->enablers_head);
-       lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+       cds_list_add(&event_enabler->node, &event_enabler->chan->parent->session->priv->enablers_head);
+       lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
 
        return event_enabler;
 }
@@ -1430,7 +1432,7 @@ struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
 int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler)
 {
        lttng_event_enabler_as_enabler(event_enabler)->enabled = 1;
-       lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+       lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
 
        return 0;
 }
@@ -1438,7 +1440,7 @@ int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler)
 int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler)
 {
        lttng_event_enabler_as_enabler(event_enabler)->enabled = 0;
-       lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+       lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
 
        return 0;
 }
@@ -1459,7 +1461,7 @@ int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event
        _lttng_enabler_attach_filter_bytecode(
                lttng_event_enabler_as_enabler(event_enabler), bytecode);
 
-       lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+       lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
        return 0;
 }
 
@@ -1479,7 +1481,7 @@ int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler *event_enabl
        _lttng_enabler_attach_exclusion(
                lttng_event_enabler_as_enabler(event_enabler), excluder);
 
-       lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+       lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
        return 0;
 }
 
@@ -1667,7 +1669,7 @@ void lttng_session_sync_event_enablers(struct lttng_ust_session *session)
                 * intesection of session and channel transient enable
                 * states.
                 */
-               enabled = enabled && session->priv->tstate && event_recorder_priv->pub->chan->tstate;
+               enabled = enabled && session->priv->tstate && event_recorder_priv->pub->chan->priv->parent.tstate;
 
                CMM_STORE_SHARED(event_recorder_priv->pub->parent->enabled, enabled);
                /*
@@ -1947,14 +1949,14 @@ void lttng_ust_context_set_session_provider(const char *name,
                size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
                void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                       struct lttng_channel *chan),
+                       struct lttng_ust_channel_buffer *chan),
                void (*get_value)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_ctx_value *value))
 {
        struct lttng_ust_session_private *session_priv;
 
        cds_list_for_each_entry(session_priv, &sessions, node) {
-               struct lttng_channel *chan;
+               struct lttng_ust_channel_buffer_private *chan;
                struct lttng_ust_event_recorder_private *event_recorder_priv;
                int ret;
 
@@ -1963,7 +1965,7 @@ void lttng_ust_context_set_session_provider(const char *name,
                if (ret)
                        abort();
                cds_list_for_each_entry(chan, &session_priv->chan_head, node) {
-                       ret = lttng_ust_context_set_provider_rcu(&chan->ctx,
+                       ret = lttng_ust_context_set_provider_rcu(&chan->pub->ctx,
                                        name, get_size, record, get_value);
                        if (ret)
                                abort();
@@ -1988,7 +1990,7 @@ void lttng_ust_context_set_event_notifier_group_provider(const char *name,
                size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
                void (*record)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                       struct lttng_channel *chan),
+                       struct lttng_ust_channel_buffer *chan),
                void (*get_value)(struct lttng_ust_ctx_field *field,
                        struct lttng_ust_ctx_value *value))
 {
index f791cd1eed12ee405f8bfb1aad712dfd680bb680..4fbfc709a19d9e8f834384aef54c0cbe3bbad2bb 100644 (file)
@@ -119,7 +119,7 @@ void ctx_get_struct_size(struct lttng_ust_ctx *ctx, size_t *ctx_len,
 
 static inline
 void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx,
-               struct lttng_channel *chan,
+               struct lttng_ust_channel_buffer *chan,
                struct lttng_ust_ctx *ctx,
                enum app_ctx_mode mode)
 {
@@ -172,12 +172,12 @@ size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config,
                                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                                 struct lttng_client_ctx *client_ctx)
 {
-       struct lttng_channel *lttng_chan = channel_get_private(chan);
+       struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
        struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
        size_t orig_offset = offset;
        size_t padding;
 
-       switch (lttng_chan->header_type) {
+       switch (lttng_chan->priv->header_type) {
        case 1: /* compact */
                padding = lib_ring_buffer_align(offset, lttng_alignof(uint32_t));
                offset += padding;
@@ -242,13 +242,13 @@ void lttng_write_event_header(const struct lttng_ust_lib_ring_buffer_config *con
                            struct lttng_ust_lib_ring_buffer_ctx *ctx,
                            uint32_t event_id)
 {
-       struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
+       struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
        struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
 
        if (caa_unlikely(ctx->rflags))
                goto slow_path;
 
-       switch (lttng_chan->header_type) {
+       switch (lttng_chan->priv->header_type) {
        case 1: /* compact */
        {
                uint32_t id_time = 0;
@@ -293,10 +293,10 @@ void lttng_write_event_header_slow(const struct lttng_ust_lib_ring_buffer_config
                                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
                                 uint32_t event_id)
 {
-       struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
+       struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
        struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
 
-       switch (lttng_chan->header_type) {
+       switch (lttng_chan->priv->header_type) {
        case 1: /* compact */
                if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTTNG_RFLAG_EXTENDED))) {
                        uint32_t id_time = 0;
@@ -397,15 +397,15 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t
                        lib_ring_buffer_offset_address(&buf->backend,
                                subbuf_idx * chan->backend.subbuf_size,
                                handle);
-       struct lttng_channel *lttng_chan = channel_get_private(chan);
+       struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
        uint64_t cnt = shmp_index(handle, buf->backend.buf_cnt, subbuf_idx)->seq_cnt;
 
        assert(header);
        if (!header)
                return;
        header->magic = CTF_MAGIC_NUMBER;
-       memcpy(header->uuid, lttng_chan->uuid, sizeof(lttng_chan->uuid));
-       header->stream_id = lttng_chan->id;
+       memcpy(header->uuid, lttng_chan->priv->uuid, sizeof(lttng_chan->priv->uuid));
+       header->stream_id = lttng_chan->priv->id;
        header->stream_instance_id = buf->backend.cpu;
        header->ctx.timestamp_begin = tsc;
        header->ctx.timestamp_end = 0;
@@ -548,9 +548,9 @@ static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf,
 {
        struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle,
                        buf->backend.chan);
-       struct lttng_channel *lttng_chan = channel_get_private(chan);
+       struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
 
-       *stream_id = lttng_chan->id;
+       *stream_id = lttng_chan->priv->id;
 
        return 0;
 }
@@ -639,7 +639,7 @@ static const struct lttng_ust_lib_ring_buffer_config client_config = {
 };
 
 static
-struct lttng_channel *_channel_create(const char *name,
+struct lttng_ust_channel_buffer *_channel_create(const char *name,
                                void *buf_addr,
                                size_t subbuf_size, size_t num_subbuf,
                                unsigned int switch_timer_interval,
@@ -651,13 +651,13 @@ struct lttng_channel *_channel_create(const char *name,
 {
        struct lttng_ust_abi_channel_config chan_priv_init;
        struct lttng_ust_shm_handle *handle;
-       struct lttng_channel *lttng_chan;
+       struct lttng_ust_channel_buffer *lttng_chan_buf;
 
-       lttng_chan = zmalloc(sizeof(struct lttng_channel));
-       if (!lttng_chan)
+       lttng_chan_buf = lttng_ust_alloc_channel_buffer();
+       if (!lttng_chan_buf)
                return NULL;
-       memcpy(lttng_chan->uuid, uuid, LTTNG_UST_UUID_LEN);
-       lttng_chan->id = chan_id;
+       memcpy(lttng_chan_buf->priv->uuid, uuid, LTTNG_UST_UUID_LEN);
+       lttng_chan_buf->priv->id = chan_id;
 
        memset(&chan_priv_init, 0, sizeof(chan_priv_init));
        memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN);
@@ -667,32 +667,32 @@ struct lttng_channel *_channel_create(const char *name,
                        __alignof__(struct lttng_ust_abi_channel_config),
                        sizeof(struct lttng_ust_abi_channel_config),
                        &chan_priv_init,
-                       lttng_chan, buf_addr, subbuf_size, num_subbuf,
+                       lttng_chan_buf, buf_addr, subbuf_size, num_subbuf,
                        switch_timer_interval, read_timer_interval,
                        stream_fds, nr_stream_fds, blocking_timeout);
        if (!handle)
                goto error;
-       lttng_chan->handle = handle;
-       lttng_chan->chan = shmp(handle, handle->chan);
-       return lttng_chan;
+       lttng_chan_buf->handle = handle;
+       lttng_chan_buf->chan = shmp(handle, handle->chan);
+       return lttng_chan_buf;
 
 error:
-       free(lttng_chan);
+       lttng_ust_free_channel_common(lttng_chan_buf->parent);
        return NULL;
 }
 
 static
-void lttng_channel_destroy(struct lttng_channel *chan)
+void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
 {
-       channel_destroy(chan->chan, chan->handle, 1);
-       free(chan);
+       channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->handle, 1);
+       lttng_ust_free_channel_common(lttng_chan_buf->parent);
 }
 
 static
 int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx,
                      uint32_t event_id)
 {
-       struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
+       struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
        struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
        struct lttng_client_ctx client_ctx;
        int ret, cpu;
@@ -708,7 +708,7 @@ int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx,
                return -EPERM;
        ctx->cpu = cpu;
 
-       switch (lttng_chan->header_type) {
+       switch (lttng_chan->priv->header_type) {
        case 1: /* compact */
                if (event_id > 30)
                        ctx->rflags |= LTTNG_RFLAG_EXTENDED;
index 956de9fde1c62215dd7df343e743d44486fca40e..8a5943972bbcc0e911047ae14fa740e2dae35262 100644 (file)
@@ -92,13 +92,13 @@ static void client_buffer_begin(struct lttng_ust_lib_ring_buffer *buf, uint64_t
                        lib_ring_buffer_offset_address(&buf->backend,
                                subbuf_idx * chan->backend.subbuf_size,
                                handle);
-       struct lttng_channel *lttng_chan = channel_get_private(chan);
+       struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
 
        assert(header);
        if (!header)
                return;
        header->magic = TSDL_MAGIC_NUMBER;
-       memcpy(header->uuid, lttng_chan->uuid, sizeof(lttng_chan->uuid));
+       memcpy(header->uuid, lttng_chan->priv->uuid, sizeof(lttng_chan->priv->uuid));
        header->checksum = 0;           /* 0 if unused */
        header->content_size = 0xFFFFFFFF; /* in bits, for debugging */
        header->packet_size = 0xFFFFFFFF;  /* in bits, for debugging */
@@ -190,7 +190,7 @@ static const struct lttng_ust_lib_ring_buffer_config client_config = {
 };
 
 static
-struct lttng_channel *_channel_create(const char *name,
+struct lttng_ust_channel_buffer *_channel_create(const char *name,
                                void *buf_addr,
                                size_t subbuf_size, size_t num_subbuf,
                                unsigned int switch_timer_interval,
@@ -202,41 +202,41 @@ struct lttng_channel *_channel_create(const char *name,
 {
        struct lttng_ust_abi_channel_config chan_priv_init;
        struct lttng_ust_shm_handle *handle;
-       struct lttng_channel *lttng_chan;
+       struct lttng_ust_channel_buffer *lttng_chan_buf;
 
-       lttng_chan = zmalloc(sizeof(struct lttng_channel));
-       if (!lttng_chan)
+       lttng_chan_buf = lttng_ust_alloc_channel_buffer();
+       if (!lttng_chan_buf)
                return NULL;
-       memcpy(lttng_chan->uuid, uuid, LTTNG_UST_UUID_LEN);
-       lttng_chan->id = chan_id;
+       memcpy(lttng_chan_buf->priv->uuid, uuid, LTTNG_UST_UUID_LEN);
+       lttng_chan_buf->priv->id = chan_id;
 
        memset(&chan_priv_init, 0, sizeof(chan_priv_init));
        memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN);
        chan_priv_init.id = chan_id;
 
        handle = channel_create(&client_config, name,
-                       __alignof__(struct lttng_channel),
-                       sizeof(struct lttng_channel),
+                       __alignof__(struct lttng_ust_channel_buffer),
+                       sizeof(struct lttng_ust_channel_buffer),
                        &chan_priv_init,
-                       lttng_chan, buf_addr, subbuf_size, num_subbuf,
+                       lttng_chan_buf, buf_addr, subbuf_size, num_subbuf,
                        switch_timer_interval, read_timer_interval,
                        stream_fds, nr_stream_fds, blocking_timeout);
        if (!handle)
                goto error;
-       lttng_chan->handle = handle;
-       lttng_chan->chan = shmp(handle, handle->chan);
-       return lttng_chan;
+       lttng_chan_buf->handle = handle;
+       lttng_chan_buf->chan = shmp(handle, handle->chan);
+       return lttng_chan_buf;
 
 error:
-       free(lttng_chan);
+       lttng_ust_free_channel_common(lttng_chan_buf->parent);
        return NULL;
 }
 
 static
-void lttng_channel_destroy(struct lttng_channel *chan)
+void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
 {
-       channel_destroy(chan->chan, chan->handle, 1);
-       free(chan);
+       channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->handle, 1);
+       lttng_ust_free_channel_common(lttng_chan_buf->parent);
 }
 
 static
index a292dae578e6628ccb31dc43781f012d4c850a60..80b49f7f2dd50922e70b185555061751d27f4db7 100644 (file)
 #define LTTNG_PROC_NS_PATH_MAX 40
 
 struct lttng_ust_session;
-struct lttng_channel;
-struct lttng_event;
+struct lttng_ust_channel_buffer;
 struct lttng_ust_ctx_field;
 struct lttng_ust_lib_ring_buffer_ctx;
 struct lttng_ust_ctx_value;
+struct lttng_ust_event_recorder;
 struct lttng_ust_event_notifier;
 
 __attribute__((visibility("hidden")))
@@ -92,7 +92,7 @@ size_t lttng_ust_dummy_get_size(struct lttng_ust_ctx_field *field, size_t offset
 __attribute__((visibility("hidden")))
 void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan);
+                struct lttng_ust_channel_buffer *chan);
 __attribute__((visibility("hidden")))
 void lttng_ust_dummy_get_value(struct lttng_ust_ctx_field *field,
                struct lttng_ust_ctx_value *value);
index a1903451478c94ecdbe772f51d672b080d1ddc81..9c4ddf15517a9c7a7a4b107574d173b87eedca96 100644 (file)
@@ -287,7 +287,7 @@ int lttng_abi_create_root_handle(void)
 }
 
 static
-int lttng_is_channel_ready(struct lttng_channel *lttng_chan)
+int lttng_is_channel_ready(struct lttng_ust_channel_buffer *lttng_chan)
 {
        struct lttng_ust_lib_ring_buffer_channel *chan;
        unsigned int nr_streams, exp_streams;
@@ -449,7 +449,7 @@ int lttng_abi_map_channel(int session_objd,
        int chan_objd;
        struct lttng_ust_shm_handle *channel_handle;
        struct lttng_ust_abi_channel_config *lttng_chan_config;
-       struct lttng_channel *lttng_chan;
+       struct lttng_ust_channel_buffer *lttng_chan_buf;
        struct lttng_ust_lib_ring_buffer_channel *chan;
        struct lttng_ust_lib_ring_buffer_config *config;
        void *chan_data;
@@ -476,10 +476,10 @@ int lttng_abi_map_channel(int session_objd,
                goto active;    /* Refuse to add channel to active session */
        }
 
-       lttng_chan = zmalloc(sizeof(struct lttng_channel));
-       if (!lttng_chan) {
+       lttng_chan_buf = lttng_ust_alloc_channel_buffer();
+       if (!lttng_chan_buf) {
                ret = -ENOMEM;
-               goto lttng_chan_error;
+               goto lttng_chan_buf_error;
        }
 
        channel_handle = channel_handle_create(chan_data, len, wakeup_fd);
@@ -544,30 +544,33 @@ int lttng_abi_map_channel(int session_objd,
        }
 
        /* Initialize our lttng chan */
-       lttng_chan->chan = chan;
-       lttng_chan->tstate = 1;
-       lttng_chan->enabled = 1;
-       lttng_chan->ctx = NULL;
-       lttng_chan->session = session;
-       lttng_chan->ops = &transport->ops;
-       memcpy(&lttng_chan->chan->backend.config,
+       lttng_chan_buf->parent->enabled = 1;
+       lttng_chan_buf->parent->session = session;
+
+       lttng_chan_buf->priv->parent.tstate = 1;
+
+       lttng_chan_buf->ctx = NULL;
+       lttng_chan_buf->ops = &transport->ops;
+       lttng_chan_buf->chan = chan;
+       lttng_chan_buf->handle = channel_handle;
+
+       memcpy(&chan->backend.config,
                transport->client_config,
-               sizeof(lttng_chan->chan->backend.config));
-       cds_list_add(&lttng_chan->node, &session->priv->chan_head);
-       lttng_chan->header_type = 0;
-       lttng_chan->handle = channel_handle;
-       lttng_chan->type = type;
+               sizeof(chan->backend.config));
+       cds_list_add(&lttng_chan_buf->priv->node, &session->priv->chan_head);
+       lttng_chan_buf->priv->header_type = 0;
+       lttng_chan_buf->priv->type = type;
        /* Copy fields from lttng ust chan config. */
-       lttng_chan->id = lttng_chan_config->id;
-       memcpy(lttng_chan->uuid, lttng_chan_config->uuid, LTTNG_UST_UUID_LEN);
-       channel_set_private(chan, lttng_chan);
+       lttng_chan_buf->priv->id = lttng_chan_config->id;
+       memcpy(lttng_chan_buf->priv->uuid, lttng_chan_config->uuid, LTTNG_UST_UUID_LEN);
+       channel_set_private(chan, lttng_chan_buf);
 
        /*
         * We tolerate no failure path after channel creation. It will stay
         * invariant for the rest of the session.
         */
-       objd_set_private(chan_objd, lttng_chan);
-       lttng_chan->objd = chan_objd;
+       objd_set_private(chan_objd, lttng_chan_buf);
+       lttng_chan_buf->priv->parent.objd = chan_objd;
        /* The channel created holds a reference on the session */
        objd_ref(session_objd);
        return chan_objd;
@@ -577,12 +580,12 @@ objd_error:
 notransport:
 alloc_error:
        channel_destroy(chan, channel_handle, 0);
-       free(lttng_chan);
+       lttng_ust_free_channel_common(lttng_chan_buf->parent);
        return ret;
 
 handle_error:
-       free(lttng_chan);
-lttng_chan_error:
+       lttng_ust_free_channel_common(lttng_chan_buf->parent);
+lttng_chan_buf_error:
 active:
 invalid:
        return ret;
@@ -1108,10 +1111,10 @@ static
 int lttng_abi_map_stream(int channel_objd, struct lttng_ust_abi_stream *info,
                union lttng_ust_abi_args *uargs, void *owner)
 {
-       struct lttng_channel *channel = objd_private(channel_objd);
+       struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(channel_objd);
        int ret;
 
-       ret = channel_handle_add_stream(channel->handle,
+       ret = channel_handle_add_stream(lttng_chan_buf->handle,
                uargs->stream.shm_fd, uargs->stream.wakeup_fd,
                info->stream_nr, info->len);
        if (ret)
@@ -1132,7 +1135,7 @@ int lttng_abi_create_event_enabler(int channel_objd,
                           void *owner,
                           enum lttng_enabler_format_type format_type)
 {
-       struct lttng_channel *channel = objd_private(channel_objd);
+       struct lttng_ust_channel_buffer *channel = objd_private(channel_objd);
        struct lttng_event_enabler *enabler;
        int event_objd, ret;
 
@@ -1196,13 +1199,13 @@ static
 long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg,
        union lttng_ust_abi_args *uargs, void *owner)
 {
-       struct lttng_channel *channel = objd_private(objd);
+       struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(objd);
 
        if (cmd != LTTNG_UST_ABI_STREAM) {
                /*
                 * Check if channel received all streams.
                 */
-               if (!lttng_is_channel_ready(channel))
+               if (!lttng_is_channel_ready(lttng_chan_buf))
                        return -EPERM;
        }
 
@@ -1235,13 +1238,15 @@ long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg,
        case LTTNG_UST_ABI_CONTEXT:
                return lttng_abi_add_context(objd,
                                (struct lttng_ust_abi_context *) arg, uargs,
-                               &channel->ctx, channel->session);
+                               &lttng_chan_buf->ctx,
+                               lttng_chan_buf->parent->session);
        case LTTNG_UST_ABI_ENABLE:
-               return lttng_channel_enable(channel);
+               return lttng_channel_enable(lttng_chan_buf->parent);
        case LTTNG_UST_ABI_DISABLE:
-               return lttng_channel_disable(channel);
+               return lttng_channel_disable(lttng_chan_buf->parent);
        case LTTNG_UST_ABI_FLUSH_BUFFER:
-               return channel->ops->priv->flush_buffer(channel->chan, channel->handle);
+               return lttng_chan_buf->ops->priv->flush_buffer(lttng_chan_buf->chan,
+                               lttng_chan_buf->handle);
        default:
                return -EINVAL;
        }
@@ -1250,10 +1255,10 @@ long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg,
 static
 int lttng_channel_release(int objd)
 {
-       struct lttng_channel *channel = objd_private(objd);
+       struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(objd);
 
-       if (channel)
-               return lttng_ust_abi_objd_unref(channel->session->priv->objd, 0);
+       if (lttng_chan_buf)
+               return lttng_ust_abi_objd_unref(lttng_chan_buf->parent->session->priv->objd, 0);
        return 0;
 }
 
@@ -1324,7 +1329,7 @@ int lttng_event_enabler_release(int objd)
        struct lttng_event_enabler *event_enabler = objd_private(objd);
 
        if (event_enabler)
-               return lttng_ust_abi_objd_unref(event_enabler->chan->objd, 0);
+               return lttng_ust_abi_objd_unref(event_enabler->chan->priv->parent.objd, 0);
 
        return 0;
 }
index 0b1fcf0b787724781e3dc855f00b41e6393e1ed1..9f21b9772e665cafe5ecd6bb5f247dfd0fbe8e6b 100644 (file)
@@ -116,7 +116,7 @@ size_t lttng_ust_dummy_get_size(struct lttng_ust_ctx_field *field, size_t offset
 
 void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *chan)
 {
        char sel_char = (char) LTTNG_UST_DYNAMIC_TYPE_NONE;
 
@@ -137,3 +137,56 @@ int lttng_context_is_app(const char *name)
        }
        return 1;
 }
+
+struct lttng_ust_channel_buffer *lttng_ust_alloc_channel_buffer(void)
+{
+       struct lttng_ust_channel_buffer *lttng_chan_buf;
+       struct lttng_ust_channel_common *lttng_chan_common;
+       struct lttng_ust_channel_buffer_private *lttng_chan_buf_priv;
+
+       lttng_chan_buf = zmalloc(sizeof(struct lttng_ust_channel_buffer));
+       if (!lttng_chan_buf)
+               goto lttng_chan_buf_error;
+       lttng_chan_buf->struct_size = sizeof(struct lttng_ust_channel_buffer);
+       lttng_chan_common = zmalloc(sizeof(struct lttng_ust_channel_common));
+       if (!lttng_chan_common)
+               goto lttng_chan_common_error;
+       lttng_chan_common->struct_size = sizeof(struct lttng_ust_channel_common);
+       lttng_chan_buf_priv = zmalloc(sizeof(struct lttng_ust_channel_buffer_private));
+       if (!lttng_chan_buf_priv)
+               goto lttng_chan_buf_priv_error;
+       lttng_chan_buf->parent = lttng_chan_common;
+       lttng_chan_common->type = LTTNG_UST_CHANNEL_TYPE_BUFFER;
+       lttng_chan_common->child = lttng_chan_buf;
+       lttng_chan_buf->priv = lttng_chan_buf_priv;
+       lttng_chan_common->priv = &lttng_chan_buf_priv->parent;
+       lttng_chan_buf_priv->pub = lttng_chan_buf;
+       lttng_chan_buf_priv->parent.pub = lttng_chan_common;
+
+       return lttng_chan_buf;
+
+lttng_chan_buf_priv_error:
+       free(lttng_chan_common);
+lttng_chan_common_error:
+       free(lttng_chan_buf);
+lttng_chan_buf_error:
+       return NULL;
+}
+
+void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan)
+{
+       switch (chan->type) {
+       case LTTNG_UST_CHANNEL_TYPE_BUFFER:
+       {
+               struct lttng_ust_channel_buffer *chan_buf;
+
+               chan_buf = (struct lttng_ust_channel_buffer *)chan->child;
+               free(chan_buf->parent);
+               free(chan_buf->priv);
+               free(chan_buf);
+               break;
+       }
+       default:
+               abort();
+       }
+}
index bed7a85c6cf3a7c85342f6b1e4e95fa9dfd107ce..d79278d7ec513958c1032c4db9c1497bb827cd5d 100644 (file)
@@ -76,7 +76,7 @@ struct lttng_enabler {
 struct lttng_event_enabler {
        struct lttng_enabler base;
        struct cds_list_head node;      /* per-session list of enablers */
-       struct lttng_channel *chan;
+       struct lttng_ust_channel_buffer *chan;
        /*
         * Unused, but kept around to make it explicit that the tracer can do
         * it.
@@ -316,10 +316,12 @@ struct lttng_enum {
        uint64_t id;                    /* Enumeration ID in sessiond */
 };
 
+struct lttng_ust_shm_handle;
+
 struct lttng_ust_channel_ops_private {
        struct lttng_ust_channel_ops *pub;      /* Public channels ops interface */
 
-       struct lttng_channel *(*channel_create)(const char *name,
+       struct lttng_ust_channel_buffer *(*channel_create)(const char *name,
                        void *buf_addr,
                        size_t subbuf_size, size_t num_subbuf,
                        unsigned int switch_timer_interval,
@@ -328,7 +330,7 @@ struct lttng_ust_channel_ops_private {
                        uint32_t chan_id,
                        const int *stream_fds, int nr_stream_fds,
                        int64_t blocking_timeout);
-       void (*channel_destroy)(struct lttng_channel *chan);
+       void (*channel_destroy)(struct lttng_ust_channel_buffer *chan);
        /*
         * packet_avail_size returns the available size in the current
         * packet. Note that the size returned is only a hint, since it
@@ -342,6 +344,24 @@ struct lttng_ust_channel_ops_private {
                            struct lttng_ust_shm_handle *handle);
 };
 
+struct lttng_ust_channel_common_private {
+       struct lttng_ust_channel_common *pub;   /* Public channel interface */
+
+       int objd;       /* Object associated with channel. */
+       int tstate:1;                   /* Transient enable state */
+};
+
+struct lttng_ust_channel_buffer_private {
+       struct lttng_ust_channel_common_private parent;
+
+       struct lttng_ust_channel_buffer *pub;   /* Public channel buffer interface */
+       struct cds_list_head node;      /* Channel list in session */
+       int header_type;                /* 0: unset, 1: compact, 2: large */
+       unsigned int id;                /* Channel ID */
+       enum lttng_ust_abi_chan_type type;
+       unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
+};
+
 /*
  * IMPORTANT: this structure is part of the ABI between the consumer
  * daemon and the UST library within traced applications. Changing it
@@ -550,7 +570,7 @@ __attribute__((visibility("hidden")))
 struct lttng_event_enabler *lttng_event_enabler_create(
                enum lttng_enabler_format_type format_type,
                struct lttng_ust_abi_event *event_param,
-               struct lttng_channel *chan);
+               struct lttng_ust_channel_buffer *chan);
 
 /*
  * Destroy a `struct lttng_event_enabler` object.
@@ -787,21 +807,10 @@ __attribute__((visibility("hidden")))
 void lttng_handle_pending_statedump(void *owner);
 
 __attribute__((visibility("hidden")))
-struct lttng_channel *lttng_channel_create(struct lttng_ust_session *session,
-                                      const char *transport_name,
-                                      void *buf_addr,
-                                      size_t subbuf_size, size_t num_subbuf,
-                                      unsigned int switch_timer_interval,
-                                      unsigned int read_timer_interval,
-                                      int **shm_fd, int **wait_fd,
-                                      uint64_t **memory_map_size,
-                                      struct lttng_channel *chan_priv_init);
+int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel);
 
 __attribute__((visibility("hidden")))
-int lttng_channel_enable(struct lttng_channel *channel);
-
-__attribute__((visibility("hidden")))
-int lttng_channel_disable(struct lttng_channel *channel);
+int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel);
 
 __attribute__((visibility("hidden")))
 void lttng_transport_register(struct lttng_transport *transport);
@@ -846,4 +855,10 @@ void lttng_ust_abi_events_exit(void);
 __attribute__((visibility("hidden")))
 void lttng_ust_abi_objd_table_owner_cleanup(void *owner);
 
+__attribute__((visibility("hidden")))
+struct lttng_ust_channel_buffer *lttng_ust_alloc_channel_buffer(void);
+
+__attribute__((visibility("hidden")))
+void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan);
+
 #endif /* _LTTNG_UST_EVENTS_INTERNAL_H */
index 19901c7caf64559c8a8fd9e3c7370e1e38fd85b4..6b1a6bd30251058abc2c20773c39e8cd1b9f2b87 100644 (file)
@@ -104,13 +104,13 @@ size_t test_get_size(struct lttng_ust_ctx_field *field, size_t offset)
 static
 void test_record(struct lttng_ust_ctx_field *field,
                 struct lttng_ust_lib_ring_buffer_ctx *ctx,
-                struct lttng_channel *chan)
+                struct lttng_ust_channel_buffer *lttng_chan_buf)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
        char sel_char = (char) sel;
 
        lib_ring_buffer_align_ctx(ctx, lttng_alignof(char));
-       chan->ops->event_write(ctx, &sel_char, sizeof(sel_char));
+       lttng_chan_buf->ops->event_write(ctx, &sel_char, sizeof(sel_char));
        switch (sel) {
        case LTTNG_UST_DYNAMIC_TYPE_NONE:
                break;
@@ -119,7 +119,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                int8_t v = -8;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_S16:
@@ -127,7 +127,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                int16_t v = -16;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_S32:
@@ -135,7 +135,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                int32_t v = -32;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_S64:
@@ -143,7 +143,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                int64_t v = -64;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_U8:
@@ -151,7 +151,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                uint8_t v = 8;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_U16:
@@ -159,7 +159,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                uint16_t v = 16;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_U32:
@@ -167,7 +167,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                uint32_t v = 32;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_U64:
@@ -175,7 +175,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                uint64_t v = 64;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
-               chan->ops->event_write(ctx, &v, sizeof(v));
+               lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_FLOAT:
@@ -183,7 +183,7 @@ void test_record(struct lttng_ust_ctx_field *field,
                float f = 22322.0;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(f));
-               chan->ops->event_write(ctx, &f, sizeof(f));
+               lttng_chan_buf->ops->event_write(ctx, &f, sizeof(f));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_DOUBLE:
@@ -191,13 +191,13 @@ void test_record(struct lttng_ust_ctx_field *field,
                double d = 2.0;
 
                lib_ring_buffer_align_ctx(ctx, lttng_alignof(d));
-               chan->ops->event_write(ctx, &d, sizeof(d));
+               lttng_chan_buf->ops->event_write(ctx, &d, sizeof(d));
                break;
        }
        case LTTNG_UST_DYNAMIC_TYPE_STRING:
        {
                const char *str = "teststr";
-               chan->ops->event_write(ctx, str, strlen(str) + 1);
+               lttng_chan_buf->ops->event_write(ctx, str, strlen(str) + 1);
                break;
        }
        default:
This page took 0.057269 seconds and 4 git commands to generate.