From: Mathieu Desnoyers Date: Wed, 3 Nov 2021 16:08:22 +0000 (-0400) Subject: Refactoring: syscalls: use common match functions X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=adfdce76604f5324d88fd888fa5236a3bacf056f;p=lttng-modules.git Refactoring: syscalls: use common match functions Signed-off-by: Mathieu Desnoyers Change-Id: If63da64ce79e75fe630ee032f587b41947e52d73 --- diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index 2bf0eb9a..ee2a4ff2 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -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, diff --git a/src/lttng-events.c b/src/lttng-events.c index 6512dde8..c212ff3d 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -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) diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index 3208cd4d..2c3b8af0 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -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)