This pointer can be moved to an internal data structure, and be
populated by the ring buffer client rather than the probes.
Also transition all ring buffer client callbacks to use buffer and
channel structures rather than shm handle.
Also remove the handle from struct ustctl_consumer_stream (internal to
ustctl.c) because it is redundant.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9c389626de5a02cf2ac7377d9f1e2802128992c4
* at the end of the structure.
*/
struct lttng_ust_lib_ring_buffer_ctx {
* at the end of the structure.
*/
struct lttng_ust_lib_ring_buffer_ctx {
- uint32_t struct_size; /* Size of this structure. */
+ uint32_t struct_size; /* Size of this structure. */
- /* input received by lib_ring_buffer_reserve(), saved here. */
+ /* input received by lib_ring_buffer_reserve(). */
struct lttng_ust_lib_ring_buffer_channel *chan; /* channel */
struct lttng_ust_lib_ring_buffer_channel *chan; /* channel */
- void *priv; /* client private data */
- size_t data_size; /* size of payload */
- int largest_align; /*
- * alignment of the largest element
- * in the payload
- */
+ void *priv; /* client private data */
+ size_t data_size; /* size of payload */
+ int largest_align; /*
+ * alignment of the largest element
+ * in the payload
+ */
/* output from lib_ring_buffer_reserve() */
/* output from lib_ring_buffer_reserve() */
- int reserve_cpu; /* processor id updated by the reserve */
+ int reserve_cpu; /* processor id updated by the reserve */
+ size_t slot_size; /* size of the reserved slot */
+ unsigned long buf_offset; /* offset following the record header */
+ unsigned long pre_offset; /*
+ * Initial offset position _before_
+ * the record is written. Positioned
+ * prior to record header alignment
+ * padding.
+ */
+ uint64_t tsc; /* time-stamp counter value */
+ unsigned int rflags; /* reservation flags */
+ void *ip; /* caller ip address */
+
struct lttng_ust_lib_ring_buffer *buf; /*
struct lttng_ust_lib_ring_buffer *buf; /*
- * buffer corresponding to processor id
- * for this channel
- */
- size_t slot_size; /* size of the reserved slot */
- unsigned long buf_offset; /* offset following the record header */
- unsigned long pre_offset; /*
- * Initial offset position _before_
- * the record is written. Positioned
- * prior to record header alignment
- * padding.
- */
- uint64_t tsc; /* time-stamp counter value */
- unsigned int rflags; /* reservation flags */
- void *ip; /* caller ip address */
+ * buffer corresponding to processor id
+ * for this channel
+ */
struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages;
/* End of base ABI. Fields below should be used after checking struct_size. */
struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages;
/* End of base ABI. Fields below should be used after checking struct_size. */
struct lttng_ust_channel_buffer_private *priv; /* Private channel buffer interface */
struct lttng_ust_channel_buffer_ops *ops;
struct lttng_ust_channel_buffer_private *priv; /* Private channel buffer interface */
struct lttng_ust_channel_buffer_ops *ops;
- struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
/* End of base ABI. Fields below should be used after checking struct_size. */
};
/* End of base ABI. Fields below should be used after checking struct_size. */
};
_TP_ARGS_DATA_VAR(_args)); \
__event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \
memset(&__lttng_ctx, 0, sizeof(__lttng_ctx)); \
_TP_ARGS_DATA_VAR(_args)); \
__event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \
memset(&__lttng_ctx, 0, sizeof(__lttng_ctx)); \
- __lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx); \
+ __lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx); \
__lttng_ctx.event_recorder = __event_recorder; \
__lttng_ctx.event_recorder = __event_recorder; \
- lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_ctx, __event_len, \
- __event_align); \
+ lib_ring_buffer_ctx_init(&__ctx, NULL, &__lttng_ctx, __event_len, __event_align); \
__ctx.ip = _TP_IP_PARAM(TP_IP_PARAM); \
__ret = __chan->ops->event_reserve(&__ctx, __event_recorder->id); \
if (__ret < 0) \
__ctx.ip = _TP_IP_PARAM(TP_IP_PARAM); \
__ret = __chan->ops->event_reserve(&__ctx, __event_recorder->id); \
if (__ret < 0) \
* Stream representation within consumer.
*/
struct ustctl_consumer_stream {
* Stream representation within consumer.
*/
struct ustctl_consumer_stream {
- struct lttng_ust_shm_handle *handle; /* shared-memory handle */
struct lttng_ust_lib_ring_buffer *buf;
struct ustctl_consumer_channel *chan;
int shm_fd, wait_fd, wakeup_fd;
struct lttng_ust_lib_ring_buffer *buf;
struct ustctl_consumer_channel *chan;
int shm_fd, wait_fd, wakeup_fd;
{
struct shm_object_table *table;
{
struct shm_object_table *table;
- table = channel->chan->chan->handle->table;
+ table = channel->chan->priv->rb_chan->handle->table;
if (table->size <= 0)
return -EINVAL;
return ustctl_send_channel(sock,
if (table->size <= 0)
return -EINVAL;
return ustctl_send_channel(sock,
{
struct lttng_ust_lib_ring_buffer_ctx ctx;
struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
{
struct lttng_ust_lib_ring_buffer_ctx ctx;
struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = lttng_chan_buf->priv->rb_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,
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,
- lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan,
- lttng_chan_buf->chan->handle),
+ lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf),
- lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char));
+ lib_ring_buffer_ctx_init(&ctx, rb_chan, NULL, reserve_len, sizeof(char));
/*
* We don't care about metadata buffer's records lost
* count, because we always retry here. Report error if
/*
* We don't care about metadata buffer's records lost
* count, because we always retry here. Report error if
{
struct lttng_ust_lib_ring_buffer_ctx ctx;
struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
{
struct lttng_ust_lib_ring_buffer_ctx ctx;
struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = lttng_chan_buf->priv->rb_chan;
const char *str = metadata_str;
ssize_t reserve_len;
int ret;
reserve_len = min_t(ssize_t,
const char *str = metadata_str;
ssize_t reserve_len;
int ret;
reserve_len = min_t(ssize_t,
- lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan,
- lttng_chan_buf->chan->handle),
+ lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf),
- lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char));
+ lib_ring_buffer_ctx_init(&ctx, rb_chan, NULL, reserve_len, sizeof(char));
ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
if (ret != 0) {
DBG("LTTng: event reservation failed");
ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
if (ret != 0) {
DBG("LTTng: event reservation failed");
struct lttng_ust_lib_ring_buffer_channel *chan;
int ret;
struct lttng_ust_lib_ring_buffer_channel *chan;
int ret;
- chan = consumer_chan->chan->chan;
+ chan = consumer_chan->chan->priv->rb_chan;
ret = ring_buffer_channel_close_wait_fd(&chan->backend.config,
chan, chan->handle);
if (!ret)
ret = ring_buffer_channel_close_wait_fd(&chan->backend.config,
chan, chan->handle);
if (!ret)
struct lttng_ust_lib_ring_buffer_channel *chan;
int ret;
struct lttng_ust_lib_ring_buffer_channel *chan;
int ret;
- chan = consumer_chan->chan->chan;
+ chan = consumer_chan->chan->priv->rb_chan;
ret = ring_buffer_channel_close_wakeup_fd(&chan->backend.config,
chan, chan->handle);
if (!ret)
ret = ring_buffer_channel_close_wakeup_fd(&chan->backend.config,
chan, chan->handle);
if (!ret)
{
struct lttng_ust_lib_ring_buffer_channel *chan;
{
struct lttng_ust_lib_ring_buffer_channel *chan;
- chan = stream->chan->chan->chan;
+ chan = stream->chan->chan->priv->rb_chan;
return ring_buffer_stream_close_wait_fd(&chan->backend.config,
return ring_buffer_stream_close_wait_fd(&chan->backend.config,
- chan, stream->handle, stream->cpu);
+ chan, chan->handle, stream->cpu);
}
int ustctl_stream_close_wakeup_fd(struct ustctl_consumer_stream *stream)
{
struct lttng_ust_lib_ring_buffer_channel *chan;
}
int ustctl_stream_close_wakeup_fd(struct ustctl_consumer_stream *stream)
{
struct lttng_ust_lib_ring_buffer_channel *chan;
- chan = stream->chan->chan->chan;
+ chan = stream->chan->chan->priv->rb_chan;
return ring_buffer_stream_close_wakeup_fd(&chan->backend.config,
return ring_buffer_stream_close_wakeup_fd(&chan->backend.config,
- chan, stream->handle, stream->cpu);
+ chan, chan->handle, stream->cpu);
}
struct ustctl_consumer_stream *
}
struct ustctl_consumer_stream *
{
struct ustctl_consumer_stream *stream;
struct lttng_ust_shm_handle *handle;
{
struct ustctl_consumer_stream *stream;
struct lttng_ust_shm_handle *handle;
- struct lttng_ust_lib_ring_buffer_channel *chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan;
int shm_fd, wait_fd, wakeup_fd;
uint64_t memory_map_size;
struct lttng_ust_lib_ring_buffer *buf;
int shm_fd, wait_fd, wakeup_fd;
uint64_t memory_map_size;
struct lttng_ust_lib_ring_buffer *buf;
if (!channel)
return NULL;
if (!channel)
return NULL;
- handle = channel->chan->chan->handle;
+ rb_chan = channel->chan->priv->rb_chan;
+ handle = rb_chan->handle;
if (!handle)
return NULL;
if (!handle)
return NULL;
- chan = channel->chan->chan;
- buf = channel_get_ring_buffer(&chan->backend.config,
- chan, cpu, handle, &shm_fd, &wait_fd,
+ buf = channel_get_ring_buffer(&rb_chan->backend.config,
+ rb_chan, cpu, handle, &shm_fd, &wait_fd,
&wakeup_fd, &memory_map_size);
if (!buf)
return NULL;
&wakeup_fd, &memory_map_size);
if (!buf)
return NULL;
stream = zmalloc(sizeof(*stream));
if (!stream)
goto alloc_error;
stream = zmalloc(sizeof(*stream));
if (!stream)
goto alloc_error;
- stream->handle = handle;
stream->buf = buf;
stream->chan = channel;
stream->shm_fd = shm_fd;
stream->buf = buf;
stream->chan = channel;
stream->shm_fd = shm_fd;
consumer_chan = stream->chan;
(void) ustctl_stream_close_wait_fd(stream);
(void) ustctl_stream_close_wakeup_fd(stream);
consumer_chan = stream->chan;
(void) ustctl_stream_close_wait_fd(stream);
(void) ustctl_stream_close_wakeup_fd(stream);
- lib_ring_buffer_release_read(buf, consumer_chan->chan->chan->handle);
+ lib_ring_buffer_release_read(buf, consumer_chan->chan->priv->rb_chan->handle);
{
if (!chan)
return -EINVAL;
{
if (!chan)
return -EINVAL;
- return shm_get_wait_fd(chan->chan->chan->handle,
- &chan->chan->chan->handle->chan._ref);
+ return shm_get_wait_fd(chan->chan->priv->rb_chan->handle,
+ &chan->chan->priv->rb_chan->handle->chan._ref);
}
int ustctl_channel_get_wakeup_fd(struct ustctl_consumer_channel *chan)
{
if (!chan)
return -EINVAL;
}
int ustctl_channel_get_wakeup_fd(struct ustctl_consumer_channel *chan)
{
if (!chan)
return -EINVAL;
- return shm_get_wakeup_fd(chan->chan->chan->handle,
- &chan->chan->chan->handle->chan._ref);
+ return shm_get_wakeup_fd(chan->chan->priv->rb_chan->handle,
+ &chan->chan->priv->rb_chan->handle->chan._ref);
}
int ustctl_stream_get_wait_fd(struct ustctl_consumer_stream *stream)
}
int ustctl_stream_get_wait_fd(struct ustctl_consumer_stream *stream)
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
- return shm_get_wait_fd(consumer_chan->chan->chan->handle, &buf->self._ref);
+ return shm_get_wait_fd(consumer_chan->chan->priv->rb_chan->handle, &buf->self._ref);
}
int ustctl_stream_get_wakeup_fd(struct ustctl_consumer_stream *stream)
}
int ustctl_stream_get_wakeup_fd(struct ustctl_consumer_stream *stream)
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
- return shm_get_wakeup_fd(consumer_chan->chan->chan->handle, &buf->self._ref);
+ return shm_get_wakeup_fd(consumer_chan->chan->priv->rb_chan->handle, &buf->self._ref);
}
/* For mmap mode, readable without "get" operation */
}
/* For mmap mode, readable without "get" operation */
return NULL;
buf = stream->buf;
consumer_chan = stream->chan;
return NULL;
buf = stream->buf;
consumer_chan = stream->chan;
- return shmp(consumer_chan->chan->chan->handle, buf->backend.memory_map);
+ return shmp(consumer_chan->chan->priv->rb_chan->handle, buf->backend.memory_map);
}
/* returns the length to mmap. */
}
/* returns the length to mmap. */
{
struct ustctl_consumer_channel *consumer_chan;
unsigned long mmap_buf_len;
{
struct ustctl_consumer_channel *consumer_chan;
unsigned long mmap_buf_len;
- struct lttng_ust_lib_ring_buffer_channel *chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan;
if (!stream)
return -EINVAL;
consumer_chan = stream->chan;
if (!stream)
return -EINVAL;
consumer_chan = stream->chan;
- chan = consumer_chan->chan->chan;
- if (chan->backend.config.output != RING_BUFFER_MMAP)
+ rb_chan = consumer_chan->chan->priv->rb_chan;
+ if (rb_chan->backend.config.output != RING_BUFFER_MMAP)
- mmap_buf_len = chan->backend.buf_size;
- if (chan->backend.extra_reader_sb)
- mmap_buf_len += chan->backend.subbuf_size;
+ mmap_buf_len = rb_chan->backend.buf_size;
+ if (rb_chan->backend.extra_reader_sb)
+ mmap_buf_len += rb_chan->backend.subbuf_size;
if (mmap_buf_len > INT_MAX)
return -EFBIG;
*len = mmap_buf_len;
if (mmap_buf_len > INT_MAX)
return -EFBIG;
*len = mmap_buf_len;
unsigned long *len)
{
struct ustctl_consumer_channel *consumer_chan;
unsigned long *len)
{
struct ustctl_consumer_channel *consumer_chan;
- struct lttng_ust_lib_ring_buffer_channel *chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan;
if (!stream)
return -EINVAL;
consumer_chan = stream->chan;
if (!stream)
return -EINVAL;
consumer_chan = stream->chan;
- chan = consumer_chan->chan->chan;
- *len = chan->backend.subbuf_size;
+ rb_chan = consumer_chan->chan->priv->rb_chan;
+ *len = rb_chan->backend.subbuf_size;
int ustctl_get_mmap_read_offset(struct ustctl_consumer_stream *stream,
unsigned long *off)
{
int ustctl_get_mmap_read_offset(struct ustctl_consumer_stream *stream,
unsigned long *off)
{
- struct lttng_ust_lib_ring_buffer_channel *chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan;
unsigned long sb_bindex;
struct lttng_ust_lib_ring_buffer *buf;
struct ustctl_consumer_channel *consumer_chan;
unsigned long sb_bindex;
struct lttng_ust_lib_ring_buffer *buf;
struct ustctl_consumer_channel *consumer_chan;
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
- chan = consumer_chan->chan->chan;
- if (chan->backend.config.output != RING_BUFFER_MMAP)
+ rb_chan = consumer_chan->chan->priv->rb_chan;
+ if (rb_chan->backend.config.output != RING_BUFFER_MMAP)
- sb_bindex = subbuffer_id_get_index(&chan->backend.config,
+ sb_bindex = subbuffer_id_get_index(&rb_chan->backend.config,
buf->backend.buf_rsb.id);
buf->backend.buf_rsb.id);
- barray_idx = shmp_index(consumer_chan->chan->chan->handle, buf->backend.array,
+ barray_idx = shmp_index(rb_chan->handle, buf->backend.array,
sb_bindex);
if (!barray_idx)
return -EINVAL;
sb_bindex);
if (!barray_idx)
return -EINVAL;
- pages = shmp(consumer_chan->chan->chan->handle, barray_idx->shmp);
+ pages = shmp(rb_chan->handle, barray_idx->shmp);
if (!pages)
return -EINVAL;
*off = pages->mmap_offset;
if (!pages)
return -EINVAL;
*off = pages->mmap_offset;
unsigned long *len)
{
struct ustctl_consumer_channel *consumer_chan;
unsigned long *len)
{
struct ustctl_consumer_channel *consumer_chan;
- struct lttng_ust_lib_ring_buffer_channel *chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan;
struct lttng_ust_lib_ring_buffer *buf;
if (!stream)
struct lttng_ust_lib_ring_buffer *buf;
if (!stream)
buf = stream->buf;
consumer_chan = stream->chan;
buf = stream->buf;
consumer_chan = stream->chan;
- chan = consumer_chan->chan->chan;
- *len = lib_ring_buffer_get_read_data_size(&chan->backend.config, buf,
- consumer_chan->chan->chan->handle);
+ rb_chan = consumer_chan->chan->priv->rb_chan;
+ *len = lib_ring_buffer_get_read_data_size(&rb_chan->backend.config, buf,
+ rb_chan->handle);
unsigned long *len)
{
struct ustctl_consumer_channel *consumer_chan;
unsigned long *len)
{
struct ustctl_consumer_channel *consumer_chan;
- struct lttng_ust_lib_ring_buffer_channel *chan;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan;
struct lttng_ust_lib_ring_buffer *buf;
if (!stream)
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
struct lttng_ust_lib_ring_buffer *buf;
if (!stream)
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
- chan = consumer_chan->chan->chan;
- *len = lib_ring_buffer_get_read_data_size(&chan->backend.config, buf,
- consumer_chan->chan->chan->handle);
+ rb_chan = consumer_chan->chan->priv->rb_chan;
+ *len = lib_ring_buffer_get_read_data_size(&rb_chan->backend.config, buf,
+ rb_chan->handle);
*len = LTTNG_UST_PAGE_ALIGN(*len);
return 0;
}
*len = LTTNG_UST_PAGE_ALIGN(*len);
return 0;
}
buf = stream->buf;
consumer_chan = stream->chan;
return lib_ring_buffer_get_next_subbuf(buf,
buf = stream->buf;
consumer_chan = stream->chan;
return lib_ring_buffer_get_next_subbuf(buf,
- consumer_chan->chan->chan->handle);
+ consumer_chan->chan->priv->rb_chan->handle);
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
- lib_ring_buffer_put_next_subbuf(buf, consumer_chan->chan->chan->handle);
+ lib_ring_buffer_put_next_subbuf(buf, consumer_chan->chan->priv->rb_chan->handle);
buf = stream->buf;
consumer_chan = stream->chan;
return lib_ring_buffer_snapshot(buf, &buf->cons_snapshot,
buf = stream->buf;
consumer_chan = stream->chan;
return lib_ring_buffer_snapshot(buf, &buf->cons_snapshot,
- &buf->prod_snapshot, consumer_chan->chan->chan->handle);
+ &buf->prod_snapshot, consumer_chan->chan->priv->rb_chan->handle);
consumer_chan = stream->chan;
return lib_ring_buffer_snapshot_sample_positions(buf,
&buf->cons_snapshot, &buf->prod_snapshot,
consumer_chan = stream->chan;
return lib_ring_buffer_snapshot_sample_positions(buf,
&buf->cons_snapshot, &buf->prod_snapshot,
- consumer_chan->chan->chan->handle);
+ consumer_chan->chan->priv->rb_chan->handle);
}
/* Get the consumer position (iteration start) */
}
/* Get the consumer position (iteration start) */
buf = stream->buf;
consumer_chan = stream->chan;
return lib_ring_buffer_get_subbuf(buf, *pos,
buf = stream->buf;
consumer_chan = stream->chan;
return lib_ring_buffer_get_subbuf(buf, *pos,
- consumer_chan->chan->chan->handle);
+ consumer_chan->chan->priv->rb_chan->handle);
}
/* Release exclusive sub-buffer access */
}
/* Release exclusive sub-buffer access */
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
return -EINVAL;
buf = stream->buf;
consumer_chan = stream->chan;
- lib_ring_buffer_put_subbuf(buf, consumer_chan->chan->chan->handle);
+ lib_ring_buffer_put_subbuf(buf, consumer_chan->chan->priv->rb_chan->handle);
consumer_chan = stream->chan;
lib_ring_buffer_switch_slow(buf,
producer_active ? SWITCH_ACTIVE : SWITCH_FLUSH,
consumer_chan = stream->chan;
lib_ring_buffer_switch_slow(buf,
producer_active ? SWITCH_ACTIVE : SWITCH_FLUSH,
- consumer_chan->chan->chan->handle);
+ consumer_chan->chan->priv->rb_chan->handle);
}
void ustctl_clear_buffer(struct ustctl_consumer_stream *stream)
}
void ustctl_clear_buffer(struct ustctl_consumer_stream *stream)
buf = stream->buf;
consumer_chan = stream->chan;
lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE,
buf = stream->buf;
consumer_chan = stream->chan;
lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE,
- consumer_chan->chan->chan->handle);
- lib_ring_buffer_clear_reader(buf, consumer_chan->chan->chan->handle);
+ consumer_chan->chan->priv->rb_chan->handle);
+ lib_ring_buffer_clear_reader(buf, consumer_chan->chan->priv->rb_chan->handle);
}
static
struct lttng_ust_client_lib_ring_buffer_client_cb *get_client_cb(
struct lttng_ust_lib_ring_buffer *buf,
}
static
struct lttng_ust_client_lib_ring_buffer_client_cb *get_client_cb(
struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle)
+ struct lttng_ust_lib_ring_buffer_channel *chan)
- struct lttng_ust_lib_ring_buffer_channel *chan;
const struct lttng_ust_lib_ring_buffer_config *config;
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
const struct lttng_ust_lib_ring_buffer_config *config;
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- chan = shmp(handle, buf->backend.chan);
- if (!chan)
- return NULL;
config = &chan->backend.config;
if (!config->cb_ptr)
return NULL;
config = &chan->backend.config;
if (!config->cb_ptr)
return NULL;
uint64_t *timestamp_begin)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *timestamp_begin)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !timestamp_begin)
return -EINVAL;
buf = stream->buf;
if (!stream || !timestamp_begin)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb)
return -ENOSYS;
if (!client_cb)
return -ENOSYS;
- return client_cb->timestamp_begin(buf, handle, timestamp_begin);
+ return client_cb->timestamp_begin(buf, chan, timestamp_begin);
}
int ustctl_get_timestamp_end(struct ustctl_consumer_stream *stream,
uint64_t *timestamp_end)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_timestamp_end(struct ustctl_consumer_stream *stream,
uint64_t *timestamp_end)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !timestamp_end)
return -EINVAL;
buf = stream->buf;
if (!stream || !timestamp_end)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb)
return -ENOSYS;
if (!client_cb)
return -ENOSYS;
- return client_cb->timestamp_end(buf, handle, timestamp_end);
+ return client_cb->timestamp_end(buf, chan, timestamp_end);
}
int ustctl_get_events_discarded(struct ustctl_consumer_stream *stream,
uint64_t *events_discarded)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_events_discarded(struct ustctl_consumer_stream *stream,
uint64_t *events_discarded)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !events_discarded)
return -EINVAL;
buf = stream->buf;
if (!stream || !events_discarded)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb)
return -ENOSYS;
if (!client_cb)
return -ENOSYS;
- return client_cb->events_discarded(buf, handle, events_discarded);
+ return client_cb->events_discarded(buf, chan, events_discarded);
}
int ustctl_get_content_size(struct ustctl_consumer_stream *stream,
uint64_t *content_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_content_size(struct ustctl_consumer_stream *stream,
uint64_t *content_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !content_size)
return -EINVAL;
buf = stream->buf;
if (!stream || !content_size)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb)
return -ENOSYS;
if (!client_cb)
return -ENOSYS;
- return client_cb->content_size(buf, handle, content_size);
+ return client_cb->content_size(buf, chan, content_size);
}
int ustctl_get_packet_size(struct ustctl_consumer_stream *stream,
uint64_t *packet_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_packet_size(struct ustctl_consumer_stream *stream,
uint64_t *packet_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !packet_size)
return -EINVAL;
buf = stream->buf;
if (!stream || !packet_size)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb)
return -ENOSYS;
if (!client_cb)
return -ENOSYS;
- return client_cb->packet_size(buf, handle, packet_size);
+ return client_cb->packet_size(buf, chan, packet_size);
}
int ustctl_get_stream_id(struct ustctl_consumer_stream *stream,
uint64_t *stream_id)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_stream_id(struct ustctl_consumer_stream *stream,
uint64_t *stream_id)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !stream_id)
return -EINVAL;
buf = stream->buf;
if (!stream || !stream_id)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb)
return -ENOSYS;
if (!client_cb)
return -ENOSYS;
- return client_cb->stream_id(buf, handle, stream_id);
+ return client_cb->stream_id(buf, chan, stream_id);
}
int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream,
uint64_t *ts)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_current_timestamp(struct ustctl_consumer_stream *stream,
uint64_t *ts)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !ts)
return -EINVAL;
buf = stream->buf;
if (!stream || !ts)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb || !client_cb->current_timestamp)
return -ENOSYS;
if (!client_cb || !client_cb->current_timestamp)
return -ENOSYS;
- return client_cb->current_timestamp(buf, handle, ts);
+ return client_cb->current_timestamp(buf, chan, ts);
}
int ustctl_get_sequence_number(struct ustctl_consumer_stream *stream,
uint64_t *seq)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_sequence_number(struct ustctl_consumer_stream *stream,
uint64_t *seq)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !seq)
return -EINVAL;
buf = stream->buf;
if (!stream || !seq)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb || !client_cb->sequence_number)
return -ENOSYS;
if (!client_cb || !client_cb->sequence_number)
return -ENOSYS;
- return client_cb->sequence_number(buf, handle, seq);
+ return client_cb->sequence_number(buf, chan, seq);
}
int ustctl_get_instance_id(struct ustctl_consumer_stream *stream,
uint64_t *id)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
}
int ustctl_get_instance_id(struct ustctl_consumer_stream *stream,
uint64_t *id)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
+ struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer *buf;
struct lttng_ust_lib_ring_buffer *buf;
- struct lttng_ust_shm_handle *handle;
if (!stream || !id)
return -EINVAL;
buf = stream->buf;
if (!stream || !id)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->chan->handle;
- client_cb = get_client_cb(buf, handle);
+ chan = stream->chan->chan->priv->rb_chan;
+ client_cb = get_client_cb(buf, chan);
if (!client_cb)
return -ENOSYS;
if (!client_cb)
return -ENOSYS;
- return client_cb->instance_id(buf, handle, id);
+ return client_cb->instance_id(buf, chan, id);
}
#ifdef HAVE_LINUX_PERF_EVENT_H
}
#ifdef HAVE_LINUX_PERF_EVENT_H
cds_list_del(<tng_chan->priv->node);
lttng_destroy_context(lttng_chan->priv->ctx);
cds_list_del(<tng_chan->priv->node);
lttng_destroy_context(lttng_chan->priv->ctx);
- chan = lttng_chan->chan;
+ chan = lttng_chan->priv->rb_chan;
handle = chan->handle;
channel_destroy(chan, handle, 0);
free(lttng_chan->parent);
handle = chan->handle;
channel_destroy(chan, handle, 0);
free(lttng_chan->parent);
struct lttng_ust_lib_ring_buffer_client_cb parent;
int (*timestamp_begin) (struct lttng_ust_lib_ring_buffer *buf,
struct lttng_ust_lib_ring_buffer_client_cb parent;
int (*timestamp_begin) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *timestamp_begin);
int (*timestamp_end) (struct lttng_ust_lib_ring_buffer *buf,
uint64_t *timestamp_begin);
int (*timestamp_end) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *timestamp_end);
int (*events_discarded) (struct lttng_ust_lib_ring_buffer *buf,
uint64_t *timestamp_end);
int (*events_discarded) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *events_discarded);
int (*content_size) (struct lttng_ust_lib_ring_buffer *buf,
uint64_t *events_discarded);
int (*content_size) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *content_size);
int (*packet_size) (struct lttng_ust_lib_ring_buffer *buf,
uint64_t *content_size);
int (*packet_size) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *packet_size);
int (*stream_id) (struct lttng_ust_lib_ring_buffer *buf,
uint64_t *packet_size);
int (*stream_id) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *stream_id);
int (*current_timestamp) (struct lttng_ust_lib_ring_buffer *buf,
uint64_t *stream_id);
int (*current_timestamp) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *ts);
int (*sequence_number) (struct lttng_ust_lib_ring_buffer *buf,
uint64_t *ts);
int (*sequence_number) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle, uint64_t *seq);
+ struct lttng_ust_lib_ring_buffer_channel *chan, uint64_t *seq);
int (*instance_id) (struct lttng_ust_lib_ring_buffer *buf,
int (*instance_id) (struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle, uint64_t *id);
+ struct lttng_ust_lib_ring_buffer_channel *chan, uint64_t *id);
};
#endif /* _LTTNG_RB_CLIENT_H */
};
#endif /* _LTTNG_RB_CLIENT_H */
}
static int client_timestamp_begin(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_timestamp_begin(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *timestamp_begin)
{
uint64_t *timestamp_begin)
{
+ struct lttng_ust_shm_handle *handle = chan->handle;
struct packet_header *header;
header = client_packet_header(buf, handle);
struct packet_header *header;
header = client_packet_header(buf, handle);
}
static int client_timestamp_end(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_timestamp_end(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *timestamp_end)
{
uint64_t *timestamp_end)
{
+ struct lttng_ust_shm_handle *handle = chan->handle;
struct packet_header *header;
header = client_packet_header(buf, handle);
struct packet_header *header;
header = client_packet_header(buf, handle);
}
static int client_events_discarded(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_events_discarded(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *events_discarded)
{
uint64_t *events_discarded)
{
+ struct lttng_ust_shm_handle *handle = chan->handle;
struct packet_header *header;
header = client_packet_header(buf, handle);
struct packet_header *header;
header = client_packet_header(buf, handle);
}
static int client_content_size(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_content_size(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *content_size)
{
uint64_t *content_size)
{
+ struct lttng_ust_shm_handle *handle = chan->handle;
struct packet_header *header;
header = client_packet_header(buf, handle);
struct packet_header *header;
header = client_packet_header(buf, handle);
}
static int client_packet_size(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_packet_size(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
+ struct lttng_ust_shm_handle *handle = chan->handle;
struct packet_header *header;
header = client_packet_header(buf, handle);
struct packet_header *header;
header = client_packet_header(buf, handle);
}
static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_stream_id(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
- struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle,
- buf->backend.chan);
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
*stream_id = lttng_chan->priv->id;
struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
*stream_id = lttng_chan->priv->id;
}
static int client_current_timestamp(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_current_timestamp(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
- struct lttng_ust_lib_ring_buffer_channel *chan;
-
- chan = shmp(handle, handle->chan);
*ts = client_ring_buffer_clock_read(chan);
return 0;
}
static int client_sequence_number(struct lttng_ust_lib_ring_buffer *buf,
*ts = client_ring_buffer_clock_read(chan);
return 0;
}
static int client_sequence_number(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
+ struct lttng_ust_shm_handle *handle = chan->handle;
struct packet_header *header;
header = client_packet_header(buf, handle);
struct packet_header *header;
header = client_packet_header(buf, handle);
}
static int client_instance_id(struct lttng_ust_lib_ring_buffer *buf,
}
static int client_instance_id(struct lttng_ust_lib_ring_buffer *buf,
- struct lttng_ust_shm_handle *handle,
+ struct lttng_ust_lib_ring_buffer_channel *chan,
uint64_t *id)
{
*id = buf->backend.cpu;
uint64_t *id)
{
*id = buf->backend.cpu;
stream_fds, nr_stream_fds, blocking_timeout);
if (!handle)
goto error;
stream_fds, nr_stream_fds, blocking_timeout);
if (!handle)
goto error;
- lttng_chan_buf->chan = shmp(handle, handle->chan);
+ lttng_chan_buf->priv->rb_chan = shmp(handle, handle->chan);
return lttng_chan_buf;
error:
return lttng_chan_buf;
error:
static
void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
{
static
void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
{
- channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->chan->handle, 1);
+ channel_destroy(lttng_chan_buf->priv->rb_chan, lttng_chan_buf->priv->rb_chan->handle, 1);
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx,
uint32_t event_id)
{
int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx,
uint32_t event_id)
{
- struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
struct lttng_ust_event_recorder *event_recorder = lttng_ctx->event_recorder;
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
struct lttng_ust_event_recorder *event_recorder = lttng_ctx->event_recorder;
+ struct lttng_ust_channel_buffer *lttng_chan = event_recorder->chan;
struct lttng_client_ctx client_ctx;
int ret;
struct lttng_client_ctx client_ctx;
int ret;
+ ctx->chan = lttng_chan->priv->rb_chan;
client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx);
client_ctx.event_ctx = lttng_ust_rcu_dereference(event_recorder->priv->ctx);
/* Compute internal size of context structures. */
client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx);
client_ctx.event_ctx = lttng_ust_rcu_dereference(event_recorder->priv->ctx);
/* Compute internal size of context structures. */
lib_ring_buffer_pstrcpy(&client_config, ctx, src, len, '\0');
}
lib_ring_buffer_pstrcpy(&client_config, ctx, src, len, '\0');
}
-wait_queue_head_t *lttng_get_reader_wait_queue(struct lttng_ust_lib_ring_buffer_channel *chan)
+int lttng_is_finalized(struct lttng_ust_channel_buffer *chan)
- return &chan->read_wait;
-}
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan;
-static
-wait_queue_head_t *lttng_get_hp_wait_queue(struct lttng_ust_lib_ring_buffer_channel *chan)
-{
- return &chan->hp_wait;
+ return lib_ring_buffer_channel_is_finalized(rb_chan);
-int lttng_is_finalized(struct lttng_ust_lib_ring_buffer_channel *chan)
+int lttng_is_disabled(struct lttng_ust_channel_buffer *chan)
- return lib_ring_buffer_channel_is_finalized(chan);
-}
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan;
-static
-int lttng_is_disabled(struct lttng_ust_lib_ring_buffer_channel *chan)
-{
- return lib_ring_buffer_channel_is_disabled(chan);
+ return lib_ring_buffer_channel_is_disabled(rb_chan);
-int lttng_flush_buffer(struct lttng_ust_lib_ring_buffer_channel *chan,
- struct lttng_ust_shm_handle *handle)
+int lttng_flush_buffer(struct lttng_ust_channel_buffer *chan)
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan;
struct lttng_ust_lib_ring_buffer *buf;
int cpu;
struct lttng_ust_lib_ring_buffer *buf;
int cpu;
- for_each_channel_cpu(cpu, chan) {
+ for_each_channel_cpu(cpu, rb_chan) {
int shm_fd, wait_fd, wakeup_fd;
uint64_t memory_map_size;
int shm_fd, wait_fd, wakeup_fd;
uint64_t memory_map_size;
- buf = channel_get_ring_buffer(&client_config, chan,
- cpu, handle, &shm_fd, &wait_fd,
+ buf = channel_get_ring_buffer(&client_config, rb_chan,
+ cpu, rb_chan->handle, &shm_fd, &wait_fd,
&wakeup_fd, &memory_map_size);
lib_ring_buffer_switch(&client_config, buf,
&wakeup_fd, &memory_map_size);
lib_ring_buffer_switch(&client_config, buf,
- SWITCH_ACTIVE, handle);
+ SWITCH_ACTIVE, rb_chan->handle);
stream_fds, nr_stream_fds, blocking_timeout);
if (!handle)
goto error;
stream_fds, nr_stream_fds, blocking_timeout);
if (!handle)
goto error;
- lttng_chan_buf->chan = shmp(handle, handle->chan);
+ lttng_chan_buf->priv->rb_chan = shmp(handle, handle->chan);
return lttng_chan_buf;
error:
return lttng_chan_buf;
error:
static
void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
{
static
void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
{
- channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->chan->handle, 1);
+ channel_destroy(lttng_chan_buf->priv->rb_chan, lttng_chan_buf->priv->rb_chan->handle, 1);
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
-size_t lttng_packet_avail_size(struct lttng_ust_lib_ring_buffer_channel *chan,
- struct lttng_ust_shm_handle *handle)
+size_t lttng_packet_avail_size(struct lttng_ust_channel_buffer *chan)
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan;
unsigned long o_begin;
struct lttng_ust_lib_ring_buffer *buf;
unsigned long o_begin;
struct lttng_ust_lib_ring_buffer *buf;
- buf = shmp(handle, chan->backend.buf[0].shmp); /* Only for global buffer ! */
+ buf = shmp(rb_chan->handle, rb_chan->backend.buf[0].shmp); /* Only for global buffer ! */
o_begin = v_read(&client_config, &buf->offset);
o_begin = v_read(&client_config, &buf->offset);
- if (subbuf_offset(o_begin, chan) != 0) {
- return chan->backend.subbuf_size - subbuf_offset(o_begin, chan);
+ if (subbuf_offset(o_begin, rb_chan) != 0) {
+ return rb_chan->backend.subbuf_size - subbuf_offset(o_begin, rb_chan);
- return chan->backend.subbuf_size - subbuf_offset(o_begin, chan)
+ return rb_chan->backend.subbuf_size - subbuf_offset(o_begin, rb_chan)
- sizeof(struct metadata_packet_header);
}
}
- sizeof(struct metadata_packet_header);
}
}
-wait_queue_head_t *lttng_get_reader_wait_queue(struct lttng_ust_lib_ring_buffer_channel *chan)
+int lttng_is_finalized(struct lttng_ust_channel_buffer *chan)
- return &chan->read_wait;
-}
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan;
-static
-wait_queue_head_t *lttng_get_hp_wait_queue(struct lttng_ust_lib_ring_buffer_channel *chan)
-{
- return &chan->hp_wait;
+ return lib_ring_buffer_channel_is_finalized(rb_chan);
-int lttng_is_finalized(struct lttng_ust_lib_ring_buffer_channel *chan)
+int lttng_is_disabled(struct lttng_ust_channel_buffer *chan)
- return lib_ring_buffer_channel_is_finalized(chan);
-}
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan;
-static
-int lttng_is_disabled(struct lttng_ust_lib_ring_buffer_channel *chan)
-{
- return lib_ring_buffer_channel_is_disabled(chan);
+ return lib_ring_buffer_channel_is_disabled(rb_chan);
-int lttng_flush_buffer(struct lttng_ust_lib_ring_buffer_channel *chan,
- struct lttng_ust_shm_handle *handle)
+int lttng_flush_buffer(struct lttng_ust_channel_buffer *chan)
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan = chan->priv->rb_chan;
struct lttng_ust_lib_ring_buffer *buf;
int shm_fd, wait_fd, wakeup_fd;
uint64_t memory_map_size;
struct lttng_ust_lib_ring_buffer *buf;
int shm_fd, wait_fd, wakeup_fd;
uint64_t memory_map_size;
- buf = channel_get_ring_buffer(&client_config, chan,
- 0, handle, &shm_fd, &wait_fd, &wakeup_fd,
+ buf = channel_get_ring_buffer(&client_config, rb_chan,
+ 0, rb_chan->handle, &shm_fd, &wait_fd, &wakeup_fd,
&memory_map_size);
lib_ring_buffer_switch(&client_config, buf,
&memory_map_size);
lib_ring_buffer_switch(&client_config, buf,
- SWITCH_ACTIVE, handle);
+ SWITCH_ACTIVE, rb_chan->handle);
struct lttng_ust_lib_ring_buffer_channel *chan;
unsigned int nr_streams, exp_streams;
struct lttng_ust_lib_ring_buffer_channel *chan;
unsigned int nr_streams, exp_streams;
- chan = lttng_chan->chan;
- nr_streams = channel_handle_get_nr_streams(lttng_chan->chan->handle);
+ chan = lttng_chan->priv->rb_chan;
+ nr_streams = channel_handle_get_nr_streams(lttng_chan->priv->rb_chan->handle);
exp_streams = chan->nr_streams;
return nr_streams == exp_streams;
}
exp_streams = chan->nr_streams;
return nr_streams == exp_streams;
}
lttng_chan_buf->priv->parent.tstate = 1;
lttng_chan_buf->priv->ctx = NULL;
lttng_chan_buf->priv->parent.tstate = 1;
lttng_chan_buf->priv->ctx = NULL;
+ lttng_chan_buf->priv->rb_chan = chan;
lttng_chan_buf->ops = &transport->ops;
lttng_chan_buf->ops = &transport->ops;
- lttng_chan_buf->chan = chan;
memcpy(&chan->backend.config,
transport->client_config,
memcpy(&chan->backend.config,
transport->client_config,
struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(channel_objd);
int ret;
struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(channel_objd);
int ret;
- ret = channel_handle_add_stream(lttng_chan_buf->chan->handle,
+ ret = channel_handle_add_stream(lttng_chan_buf->priv->rb_chan->handle,
uargs->stream.shm_fd, uargs->stream.wakeup_fd,
info->stream_nr, info->len);
if (ret)
uargs->stream.shm_fd, uargs->stream.wakeup_fd,
info->stream_nr, info->len);
if (ret)
case LTTNG_UST_ABI_DISABLE:
return lttng_channel_disable(lttng_chan_buf->parent);
case LTTNG_UST_ABI_FLUSH_BUFFER:
case LTTNG_UST_ABI_DISABLE:
return lttng_channel_disable(lttng_chan_buf->parent);
case LTTNG_UST_ABI_FLUSH_BUFFER:
- return lttng_chan_buf->ops->priv->flush_buffer(lttng_chan_buf->chan,
- lttng_chan_buf->chan->handle);
+ return lttng_chan_buf->ops->priv->flush_buffer(lttng_chan_buf);
default:
return -EINVAL;
}
default:
return -EINVAL;
}
* packet. Note that the size returned is only a hint, since it
* may change due to concurrent writes.
*/
* packet. Note that the size returned is only a hint, since it
* may change due to concurrent writes.
*/
- size_t (*packet_avail_size)(struct lttng_ust_lib_ring_buffer_channel *chan,
- struct lttng_ust_shm_handle *handle);
- int (*is_finalized)(struct lttng_ust_lib_ring_buffer_channel *chan);
- int (*is_disabled)(struct lttng_ust_lib_ring_buffer_channel *chan);
- int (*flush_buffer)(struct lttng_ust_lib_ring_buffer_channel *chan,
- struct lttng_ust_shm_handle *handle);
+ size_t (*packet_avail_size)(struct lttng_ust_channel_buffer *chan);
+ int (*is_finalized)(struct lttng_ust_channel_buffer *chan);
+ int (*is_disabled)(struct lttng_ust_channel_buffer *chan);
+ int (*flush_buffer)(struct lttng_ust_channel_buffer *chan);
};
struct lttng_ust_channel_common_private {
};
struct lttng_ust_channel_common_private {
unsigned int id; /* Channel ID */
enum lttng_ust_abi_chan_type type;
struct lttng_ust_ctx *ctx;
unsigned int id; /* Channel ID */
enum lttng_ust_abi_chan_type type;
struct lttng_ust_ctx *ctx;
+ struct lttng_ust_lib_ring_buffer_channel *rb_chan; /* Ring buffer channel */
unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
};
unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
};