* UST. Fields need to be only added at the end, never reordered, never
* removed.
*/
-#define LTTNG_UST_RING_BUFFER_CTX_PADDING \
- (24 - sizeof(int) - sizeof(void *) - sizeof(void *))
+#define LTTNG_UST_RING_BUFFER_CTX_PADDING 64
struct lttng_ust_lib_ring_buffer_ctx {
+ uint32_t struct_size; /* Size of this structure. */
+
/* input received by lib_ring_buffer_reserve(), saved here. */
struct channel *chan; /* channel */
void *priv; /* client private data */
*/
uint64_t tsc; /* time-stamp counter value */
unsigned int rflags; /* reservation flags */
- /*
- * The field ctx_len is the length of struct
- * lttng_ust_lib_ring_buffer_ctx as known by the user of
- * lib_ring_buffer_ctx_init.
- */
- unsigned int ctx_len;
void *ip; /* caller ip address */
- void *priv2; /* 2nd priv data */
- char padding2[LTTNG_UST_RING_BUFFER_CTX_PADDING];
- /*
- * This is the end of the initial fields expected by the original ABI
- * between probes and UST. Only the fields above can be used if
- * ctx_len is 0. Use the value of ctx_len to find out which of the
- * following fields may be used.
- */
struct lttng_ust_lib_ring_buffer_backend_pages *backend_pages;
};
void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx,
struct channel *chan, void *priv,
size_t data_size, int largest_align,
- int cpu, struct lttng_ust_shm_handle *handle,
- void *priv2);
+ int cpu, struct lttng_ust_shm_handle *handle);
static inline
void lib_ring_buffer_ctx_init(struct lttng_ust_lib_ring_buffer_ctx *ctx,
struct channel *chan, void *priv,
size_t data_size, int largest_align,
- int cpu, struct lttng_ust_shm_handle *handle,
- void *priv2)
+ int cpu, struct lttng_ust_shm_handle *handle)
{
+ ctx->struct_size = sizeof(struct lttng_ust_lib_ring_buffer_ctx);
ctx->chan = chan;
ctx->priv = priv;
ctx->data_size = data_size;
ctx->cpu = cpu;
ctx->rflags = 0;
ctx->handle = handle;
- ctx->ctx_len = sizeof(struct lttng_ust_lib_ring_buffer_ctx);
ctx->ip = 0;
- ctx->priv2 = priv2;
- memset(ctx->padding2, 0, LTTNG_UST_RING_BUFFER_CTX_PADDING);
}
/*
chan->ops->packet_avail_size(chan->chan, chan->handle),
len - pos);
lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len,
- sizeof(char), -1, chan->handle, NULL);
+ sizeof(char), -1, chan->handle);
/*
* We don't care about metadata buffer's records lost
* count, because we always retry here. Report error if
chan->ops->packet_avail_size(chan->chan, chan->handle),
len);
lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len,
- sizeof(char), -1, chan->handle, NULL);
+ sizeof(char), -1, chan->handle);
ret = chan->ops->event_reserve(&ctx, 0);
if (ret != 0) {
DBG("LTTng: event reservation failed");
struct lttng_client_ctx *client_ctx)
{
struct lttng_channel *lttng_chan = channel_get_private(chan);
- struct lttng_ust_event_recorder *event_recorder = ctx->priv;
- struct lttng_stack_ctx *lttng_ctx = ctx->priv2;
+ struct lttng_stack_ctx *lttng_ctx = ctx->priv;
size_t orig_offset = offset;
size_t padding;
padding = 0;
WARN_ON_ONCE(1);
}
- if (lttng_ctx) {
- /* 2.8+ probe ABI. */
- offset += ctx_get_aligned_size(offset, lttng_ctx->chan_ctx,
- client_ctx->packet_context_len);
- offset += ctx_get_aligned_size(offset, lttng_ctx->event_ctx,
- client_ctx->event_context_len);
- } else {
- /* Pre 2.8 probe ABI. */
- offset += ctx_get_aligned_size(offset, lttng_chan->ctx,
- client_ctx->packet_context_len);
- offset += ctx_get_aligned_size(offset, event_recorder->ctx,
- client_ctx->event_context_len);
- }
+ offset += ctx_get_aligned_size(offset, lttng_ctx->chan_ctx,
+ client_ctx->packet_context_len);
+ offset += ctx_get_aligned_size(offset, lttng_ctx->event_ctx,
+ client_ctx->event_context_len);
*pre_header_padding = padding;
return offset - orig_offset;
}
uint32_t event_id)
{
struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_ust_event_recorder *event_recorder = ctx->priv;
- struct lttng_stack_ctx *lttng_ctx = ctx->priv2;
+ struct lttng_stack_ctx *lttng_ctx = ctx->priv;
if (caa_unlikely(ctx->rflags))
goto slow_path;
WARN_ON_ONCE(1);
}
- if (lttng_ctx) {
- /* 2.8+ probe ABI. */
- ctx_record(ctx, lttng_chan, lttng_ctx->chan_ctx, APP_CTX_ENABLED);
- ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx, APP_CTX_ENABLED);
- } else {
- /* Pre 2.8 probe ABI. */
- ctx_record(ctx, lttng_chan, lttng_chan->ctx, APP_CTX_DISABLED);
- ctx_record(ctx, lttng_chan, event_recorder->ctx, APP_CTX_DISABLED);
- }
+ ctx_record(ctx, lttng_chan, lttng_ctx->chan_ctx, APP_CTX_ENABLED);
+ ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx, APP_CTX_ENABLED);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
return;
uint32_t event_id)
{
struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_ust_event_recorder *event_recorder = ctx->priv;
- struct lttng_stack_ctx *lttng_ctx = ctx->priv2;
+ struct lttng_stack_ctx *lttng_ctx = ctx->priv;
switch (lttng_chan->header_type) {
case 1: /* compact */
default:
WARN_ON_ONCE(1);
}
- if (lttng_ctx) {
- /* 2.8+ probe ABI. */
- ctx_record(ctx, lttng_chan, lttng_ctx->chan_ctx, APP_CTX_ENABLED);
- ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx, APP_CTX_ENABLED);
- } else {
- /* Pre 2.8 probe ABI. */
- ctx_record(ctx, lttng_chan, lttng_chan->ctx, APP_CTX_DISABLED);
- ctx_record(ctx, lttng_chan, event_recorder->ctx, APP_CTX_DISABLED);
- }
+ ctx_record(ctx, lttng_chan, lttng_ctx->chan_ctx, APP_CTX_ENABLED);
+ ctx_record(ctx, lttng_chan, lttng_ctx->event_ctx, APP_CTX_ENABLED);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
}
uint32_t event_id)
{
struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_ust_event_recorder *event_recorder = ctx->priv;
- struct lttng_stack_ctx *lttng_ctx = ctx->priv2;
+ struct lttng_stack_ctx *lttng_ctx = ctx->priv;
struct lttng_client_ctx client_ctx;
int ret, cpu;
/* Compute internal size of context structures. */
-
- if (lttng_ctx) {
- /* 2.8+ probe ABI. */
- ctx_get_struct_size(lttng_ctx->chan_ctx, &client_ctx.packet_context_len,
- APP_CTX_ENABLED);
- ctx_get_struct_size(lttng_ctx->event_ctx, &client_ctx.event_context_len,
- APP_CTX_ENABLED);
- } else {
- /* Pre 2.8 probe ABI. */
- ctx_get_struct_size(lttng_chan->ctx, &client_ctx.packet_context_len,
- APP_CTX_DISABLED);
- ctx_get_struct_size(event_recorder->ctx, &client_ctx.event_context_len,
- APP_CTX_DISABLED);
- }
+ ctx_get_struct_size(lttng_ctx->chan_ctx, &client_ctx.packet_context_len,
+ APP_CTX_ENABLED);
+ ctx_get_struct_size(lttng_ctx->event_ctx, &client_ctx.event_context_len,
+ APP_CTX_ENABLED);
cpu = lib_ring_buffer_get_cpu(&client_config);
if (cpu < 0)
ret = lib_ring_buffer_reserve(&client_config, ctx, &client_ctx);
if (caa_unlikely(ret))
goto put;
- if (caa_likely(ctx->ctx_len
- >= sizeof(struct lttng_ust_lib_ring_buffer_ctx))) {
- if (lib_ring_buffer_backend_get_pages(&client_config, ctx,
- &ctx->backend_pages)) {
- ret = -EPERM;
- goto put;
- }
+ if (lib_ring_buffer_backend_get_pages(&client_config, ctx,
+ &ctx->backend_pages)) {
+ ret = -EPERM;
+ goto put;
}
lttng_write_event_header(&client_config, ctx, event_id);
return 0;