Refactoring: introduce lttng_event_enabler_init_event_filter
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 3 Nov 2021 19:22:28 +0000 (15:22 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 3 Nov 2021 19:23:08 +0000 (15:23 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9eff68c72e55cc8a92a821043e7428220c082f6e

src/lttng-events.c

index a6a7904e2e2133cec6b060372dbbe704971cbad7..8839c1e8ae6cc906d73860ad25d9cde5b0273ad1 100644 (file)
@@ -2222,6 +2222,15 @@ void lttng_create_event_if_missing(struct lttng_event_enabler_common *event_enab
        }
 }
 
+static
+void lttng_event_enabler_init_event_filter(struct lttng_event_enabler_common *event_enabler,
+               struct lttng_kernel_event_common *event)
+{
+       /* Link filter bytecodes if not linked yet. */
+       lttng_enabler_link_bytecode(event->priv->desc, lttng_static_ctx,
+               &event->priv->filter_bytecode_runtime_head, &event_enabler->filter_bytecode_head);
+}
+
 static
 void lttng_event_enabler_init_event_capture(struct lttng_event_enabler_common *event_enabler,
                struct lttng_kernel_event_common *event)
@@ -2287,13 +2296,7 @@ int lttng_event_enabler_ref_events(struct lttng_event_recorder_enabler *event_en
                                &event_recorder_priv->parent.enablers_ref_head);
                }
 
-               /*
-                * Link filter bytecodes if not linked yet.
-                */
-               lttng_enabler_link_bytecode(event_recorder_priv->parent.desc,
-                       lttng_static_ctx,
-                       &event_recorder_priv->parent.filter_bytecode_runtime_head,
-                       &lttng_event_recorder_enabler_as_enabler(event_enabler)->filter_bytecode_head);
+               lttng_event_enabler_init_event_filter(&event_enabler->parent, &event_recorder->parent);
        }
        return 0;
 }
@@ -2338,13 +2341,7 @@ int lttng_event_notifier_enabler_ref_event_notifiers(
                                &event_notifier_priv->parent.enablers_ref_head);
                }
 
-               /*
-                * Link filter bytecodes if not linked yet.
-                */
-               lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
-                       lttng_static_ctx, &event_notifier_priv->parent.filter_bytecode_runtime_head,
-                       &lttng_event_notifier_enabler_as_enabler(event_notifier_enabler)->filter_bytecode_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);
        }
        return 0;
This page took 0.031404 seconds and 4 git commands to generate.