}
static
-int bytecode_is_linked(struct lttng_ust_filter_bytecode_node *filter_bytecode,
+int bytecode_is_linked(struct lttng_ust_bytecode_node *bytecode,
struct cds_list_head *bytecode_runtime_head)
{
struct lttng_bytecode_runtime *bc_runtime;
cds_list_for_each_entry(bc_runtime, bytecode_runtime_head, node) {
- if (bc_runtime->bc == filter_bytecode)
+ if (bc_runtime->bc == bytecode)
return 1;
}
return 0;
static
int _lttng_filter_link_bytecode(const struct lttng_event_desc *event_desc,
struct lttng_ctx **ctx,
- struct lttng_ust_filter_bytecode_node *filter_bytecode,
+ struct lttng_ust_bytecode_node *bytecode,
struct cds_list_head *insert_loc)
{
int ret, offset, next_offset;
struct bytecode_runtime *runtime = NULL;
size_t runtime_alloc_len;
- if (!filter_bytecode)
+ if (!bytecode)
return 0;
/* Bytecode already linked */
- if (bytecode_is_linked(filter_bytecode, insert_loc))
+ if (bytecode_is_linked(bytecode, insert_loc))
return 0;
dbg_printf("Linking...\n");
/* We don't need the reloc table in the runtime */
- runtime_alloc_len = sizeof(*runtime) + filter_bytecode->bc.reloc_offset;
+ runtime_alloc_len = sizeof(*runtime) + bytecode->bc.reloc_offset;
runtime = zmalloc(runtime_alloc_len);
if (!runtime) {
ret = -ENOMEM;
goto alloc_error;
}
- runtime->p.bc = filter_bytecode;
+ runtime->p.bc = bytecode;
runtime->p.pctx = ctx;
- runtime->len = filter_bytecode->bc.reloc_offset;
+ runtime->len = bytecode->bc.reloc_offset;
/* copy original bytecode */
- memcpy(runtime->code, filter_bytecode->bc.data, runtime->len);
+ memcpy(runtime->code, bytecode->bc.data, runtime->len);
/*
* apply relocs. Those are a uint16_t (offset in bytecode)
* followed by a string (field name).
*/
- for (offset = filter_bytecode->bc.reloc_offset;
- offset < filter_bytecode->bc.len;
+ for (offset = bytecode->bc.reloc_offset;
+ offset < bytecode->bc.len;
offset = next_offset) {
uint16_t reloc_offset =
- *(uint16_t *) &filter_bytecode->bc.data[offset];
+ *(uint16_t *) &bytecode->bc.data[offset];
const char *name =
- (const char *) &filter_bytecode->bc.data[offset + sizeof(uint16_t)];
+ (const char *) &bytecode->bc.data[offset + sizeof(uint16_t)];
ret = apply_reloc(event_desc, runtime, runtime->len, reloc_offset, name);
if (ret) {
return 0;
link_error:
- runtime->p.filter = lttng_filter_false;
+ runtime->p.filter = lttng_filter_interpret_bytecode_false;
runtime->p.link_failed = 1;
cds_list_add_rcu(&runtime->p.node, insert_loc);
alloc_error:
void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime)
{
- struct lttng_ust_filter_bytecode_node *bc = runtime->bc;
+ struct lttng_ust_bytecode_node *bc = runtime->bc;
if (!bc->enabler->enabled || runtime->link_failed)
- runtime->filter = lttng_filter_false;
+ runtime->filter = lttng_filter_interpret_bytecode_false;
else
runtime->filter = lttng_filter_interpret_bytecode;
}
struct cds_list_head *bytecode_runtime_head,
struct lttng_enabler *enabler)
{
- struct lttng_ust_filter_bytecode_node *bc;
+ struct lttng_ust_bytecode_node *bc;
struct lttng_bytecode_runtime *runtime;
assert(event_desc);
}
/*
- * We own the filter_bytecode if we return success.
+ * We own the bytecode if we return success.
*/
int lttng_filter_enabler_attach_bytecode(struct lttng_enabler *enabler,
- struct lttng_ust_filter_bytecode_node *filter_bytecode)
+ struct lttng_ust_bytecode_node *bytecode)
{
- cds_list_add(&filter_bytecode->node, &enabler->filter_bytecode_head);
+ cds_list_add(&bytecode->node, &enabler->filter_bytecode_head);
return 0;
}
void lttng_free_event_filter_runtime(struct lttng_event *event)
{
- free_filter_runtime(&event->bytecode_runtime_head);
+ free_filter_runtime(&event->filter_bytecode_runtime_head);
+}
+
+void lttng_free_event_notifier_filter_runtime(
+ struct lttng_event_notifier *event_notifier)
+{
+ free_filter_runtime(&event_notifier->filter_bytecode_runtime_head);
}