Tracepoint API namespacing 'tracepoint_dlopen'
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 19 Apr 2021 20:26:35 +0000 (16:26 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Apr 2021 15:01:18 +0000 (11:01 -0400)
The ABI bump gives us the opportunity to namespace all public symbols
under the 'lttng_ust_' prefix. Namespace all API symbols and macros
under 'lttng_ust_' / 'LTTNG_UST_' and add compat macros to keep
compatibility with the previous API.

Change-Id: I3349b267ee0c1e119fed509f6e600bc8edb27f1c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/tracepoint-rcu.h
include/lttng/tracepoint.h

index 4528236814c777b0b563fef05bd1f9a0ba3eaf86..552af64ae8d1e438524e62791adb2ed03f574581 100644 (file)
 
 #else  /* _LGPL_SOURCE */
 
-#define tp_rcu_read_lock       tracepoint_dlopen_ptr->rcu_read_lock_sym
-#define tp_rcu_read_unlock     tracepoint_dlopen_ptr->rcu_read_unlock_sym
+#define tp_rcu_read_lock       lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym
+#define tp_rcu_read_unlock     lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym
 
 #define tp_rcu_dereference(p)                                             \
                URCU_FORCE_CAST(__typeof__(p),                             \
-                       tracepoint_dlopen_ptr->rcu_dereference_sym(URCU_FORCE_CAST(void *, p)))
+                       lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym(URCU_FORCE_CAST(void *, p)))
 
-#define TP_RCU_LINK_TEST()     (tracepoint_dlopen_ptr && tp_rcu_read_lock)
+#define TP_RCU_LINK_TEST()     (lttng_ust_tracepoint_dlopen_ptr && tp_rcu_read_lock)
 
 #endif /* _LGPL_SOURCE */
 
index 0f6b34ee39f400712f796d4099a99687164c05c4..5358f1cef0d65b593d79705efdc6c0efe19bb94e 100644 (file)
@@ -261,8 +261,8 @@ struct lttng_ust_tracepoint_dlopen {
        /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
-extern struct lttng_ust_tracepoint_dlopen tracepoint_dlopen;
-extern struct lttng_ust_tracepoint_dlopen *tracepoint_dlopen_ptr;
+extern struct lttng_ust_tracepoint_dlopen lttng_ust_tracepoint_dlopen;
+extern struct lttng_ust_tracepoint_dlopen *lttng_ust_tracepoint_dlopen_ptr;
 
 /*
  * These weak symbols, the constructor, and destructor take care of
@@ -273,7 +273,7 @@ int __tracepoint_registered
        __attribute__((weak, visibility("hidden")));
 int __tracepoint_ptrs_registered
        __attribute__((weak, visibility("hidden")));
-struct lttng_ust_tracepoint_dlopen tracepoint_dlopen
+struct lttng_ust_tracepoint_dlopen lttng_ust_tracepoint_dlopen
                __attribute__((weak, visibility("hidden"))) = {
        .struct_size = sizeof(struct lttng_ust_tracepoint_dlopen),
 };
@@ -287,7 +287,7 @@ struct lttng_ust_tracepoint_dlopen tracepoint_dlopen
  * scoping match that of the other weak hidden symbols found in this
  * header.
  */
-struct lttng_ust_tracepoint_dlopen *tracepoint_dlopen_ptr
+struct lttng_ust_tracepoint_dlopen *lttng_ust_tracepoint_dlopen_ptr
        __attribute__((weak, visibility("hidden")));
 
 /*
@@ -324,11 +324,11 @@ struct lttng_ust_tracepoint_destructors_syms *tracepoint_destructors_syms_ptr
 
 static inline void tracepoint_disable_destructors(void)
 {
-       if (!tracepoint_dlopen_ptr)
-               tracepoint_dlopen_ptr = &tracepoint_dlopen;
+       if (!lttng_ust_tracepoint_dlopen_ptr)
+               lttng_ust_tracepoint_dlopen_ptr = &lttng_ust_tracepoint_dlopen;
        if (!tracepoint_destructors_syms_ptr)
                tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms;
-       if (tracepoint_dlopen_ptr->liblttngust_handle
+       if (lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle
                        && tracepoint_destructors_syms_ptr->tracepoint_disable_destructors)
                tracepoint_destructors_syms_ptr->tracepoint_disable_destructors();
 }
@@ -340,26 +340,26 @@ __tracepoint__init_urcu_sym(void)
 static inline void
 __tracepoint__init_urcu_sym(void)
 {
-       if (!tracepoint_dlopen_ptr)
-               tracepoint_dlopen_ptr = &tracepoint_dlopen;
+       if (!lttng_ust_tracepoint_dlopen_ptr)
+               lttng_ust_tracepoint_dlopen_ptr = &lttng_ust_tracepoint_dlopen;
        /*
         * Symbols below are needed by tracepoint call sites and probe
         * providers.
         */
-       if (!tracepoint_dlopen_ptr->rcu_read_lock_sym)
-               tracepoint_dlopen_ptr->rcu_read_lock_sym =
+       if (!lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym)
+               lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym =
                        URCU_FORCE_CAST(void (*)(void),
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+                               dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
                                        "tp_rcu_read_lock"));
