Now that the handle is fetched from struct lttng_ust_lib_ring_buffer_channel
by the ring buffer client callbacks, there is no need to keep it around
in the public API struct lttng_ust_channel_buffer.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id41d1ffb171ea64150e2ceebd51c9679071ee337
struct lttng_ust_lib_ring_buffer;
struct lttng_ust_lib_ring_buffer_channel;
struct lttng_ust_lib_ring_buffer_ctx;
struct lttng_ust_lib_ring_buffer;
struct lttng_ust_lib_ring_buffer_channel;
struct lttng_ust_lib_ring_buffer_ctx;
-struct lttng_ust_shm_handle;
"lttng-ust-wait-" \
__ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION)
"lttng-ust-wait-" \
__ust_stringify(LTTNG_UST_ABI_MAJOR_VERSION)
-struct lttng_ust_shm_handle;
struct lttng_ust_lib_ring_buffer;
struct ustctl_consumer_channel_attr {
struct lttng_ust_lib_ring_buffer;
struct ustctl_consumer_channel_attr {
struct lttng_ust_channel_buffer_ops *ops;
struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
struct lttng_ust_channel_buffer_ops *ops;
struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
- struct lttng_ust_shm_handle *handle; /* shared-memory handle */
/* 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. */
};
{
struct shm_object_table *table;
{
struct shm_object_table *table;
- table = channel->chan->handle->table;
+ table = channel->chan->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,
for (pos = 0; pos < len; pos += reserve_len) {
reserve_len = min_t(size_t,
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->handle),
+ lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan,
+ lttng_chan_buf->chan->handle),
len - pos);
lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char));
/*
len - pos);
lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char));
/*
int ret;
reserve_len = min_t(ssize_t,
int ret;
reserve_len = min_t(ssize_t,
- lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle),
+ lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan,
+ lttng_chan_buf->chan->handle),
len);
lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char));
ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
len);
lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len, sizeof(char));
ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
if (!channel)
return NULL;
if (!channel)
return NULL;
- handle = channel->chan->handle;
+ handle = channel->chan->chan->handle;
if (!handle)
return NULL;
if (!handle)
return NULL;
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->handle);
+ lib_ring_buffer_release_read(buf, consumer_chan->chan->chan->handle);
{
if (!chan)
return -EINVAL;
{
if (!chan)
return -EINVAL;
- return shm_get_wait_fd(chan->chan->handle,
- &chan->chan->handle->chan._ref);
+ return shm_get_wait_fd(chan->chan->chan->handle,
+ &chan->chan->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->handle,
- &chan->chan->handle->chan._ref);
+ return shm_get_wakeup_fd(chan->chan->chan->handle,
+ &chan->chan->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->handle, &buf->self._ref);
+ return shm_get_wait_fd(consumer_chan->chan->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->handle, &buf->self._ref);
+ return shm_get_wakeup_fd(consumer_chan->chan->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->handle, buf->backend.memory_map);
+ return shmp(consumer_chan->chan->chan->handle, buf->backend.memory_map);
}
/* returns the length to mmap. */
}
/* returns the length to mmap. */
return -EINVAL;
sb_bindex = subbuffer_id_get_index(&chan->backend.config,
buf->backend.buf_rsb.id);
return -EINVAL;
sb_bindex = subbuffer_id_get_index(&chan->backend.config,
buf->backend.buf_rsb.id);
- barray_idx = shmp_index(consumer_chan->chan->handle, buf->backend.array,
+ barray_idx = shmp_index(consumer_chan->chan->chan->handle, buf->backend.array,
sb_bindex);
if (!barray_idx)
return -EINVAL;
sb_bindex);
if (!barray_idx)
return -EINVAL;
- pages = shmp(consumer_chan->chan->handle, barray_idx->shmp);
+ pages = shmp(consumer_chan->chan->chan->handle, barray_idx->shmp);
if (!pages)
return -EINVAL;
*off = pages->mmap_offset;
if (!pages)
return -EINVAL;
*off = pages->mmap_offset;
consumer_chan = stream->chan;
chan = consumer_chan->chan->chan;
*len = lib_ring_buffer_get_read_data_size(&chan->backend.config, 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->handle);
+ consumer_chan->chan->chan->handle);
consumer_chan = stream->chan;
chan = consumer_chan->chan->chan;
*len = lib_ring_buffer_get_read_data_size(&chan->backend.config, 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->handle);
+ consumer_chan->chan->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->handle);
+ consumer_chan->chan->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->handle);
+ lib_ring_buffer_put_next_subbuf(buf, consumer_chan->chan->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->handle);
+ &buf->prod_snapshot, consumer_chan->chan->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->handle);
+ consumer_chan->chan->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->handle);
+ consumer_chan->chan->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->handle);
+ lib_ring_buffer_put_subbuf(buf, consumer_chan->chan->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->handle);
+ consumer_chan->chan->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->handle);
- lib_ring_buffer_clear_reader(buf, consumer_chan->chan->handle);
+ consumer_chan->chan->chan->handle);
+ lib_ring_buffer_clear_reader(buf, consumer_chan->chan->chan->handle);
if (!stream || !timestamp_begin)
return -EINVAL;
buf = stream->buf;
if (!stream || !timestamp_begin)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
if (!stream || !timestamp_end)
return -EINVAL;
buf = stream->buf;
if (!stream || !timestamp_end)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
if (!stream || !events_discarded)
return -EINVAL;
buf = stream->buf;
if (!stream || !events_discarded)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
if (!stream || !content_size)
return -EINVAL;
buf = stream->buf;
if (!stream || !content_size)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
if (!stream || !packet_size)
return -EINVAL;
buf = stream->buf;
if (!stream || !packet_size)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
if (!stream || !stream_id)
return -EINVAL;
buf = stream->buf;
if (!stream || !stream_id)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
if (!stream || !ts)
return -EINVAL;
buf = stream->buf;
if (!stream || !ts)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb || !client_cb->current_timestamp)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb || !client_cb->current_timestamp)
return -ENOSYS;
if (!stream || !seq)
return -EINVAL;
buf = stream->buf;
if (!stream || !seq)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb || !client_cb->sequence_number)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb || !client_cb->sequence_number)
return -ENOSYS;
if (!stream || !id)
return -EINVAL;
buf = stream->buf;
if (!stream || !id)
return -EINVAL;
buf = stream->buf;
- handle = stream->chan->chan->handle;
+ handle = stream->chan->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
#include "ust-events-internal.h"
#include "wait.h"
#include "../libringbuffer/shm.h"
#include "ust-events-internal.h"
#include "wait.h"
#include "../libringbuffer/shm.h"
+#include "../libringbuffer/frontend_types.h"
#include "../libcounter/counter.h"
#include "jhash.h"
#include <lttng/ust-abi.h>
#include "../libcounter/counter.h"
#include "jhash.h"
#include <lttng/ust-abi.h>
cds_list_del(<tng_chan->priv->node);
lttng_destroy_context(lttng_chan->priv->ctx);
chan = lttng_chan->chan;
cds_list_del(<tng_chan->priv->node);
lttng_destroy_context(lttng_chan->priv->ctx);
chan = lttng_chan->chan;
- handle = lttng_chan->handle;
channel_destroy(chan, handle, 0);
free(lttng_chan->parent);
free(lttng_chan->priv);
channel_destroy(chan, handle, 0);
free(lttng_chan->parent);
free(lttng_chan->priv);
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->handle = handle;
lttng_chan_buf->chan = shmp(handle, handle->chan);
return lttng_chan_buf;
lttng_chan_buf->chan = shmp(handle, handle->chan);
return lttng_chan_buf;
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->handle, 1);
+ channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->chan->handle, 1);
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
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->handle = handle;
lttng_chan_buf->chan = shmp(handle, handle->chan);
return lttng_chan_buf;
lttng_chan_buf->chan = shmp(handle, handle->chan);
return lttng_chan_buf;
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->handle, 1);
+ channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->chan->handle, 1);
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
unsigned int nr_streams, exp_streams;
chan = lttng_chan->chan;
unsigned int nr_streams, exp_streams;
chan = lttng_chan->chan;
- nr_streams = channel_handle_get_nr_streams(lttng_chan->handle);
+ nr_streams = channel_handle_get_nr_streams(lttng_chan->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->ops = &transport->ops;
lttng_chan_buf->chan = chan;
lttng_chan_buf->ops = &transport->ops;
lttng_chan_buf->chan = chan;
- lttng_chan_buf->handle = channel_handle;
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->handle,
+ ret = channel_handle_add_stream(lttng_chan_buf->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)
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,
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->handle);
+ lttng_chan_buf->chan->handle);
default:
return -EINVAL;
}
default:
return -EINVAL;
}