return 0;
}
-static int specialize_context_lookup(struct lttng_session *session,
+static int specialize_context_lookup(struct lttng_ctx *ctx,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
struct filter_get_index_data gid;
ssize_t data_offset;
- idx = specialize_context_lookup_name(session->ctx, runtime, insn);
+ idx = specialize_context_lookup_name(ctx, runtime, insn);
if (idx < 0) {
return -ENOENT;
}
- ctx_field = &session->ctx->fields[idx];
+ ctx_field = &ctx->fields[idx];
field = &ctx_field->event_field;
ret = specialize_load_object(field, load, true);
if (ret)
return 0;
}
-static int specialize_app_context_lookup(struct lttng_session *session,
+static int specialize_app_context_lookup(struct lttng_ctx *ctx,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
}
strcpy(name, "$app.");
strcat(name, orig_name);
- idx = lttng_get_context_index(session->ctx, name);
+ idx = lttng_get_context_index(ctx, name);
if (idx < 0) {
assert(lttng_context_is_app(name));
ret = lttng_ust_add_app_context_to_ctx_rcu(name,
- &session->ctx);
+ &ctx);
if (ret)
return ret;
- idx = lttng_get_context_index(session->ctx,
- name);
+ idx = lttng_get_context_index(ctx, name);
if (idx < 0)
return -ENOENT;
}
- ctx_field = &session->ctx->fields[idx];
+ ctx_field = &ctx->fields[idx];
field = &ctx_field->event_field;
ret = specialize_load_object(field, load, true);
if (ret)
return ret;
}
-static int specialize_event_payload_lookup(struct lttng_event *event,
+static int specialize_payload_lookup(const struct lttng_event_desc *event_desc,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
{
const char *name;
uint16_t offset;
- const struct lttng_event_desc *desc = event->desc;
unsigned int i, nr_fields;
bool found = false;
uint32_t field_offset = 0;
struct filter_get_index_data gid;
ssize_t data_offset;
- nr_fields = desc->nr_fields;
+ nr_fields = event_desc->nr_fields;
offset = ((struct get_symbol *) insn->data)->offset;
name = runtime->p.bc->bc.data + runtime->p.bc->bc.reloc_offset + offset;
for (i = 0; i < nr_fields; i++) {
- field = &desc->fields[i];
+ field = &event_desc->fields[i];
if (!strcmp(field->name, name)) {
found = true;
break;
return ret;
}
-int lttng_filter_specialize_bytecode(struct lttng_event *event,
+int lttng_filter_specialize_bytecode(const struct lttng_event_desc *event_desc,
struct bytecode_runtime *bytecode)
{
void *pc, *next_pc, *start_pc;
int ret = -EINVAL;
struct vstack _stack;
struct vstack *stack = &_stack;
- struct lttng_session *session = bytecode->p.session;
+ struct lttng_ctx *ctx = *bytecode->p.ctx;
vstack_init(stack);
goto end;
case LOAD_ROOT_CONTEXT:
/* Lookup context field. */
- ret = specialize_context_lookup(session,
+ ret = specialize_context_lookup(ctx,
bytecode, insn,
&vstack_ax(stack)->load);
if (ret)
break;
case LOAD_ROOT_APP_CONTEXT:
/* Lookup app context field. */
- ret = specialize_app_context_lookup(session,
+ ret = specialize_app_context_lookup(ctx,
bytecode, insn,
&vstack_ax(stack)->load);
if (ret)
break;
case LOAD_ROOT_PAYLOAD:
/* Lookup event payload field. */
- ret = specialize_event_payload_lookup(event,
+ ret = specialize_payload_lookup(event_desc,
bytecode, insn,
&vstack_ax(stack)->load);
if (ret)