* Should be called with sessions mutex held.
*/
static
-int lttng_event_enabler_ref_events(struct lttng_event_recorder_enabler *event_enabler)
+int lttng_event_enabler_ref_events(struct lttng_event_enabler_common *event_enabler)
{
- struct lttng_event_enabler_common *base_enabler = lttng_event_recorder_enabler_as_enabler(event_enabler);
- struct lttng_kernel_event_recorder_private *event_recorder_priv;
- struct list_head *event_list_head = lttng_get_event_list_head_from_enabler(&event_enabler->parent);
+ struct list_head *event_list_head = lttng_get_event_list_head_from_enabler(event_enabler);
+ struct lttng_kernel_event_common_private *event_priv;
- lttng_syscall_table_set_wildcard_all(base_enabler);
+ lttng_syscall_table_set_wildcard_all(event_enabler);
/* First ensure that probe events are created for this enabler. */
- lttng_create_event_if_missing(&event_enabler->parent);
-
- /* For each event matching event_enabler in session event list. */
- list_for_each_entry(event_recorder_priv, event_list_head, parent.node) {
- struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
- struct lttng_enabler_ref *enabler_ref;
-
- if (!lttng_event_enabler_match_event(&event_enabler->parent, &event_recorder->parent))
- continue;
- enabler_ref = lttng_enabler_ref(&event_recorder_priv->parent.enablers_ref_head,
- lttng_event_recorder_enabler_as_enabler(event_enabler));
- if (!enabler_ref) {
- /*
- * If no backward ref, create it.
- * Add backward ref from event to event_enabler.
- */
- enabler_ref = kzalloc(sizeof(*enabler_ref), GFP_KERNEL);
- if (!enabler_ref)
- return -ENOMEM;
- enabler_ref->ref = lttng_event_recorder_enabler_as_enabler(event_enabler);
- list_add(&enabler_ref->node,
- &event_recorder_priv->parent.enablers_ref_head);
- }
+ lttng_create_event_if_missing(event_enabler);
- lttng_event_enabler_init_event_filter(&event_enabler->parent, &event_recorder->parent);
- }
- return 0;
-}
-
-/*
- * Create event_notifiers associated with a event_notifier enabler (if not already present).
- */
-static
-int lttng_event_notifier_enabler_ref_event_notifiers(
- struct lttng_event_notifier_enabler *event_notifier_enabler)
-{
- struct lttng_kernel_event_notifier_private *event_notifier_priv;
- struct list_head *event_list_head = lttng_get_event_list_head_from_enabler(&event_notifier_enabler->parent);
-
- lttng_syscall_table_set_wildcard_all(&event_notifier_enabler->parent);
-
- /* First ensure that probe event_notifiers are created for this enabler. */
- lttng_create_event_if_missing(&event_notifier_enabler->parent);
-
- /* Link the created event_notifier with its associated enabler. */
- list_for_each_entry(event_notifier_priv, event_list_head, parent.node) {
- struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+ /* Link the created event with its associated enabler. */
+ list_for_each_entry(event_priv, event_list_head, node) {
+ struct lttng_kernel_event_common *event = event_priv->pub;
struct lttng_enabler_ref *enabler_ref;
- if (!lttng_event_enabler_match_event(&event_notifier_enabler->parent, &event_notifier->parent))
+ if (!lttng_event_enabler_match_event(event_enabler, event))
continue;
- enabler_ref = lttng_enabler_ref(&event_notifier_priv->parent.enablers_ref_head,
- lttng_event_notifier_enabler_as_enabler(event_notifier_enabler));
+ enabler_ref = lttng_enabler_ref(&event_priv->enablers_ref_head, event_enabler);
if (!enabler_ref) {
/*
* If no backward ref, create it.
if (!enabler_ref)
return -ENOMEM;
- enabler_ref->ref = lttng_event_notifier_enabler_as_enabler(
- event_notifier_enabler);
- list_add(&enabler_ref->node,
- &event_notifier_priv->parent.enablers_ref_head);
+ enabler_ref->ref = event_enabler;
+ list_add(&enabler_ref->node, &event_priv->enablers_ref_head);
}
- lttng_event_enabler_init_event_filter(&event_notifier_enabler->parent, &event_notifier->parent);
- lttng_event_enabler_init_event_capture(&event_notifier_enabler->parent, &event_notifier->parent);
+ lttng_event_enabler_init_event_filter(event_enabler, event);
+ lttng_event_enabler_init_event_capture(event_enabler, event);
}
return 0;
}
struct lttng_kernel_event_recorder_private *event_recorder_priv;
list_for_each_entry(event_enabler, &session->priv->enablers_head, node)
- lttng_event_enabler_ref_events(event_enabler);
+ lttng_event_enabler_ref_events(&event_enabler->parent);
/*
* For each event, if at least one of its enablers is enabled,
* and its channel and session transient states are enabled, we
struct lttng_kernel_event_notifier_private *event_notifier_priv;
list_for_each_entry(event_notifier_enabler, &event_notifier_group->enablers_head, node)
- lttng_event_notifier_enabler_ref_event_notifiers(event_notifier_enabler);
+ lttng_event_enabler_ref_events(&event_notifier_enabler->parent);
/*
* For each event_notifier, if at least one of its enablers is enabled,