From: Mathieu Desnoyers Date: Fri, 5 Nov 2021 14:16:10 +0000 (-0400) Subject: Refactoring: introduce lttng_event_enabler_create_{syscall,tracepoint}_events_if_missing X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b2f63bdecfbd2e389e2ebea6565482067386a873;p=lttng-modules.git Refactoring: introduce lttng_event_enabler_create_{syscall,tracepoint}_events_if_missing Signed-off-by: Mathieu Desnoyers Change-Id: I6b0a21efcb39119cffbf5b2929c87fb27f455a45 --- diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index 202427f2..ef1bed28 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -853,7 +853,7 @@ void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_des struct list_head *enabler_bytecode_runtime_head); #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) -int lttng_syscalls_register_event(struct lttng_event_enabler_common *event_enabler); +int lttng_event_enabler_create_syscall_events_if_missing(struct lttng_event_enabler_common *event_enabler); int lttng_syscall_filter_enable_event(struct lttng_kernel_event_common *event); int lttng_syscall_filter_disable_event(struct lttng_kernel_event_common *event); @@ -865,7 +865,7 @@ long lttng_syscall_table_get_active_mask(struct lttng_kernel_syscall_table *sysc void lttng_syscall_table_set_wildcard_all(struct lttng_event_enabler_common *event_enabler); #else -static inline int lttng_syscalls_register_event(struct lttng_event_enabler_common *event_enabler) +static inline int lttng_event_enabler_create_syscall_events_if_missing(struct lttng_event_enabler_common *event_enabler) { return -ENOSYS; } diff --git a/src/lttng-events.c b/src/lttng-events.c index 9d186116..b787b95c 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -2063,7 +2063,7 @@ struct lttng_enabler_ref *lttng_enabler_ref( } static -void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler_common *event_enabler) +void lttng_event_enabler_create_tracepoint_events_if_missing(struct lttng_event_enabler_common *event_enabler) { struct lttng_event_ht *events_ht = lttng_get_event_ht_from_enabler(event_enabler); struct lttng_kernel_probe_desc *probe_desc; @@ -2111,29 +2111,23 @@ void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler_common } } -static -void lttng_create_syscall_event_if_missing(struct lttng_event_enabler_common *event_enabler) -{ - int ret; - - ret = lttng_syscalls_register_event(event_enabler); - WARN_ON_ONCE(ret); -} - /* * Create event if it is missing and present in the list of tracepoint probes. * Should be called with sessions mutex held. */ static -void lttng_create_event_if_missing(struct lttng_event_enabler_common *event_enabler) +void lttng_event_enabler_create_events_if_missing(struct lttng_event_enabler_common *event_enabler) { + int ret; + switch (event_enabler->event_param.instrumentation) { case LTTNG_KERNEL_ABI_TRACEPOINT: - lttng_create_tracepoint_event_if_missing(event_enabler); + lttng_event_enabler_create_tracepoint_events_if_missing(event_enabler); break; case LTTNG_KERNEL_ABI_SYSCALL: - lttng_create_syscall_event_if_missing(event_enabler); + ret = lttng_event_enabler_create_syscall_events_if_missing(event_enabler); + WARN_ON_ONCE(ret); break; default: @@ -2191,7 +2185,7 @@ int lttng_event_enabler_ref_events(struct lttng_event_enabler_common *event_enab lttng_syscall_table_set_wildcard_all(event_enabler); /* First ensure that probe events are created for this enabler. */ - lttng_create_event_if_missing(event_enabler); + lttng_event_enabler_create_events_if_missing(event_enabler); /* Link the created event with its associated enabler. */ list_for_each_entry(event_priv, event_list_head, node) { diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index d26dd83f..27f9421b 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -751,7 +751,7 @@ int lttng_syscalls_populate_events(struct lttng_event_enabler_common *syscall_ev /* * Should be called with sessions lock held. */ -int lttng_syscalls_register_event(struct lttng_event_enabler_common *syscall_event_enabler) +int lttng_event_enabler_create_syscall_events_if_missing(struct lttng_event_enabler_common *syscall_event_enabler) { struct lttng_kernel_syscall_table *syscall_table = get_syscall_table_from_enabler(syscall_event_enabler); int ret;