Refactoring: combine common code into lttng_event_enabler_attach_filter_bytecode
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 8 Nov 2021 16:32:04 +0000 (11:32 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 12 Jul 2024 15:39:51 +0000 (11:39 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I130317af55aaef3273079450b56d4218e878324e

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

index ea9851278b35bd2805ea8b644258ff9cdd1ef908..0f56f9409717fa29ac5aaf9e6aef730a1a43d452 100644 (file)
@@ -55,11 +55,11 @@ int lttng_event_enabler_disable(struct lttng_event_enabler_common *enabler)
        __attribute__((visibility("hidden")));
 
 /*
- * Attach filter bytecode program to `struct lttng_event_enabler` and all
+ * Attach filter bytecode program to `struct lttng_event_enabler_common` and all
  * events related to this enabler.
  */
 int lttng_event_enabler_attach_filter_bytecode(
-               struct lttng_event_enabler_session_common *enabler,
+               struct lttng_event_enabler_common *enabler,
                struct lttng_ust_bytecode_node **bytecode)
        __attribute__((visibility("hidden")));
 
@@ -121,15 +121,6 @@ struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
                struct lttng_ust_abi_event_notifier *event_notifier_param)
        __attribute__((visibility("hidden")));
 
-/*
- * Attach filter bytecode program to `struct lttng_event_notifier_enabler` and
- * all event notifiers related to this enabler.
- */
-int lttng_event_notifier_enabler_attach_filter_bytecode(
-               struct lttng_event_notifier_enabler *event_notifier_enabler,
-               struct lttng_ust_bytecode_node **bytecode)
-       __attribute__((visibility("hidden")));
-
 /*
  * Attach capture bytecode program to `struct lttng_event_notifier_enabler` and
  * all event_notifiers related to this enabler.
index 25b86fbf7c5945651fe5abb2059af6ee64582eea..396ac9a06ce28d1f8f963743c7a2fa450a72b97f 100644 (file)
@@ -1808,22 +1808,14 @@ int lttng_event_enabler_disable(struct lttng_event_enabler_common *event_enabler
        return 0;
 }
 
-static
-void _lttng_enabler_attach_filter_bytecode(struct lttng_event_enabler_common *enabler,
+int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler_common *event_enabler,
                struct lttng_ust_bytecode_node **bytecode)
 {
-       (*bytecode)->enabler = enabler;
-       cds_list_add_tail(&(*bytecode)->node, &enabler->filter_bytecode_head);
+       (*bytecode)->enabler = event_enabler;
+       cds_list_add_tail(&(*bytecode)->node, &event_enabler->filter_bytecode_head);
        /* Take ownership of bytecode */
        *bytecode = NULL;
-}
-
-int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler_session_common *event_enabler,
-               struct lttng_ust_bytecode_node **bytecode)
-{
-       _lttng_enabler_attach_filter_bytecode(&event_enabler->parent, bytecode);
-
-       lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+       lttng_event_enabler_sync(event_enabler);
        return 0;
 }
 
@@ -1846,18 +1838,6 @@ int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler_session_comm
        return 0;
 }
 
-int lttng_event_notifier_enabler_attach_filter_bytecode(
-               struct lttng_event_notifier_enabler *event_notifier_enabler,
-               struct lttng_ust_bytecode_node **bytecode)
-{
-       _lttng_enabler_attach_filter_bytecode(
-               lttng_event_notifier_enabler_as_enabler(event_notifier_enabler),
-               bytecode);
-
-       lttng_event_notifier_group_sync_enablers(event_notifier_enabler->group);
-       return 0;
-}
-
 int lttng_event_notifier_enabler_attach_capture_bytecode(
                struct lttng_event_notifier_enabler *event_notifier_enabler,
                struct lttng_ust_bytecode_node **bytecode)
index 390e291ff5acf8a5a7db37be2abbf4e4ec137a98..b10541ab345308c3ae3bb48ded3f71313ba56b01 100644 (file)
@@ -858,8 +858,8 @@ long lttng_event_notifier_enabler_cmd(int objd, unsigned int cmd, unsigned long
        struct lttng_event_notifier_enabler *event_notifier_enabler = objd_private(objd);
        switch (cmd) {
        case LTTNG_UST_ABI_FILTER:
-               return lttng_event_notifier_enabler_attach_filter_bytecode(
-                       event_notifier_enabler,
+               return lttng_event_enabler_attach_filter_bytecode(
+                       &event_notifier_enabler->parent,
                        (struct lttng_ust_bytecode_node **) arg);
        case LTTNG_UST_ABI_EXCLUSION:
                return lttng_event_notifier_enabler_attach_exclusion(event_notifier_enabler,
@@ -1776,7 +1776,7 @@ long lttng_event_enabler_cmd(int objd, unsigned int cmd, unsigned long arg,
        {
                int ret;
 
-               ret = lttng_event_enabler_attach_filter_bytecode(enabler,
+               ret = lttng_event_enabler_attach_filter_bytecode(&enabler->parent,
                                (struct lttng_ust_bytecode_node **) arg);
                if (ret)
                        return ret;
This page took 0.02761 seconds and 4 git commands to generate.