From 4a399b764e79f280a434da2201a5c3e30490aa9e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 3 May 2021 11:14:39 -0400 Subject: [PATCH] Refactoring: struct lttng_kernel_channel_buffer_ops Introduce public/private structures for ring buffer channel operations. Signed-off-by: Mathieu Desnoyers Change-Id: I3614d550615a4617541a292fa761bebbdf6a275a --- include/lttng/events-internal.h | 52 ++++++++++++++++ include/lttng/events.h | 57 ++---------------- src/lttng-abi.c | 60 +++++++++---------- src/lttng-events.c | 10 ++-- src/lttng-ring-buffer-client.h | 43 ++++++------- src/lttng-ring-buffer-event-notifier-client.h | 43 ++++++------- src/lttng-ring-buffer-metadata-client.h | 43 ++++++------- 7 files changed, 162 insertions(+), 146 deletions(-) diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index f0d0b0da..9a807408 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -243,6 +243,58 @@ struct lttng_metadata_cache { uint64_t version; /* Current version of the metadata */ }; +struct lttng_kernel_channel_buffer_ops_private { + struct lttng_kernel_channel_buffer_ops *pub; /* Public channel buffer ops interface */ + + struct channel *(*channel_create)(const char *name, + void *priv, + void *buf_addr, + size_t subbuf_size, size_t num_subbuf, + unsigned int switch_timer_interval, + unsigned int read_timer_interval); + void (*channel_destroy)(struct channel *chan); + struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); + int (*buffer_has_read_closed_stream)(struct channel *chan); + void (*buffer_read_close)(struct lib_ring_buffer *buf); + /* + * packet_avail_size returns the available size in the current + * packet. Note that the size returned is only a hint, since it + * may change due to concurrent writes. + */ + size_t (*packet_avail_size)(struct channel *chan); + wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu); + wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan); + int (*is_finalized)(struct channel *chan); + int (*is_disabled)(struct channel *chan); + int (*timestamp_begin) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *timestamp_begin); + int (*timestamp_end) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *timestamp_end); + int (*events_discarded) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *events_discarded); + int (*content_size) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *content_size); + int (*packet_size) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *packet_size); + int (*stream_id) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *stream_id); + int (*current_timestamp) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *ts); + int (*sequence_number) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *seq); + int (*instance_id) (const struct lib_ring_buffer_config *config, + struct lib_ring_buffer *bufb, + uint64_t *id); +}; + extern struct lttng_kernel_ctx *lttng_static_ctx; static inline diff --git a/include/lttng/events.h b/include/lttng/events.h index 38cb3993..9cc552bc 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -371,17 +371,9 @@ struct lttng_kernel_event_notifier { struct lttng_kernel_notification_ctx *notif_ctx); }; -struct lttng_channel_ops { - struct channel *(*channel_create)(const char *name, - void *priv, - void *buf_addr, - size_t subbuf_size, size_t num_subbuf, - unsigned int switch_timer_interval, - unsigned int read_timer_interval); - void (*channel_destroy)(struct channel *chan); - struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); - int (*buffer_has_read_closed_stream)(struct channel *chan); - void (*buffer_read_close)(struct lib_ring_buffer *buf); +struct lttng_kernel_channel_buffer_ops { + struct lttng_kernel_channel_buffer_ops_private *priv; /* Private channel buffer ops interface. */ + int (*event_reserve)(struct lib_ring_buffer_ctx *ctx); void (*event_commit)(struct lib_ring_buffer_ctx *ctx); void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src, @@ -394,43 +386,6 @@ struct lttng_channel_ops { size_t len); void (*event_strcpy_from_user)(struct lib_ring_buffer_ctx *ctx, const char __user *src, size_t len); - /* - * packet_avail_size returns the available size in the current - * packet. Note that the size returned is only a hint, since it - * may change due to concurrent writes. - */ - size_t (*packet_avail_size)(struct channel *chan); - wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu); - wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan); - int (*is_finalized)(struct channel *chan); - int (*is_disabled)(struct channel *chan); - int (*timestamp_begin) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *timestamp_begin); - int (*timestamp_end) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *timestamp_end); - int (*events_discarded) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *events_discarded); - int (*content_size) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *content_size); - int (*packet_size) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *packet_size); - int (*stream_id) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *stream_id); - int (*current_timestamp) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *ts); - int (*sequence_number) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *seq); - int (*instance_id) (const struct lib_ring_buffer_config *config, - struct lib_ring_buffer *bufb, - uint64_t *id); }; struct lttng_counter_ops { @@ -459,7 +414,7 @@ struct lttng_transport { char *name; struct module *owner; struct list_head node; - struct lttng_channel_ops ops; + struct lttng_kernel_channel_buffer_ops ops; }; struct lttng_counter_transport { @@ -495,7 +450,7 @@ struct lttng_channel { struct file *file; /* File associated to channel */ unsigned int free_event_id; /* Next event ID to allocate */ struct list_head list; /* Channel list */ - struct lttng_channel_ops *ops; + struct lttng_kernel_channel_buffer_ops *ops; struct lttng_transport *transport; struct hlist_head *sc_table; /* for syscall tracing */ struct hlist_head *compat_sc_table; @@ -612,7 +567,7 @@ struct lttng_event_notifier_group { struct list_head enablers_head; /* List of enablers */ struct list_head event_notifiers_head; /* List of event notifier */ struct lttng_event_notifier_ht event_notifiers_ht; /* Hash table of event notifiers */ - struct lttng_channel_ops *ops; + struct lttng_kernel_channel_buffer_ops *ops; struct lttng_transport *transport; struct channel *chan; /* Ring buffer channel for event notifier group. */ struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */ diff --git a/src/lttng-abi.c b/src/lttng-abi.c index 6829c239..6da86d54 100644 --- a/src/lttng-abi.c +++ b/src/lttng-abi.c @@ -1632,7 +1632,7 @@ int lttng_abi_open_stream(struct file *channel_file) int ret; void *stream_priv; - buf = channel->ops->buffer_read_open(channel->chan); + buf = channel->ops->priv->buffer_read_open(channel->chan); if (!buf) return -ENOENT; @@ -1646,7 +1646,7 @@ int lttng_abi_open_stream(struct file *channel_file) return ret; fd_error: - channel->ops->buffer_read_close(buf); + channel->ops->priv->buffer_read_close(buf); return ret; } @@ -1660,7 +1660,7 @@ int lttng_abi_open_metadata_stream(struct file *channel_file) struct lttng_metadata_stream *metadata_stream; void *stream_priv; - buf = channel->ops->buffer_read_open(channel->chan); + buf = channel->ops->priv->buffer_read_open(channel->chan); if (!buf) return -ENOENT; @@ -1712,7 +1712,7 @@ kref_error: notransport: kfree(metadata_stream); nomem: - channel->ops->buffer_read_close(buf); + channel->ops->priv->buffer_read_close(buf); return ret; } @@ -1725,7 +1725,7 @@ int lttng_abi_open_event_notifier_group_stream(struct file *notif_file) int ret; void *stream_priv; - buf = event_notifier_group->ops->buffer_read_open(chan); + buf = event_notifier_group->ops->priv->buffer_read_open(chan); if (!buf) return -ENOENT; @@ -1747,7 +1747,7 @@ int lttng_abi_open_event_notifier_group_stream(struct file *notif_file) fd_error: atomic_long_dec(¬if_file->f_count); refcount_error: - event_notifier_group->ops->buffer_read_close(buf); + event_notifier_group->ops->priv->buffer_read_close(buf); return ret; } @@ -2538,14 +2538,14 @@ unsigned int lttng_channel_poll(struct file *file, poll_table *wait) if (file->f_mode & FMODE_READ) { poll_wait_set_exclusive(wait); - poll_wait(file, channel->ops->get_hp_wait_queue(channel->chan), + poll_wait(file, channel->ops->priv->get_hp_wait_queue(channel->chan), wait); - if (channel->ops->is_disabled(channel->chan)) + if (channel->ops->priv->is_disabled(channel->chan)) return POLLERR; - if (channel->ops->is_finalized(channel->chan)) + if (channel->ops->priv->is_finalized(channel->chan)) return POLLHUP; - if (channel->ops->buffer_has_read_closed_stream(channel->chan)) + if (channel->ops->priv->buffer_has_read_closed_stream(channel->chan)) return POLLIN | POLLRDNORM; return 0; } @@ -2744,7 +2744,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, struct lib_ring_buffer *buf = filp->private_data; struct channel *chan = buf->backend.chan; const struct lib_ring_buffer_config *config = &chan->backend.config; - const struct lttng_channel_ops *ops = chan->backend.priv_ops; + const struct lttng_kernel_channel_buffer_ops *ops = chan->backend.priv_ops; int ret; if (atomic_read(&chan->record_disabled)) @@ -2755,7 +2755,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t ts; - ret = ops->timestamp_begin(config, buf, &ts); + ret = ops->priv->timestamp_begin(config, buf, &ts); if (ret < 0) goto error; return put_u64(ts, arg); @@ -2764,7 +2764,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t ts; - ret = ops->timestamp_end(config, buf, &ts); + ret = ops->priv->timestamp_end(config, buf, &ts); if (ret < 0) goto error; return put_u64(ts, arg); @@ -2773,7 +2773,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t ed; - ret = ops->events_discarded(config, buf, &ed); + ret = ops->priv->events_discarded(config, buf, &ed); if (ret < 0) goto error; return put_u64(ed, arg); @@ -2782,7 +2782,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t cs; - ret = ops->content_size(config, buf, &cs); + ret = ops->priv->content_size(config, buf, &cs); if (ret < 0) goto error; return put_u64(cs, arg); @@ -2791,7 +2791,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t ps; - ret = ops->packet_size(config, buf, &ps); + ret = ops->priv->packet_size(config, buf, &ps); if (ret < 0) goto error; return put_u64(ps, arg); @@ -2800,7 +2800,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t si; - ret = ops->stream_id(config, buf, &si); + ret = ops->priv->stream_id(config, buf, &si); if (ret < 0) goto error; return put_u64(si, arg); @@ -2809,7 +2809,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t ts; - ret = ops->current_timestamp(config, buf, &ts); + ret = ops->priv->current_timestamp(config, buf, &ts); if (ret < 0) goto error; return put_u64(ts, arg); @@ -2818,7 +2818,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t seq; - ret = ops->sequence_number(config, buf, &seq); + ret = ops->priv->sequence_number(config, buf, &seq); if (ret < 0) goto error; return put_u64(seq, arg); @@ -2827,7 +2827,7 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, { uint64_t id; - ret = ops->instance_id(config, buf, &id); + ret = ops->priv->instance_id(config, buf, &id); if (ret < 0) goto error; return put_u64(id, arg); @@ -2848,7 +2848,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, struct lib_ring_buffer *buf = filp->private_data; struct channel *chan = buf->backend.chan; const struct lib_ring_buffer_config *config = &chan->backend.config; - const struct lttng_channel_ops *ops = chan->backend.priv_ops; + const struct lttng_kernel_channel_buffer_ops *ops = chan->backend.priv_ops; int ret; if (atomic_read(&chan->record_disabled)) @@ -2859,7 +2859,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t ts; - ret = ops->timestamp_begin(config, buf, &ts); + ret = ops->priv->timestamp_begin(config, buf, &ts); if (ret < 0) goto error; return put_u64(ts, arg); @@ -2868,7 +2868,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t ts; - ret = ops->timestamp_end(config, buf, &ts); + ret = ops->priv->timestamp_end(config, buf, &ts); if (ret < 0) goto error; return put_u64(ts, arg); @@ -2877,7 +2877,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t ed; - ret = ops->events_discarded(config, buf, &ed); + ret = ops->priv->events_discarded(config, buf, &ed); if (ret < 0) goto error; return put_u64(ed, arg); @@ -2886,7 +2886,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t cs; - ret = ops->content_size(config, buf, &cs); + ret = ops->priv->content_size(config, buf, &cs); if (ret < 0) goto error; return put_u64(cs, arg); @@ -2895,7 +2895,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t ps; - ret = ops->packet_size(config, buf, &ps); + ret = ops->priv->packet_size(config, buf, &ps); if (ret < 0) goto error; return put_u64(ps, arg); @@ -2904,7 +2904,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t si; - ret = ops->stream_id(config, buf, &si); + ret = ops->priv->stream_id(config, buf, &si); if (ret < 0) goto error; return put_u64(si, arg); @@ -2913,7 +2913,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t ts; - ret = ops->current_timestamp(config, buf, &ts); + ret = ops->priv->current_timestamp(config, buf, &ts); if (ret < 0) goto error; return put_u64(ts, arg); @@ -2922,7 +2922,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t seq; - ret = ops->sequence_number(config, buf, &seq); + ret = ops->priv->sequence_number(config, buf, &seq); if (ret < 0) goto error; return put_u64(seq, arg); @@ -2931,7 +2931,7 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, { uint64_t id; - ret = ops->instance_id(config, buf, &id); + ret = ops->priv->instance_id(config, buf, &id); if (ret < 0) goto error; return put_u64(id, arg); diff --git a/src/lttng-events.c b/src/lttng-events.c index 4cb0f037..172513f3 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -291,7 +291,7 @@ struct lttng_event_notifier_group *lttng_event_notifier_group_create(void) * notifications. */ event_notifier_group->ops = &transport->ops; - event_notifier_group->chan = transport->ops.channel_create( + event_notifier_group->chan = transport->ops.priv->channel_create( transport_name, event_notifier_group, NULL, subbuf_size, num_subbuf, switch_timer_interval, read_timer_interval); @@ -422,7 +422,7 @@ void lttng_event_notifier_group_destroy( event_notifier_group->error_counter = NULL; } - event_notifier_group->ops->channel_destroy(event_notifier_group->chan); + event_notifier_group->ops->priv->channel_destroy(event_notifier_group->chan); module_put(event_notifier_group->transport->owner); list_del(&event_notifier_group->node); @@ -758,7 +758,7 @@ struct lttng_channel *lttng_channel_create(struct lttng_session *session, * headers. Therefore the "chan" information used as input * should be already accessible. */ - chan->chan = transport->ops.channel_create(transport_name, + chan->chan = transport->ops.priv->channel_create(transport_name, chan, buf_addr, subbuf_size, num_subbuf, switch_timer_interval, read_timer_interval); if (!chan->chan) @@ -790,7 +790,7 @@ active: static void _lttng_channel_destroy(struct lttng_channel *chan) { - chan->ops->channel_destroy(chan->chan); + chan->ops->priv->channel_destroy(chan->chan); module_put(chan->transport->owner); list_del(&chan->list); lttng_kernel_destroy_context(chan->ctx); @@ -2879,7 +2879,7 @@ int lttng_metadata_output_channel(struct lttng_metadata_stream *stream, if (!len) goto end; reserve_len = min_t(size_t, - stream->transport->ops.packet_avail_size(chan), + stream->transport->ops.priv->packet_avail_size(chan), len); lib_ring_buffer_ctx_init(&ctx, chan, reserve_len, sizeof(char), NULL); diff --git a/src/lttng-ring-buffer-client.h b/src/lttng-ring-buffer-client.h index cec656af..8fa62073 100644 --- a/src/lttng-ring-buffer-client.h +++ b/src/lttng-ring-buffer-client.h @@ -720,12 +720,29 @@ static struct lttng_transport lttng_relay_transport = { .name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING, .owner = THIS_MODULE, .ops = { - .channel_create = _channel_create, - .channel_destroy = lttng_channel_destroy, - .buffer_read_open = lttng_buffer_read_open, - .buffer_has_read_closed_stream = - lttng_buffer_has_read_closed_stream, - .buffer_read_close = lttng_buffer_read_close, + .priv = __LTTNG_COMPOUND_LITERAL(struct lttng_kernel_channel_buffer_ops_private, { + .pub = <tng_relay_transport.ops, + .channel_create = _channel_create, + .channel_destroy = lttng_channel_destroy, + .buffer_read_open = lttng_buffer_read_open, + .buffer_has_read_closed_stream = + lttng_buffer_has_read_closed_stream, + .buffer_read_close = lttng_buffer_read_close, + .packet_avail_size = NULL, /* Would be racy anyway */ + .get_writer_buf_wait_queue = lttng_get_writer_buf_wait_queue, + .get_hp_wait_queue = lttng_get_hp_wait_queue, + .is_finalized = lttng_is_finalized, + .is_disabled = lttng_is_disabled, + .timestamp_begin = client_timestamp_begin, + .timestamp_end = client_timestamp_end, + .events_discarded = client_events_discarded, + .content_size = client_content_size, + .packet_size = client_packet_size, + .stream_id = client_stream_id, + .current_timestamp = client_current_timestamp, + .sequence_number = client_sequence_number, + .instance_id = client_instance_id, + }), .event_reserve = lttng_event_reserve, .event_commit = lttng_event_commit, .event_write = lttng_event_write, @@ -733,20 +750,6 @@ static struct lttng_transport lttng_relay_transport = { .event_memset = lttng_event_memset, .event_strcpy = lttng_event_strcpy, .event_strcpy_from_user = lttng_event_strcpy_from_user, - .packet_avail_size = NULL, /* Would be racy anyway */ - .get_writer_buf_wait_queue = lttng_get_writer_buf_wait_queue, - .get_hp_wait_queue = lttng_get_hp_wait_queue, - .is_finalized = lttng_is_finalized, - .is_disabled = lttng_is_disabled, - .timestamp_begin = client_timestamp_begin, - .timestamp_end = client_timestamp_end, - .events_discarded = client_events_discarded, - .content_size = client_content_size, - .packet_size = client_packet_size, - .stream_id = client_stream_id, - .current_timestamp = client_current_timestamp, - .sequence_number = client_sequence_number, - .instance_id = client_instance_id, }, }; diff --git a/src/lttng-ring-buffer-event-notifier-client.h b/src/lttng-ring-buffer-event-notifier-client.h index 9bc0f967..3b9dbfb7 100644 --- a/src/lttng-ring-buffer-event-notifier-client.h +++ b/src/lttng-ring-buffer-event-notifier-client.h @@ -400,32 +400,35 @@ static struct lttng_transport lttng_relay_transport = { .name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING, .owner = THIS_MODULE, .ops = { - .channel_create = _channel_create, - .channel_destroy = lttng_channel_destroy, - .buffer_read_open = lttng_buffer_read_open, - .buffer_has_read_closed_stream = - lttng_buffer_has_read_closed_stream, - .buffer_read_close = lttng_buffer_read_close, + .priv = __LTTNG_COMPOUND_LITERAL(struct lttng_kernel_channel_buffer_ops_private, { + .pub = <tng_relay_transport.ops, + .channel_create = _channel_create, + .channel_destroy = lttng_channel_destroy, + .buffer_read_open = lttng_buffer_read_open, + .buffer_has_read_closed_stream = + lttng_buffer_has_read_closed_stream, + .buffer_read_close = lttng_buffer_read_close, + .packet_avail_size = lttng_packet_avail_size, + .get_writer_buf_wait_queue = lttng_get_writer_buf_wait_queue, + .get_hp_wait_queue = lttng_get_hp_wait_queue, + .is_finalized = lttng_is_finalized, + .is_disabled = lttng_is_disabled, + .timestamp_begin = client_timestamp_begin, + .timestamp_end = client_timestamp_end, + .events_discarded = client_events_discarded, + .content_size = client_content_size, + .packet_size = client_packet_size, + .stream_id = client_stream_id, + .current_timestamp = client_current_timestamp, + .sequence_number = client_sequence_number, + .instance_id = client_instance_id, + }), .event_reserve = lttng_event_reserve, .event_commit = lttng_event_commit, .event_write_from_user = lttng_event_write_from_user, .event_memset = lttng_event_memset, .event_write = lttng_event_write, .event_strcpy = lttng_event_strcpy, - .packet_avail_size = lttng_packet_avail_size, - .get_writer_buf_wait_queue = lttng_get_writer_buf_wait_queue, - .get_hp_wait_queue = lttng_get_hp_wait_queue, - .is_finalized = lttng_is_finalized, - .is_disabled = lttng_is_disabled, - .timestamp_begin = client_timestamp_begin, - .timestamp_end = client_timestamp_end, - .events_discarded = client_events_discarded, - .content_size = client_content_size, - .packet_size = client_packet_size, - .stream_id = client_stream_id, - .current_timestamp = client_current_timestamp, - .sequence_number = client_sequence_number, - .instance_id = client_instance_id, }, }; diff --git a/src/lttng-ring-buffer-metadata-client.h b/src/lttng-ring-buffer-metadata-client.h index f697cafd..ab393c8e 100644 --- a/src/lttng-ring-buffer-metadata-client.h +++ b/src/lttng-ring-buffer-metadata-client.h @@ -398,32 +398,35 @@ static struct lttng_transport lttng_relay_transport = { .name = "relay-" RING_BUFFER_MODE_TEMPLATE_STRING, .owner = THIS_MODULE, .ops = { - .channel_create = _channel_create, - .channel_destroy = lttng_channel_destroy, - .buffer_read_open = lttng_buffer_read_open, - .buffer_has_read_closed_stream = - lttng_buffer_has_read_closed_stream, - .buffer_read_close = lttng_buffer_read_close, + .priv = __LTTNG_COMPOUND_LITERAL(struct lttng_kernel_channel_buffer_ops_private, { + .pub = <tng_relay_transport.ops, + .channel_create = _channel_create, + .channel_destroy = lttng_channel_destroy, + .buffer_read_open = lttng_buffer_read_open, + .buffer_has_read_closed_stream = + lttng_buffer_has_read_closed_stream, + .buffer_read_close = lttng_buffer_read_close, + .packet_avail_size = lttng_packet_avail_size, + .get_writer_buf_wait_queue = lttng_get_writer_buf_wait_queue, + .get_hp_wait_queue = lttng_get_hp_wait_queue, + .is_finalized = lttng_is_finalized, + .is_disabled = lttng_is_disabled, + .timestamp_begin = client_timestamp_begin, + .timestamp_end = client_timestamp_end, + .events_discarded = client_events_discarded, + .content_size = client_content_size, + .packet_size = client_packet_size, + .stream_id = client_stream_id, + .current_timestamp = client_current_timestamp, + .sequence_number = client_sequence_number, + .instance_id = client_instance_id, + }), .event_reserve = lttng_event_reserve, .event_commit = lttng_event_commit, .event_write_from_user = lttng_event_write_from_user, .event_memset = lttng_event_memset, .event_write = lttng_event_write, .event_strcpy = lttng_event_strcpy, - .packet_avail_size = lttng_packet_avail_size, - .get_writer_buf_wait_queue = lttng_get_writer_buf_wait_queue, - .get_hp_wait_queue = lttng_get_hp_wait_queue, - .is_finalized = lttng_is_finalized, - .is_disabled = lttng_is_disabled, - .timestamp_begin = client_timestamp_begin, - .timestamp_end = client_timestamp_end, - .events_discarded = client_events_discarded, - .content_size = client_content_size, - .packet_size = client_packet_size, - .stream_id = client_stream_id, - .current_timestamp = client_current_timestamp, - .sequence_number = client_sequence_number, - .instance_id = client_instance_id, }, }; -- 2.34.1