Refactoring: introduce lttng_event_enabler_init_event_capture
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 8 Nov 2021 17:16:27 +0000 (12:16 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Jul 2024 15:39:52 +0000 (11:39 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I777d917a7458fcacb2e6eb1e96544694d17a8045

src/lib/lttng-ust/lttng-events.c

index d8bf0d79d4a0220a59abdc923cfc3635ce81cac4..70049e3b2e97c1d307ff0eb94c334d59dd9cd237 100644 (file)
@@ -1548,6 +1548,31 @@ void lttng_event_enabler_init_event_filter(struct lttng_event_enabler_common *ev
        }
 }
 
+static
+void lttng_event_enabler_init_event_capture(struct lttng_event_enabler_common *event_enabler,
+               struct lttng_ust_event_common *event)
+{
+       switch (event_enabler->enabler_type) {
+       case LTTNG_EVENT_ENABLER_TYPE_RECORDER:         /* Fall-through */
+       case LTTNG_EVENT_ENABLER_TYPE_COUNTER:
+               break;
+       case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
+       {
+               struct lttng_event_notifier_enabler *event_notifier_enabler =
+                       caa_container_of(event_enabler, struct lttng_event_notifier_enabler, parent);
+               struct lttng_ust_event_notifier *event_notifier = event->child;
+
+               lttng_enabler_link_bytecode(event->priv->desc, &event_notifier_enabler->group->ctx,
+                       &event_notifier->priv->capture_bytecode_runtime_head,
+                       &event_notifier_enabler->capture_bytecode_head);
+               event_notifier->priv->num_captures = event_notifier_enabler->num_captures;
+               break;
+       }
+       default:
+               WARN_ON_ONCE(1);
+       }
+}
+
 /*
  * Create events associated with an event enabler (if not already present),
  * and add backward reference from the event to the enabler.
@@ -2138,15 +2163,7 @@ int lttng_event_notifier_enabler_ref_event_notifiers(
 
 
                lttng_event_enabler_init_event_filter(&event_notifier_enabler->parent, event_notifier_priv->parent.pub);
-
-               /*
-                * Link capture bytecodes if not linked yet.
-                */
-               lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
-                       &event_notifier_group->ctx, &event_notifier_priv->capture_bytecode_runtime_head,
-                       &event_notifier_enabler->capture_bytecode_head);
-
-               event_notifier_priv->num_captures = event_notifier_enabler->num_captures;
+               lttng_event_enabler_init_event_capture(&event_notifier_enabler->parent, event_notifier_priv->parent.pub);
        }
 end:
        return 0;
This page took 0.027747 seconds and 4 git commands to generate.