From: Jonathan Rajotte Date: Thu, 5 Nov 2020 01:48:56 +0000 (-0500) Subject: Rename lttng_condition_event_rule to lttng_condition_on_event X-Git-Tag: v2.13.0-rc1~220 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d602bd6a8ee25d5ca662dde4edb3db3cabf264e1;p=lttng-tools.git Rename lttng_condition_event_rule to lttng_condition_on_event Files renaming is following. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Icf74aa7cc84b46b1f23bbe1418b7e1241d8dc081 --- diff --git a/include/lttng/condition/condition.h b/include/lttng/condition/condition.h index 6681cf76f..5610a7604 100644 --- a/include/lttng/condition/condition.h +++ b/include/lttng/condition/condition.h @@ -21,7 +21,7 @@ enum lttng_condition_type { LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW = 102, LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING = 103, LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED = 104, - LTTNG_CONDITION_TYPE_EVENT_RULE_HIT = 105, + LTTNG_CONDITION_TYPE_ON_EVENT = 105, }; enum lttng_condition_status { diff --git a/include/lttng/condition/event-rule-internal.h b/include/lttng/condition/event-rule-internal.h index 6dd663d7c..e22cb762a 100644 --- a/include/lttng/condition/event-rule-internal.h +++ b/include/lttng/condition/event-rule-internal.h @@ -5,8 +5,8 @@ * */ -#ifndef LTTNG_CONDITION_EVENT_RULE_INTERNAL_H -#define LTTNG_CONDITION_EVENT_RULE_INTERNAL_H +#ifndef LTTNG_CONDITION_ON_EVENT_INTERNAL_H +#define LTTNG_CONDITION_ON_EVENT_INTERNAL_H #include #include @@ -20,7 +20,7 @@ struct lttng_capture_descriptor { struct lttng_bytecode *bytecode; }; -struct lttng_condition_event_rule { +struct lttng_condition_on_event { struct lttng_condition parent; struct lttng_event_rule *rule; @@ -28,7 +28,7 @@ struct lttng_condition_event_rule { struct lttng_dynamic_pointer_array capture_descriptors; }; -struct lttng_evaluation_event_rule { +struct lttng_evaluation_on_event { struct lttng_evaluation parent; char *name; @@ -45,7 +45,7 @@ struct lttng_evaluation_event_rule { struct lttng_event_field_value *captured_values; }; -struct lttng_evaluation_event_rule_comm { +struct lttng_evaluation_on_event_comm { /* Includes the null terminator. */ uint32_t trigger_name_length; /* Trigger name. */ @@ -53,37 +53,37 @@ struct lttng_evaluation_event_rule_comm { } LTTNG_PACKED; LTTNG_HIDDEN -ssize_t lttng_condition_event_rule_create_from_payload( +ssize_t lttng_condition_on_event_create_from_payload( struct lttng_payload_view *view, struct lttng_condition **condition); LTTNG_HIDDEN enum lttng_condition_status -lttng_condition_event_rule_borrow_rule_mutable( +lttng_condition_on_event_borrow_rule_mutable( const struct lttng_condition *condition, struct lttng_event_rule **rule); LTTNG_HIDDEN -struct lttng_evaluation *lttng_evaluation_event_rule_create( - const struct lttng_condition_event_rule *condition, +struct lttng_evaluation *lttng_evaluation_on_event_create( + const struct lttng_condition_on_event *condition, const char* trigger_name, const char *capture_payload, size_t capture_payload_size, bool decode_capture_payload); LTTNG_HIDDEN -ssize_t lttng_evaluation_event_rule_create_from_payload( - const struct lttng_condition_event_rule *condition, +ssize_t lttng_evaluation_on_event_create_from_payload( + const struct lttng_condition_on_event *condition, struct lttng_payload_view *view, struct lttng_evaluation **_evaluation); LTTNG_HIDDEN enum lttng_error_code -lttng_condition_event_rule_generate_capture_descriptor_bytecode( +lttng_condition_on_event_generate_capture_descriptor_bytecode( struct lttng_condition *condition); LTTNG_HIDDEN const struct lttng_bytecode * -lttng_condition_event_rule_get_capture_bytecode_at_index( +lttng_condition_on_event_get_capture_bytecode_at_index( const struct lttng_condition *condition, unsigned int index); -#endif /* LTTNG_CONDITION_EVENT_RULE_INTERNAL_H */ +#endif /* LTTNG_CONDITION_ON_EVENT_INTERNAL_H */ diff --git a/include/lttng/condition/event-rule.h b/include/lttng/condition/event-rule.h index 170f38160..450507613 100644 --- a/include/lttng/condition/event-rule.h +++ b/include/lttng/condition/event-rule.h @@ -5,8 +5,8 @@ * */ -#ifndef LTTNG_CONDITION_EVENT_RULE_H -#define LTTNG_CONDITION_EVENT_RULE_H +#ifndef LTTNG_CONDITION_ON_EVENT_H +#define LTTNG_CONDITION_ON_EVENT_H #include #include @@ -20,10 +20,10 @@ struct lttng_event_expr; struct lttng_event_field_value; /** - * Event rule conditions allows an action to be taken whenever an event matching - * the event rule is hit by the tracers. + * On event conditions allows an action to be taken whenever an event matching + * the on event is hit by the tracers. * - * An event rule condition can also specify a payload to be captured at runtime. + * An on event condition can also specify a payload to be captured at runtime. * This is done via the capture descriptor. * * Note: the dynamic runtime capture of payload is only available for the @@ -31,16 +31,16 @@ struct lttng_event_field_value; */ /* - * Create a newly allocated event rule condition. + * Create a newly allocated on event condition. * * Returns a new condition on success, NULL on failure. This condition must be * destroyed using lttng_condition_destroy(). */ -extern struct lttng_condition *lttng_condition_event_rule_create( +extern struct lttng_condition *lttng_condition_on_event_create( struct lttng_event_rule *rule); /* - * Get the rule property of a event rule condition. + * Get the rule property of a on event condition. * * The caller does not assume the ownership of the returned rule. The * rule shall only be used for the duration of the condition's @@ -49,34 +49,34 @@ extern struct lttng_condition *lttng_condition_event_rule_create( * Returns LTTNG_CONDITION_STATUS_OK and a pointer to the condition's rule * on success, LTTNG_CONDITION_STATUS_INVALID if an invalid * parameter is passed. */ -extern enum lttng_condition_status lttng_condition_event_rule_get_rule( - const struct lttng_condition *condition, +extern enum lttng_condition_status lttng_condition_on_event_get_rule( + const struct lttng_condition *condition, const struct lttng_event_rule **rule); /** - * lttng_evaluation_event_rule_hit are specialised lttng_evaluations which + * lttng_evaluation_on_event_hit are specialised lttng_evaluations which * allow users to query a number of properties resulting from the evaluation * of a condition which evaluated to true. * - * The evaluation of a event rule hit yields two different results: + * The evaluation of a on event hit yields two different results: * TEMPORARY - The name of the triggers associated with the condition. * TODO - The captured event payload if any */ /* - * Get the trigger name property of a event rule hit evaluation. + * Get the trigger name property of a on event hit evaluation. * * Returns LTTNG_EVALUATION_STATUS_OK on success and a trigger name * or LTTNG_EVALUATION_STATUS_INVALID if * an invalid parameter is passed. */ extern enum lttng_evaluation_status -lttng_evaluation_event_rule_get_trigger_name( +lttng_evaluation_on_event_get_trigger_name( const struct lttng_evaluation *evaluation, const char **name); /* - * Sets `*field_val` to the array event field value of the event rule + * Sets `*field_val` to the array event field value of the on event * condition evaluation `evaluation` which contains its captured values. * * Returns: @@ -90,18 +90,18 @@ lttng_evaluation_event_rule_get_trigger_name( * `LTTNG_EVALUATION_STATUS_INVALID`: * * `evaluation` is `NULL`. * * The type of the condition of `evaluation` is not - * `LTTNG_CONDITION_TYPE_EVENT_RULE_HIT`. + * `LTTNG_CONDITION_TYPE_ON_EVENT`. * * The condition of `evaluation` has no capture descriptors. * * `field_val` is `NULL`. */ extern enum lttng_evaluation_status -lttng_evaluation_event_rule_get_captured_values( +lttng_evaluation_on_event_get_captured_values( const struct lttng_evaluation *evaluation, const struct lttng_event_field_value **field_val); /* * Appends (transfering the ownership) the capture descriptor `expr` to - * the event rule condition `condition`. + * the on event condition `condition`. * * Returns: * @@ -114,7 +114,7 @@ lttng_evaluation_event_rule_get_captured_values( * `LTTNG_CONDITION_STATUS_INVALID`: * * `condition` is `NULL`. * * The type of `condition` is not - * `LTTNG_CONDITION_TYPE_EVENT_RULE_HIT`. + * `LTTNG_CONDITION_TYPE_ON_EVENT`. * * `expr` is `NULL`. * * `expr` is not a locator expression, that is, its type is not * one of: @@ -128,12 +128,12 @@ lttng_evaluation_event_rule_get_captured_values( * * The associated event-rule does not support runtime capture. */ extern enum lttng_condition_status -lttng_condition_event_rule_append_capture_descriptor( +lttng_condition_on_event_append_capture_descriptor( struct lttng_condition *condition, struct lttng_event_expr *expr); /* - * Sets `*count` to the number of capture descriptors in the event rule + * Sets `*count` to the number of capture descriptors in the on event * condition `condition`. * * Returns: @@ -144,30 +144,30 @@ lttng_condition_event_rule_append_capture_descriptor( * `LTTNG_CONDITION_STATUS_INVALID`: * * `condition` is `NULL`. * * The type of `condition` is not - * `LTTNG_CONDITION_TYPE_EVENT_RULE_HIT`. + * `LTTNG_CONDITION_TYPE_ON_EVENT`. * * `count` is `NULL`. */ extern enum lttng_condition_status -lttng_condition_event_rule_get_capture_descriptor_count( +lttng_condition_on_event_get_capture_descriptor_count( const struct lttng_condition *condition, unsigned int *count); /* - * Returns the capture descriptor (borrowed) of the event rule condition + * Returns the capture descriptor (borrowed) of the on event condition * `condition` at the index `index`, or `NULL` if: * * * `condition` is `NULL`. * * The type of `condition` is not - * `LTTNG_CONDITION_TYPE_EVENT_RULE_HIT`. + * `LTTNG_CONDITION_TYPE_ON_EVENT`. * * `index` is greater than or equal to the number of capture * descriptors in `condition` (as returned by - * lttng_condition_event_rule_get_capture_descriptor_count()). + * lttng_condition_on_event_get_capture_descriptor_count()). */ extern const struct lttng_event_expr * -lttng_condition_event_rule_get_capture_descriptor_at_index( +lttng_condition_on_event_get_capture_descriptor_at_index( const struct lttng_condition *condition, unsigned int index); #ifdef __cplusplus } #endif -#endif /* LTTNG_CONDITION_EVENT_RULE_H */ +#endif /* LTTNG_CONDITION_ON_EVENT_H */ diff --git a/src/bin/lttng-sessiond/agent.c b/src/bin/lttng-sessiond/agent.c index 283d5b035..f9d98ab1e 100644 --- a/src/bin/lttng-sessiond/agent.c +++ b/src/bin/lttng-sessiond/agent.c @@ -1253,9 +1253,9 @@ struct agent_event *agent_find_event_by_trigger( condition = lttng_trigger_get_const_condition(trigger); assert(lttng_condition_get_type(condition) == - LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); + LTTNG_CONDITION_TYPE_ON_EVENT); - c_status = lttng_condition_event_rule_get_rule(condition, &rule); + c_status = lttng_condition_on_event_get_rule(condition, &rule); assert(c_status == LTTNG_CONDITION_STATUS_OK); assert(lttng_event_rule_get_type(rule) == diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 83ad957fc..6732a1c3c 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -4306,7 +4306,7 @@ static enum lttng_error_code trigger_modifies_event_notifier( } *adds_event_notifier = lttng_condition_get_type(condition) == - LTTNG_CONDITION_TYPE_EVENT_RULE_HIT; + LTTNG_CONDITION_TYPE_ON_EVENT; end: return ret_code; } diff --git a/src/bin/lttng-sessiond/condition-internal.c b/src/bin/lttng-sessiond/condition-internal.c index dc21ca3af..0163a8977 100644 --- a/src/bin/lttng-sessiond/condition-internal.c +++ b/src/bin/lttng-sessiond/condition-internal.c @@ -95,7 +95,7 @@ unsigned long lttng_condition_session_rotation_hash( } static -unsigned long lttng_condition_event_rule_hash( +unsigned long lttng_condition_on_event_hash( const struct lttng_condition *condition) { unsigned long hash, condition_type; @@ -103,8 +103,7 @@ unsigned long lttng_condition_event_rule_hash( const struct lttng_event_rule *event_rule; condition_type = (unsigned long) condition->type; - - condition_status = lttng_condition_event_rule_get_rule(condition, + condition_status = lttng_condition_on_event_get_rule(condition, &event_rule); assert(condition_status == LTTNG_CONDITION_STATUS_OK); @@ -128,8 +127,8 @@ unsigned long lttng_condition_hash(const struct lttng_condition *condition) case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING: case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED: return lttng_condition_session_rotation_hash(condition); - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: - return lttng_condition_event_rule_hash(condition); + case LTTNG_CONDITION_TYPE_ON_EVENT: + return lttng_condition_on_event_hash(condition); default: //ERR("[notification-thread] Unexpected condition type caught"); abort(); diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index 84375d3b4..17f510154 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -601,9 +601,9 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt) condition = lttng_trigger_get_const_condition(trigger); assert(lttng_condition_get_type(condition) == - LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); + LTTNG_CONDITION_TYPE_ON_EVENT); - c_status = lttng_condition_event_rule_get_rule(condition, &rule); + c_status = lttng_condition_on_event_get_rule(condition, &rule); assert(c_status == LTTNG_CONDITION_STATUS_OK); assert(lttng_event_rule_get_type(rule) == diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index fe7271ed9..4e5216edc 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -2310,10 +2310,10 @@ static enum lttng_error_code kernel_create_event_notifier_rule( assert(condition); condition_type = lttng_condition_get_type(condition); - assert(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); + assert(condition_type == LTTNG_CONDITION_TYPE_ON_EVENT); /* Does not acquire a reference. */ - condition_status = lttng_condition_event_rule_get_rule( + condition_status = lttng_condition_on_event_get_rule( condition, &event_rule); assert(condition_status == LTTNG_CONDITION_STATUS_OK); assert(event_rule); @@ -2395,14 +2395,14 @@ static enum lttng_error_code kernel_create_event_notifier_rule( } } - /* Set the capture bytecode, if any. */ - cond_status = lttng_condition_event_rule_get_capture_descriptor_count( + /* Set the capture bytecode if any. */ + cond_status = lttng_condition_on_event_get_capture_descriptor_count( condition, &capture_bytecode_count); assert(cond_status == LTTNG_CONDITION_STATUS_OK); for (i = 0; i < capture_bytecode_count; i++) { const struct lttng_bytecode *capture_bytecode = - lttng_condition_event_rule_get_capture_bytecode_at_index( + lttng_condition_on_event_get_capture_bytecode_at_index( condition, i); if (capture_bytecode == NULL) { @@ -2479,7 +2479,7 @@ enum lttng_error_code kernel_register_event_notifier( assert(condition); /* Does not acquire a reference to the event rule. */ - status = lttng_condition_event_rule_get_rule( + status = lttng_condition_on_event_get_rule( condition, &event_rule); assert(status == LTTNG_CONDITION_STATUS_OK); diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 413f1848b..aadc1b0a8 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -467,7 +467,7 @@ enum lttng_object_type get_condition_binding_object( case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING: case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED: return LTTNG_OBJECT_TYPE_SESSION; - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: return LTTNG_OBJECT_TYPE_NONE; default: return LTTNG_OBJECT_TYPE_UNKNOWN; @@ -2222,12 +2222,12 @@ bool condition_is_supported(struct lttng_condition *condition) is_supported = kernel_supports_ring_buffer_snapshot_sample_positions() == 1; break; } - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: { const struct lttng_event_rule *event_rule; enum lttng_domain_type domain; const enum lttng_condition_status status = - lttng_condition_event_rule_get_rule( + lttng_condition_on_event_get_rule( condition, &event_rule); assert(status == LTTNG_CONDITION_STATUS_OK); @@ -2535,7 +2535,7 @@ int handle_notification_thread_command_register_trigger( goto error_free_ht_element; } - if (lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT) { + if (lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_ON_EVENT) { trigger_tokens_ht_element = zmalloc(sizeof(*trigger_tokens_ht_element)); if (!trigger_tokens_ht_element) { /* Fatal error. */ @@ -2830,7 +2830,7 @@ int handle_notification_thread_command_unregister_trigger( } if (lttng_condition_get_type(condition) == - LTTNG_CONDITION_TYPE_EVENT_RULE_HIT) { + LTTNG_CONDITION_TYPE_ON_EVENT) { struct notification_trigger_tokens_ht_element *trigger_tokens_ht_element; @@ -4385,7 +4385,7 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s trigger_status = lttng_trigger_get_name(element->trigger, &trigger_name); assert(trigger_status == LTTNG_TRIGGER_STATUS_OK); - if (lttng_condition_event_rule_get_capture_descriptor_count( + if (lttng_condition_on_event_get_capture_descriptor_count( lttng_trigger_get_const_condition(element->trigger), &capture_count) != LTTNG_CONDITION_STATUS_OK) { ERR("Failed to get capture count"); @@ -4399,10 +4399,10 @@ int dispatch_one_event_notifier_notification(struct notification_thread_state *s goto end; } - evaluation = lttng_evaluation_event_rule_create( + evaluation = lttng_evaluation_on_event_create( container_of(lttng_trigger_get_const_condition( element->trigger), - struct lttng_condition_event_rule, + struct lttng_condition_on_event, parent), trigger_name, notification->capture_buffer, diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index 9d019752b..ba8ceab1d 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -501,9 +501,9 @@ enum lttng_error_code trace_kernel_create_event_notifier_rule( assert(condition); condition_type = lttng_condition_get_type(condition); - assert(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); + assert(condition_type == LTTNG_CONDITION_TYPE_ON_EVENT); - condition_status = lttng_condition_event_rule_get_rule( + condition_status = lttng_condition_on_event_get_rule( condition, &event_rule); assert(condition_status == LTTNG_CONDITION_STATUS_OK); assert(event_rule); diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 8e96e3e42..de2289502 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1253,9 +1253,9 @@ static struct ust_app_event_notifier_rule *alloc_ust_app_event_notifier_rule( condition = lttng_trigger_get_condition(trigger); assert(condition); - assert(lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); + assert(lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_ON_EVENT); - assert(LTTNG_CONDITION_STATUS_OK == lttng_condition_event_rule_get_rule(condition, &event_rule)); + assert(LTTNG_CONDITION_STATUS_OK == lttng_condition_on_event_get_rule(condition, &event_rule)); assert(event_rule); /* Acquire the event notifier's reference to the trigger. */ @@ -2095,10 +2095,12 @@ static int create_ust_event_notifier(struct ust_app *app, condition = lttng_trigger_get_const_condition( ua_event_notifier_rule->trigger); assert(condition); - assert(lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); + assert(lttng_condition_get_type(condition) == LTTNG_CONDITION_TYPE_ON_EVENT); - condition_status = lttng_condition_event_rule_get_rule(condition, &event_rule); + condition_status = lttng_condition_on_event_get_rule( + condition, &event_rule); assert(condition_status == LTTNG_CONDITION_STATUS_OK); + assert(event_rule); assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_TRACEPOINT); @@ -2158,13 +2160,13 @@ static int create_ust_event_notifier(struct ust_app *app, } /* Set the capture bytecodes. */ - cond_status = lttng_condition_event_rule_get_capture_descriptor_count( + cond_status = lttng_condition_on_event_get_capture_descriptor_count( condition, &capture_bytecode_count); assert(cond_status == LTTNG_CONDITION_STATUS_OK); for (i = 0; i < capture_bytecode_count; i++) { const struct lttng_bytecode *capture_bytecode = - lttng_condition_event_rule_get_capture_bytecode_at_index( + lttng_condition_on_event_get_capture_bytecode_at_index( condition, i); ret = set_ust_capture(app, capture_bytecode, i, @@ -5648,12 +5650,12 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app) token = lttng_trigger_get_tracer_token(trigger); condition = lttng_trigger_get_condition(trigger); - if (lttng_condition_get_type(condition) != LTTNG_CONDITION_TYPE_EVENT_RULE_HIT) { + if (lttng_condition_get_type(condition) != LTTNG_CONDITION_TYPE_ON_EVENT) { /* Does not apply */ continue; } - condition_status = lttng_condition_event_rule_borrow_rule_mutable(condition, &event_rule); + condition_status = lttng_condition_on_event_borrow_rule_mutable(condition, &event_rule); assert(condition_status == LTTNG_CONDITION_STATUS_OK); if (lttng_event_rule_get_domain_type(event_rule) == LTTNG_DOMAIN_KERNEL) { diff --git a/src/bin/lttng/commands/add_trigger.c b/src/bin/lttng/commands/add_trigger.c index b55f4edde..d88fa0cf9 100644 --- a/src/bin/lttng/commands/add_trigger.c +++ b/src/bin/lttng/commands/add_trigger.c @@ -1096,7 +1096,7 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv) goto error; } - c = lttng_condition_event_rule_create(res.er); + c = lttng_condition_on_event_create(res.er); lttng_event_rule_destroy(res.er); res.er = NULL; if (!c) { @@ -1112,7 +1112,7 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv) assert(expr); assert(*expr); - status = lttng_condition_event_rule_append_capture_descriptor( + status = lttng_condition_on_event_append_capture_descriptor( c, *expr); if (status != LTTNG_CONDITION_STATUS_OK) { if (status == LTTNG_CONDITION_STATUS_UNSUPPORTED) { diff --git a/src/bin/lttng/commands/list_triggers.c b/src/bin/lttng/commands/list_triggers.c index 906aae076..024dc50bc 100644 --- a/src/bin/lttng/commands/list_triggers.c +++ b/src/bin/lttng/commands/list_triggers.c @@ -362,20 +362,20 @@ void print_one_event_expr(const struct lttng_event_expr *event_expr) } static -void print_condition_event_rule_hit(const struct lttng_condition *condition) +void print_condition_on_event(const struct lttng_condition *condition) { const struct lttng_event_rule *event_rule; enum lttng_condition_status condition_status; unsigned int cap_desc_count, i; condition_status = - lttng_condition_event_rule_get_rule(condition, &event_rule); + lttng_condition_on_event_get_rule(condition, &event_rule); assert(condition_status == LTTNG_CONDITION_STATUS_OK); print_event_rule(event_rule); condition_status = - lttng_condition_event_rule_get_capture_descriptor_count( + lttng_condition_on_event_get_capture_descriptor_count( condition, &cap_desc_count); assert(condition_status == LTTNG_CONDITION_STATUS_OK); @@ -384,7 +384,7 @@ void print_condition_event_rule_hit(const struct lttng_condition *condition) for (i = 0; i < cap_desc_count; i++) { const struct lttng_event_expr *cap_desc = - lttng_condition_event_rule_get_capture_descriptor_at_index( + lttng_condition_on_event_get_capture_descriptor_at_index( condition, i); _MSG(" - "); @@ -534,8 +534,8 @@ void print_one_trigger(const struct lttng_trigger *trigger) condition_type = lttng_condition_get_type(condition); MSG(" condition: %s", lttng_condition_type_str(condition_type)); switch (condition_type) { - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: - print_condition_event_rule_hit(condition); + case LTTNG_CONDITION_TYPE_ON_EVENT: + print_condition_on_event(condition); break; default: MSG(" (condition type not handled in %s)", __func__); diff --git a/src/common/conditions/condition.c b/src/common/conditions/condition.c index e0b85e429..fa45ee22b 100644 --- a/src/common/conditions/condition.c +++ b/src/common/conditions/condition.c @@ -170,8 +170,8 @@ ssize_t lttng_condition_create_from_payload( case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED: create_from_payload = lttng_condition_session_rotation_completed_create_from_payload; break; - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: - create_from_payload = lttng_condition_event_rule_create_from_payload; + case LTTNG_CONDITION_TYPE_ON_EVENT: + create_from_payload = lttng_condition_on_event_create_from_payload; break; default: ERR("Attempted to create condition of unknown type (%i)", @@ -230,7 +230,7 @@ const char *lttng_condition_type_str(enum lttng_condition_type type) case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED: return "session rotation completed"; - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: return "event rule hit"; default: diff --git a/src/common/conditions/event-rule.c b/src/common/conditions/event-rule.c index a8fd7c912..b1219544a 100644 --- a/src/common/conditions/event-rule.c +++ b/src/common/conditions/event-rule.c @@ -24,42 +24,42 @@ #include #include -#define IS_EVENT_RULE_CONDITION(condition) \ +#define IS_ON_EVENT_CONDITION(condition) \ (lttng_condition_get_type(condition) == \ - LTTNG_CONDITION_TYPE_EVENT_RULE_HIT) + LTTNG_CONDITION_TYPE_ON_EVENT) -static bool is_event_rule_evaluation(const struct lttng_evaluation *evaluation) +static bool is_on_event_evaluation(const struct lttng_evaluation *evaluation) { enum lttng_condition_type type = lttng_evaluation_get_type(evaluation); - return type == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT; + return type == LTTNG_CONDITION_TYPE_ON_EVENT; } -static bool lttng_condition_event_rule_validate( +static bool lttng_condition_on_event_validate( const struct lttng_condition *condition); -static int lttng_condition_event_rule_serialize( +static int lttng_condition_on_event_serialize( const struct lttng_condition *condition, struct lttng_payload *payload); -static bool lttng_condition_event_rule_is_equal( +static bool lttng_condition_on_event_is_equal( const struct lttng_condition *_a, const struct lttng_condition *_b); -static void lttng_condition_event_rule_destroy( +static void lttng_condition_on_event_destroy( struct lttng_condition *condition); -static bool lttng_condition_event_rule_validate( +static bool lttng_condition_on_event_validate( const struct lttng_condition *condition) { bool valid = false; - struct lttng_condition_event_rule *event_rule; + struct lttng_condition_on_event *event_rule; if (!condition) { goto end; } event_rule = container_of( - condition, struct lttng_condition_event_rule, parent); + condition, struct lttng_condition_on_event, parent); if (!event_rule->rule) { - ERR("Invalid event rule condition: a rule must be set"); + ERR("Invalid on event condition: a rule must be set"); goto end; } @@ -245,22 +245,22 @@ end: static struct lttng_capture_descriptor * -lttng_condition_event_rule_get_internal_capture_descriptor_at_index( +lttng_condition_on_event_get_internal_capture_descriptor_at_index( const struct lttng_condition *condition, unsigned int index) { - const struct lttng_condition_event_rule *event_rule_cond = + const struct lttng_condition_on_event *on_event_cond = container_of(condition, - const struct lttng_condition_event_rule, + const struct lttng_condition_on_event, parent); struct lttng_capture_descriptor *desc = NULL; unsigned int count; enum lttng_condition_status status; - if (!condition || !IS_EVENT_RULE_CONDITION(condition)) { + if (!condition || !IS_ON_EVENT_CONDITION(condition)) { goto end; } - status = lttng_condition_event_rule_get_capture_descriptor_count( + status = lttng_condition_on_event_get_capture_descriptor_count( condition, &count); if (status != LTTNG_CONDITION_STATUS_OK) { goto end; @@ -271,44 +271,44 @@ lttng_condition_event_rule_get_internal_capture_descriptor_at_index( } desc = lttng_dynamic_pointer_array_get_pointer( - &event_rule_cond->capture_descriptors, index); + &on_event_cond->capture_descriptors, index); end: return desc; } -static int lttng_condition_event_rule_serialize( +static int lttng_condition_on_event_serialize( const struct lttng_condition *condition, struct lttng_payload *payload) { int ret; - struct lttng_condition_event_rule *event_rule; + struct lttng_condition_on_event *on_event_condition; enum lttng_condition_status status; /* Used for iteration and communication (size matters). */ uint32_t i, capture_descr_count; - if (!condition || !IS_EVENT_RULE_CONDITION(condition)) { + if (!condition || !IS_ON_EVENT_CONDITION(condition)) { ret = -1; goto end; } - DBG("Serializing event rule condition"); - event_rule = container_of( - condition, struct lttng_condition_event_rule, parent); + DBG("Serializing on event condition"); + on_event_condition = container_of( + condition, struct lttng_condition_on_event, parent); - DBG("Serializing event rule condition's event rule"); - ret = lttng_event_rule_serialize(event_rule->rule, payload); + DBG("Serializing on event condition's event rule"); + ret = lttng_event_rule_serialize(on_event_condition->rule, payload); if (ret) { goto end; } - status = lttng_condition_event_rule_get_capture_descriptor_count( + status = lttng_condition_on_event_get_capture_descriptor_count( condition, &capture_descr_count); if (status != LTTNG_CONDITION_STATUS_OK) { ret = -1; goto end; }; - DBG("Serializing event rule condition's capture descriptor count: %" PRIu32, + DBG("Serializing on event condition's capture descriptor count: %" PRIu32, capture_descr_count); ret = lttng_dynamic_buffer_append(&payload->buffer, &capture_descr_count, sizeof(capture_descr_count)); @@ -318,10 +318,10 @@ static int lttng_condition_event_rule_serialize( for (i = 0; i < capture_descr_count; i++) { const struct lttng_capture_descriptor *desc = - lttng_condition_event_rule_get_internal_capture_descriptor_at_index( + lttng_condition_on_event_get_internal_capture_descriptor_at_index( condition, i); - DBG("Serializing event rule condition's capture descriptor %" PRIu32, + DBG("Serializing on event condition's capture descriptor %" PRIu32, i); ret = serialize_event_expr(desc->event_expression, payload); if (ret) { @@ -344,13 +344,13 @@ bool capture_descriptors_are_equal( size_t i; enum lttng_condition_status status; - status = lttng_condition_event_rule_get_capture_descriptor_count( + status = lttng_condition_on_event_get_capture_descriptor_count( condition_a, &capture_descr_count_a); if (status != LTTNG_CONDITION_STATUS_OK) { goto not_equal; } - status = lttng_condition_event_rule_get_capture_descriptor_count( + status = lttng_condition_on_event_get_capture_descriptor_count( condition_b, &capture_descr_count_b); if (status != LTTNG_CONDITION_STATUS_OK) { goto not_equal; @@ -362,11 +362,11 @@ bool capture_descriptors_are_equal( for (i = 0; i < capture_descr_count_a; i++) { const struct lttng_event_expr *expr_a = - lttng_condition_event_rule_get_capture_descriptor_at_index( + lttng_condition_on_event_get_capture_descriptor_at_index( condition_a, i); const struct lttng_event_expr *expr_b = - lttng_condition_event_rule_get_capture_descriptor_at_index( + lttng_condition_on_event_get_capture_descriptor_at_index( condition_b, i); @@ -384,15 +384,15 @@ end: return is_equal; } -static bool lttng_condition_event_rule_is_equal( +static bool lttng_condition_on_event_is_equal( const struct lttng_condition *_a, const struct lttng_condition *_b) { bool is_equal = false; - struct lttng_condition_event_rule *a, *b; + struct lttng_condition_on_event *a, *b; - a = container_of(_a, struct lttng_condition_event_rule, parent); - b = container_of(_b, struct lttng_condition_event_rule, parent); + a = container_of(_a, struct lttng_condition_on_event, parent); + b = container_of(_b, struct lttng_condition_on_event, parent); /* Both event rules must be set or both must be unset. */ if ((a->rule && !b->rule) || (!a->rule && b->rule)) { @@ -411,17 +411,17 @@ end: return is_equal; } -static void lttng_condition_event_rule_destroy( +static void lttng_condition_on_event_destroy( struct lttng_condition *condition) { - struct lttng_condition_event_rule *event_rule; + struct lttng_condition_on_event *on_event_condition; - event_rule = container_of( - condition, struct lttng_condition_event_rule, parent); + on_event_condition = container_of( + condition, struct lttng_condition_on_event, parent); - lttng_event_rule_put(event_rule->rule); - lttng_dynamic_pointer_array_reset(&event_rule->capture_descriptors); - free(event_rule); + lttng_event_rule_put(on_event_condition->rule); + lttng_dynamic_pointer_array_reset(&on_event_condition->capture_descriptors); + free(on_event_condition); } static @@ -435,27 +435,27 @@ void destroy_capture_descriptor(void *ptr) free(desc); } -struct lttng_condition *lttng_condition_event_rule_create( +struct lttng_condition *lttng_condition_on_event_create( struct lttng_event_rule *rule) { struct lttng_condition *parent = NULL; - struct lttng_condition_event_rule *condition = NULL; + struct lttng_condition_on_event *condition = NULL; if (!rule) { goto end; } - condition = zmalloc(sizeof(struct lttng_condition_event_rule)); + condition = zmalloc(sizeof(struct lttng_condition_on_event)); if (!condition) { return NULL; } lttng_condition_init(&condition->parent, - LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); - condition->parent.validate = lttng_condition_event_rule_validate, - condition->parent.serialize = lttng_condition_event_rule_serialize, - condition->parent.equal = lttng_condition_event_rule_is_equal, - condition->parent.destroy = lttng_condition_event_rule_destroy, + LTTNG_CONDITION_TYPE_ON_EVENT); + condition->parent.validate = lttng_condition_on_event_validate, + condition->parent.serialize = lttng_condition_on_event_serialize, + condition->parent.equal = lttng_condition_on_event_is_equal, + condition->parent.destroy = lttng_condition_on_event_destroy, lttng_event_rule_get(rule); condition->rule = rule; @@ -625,7 +625,7 @@ end: } LTTNG_HIDDEN -ssize_t lttng_condition_event_rule_create_from_payload( +ssize_t lttng_condition_on_event_create_from_payload( struct lttng_payload_view *view, struct lttng_condition **_condition) { @@ -653,13 +653,12 @@ ssize_t lttng_condition_event_rule_create_from_payload( goto error; } - /* Create condition (no capture descriptors yet) at this point. */ - condition = lttng_condition_event_rule_create(event_rule); + /* Create condition (no capture descriptors yet) at this point */ + condition = lttng_condition_on_event_create(event_rule); if (!condition) { goto error; } - /* Capture descriptor count. */ assert(event_rule_length >= 0); offset += (size_t) event_rule_length; @@ -679,7 +678,7 @@ ssize_t lttng_condition_event_rule_create_from_payload( } /* Move ownership of `expr` to `condition`. */ - status = lttng_condition_event_rule_append_capture_descriptor( + status = lttng_condition_on_event_append_capture_descriptor( condition, expr); if (status != LTTNG_CONDITION_STATUS_OK) { /* `expr` not moved: destroy it. */ @@ -703,20 +702,20 @@ end: } LTTNG_HIDDEN -enum lttng_condition_status lttng_condition_event_rule_borrow_rule_mutable( +enum lttng_condition_status lttng_condition_on_event_borrow_rule_mutable( const struct lttng_condition *condition, struct lttng_event_rule **rule) { - struct lttng_condition_event_rule *event_rule; + struct lttng_condition_on_event *event_rule; enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK; - if (!condition || !IS_EVENT_RULE_CONDITION(condition) || !rule) { + if (!condition || !IS_ON_EVENT_CONDITION(condition) || !rule) { status = LTTNG_CONDITION_STATUS_INVALID; goto end; } event_rule = container_of( - condition, struct lttng_condition_event_rule, parent); + condition, struct lttng_condition_on_event, parent); if (!event_rule->rule) { status = LTTNG_CONDITION_STATUS_UNSET; goto end; @@ -727,13 +726,13 @@ end: return status; } -enum lttng_condition_status lttng_condition_event_rule_get_rule( +enum lttng_condition_status lttng_condition_on_event_get_rule( const struct lttng_condition *condition, const struct lttng_event_rule **rule) { struct lttng_event_rule *mutable_rule = NULL; const enum lttng_condition_status status = - lttng_condition_event_rule_borrow_rule_mutable( + lttng_condition_on_event_borrow_rule_mutable( condition, &mutable_rule); *rule = mutable_rule; @@ -741,26 +740,26 @@ enum lttng_condition_status lttng_condition_event_rule_get_rule( } enum lttng_condition_status -lttng_condition_event_rule_append_capture_descriptor( +lttng_condition_on_event_append_capture_descriptor( struct lttng_condition *condition, struct lttng_event_expr *expr) { int ret; enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK; - struct lttng_condition_event_rule *event_rule_cond = + struct lttng_condition_on_event *event_rule_cond = container_of(condition, - struct lttng_condition_event_rule, parent); + struct lttng_condition_on_event, parent); struct lttng_capture_descriptor *descriptor = NULL; const struct lttng_event_rule *rule = NULL; /* Only accept l-values. */ - if (!condition || !IS_EVENT_RULE_CONDITION(condition) || !expr || + if (!condition || !IS_ON_EVENT_CONDITION(condition) || !expr || !lttng_event_expr_is_lvalue(expr)) { status = LTTNG_CONDITION_STATUS_INVALID; goto end; } - status = lttng_condition_event_rule_get_rule(condition, &rule); + status = lttng_condition_on_event_get_rule(condition, &rule); if (status != LTTNG_CONDITION_STATUS_OK) { goto end; } @@ -807,35 +806,35 @@ end: } enum lttng_condition_status -lttng_condition_event_rule_get_capture_descriptor_count( +lttng_condition_on_event_get_capture_descriptor_count( const struct lttng_condition *condition, unsigned int *count) { enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK; - const struct lttng_condition_event_rule *event_rule_cond = + const struct lttng_condition_on_event *on_event_condition = container_of(condition, - const struct lttng_condition_event_rule, + const struct lttng_condition_on_event, parent); - if (!condition || !IS_EVENT_RULE_CONDITION(condition) || !count) { + if (!condition || !IS_ON_EVENT_CONDITION(condition) || !count) { status = LTTNG_CONDITION_STATUS_INVALID; goto end; } *count = lttng_dynamic_pointer_array_get_count( - &event_rule_cond->capture_descriptors); + &on_event_condition->capture_descriptors); end: return status; } const struct lttng_event_expr * -lttng_condition_event_rule_get_capture_descriptor_at_index( +lttng_condition_on_event_get_capture_descriptor_at_index( const struct lttng_condition *condition, unsigned int index) { const struct lttng_event_expr *expr = NULL; const struct lttng_capture_descriptor *desc = NULL; - desc = lttng_condition_event_rule_get_internal_capture_descriptor_at_index( + desc = lttng_condition_on_event_get_internal_capture_descriptor_at_index( condition, index); if (desc == NULL) { goto end; @@ -847,15 +846,15 @@ end: } LTTNG_HIDDEN -ssize_t lttng_evaluation_event_rule_create_from_payload( - const struct lttng_condition_event_rule *condition, +ssize_t lttng_evaluation_on_event_create_from_payload( + const struct lttng_condition_on_event *condition, struct lttng_payload_view *view, struct lttng_evaluation **_evaluation) { ssize_t ret, offset = 0; const char *trigger_name; struct lttng_evaluation *evaluation = NULL; - const struct lttng_evaluation_event_rule_comm *header; + const struct lttng_evaluation_on_event_comm *header; const struct lttng_payload_view header_view = lttng_payload_view_from_view( view, 0, sizeof(*header)); @@ -924,7 +923,7 @@ ssize_t lttng_evaluation_event_rule_create_from_payload( capture_payload = current_view.buffer.data; } - evaluation = lttng_evaluation_event_rule_create(condition, trigger_name, + evaluation = lttng_evaluation_on_event_create(condition, trigger_name, capture_payload, capture_payload_size, true); if (!evaluation) { ret = -1; @@ -941,17 +940,17 @@ error: return ret; } -static int lttng_evaluation_event_rule_serialize( +static int lttng_evaluation_on_event_serialize( const struct lttng_evaluation *evaluation, struct lttng_payload *payload) { int ret = 0; - struct lttng_evaluation_event_rule *hit; - struct lttng_evaluation_event_rule_comm comm; + struct lttng_evaluation_on_event *hit; + struct lttng_evaluation_on_event_comm comm; uint32_t capture_payload_size; hit = container_of( - evaluation, struct lttng_evaluation_event_rule, parent); + evaluation, struct lttng_evaluation_on_event, parent); assert(hit->name); comm.trigger_name_length = strlen(hit->name) + 1; @@ -1030,13 +1029,13 @@ end: return ret; } -static void lttng_evaluation_event_rule_destroy( +static void lttng_evaluation_on_event_destroy( struct lttng_evaluation *evaluation) { - struct lttng_evaluation_event_rule *hit; + struct lttng_evaluation_on_event *hit; hit = container_of( - evaluation, struct lttng_evaluation_event_rule, parent); + evaluation, struct lttng_evaluation_on_event, parent); free(hit->name); lttng_dynamic_buffer_reset(&hit->capture_payload); lttng_event_field_value_destroy(hit->captured_values); @@ -1221,7 +1220,7 @@ end: static struct lttng_event_field_value *event_field_value_from_capture_payload( - const struct lttng_condition_event_rule *condition, + const struct lttng_condition_on_event *condition, const char *capture_payload, size_t capture_payload_size) { struct lttng_event_field_value *ret = NULL; @@ -1282,7 +1281,7 @@ struct lttng_event_field_value *event_field_value_from_capture_payload( for (i = 0; i < count; i++) { const struct lttng_capture_descriptor *capture_descriptor = - lttng_condition_event_rule_get_internal_capture_descriptor_at_index( + lttng_condition_on_event_get_internal_capture_descriptor_at_index( &condition->parent, i); const msgpack_object *elem_obj; struct lttng_event_field_value *elem_field_val; @@ -1323,16 +1322,16 @@ end: } LTTNG_HIDDEN -struct lttng_evaluation *lttng_evaluation_event_rule_create( - const struct lttng_condition_event_rule *condition, +struct lttng_evaluation *lttng_evaluation_on_event_create( + const struct lttng_condition_on_event *condition, const char *trigger_name, const char *capture_payload, size_t capture_payload_size, bool decode_capture_payload) { - struct lttng_evaluation_event_rule *hit; + struct lttng_evaluation_on_event *hit; struct lttng_evaluation *evaluation = NULL; - hit = zmalloc(sizeof(struct lttng_evaluation_event_rule)); + hit = zmalloc(sizeof(struct lttng_evaluation_on_event)); if (!hit) { goto error; } @@ -1367,35 +1366,35 @@ struct lttng_evaluation *lttng_evaluation_event_rule_create( } } - hit->parent.type = LTTNG_CONDITION_TYPE_EVENT_RULE_HIT; - hit->parent.serialize = lttng_evaluation_event_rule_serialize; - hit->parent.destroy = lttng_evaluation_event_rule_destroy; + hit->parent.type = LTTNG_CONDITION_TYPE_ON_EVENT; + hit->parent.serialize = lttng_evaluation_on_event_serialize; + hit->parent.destroy = lttng_evaluation_on_event_destroy; evaluation = &hit->parent; hit = NULL; error: if (hit) { - lttng_evaluation_event_rule_destroy(&hit->parent); + lttng_evaluation_on_event_destroy(&hit->parent); } return evaluation; } -enum lttng_evaluation_status lttng_evaluation_event_rule_get_captured_values( +enum lttng_evaluation_status lttng_evaluation_on_event_get_captured_values( const struct lttng_evaluation *evaluation, const struct lttng_event_field_value **field_val) { - struct lttng_evaluation_event_rule *hit; + struct lttng_evaluation_on_event *hit; enum lttng_evaluation_status status = LTTNG_EVALUATION_STATUS_OK; - if (!evaluation || !is_event_rule_evaluation(evaluation) || + if (!evaluation || !is_on_event_evaluation(evaluation) || !field_val) { status = LTTNG_EVALUATION_STATUS_INVALID; goto end; } - hit = container_of(evaluation, struct lttng_evaluation_event_rule, + hit = container_of(evaluation, struct lttng_evaluation_on_event, parent); if (!hit->captured_values) { status = LTTNG_EVALUATION_STATUS_INVALID; @@ -1408,19 +1407,19 @@ end: return status; } -enum lttng_evaluation_status lttng_evaluation_event_rule_get_trigger_name( +enum lttng_evaluation_status lttng_evaluation_on_event_get_trigger_name( const struct lttng_evaluation *evaluation, const char **name) { - struct lttng_evaluation_event_rule *hit; + struct lttng_evaluation_on_event *hit; enum lttng_evaluation_status status = LTTNG_EVALUATION_STATUS_OK; - if (!evaluation || !is_event_rule_evaluation(evaluation) || !name) { + if (!evaluation || !is_on_event_evaluation(evaluation) || !name) { status = LTTNG_EVALUATION_STATUS_INVALID; goto end; } hit = container_of( - evaluation, struct lttng_evaluation_event_rule, parent); + evaluation, struct lttng_evaluation_on_event, parent); *name = hit->name; end: return status; @@ -1428,19 +1427,19 @@ end: LTTNG_HIDDEN enum lttng_error_code -lttng_condition_event_rule_generate_capture_descriptor_bytecode( +lttng_condition_on_event_generate_capture_descriptor_bytecode( struct lttng_condition *condition) { enum lttng_error_code ret; enum lttng_condition_status status; unsigned int capture_count, i; - if (!condition || !IS_EVENT_RULE_CONDITION(condition)) { + if (!condition || !IS_ON_EVENT_CONDITION(condition)) { ret = LTTNG_ERR_FATAL; goto end; } - status = lttng_condition_event_rule_get_capture_descriptor_count( + status = lttng_condition_on_event_get_capture_descriptor_count( condition, &capture_count); if (status != LTTNG_CONDITION_STATUS_OK) { ret = LTTNG_ERR_FATAL; @@ -1449,7 +1448,7 @@ lttng_condition_event_rule_generate_capture_descriptor_bytecode( for (i = 0; i < capture_count; i++) { struct lttng_capture_descriptor *local_capture_desc = - lttng_condition_event_rule_get_internal_capture_descriptor_at_index( + lttng_condition_on_event_get_internal_capture_descriptor_at_index( condition, i); if (local_capture_desc == NULL) { @@ -1476,23 +1475,23 @@ end: LTTNG_HIDDEN const struct lttng_bytecode * -lttng_condition_event_rule_get_capture_bytecode_at_index( +lttng_condition_on_event_get_capture_bytecode_at_index( const struct lttng_condition *condition, unsigned int index) { - const struct lttng_condition_event_rule *event_rule_cond = + const struct lttng_condition_on_event *event_rule_cond = container_of(condition, - const struct lttng_condition_event_rule, + const struct lttng_condition_on_event, parent); struct lttng_capture_descriptor *desc = NULL; struct lttng_bytecode *bytecode = NULL; unsigned int count; enum lttng_condition_status status; - if (!condition || !IS_EVENT_RULE_CONDITION(condition)) { + if (!condition || !IS_ON_EVENT_CONDITION(condition)) { goto end; } - status = lttng_condition_event_rule_get_capture_descriptor_count( + status = lttng_condition_on_event_get_capture_descriptor_count( condition, &count); if (status != LTTNG_CONDITION_STATUS_OK) { goto end; diff --git a/src/common/evaluation.c b/src/common/evaluation.c index 16c3ef39c..872875a9f 100644 --- a/src/common/evaluation.c +++ b/src/common/evaluation.c @@ -117,12 +117,12 @@ ssize_t lttng_evaluation_create_from_payload( } evaluation_size += ret; break; - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: assert(condition); - assert(condition->type == LTTNG_CONDITION_TYPE_EVENT_RULE_HIT); - ret = lttng_evaluation_event_rule_create_from_payload( + assert(condition->type == LTTNG_CONDITION_TYPE_ON_EVENT); + ret = lttng_evaluation_on_event_create_from_payload( container_of(condition, - const struct lttng_condition_event_rule, + const struct lttng_condition_on_event, parent), &evaluation_view, evaluation); if (ret < 0) { diff --git a/src/common/trigger.c b/src/common/trigger.c index 71162e79b..0fdcf4049 100644 --- a/src/common/trigger.c +++ b/src/common/trigger.c @@ -909,9 +909,9 @@ enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction( /* Apply to any domain. */ type = LTTNG_DOMAIN_NONE; break; - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: /* Return the domain of the event rule. */ - c_status = lttng_condition_event_rule_get_rule( + c_status = lttng_condition_on_event_get_rule( trigger->condition, &event_rule); assert(c_status == LTTNG_CONDITION_STATUS_OK); type = lttng_event_rule_get_domain_type(event_rule); @@ -949,11 +949,11 @@ enum lttng_error_code lttng_trigger_generate_bytecode( } switch (lttng_condition_get_type(condition)) { - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: { struct lttng_event_rule *event_rule; const enum lttng_condition_status condition_status = - lttng_condition_event_rule_borrow_rule_mutable( + lttng_condition_on_event_borrow_rule_mutable( condition, &event_rule); assert(condition_status == LTTNG_CONDITION_STATUS_OK); @@ -966,7 +966,7 @@ enum lttng_error_code lttng_trigger_generate_bytecode( } /* Generate the capture bytecode. */ - ret = lttng_condition_event_rule_generate_capture_descriptor_bytecode( + ret = lttng_condition_on_event_generate_capture_descriptor_bytecode( condition); if (ret != LTTNG_OK) { goto end; diff --git a/tests/regression/tools/notification/notification.c b/tests/regression/tools/notification/notification.c index b701681c0..9356d432e 100644 --- a/tests/regression/tools/notification/notification.c +++ b/tests/regression/tools/notification/notification.c @@ -589,12 +589,12 @@ static const char *get_notification_trigger_name( } switch (lttng_evaluation_get_type(evaluation)) { - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: { - status = lttng_evaluation_event_rule_get_trigger_name( + status = lttng_evaluation_on_event_get_trigger_name( evaluation, &name); if (status != LTTNG_EVALUATION_STATUS_OK) { - fail("lttng_evaluation_event_rule_get_trigger_name"); + fail("lttng_evaluation_on_event_get_trigger_name"); name = NULL; goto end; } @@ -1504,7 +1504,7 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern, ok(success, "Setting tracepoint event rule exclusions"); } - tmp_condition = lttng_condition_event_rule_create(event_rule); + tmp_condition = lttng_condition_on_event_create(event_rule); ok(tmp_condition, "Condition event rule object creation"); if (capture_desc_cb) { @@ -1877,7 +1877,7 @@ static void test_kprobe_event_rule_notification( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting kprobe event rule name: '%s'", trigger_name); - condition = lttng_condition_event_rule_create(event_rule); + condition = lttng_condition_on_event_create(event_rule); ok(condition, "Condition event rule object creation"); /* Register the trigger for condition. */ @@ -1991,7 +1991,7 @@ static void test_uprobe_event_rule_notification( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting uprobe event rule name: '%s'", trigger_name); - condition = lttng_condition_event_rule_create(event_rule); + condition = lttng_condition_on_event_create(event_rule); ok(condition, "Condition event rule object creation"); /* Register the trigger for condition. */ @@ -2083,7 +2083,7 @@ static void test_syscall_event_rule_notification( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting syscall event rule pattern: '%s'", syscall_name); - condition = lttng_condition_event_rule_create(event_rule); + condition = lttng_condition_on_event_create(event_rule); ok(condition, "Condition syscall event rule object creation"); /* Register the trigger for condition. */ @@ -2178,7 +2178,7 @@ static void test_syscall_event_rule_notification_filter( ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting filter: '%s'", filter_pattern); - condition = lttng_condition_event_rule_create(event_rule); + condition = lttng_condition_on_event_create(event_rule); ok(condition, "Condition event rule object creation"); /* Register the triggers for condition */ @@ -2293,7 +2293,7 @@ static int generate_capture_descr(struct lttng_condition *condition) goto end; } - cond_status = lttng_condition_event_rule_append_capture_descriptor( + cond_status = lttng_condition_on_event_append_capture_descriptor( condition, expr); if (cond_status != LTTNG_CONDITION_STATUS_OK) { fail("Failed to append capture descriptor"); @@ -2329,7 +2329,7 @@ static int validator_notification_trigger_capture( goto end; } - evaluation_status = lttng_evaluation_event_rule_get_captured_values( + evaluation_status = lttng_evaluation_on_event_get_captured_values( evaluation, &captured_fields); if (evaluation_status != LTTNG_EVALUATION_STATUS_OK) { diag("Failed to get event rule evaluation captured values: status = %d", diff --git a/tests/regression/tools/trigger/utils/notification-client.c b/tests/regression/tools/trigger/utils/notification-client.c index aecc478bd..0722945f7 100644 --- a/tests/regression/tools/trigger/utils/notification-client.c +++ b/tests/regression/tools/trigger/utils/notification-client.c @@ -69,13 +69,13 @@ static bool is_expected_trigger_name(const char *expected_trigger_name, case LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING: case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED: break; - case LTTNG_CONDITION_TYPE_EVENT_RULE_HIT: + case LTTNG_CONDITION_TYPE_ON_EVENT: { const char *trigger_name; enum lttng_evaluation_status evaluation_status; evaluation_status = - lttng_evaluation_event_rule_get_trigger_name( + lttng_evaluation_on_event_get_trigger_name( evaluation, &trigger_name); if (evaluation_status != LTTNG_EVALUATION_STATUS_OK) { fprintf(stderr, "Failed to get trigger name of event rule notification\n"); diff --git a/tests/unit/test_condition.c b/tests/unit/test_condition.c index 3b0144a0a..4f4818743 100644 --- a/tests/unit/test_condition.c +++ b/tests/unit/test_condition.c @@ -69,10 +69,10 @@ void test_condition_event_rule(void) "Setting exclusion pattern"); } - condition = lttng_condition_event_rule_create(tracepoint); + condition = lttng_condition_on_event_create(tracepoint); ok(condition, "Created condition"); - condition_status = lttng_condition_event_rule_get_rule( + condition_status = lttng_condition_on_event_get_rule( condition, &tracepoint_tmp); ok(condition_status == LTTNG_CONDITION_STATUS_OK, "Getting event rule from event rule condition");