Refactoring: introduce lttng_event_enabler_create_{syscall,tracepoint}_events_if_missing
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 5 Nov 2021 14:16:10 +0000 (10:16 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 5 Nov 2021 14:16:10 +0000 (10:16 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6b0a21efcb39119cffbf5b2929c87fb27f455a45

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

index 202427f2aa9482a8731b02ff3630e4eb2970821b..ef1bed28432008fed28c1d2dbc8541f482644a38 100644 (file)
@@ -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;
 }
index 9d1861160936638d44e7f9134c37639f4b9e0901..b787b95c25f0fcfb1600ea81bc06b9e370add4e0 100644 (file)
@@ -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) {
index d26dd83fc15763b5ecbc5970ad5c29c3bc66d186..27f9421ba7334ac190d6d8365422d2801bdc2bc5 100644 (file)
@@ -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;
This page took 0.029617 seconds and 4 git commands to generate.