-       if (!tracepoint_dlopen_ptr->rcu_read_unlock_sym)
-               tracepoint_dlopen_ptr->rcu_read_unlock_sym =
+       if (!lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym)
+               lttng_ust_tracepoint_dlopen_ptr->rcu_read_unlock_sym =
                        URCU_FORCE_CAST(void (*)(void),
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+                               dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
                                        "tp_rcu_read_unlock"));
-       if (!tracepoint_dlopen_ptr->rcu_dereference_sym)
-               tracepoint_dlopen_ptr->rcu_dereference_sym =
+       if (!lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym)
+               lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym =
                        URCU_FORCE_CAST(void *(*)(void *p),
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+                               dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
                                        "tp_rcu_dereference_sym"));
 }
 #else
@@ -379,18 +379,18 @@ static void
 __tracepoints__init(void)
 {
        if (__tracepoint_registered++) {
-               if (!tracepoint_dlopen_ptr->liblttngust_handle)
+               if (!lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle)
                        return;
                __tracepoint__init_urcu_sym();
                return;
        }
 
-       if (!tracepoint_dlopen_ptr)
-               tracepoint_dlopen_ptr = &tracepoint_dlopen;
-       if (!tracepoint_dlopen_ptr->liblttngust_handle)
-               tracepoint_dlopen_ptr->liblttngust_handle =
+       if (!lttng_ust_tracepoint_dlopen_ptr)
+               lttng_ust_tracepoint_dlopen_ptr = &lttng_ust_tracepoint_dlopen;
+       if (!lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle)
+               lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle =
                        dlopen(LTTNG_UST_TRACEPOINT_LIB_SONAME, RTLD_NOW | RTLD_GLOBAL);
-       if (!tracepoint_dlopen_ptr->liblttngust_handle)
+       if (!lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle)
                return;
        __tracepoint__init_urcu_sym();
 }
@@ -405,11 +405,11 @@ __tracepoints__destroy(void)
 
        if (--__tracepoint_registered)
                return;
-       if (!tracepoint_dlopen_ptr)
-               tracepoint_dlopen_ptr = &tracepoint_dlopen;
+       if (!lttng_ust_tracepoint_dlopen_ptr)
+               lttng_ust_tracepoint_dlopen_ptr = &lttng_ust_tracepoint_dlopen;
        if (!tracepoint_destructors_syms_ptr)
                tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms;
-       if (!tracepoint_dlopen_ptr->liblttngust_handle)
+       if (!lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle)
                return;
        if (__tracepoint_ptrs_registered)
                return;
@@ -425,12 +425,12 @@ __tracepoints__destroy(void)
                 */
                return;
        }
-       ret = dlclose(tracepoint_dlopen_ptr->liblttngust_handle);
+       ret = dlclose(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle);
        if (ret) {
                fprintf(stderr, "Error (%d) in dlclose\n", ret);
                abort();
        }
-       memset(tracepoint_dlopen_ptr, 0, sizeof(*tracepoint_dlopen_ptr));
+       memset(lttng_ust_tracepoint_dlopen_ptr, 0, sizeof(*lttng_ust_tracepoint_dlopen_ptr));
 }
 
 #ifdef TRACEPOINT_DEFINE
