Refactoring: syscalls: use common match functions
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 3 Nov 2021 16:08:22 +0000 (12:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 3 Nov 2021 16:08:22 +0000 (12:08 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If63da64ce79e75fe630ee032f587b41947e52d73

include/lttng/events-internal.h
src/lttng-events.c
src/lttng-syscalls.c

index 2bf0eb9a7c0d007147bb4f1699312fbe38112ff8..ee2a4ff26bd0c970bbd4d9a8e5e07a6f1ac566b9 100644 (file)
@@ -819,6 +819,11 @@ void lttng_event_enabler_destroy(struct lttng_event_enabler_common *event_enable
 
 int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
                struct lttng_event_enabler_common *enabler);
+bool lttng_event_enabler_match_event(struct lttng_event_enabler_common *event_enabler,
+               struct lttng_kernel_event_common *event);
+bool lttng_event_enabler_desc_match_event(struct lttng_event_enabler_common *event_enabler,
+               const struct lttng_kernel_event_desc *desc,
+               struct lttng_kernel_event_common *event);
 
 void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc,
                struct lttng_kernel_ctx *ctx,
index 6512dde8ce1fe2eb3b3f3c5b42e4a0ea5ff46d1d..c212ff3d6bcff092092a07a9fada60bee748d21c 100644 (file)
@@ -2034,7 +2034,6 @@ int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
        }
 }
 
-static
 bool lttng_event_enabler_match_event(struct lttng_event_enabler_common *event_enabler,
                struct lttng_kernel_event_common *event)
 {
@@ -2075,7 +2074,6 @@ bool lttng_event_enabler_match_event(struct lttng_event_enabler_common *event_en
        }
 }
 
-static
 bool lttng_event_enabler_desc_match_event(struct lttng_event_enabler_common *event_enabler,
                const struct lttng_kernel_event_desc *desc,
                struct lttng_kernel_event_common *event)
index 3208cd4d600696af741eafd6483bd3411f3a5cfa..2c3b8af028b609a2839423c4f253168098f1511b 100644 (file)
@@ -537,7 +537,6 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl
        enum sc_type type)
 {
        struct lttng_event_ht *events_ht = lttng_get_event_ht_from_enabler(&syscall_event_enabler->parent);
-       struct lttng_kernel_syscall_table *syscall_table = get_syscall_table_from_enabler(&syscall_event_enabler->parent);
        struct lttng_kernel_channel_buffer *chan = syscall_event_enabler->chan;
        unsigned int i;
 
@@ -563,8 +562,7 @@ int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *tabl
                 */
                head = utils_borrow_hash_table_bucket(events_ht->table, LTTNG_EVENT_HT_SIZE, desc->event_name);
                lttng_hlist_for_each_entry(event_priv, head, hlist_node) {
-                       if (event_priv->desc == desc
-                               && get_syscall_table_from_event(event_priv->pub) == syscall_table)
+                       if (lttng_event_enabler_desc_match_event(&syscall_event_enabler->parent, desc, event_priv->pub))
                                found = true;
                }
                if (found)
@@ -882,8 +880,7 @@ int create_unknown_event_notifier(
         */
        head = utils_borrow_hash_table_bucket(events_ht->table, LTTNG_EVENT_HT_SIZE, desc->event_name);
        lttng_hlist_for_each_entry(event_priv, head, hlist_node) {
-               if (event_priv->desc == desc &&
-                               event_priv->user_token == base_enabler->user_token)
+               if (lttng_event_enabler_desc_match_event(base_enabler, desc, event_priv->pub))
                        found = true;
        }
        if (found)
@@ -956,8 +953,7 @@ static int create_matching_event_notifiers(
                 */
                head = utils_borrow_hash_table_bucket(events_ht->table, LTTNG_EVENT_HT_SIZE, desc->event_name);
                lttng_hlist_for_each_entry(event_priv, head, hlist_node) {
-                       if (event_priv->desc == desc
-                               && event_priv->user_token == syscall_event_notifier_enabler->parent.user_token)
+                       if (lttng_event_enabler_desc_match_event(&syscall_event_notifier_enabler->parent, desc, event_priv->pub))
                                found = 1;
                }
                if (found)
This page took 0.029053 seconds and 4 git commands to generate.