@@ -500,34 +500,34 @@ __tracepoints__ptrs_init(void)
 {
        if (__tracepoint_ptrs_registered++)
                return;
-       if (!tracepoint_dlopen_ptr)
-               tracepoint_dlopen_ptr = &tracepoint_dlopen;
-       if (!tracepoint_dlopen_ptr->liblttngust_handle)
-               tracepoint_dlopen_ptr->liblttngust_handle =
+       if (!lttng_ust_tracepoint_dlopen_ptr)
+               lttng_ust_tracepoint_dlopen_ptr = &lttng_ust_tracepoint_dlopen;
+       if (!lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle)
+               lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle =
                        dlopen(LTTNG_UST_TRACEPOINT_LIB_SONAME, RTLD_NOW | RTLD_GLOBAL);
-       if (!tracepoint_dlopen_ptr->liblttngust_handle)
+       if (!lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle)
                return;
        if (!tracepoint_destructors_syms_ptr)
                tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms;
-       tracepoint_dlopen_ptr->tracepoint_register_lib =
+       lttng_ust_tracepoint_dlopen_ptr->tracepoint_register_lib =
                URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint * const *, int),
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+                               dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
                                        "tracepoint_register_lib"));
-       tracepoint_dlopen_ptr->tracepoint_unregister_lib =
+       lttng_ust_tracepoint_dlopen_ptr->tracepoint_unregister_lib =
                URCU_FORCE_CAST(int (*)(struct lttng_ust_tracepoint * const *),
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+                               dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
                                        "tracepoint_unregister_lib"));
        tracepoint_destructors_syms_ptr->tracepoint_disable_destructors =
                URCU_FORCE_CAST(void (*)(void),
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+                               dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
                                        "tp_disable_destructors"));
        tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state =
                URCU_FORCE_CAST(int (*)(void),
-                               dlsym(tracepoint_dlopen_ptr->liblttngust_handle,
+                               dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
                                        "tp_get_destructors_state"));
        __tracepoint__init_urcu_sym();
-       if (tracepoint_dlopen_ptr->tracepoint_register_lib) {
-               tracepoint_dlopen_ptr->tracepoint_register_lib(__start___tracepoints_ptrs,
+       if (lttng_ust_tracepoint_dlopen_ptr->tracepoint_register_lib) {
+               lttng_ust_tracepoint_dlopen_ptr->tracepoint_register_lib(__start___tracepoints_ptrs,
                                __stop___tracepoints_ptrs -
                                __start___tracepoints_ptrs);
        }
@@ -543,22 +543,22 @@ __tracepoints__ptrs_destroy(void)
 
        if (--__tracepoint_ptrs_registered)
                return;
-       if (!tracepoint_dlopen_ptr)
-               tracepoint_dlopen_ptr = &tracepoint_dlopen;
+       if (!lttng_ust_tracepoint_dlopen_ptr)
+               lttng_ust_tracepoint_dlopen_ptr = &lttng_ust_tracepoint_dlopen;
        if (!tracepoint_destructors_syms_ptr)
                tracepoint_destructors_syms_ptr = &tracepoint_destructors_syms;
-       if (tracepoint_dlopen_ptr->tracepoint_unregister_lib)
-               tracepoint_dlopen_ptr->tracepoint_unregister_lib(__start___tracepoints_ptrs);
-       if (tracepoint_dlopen_ptr->liblttngust_handle
+       if (lttng_ust_tracepoint_dlopen_ptr->tracepoint_unregister_lib)
+               lttng_ust_tracepoint_dlopen_ptr->tracepoint_unregister_lib(__start___tracepoints_ptrs);
+       if (lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle
                        && tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state
                        && tracepoint_destructors_syms_ptr->tracepoint_get_destructors_state()
                        && !__tracepoint_ptrs_registered) {
-               ret = dlclose(tracepoint_dlopen_ptr->liblttngust_handle);
+               ret = dlclose(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle);
                if (ret) {
                        fprintf(stderr, "Error (%d) in dlclose\n", ret);
                        abort();
                }
-               memset(tracepoint_dlopen_ptr, 0, sizeof(*tracepoint_dlopen_ptr));
+               memset(lttng_ust_tracepoint_dlopen_ptr, 0, sizeof(*lttng_ust_tracepoint_dlopen_ptr));
        }
 }
 
This page took 0.033569 seconds and 4 git commands to generate.