Tracepoint API namespacing ctf_string
[lttng-ust.git] / include / lttng / tracepoint.h
index b02ec3301893d563b0ca17bf1ddf4279a623ddae..9ec52ef907880f3304c28e6cd8b1b4ba83500ae6 100644 (file)
@@ -191,10 +191,10 @@ void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__
 {                                                                                      \
        struct lttng_ust_tracepoint_probe *__tp_probe;                                  \
                                                                                        \
-       if (caa_unlikely(!TP_RCU_LINK_TEST()))                                          \
+       if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST()))                                                \
                return;                                                                 \
-       tp_rcu_read_lock();                                                             \
-       __tp_probe = tp_rcu_dereference(lttng_ust_tracepoint_##_provider##___##_name.probes);   \
+       lttng_ust_tp_rcu_read_lock();                                                           \
+       __tp_probe = lttng_ust_tp_rcu_dereference(lttng_ust_tracepoint_##_provider##___##_name.probes); \
        if (caa_unlikely(!__tp_probe))                                                  \
                goto end;                                                               \
        do {                                                                            \
@@ -205,7 +205,7 @@ void lttng_ust_tracepoint_cb_##_provider##___##_name(LTTNG_UST__TP_ARGS_PROTO(__
                                (LTTNG_UST__TP_ARGS_DATA_VAR(__VA_ARGS__));                     \
        } while ((++__tp_probe)->func);                                                 \
 end:                                                                                   \
-       tp_rcu_read_unlock();                                                           \
+       lttng_ust_tp_rcu_read_unlock();                                                         \
 }                                                                                      \
 static inline                                                                          \
 void lttng_ust_tracepoint_register_##_provider##___##_name(char *provider_name, char *event_name, \
@@ -350,17 +350,17 @@ lttng_ust_tracepoint__init_urcu_sym(void)
                lttng_ust_tracepoint_dlopen_ptr->rcu_read_lock_sym =
                        URCU_FORCE_CAST(void (*)(void),
                                dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
-                                       "tp_rcu_read_lock"));
+                                       "lttng_ust_tp_rcu_read_lock"));
        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(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
-                                       "tp_rcu_read_unlock"));
+                                       "lttng_ust_tp_rcu_read_unlock"));
        if (!lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym)
                lttng_ust_tracepoint_dlopen_ptr->rcu_dereference_sym =
                        URCU_FORCE_CAST(void *(*)(void *p),
                                dlsym(lttng_ust_tracepoint_dlopen_ptr->liblttngust_handle,
-                                       "tp_rcu_dereference_sym"));
+                                       "lttng_ust_tp_rcu_dereference_sym"));
 }
 #else
 static inline void
@@ -433,7 +433,13 @@ lttng_ust__tracepoints__destroy(void)
        memset(lttng_ust_tracepoint_dlopen_ptr, 0, sizeof(*lttng_ust_tracepoint_dlopen_ptr));
 }
 
-#ifdef TRACEPOINT_DEFINE
+#if LTTNG_UST_COMPAT_API(0)
+# if defined(TRACEPOINT_DEFINE) && !defined(LTTNG_UST_TRACEPOINT_DEFINE)
+#  define LTTNG_UST_TRACEPOINT_DEFINE
+# endif
+#endif /* #if LTTNG_UST_COMPAT_API(0) */
+
+#ifdef LTTNG_UST_TRACEPOINT_DEFINE
 
 /*
  * These weak symbols, the constructor, and destructor take care of
@@ -569,11 +575,11 @@ lttng_ust__tracepoints__ptrs_destroy(void)
        }
 }
 
-#else /* TRACEPOINT_DEFINE */
+#else /* LTTNG_UST_TRACEPOINT_DEFINE */
 
 #define LTTNG_UST__DEFINE_TRACEPOINT(_provider, _name, _args)
 
-#endif /* #else TRACEPOINT_DEFINE */
+#endif /* #else LTTNG_UST_TRACEPOINT_DEFINE */
 
 #if LTTNG_UST_COMPAT_API(0)
 #define tracepoint                     lttng_ust_tracepoint
@@ -581,6 +587,40 @@ lttng_ust__tracepoints__ptrs_destroy(void)
 #define tracepoint_enabled             lttng_ust_tracepoint_enabled
 #define TP_ARGS                                LTTNG_UST_TP_ARGS
 #define TP_FIELDS                      LTTNG_UST_TP_FIELDS
+
+#define ctf_integer                    lttng_ust_field_integer
+#define ctf_integer_hex                        lttng_ust_field_integer_hex
+#define ctf_integer_network            lttng_ust_field_integer_network
+#define ctf_integer_network_hex                lttng_ust_field_integer_network_hex
+#define ctf_integer_nowrite            lttng_ust_field_integer_nowrite
+
+#define ctf_float                      lttng_ust_field_float
+#define ctf_float_nowrite              lttng_ust_field_float_nowrite
+
+#define ctf_array                      lttng_ust_field_array
+#define ctf_array_hex                  lttng_ust_field_array_hex
+#define ctf_array_network              lttng_ust_field_array_network
+#define ctf_array_network_hex          lttng_ust_field_array_network_hex
+#define ctf_array_text                 lttng_ust_field_array_text
+#define ctf_array_nowrite              lttng_ust_field_array_nowrite
+#define ctf_array_nowrite_hex          lttng_ust_field_array_nowrite_hex
+#define ctf_array_network_nowrite      lttng_ust_field_array_network_nowrite
+#define ctf_array_network_nowrite_hex  lttng_ust_field_array_network_nowrite_hex
+#define ctf_array_text_nowrite         lttng_ust_field_array_text_nowrite
+
+#define ctf_sequence                   lttng_ust_field_sequence
+#define ctf_sequence_hex               lttng_ust_field_sequence_hex
+#define ctf_sequence_network           lttng_ust_field_sequence_network
+#define ctf_sequence_network_hex       lttng_ust_field_sequence_network_hex
+#define ctf_sequence_text              lttng_ust_field_sequence_text
+#define ctf_sequence_nowrite           lttng_ust_field_sequence_nowrite
+#define ctf_sequence_nowrite_hex       lttng_ust_field_sequence_nowrite_hex
+#define ctf_sequence_network_nowrite   lttng_ust_field_sequence_network_nowrite
+#define ctf_sequence_network_nowrite_hex lttng_ust_field_sequence_network_nowrite_hex
+#define ctf_sequence_text_nowrite      lttng_ust_field_sequence_text_nowrite
+
+#define ctf_string                     lttng_ust_field_string
+#define ctf_string_nowrite             lttng_ust_field_string_nowrite
 #endif /* #if LTTNG_UST_COMPAT_API(0) */
 
 #ifdef __cplusplus
@@ -591,7 +631,7 @@ lttng_ust__tracepoints__ptrs_destroy(void)
 
 /* The following declarations must be outside re-inclusion protection. */
 
-#ifndef TRACEPOINT_ENUM
+#ifndef LTTNG_UST_TRACEPOINT_ENUM
 
 /*
  * Tracepoint Enumerations
@@ -602,8 +642,8 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  *
  * An example:
  *
- * TRACEPOINT_ENUM(someproject_component, enumname,
- *     TP_ENUM_VALUES(
+ * LTTNG_UST_TRACEPOINT_ENUM(someproject_component, enumname,
+ *     LTTNG_UST_TP_ENUM_VALUES(
  *             ctf_enum_value("even", 0)
  *             ctf_enum_value("uneven", 1)
  *             ctf_enum_range("twoto4", 2, 4)
@@ -613,7 +653,7 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  *
  * Where "someproject_component" is the name of the component this enumeration
  * belongs to and "enumname" identifies this enumeration. Inside the
- * TP_ENUM_VALUES macro is the actual mapping. Each string value can map
+ * LTTNG_UST_TP_ENUM_VALUES macro is the actual mapping. Each string value can map
  * to either a single value with ctf_enum_value or a range of values
  * with ctf_enum_range.
  *
@@ -626,14 +666,18 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  * ctf_enum(someproject_component, enumname, enumtype, enumfield, enumval)
  *
  * Where "someproject_component" and "enumname" match those in the
- * TRACEPOINT_ENUM, "enumtype" is a signed or unsigned integer type
+ * LTTNG_UST_TRACEPOINT_ENUM, "enumtype" is a signed or unsigned integer type
  * backing the enumeration, "enumfield" is the name of the field and
  * "enumval" is the value.
  */
 
-#define TRACEPOINT_ENUM(provider, name, values)
+#define LTTNG_UST_TRACEPOINT_ENUM(provider, name, values)
+
+#if LTTNG_UST_COMPAT_API(0)
+#define TRACEPOINT_ENUM                LTTNG_UST_TRACEPOINT_ENUM
+#endif /* #if LTTNG_UST_COMPAT_API(0) */
 
-#endif /* #ifndef TRACEPOINT_ENUM */
+#endif /* #ifndef LTTNG_UST_TRACEPOINT_ENUM */
 
 #ifndef LTTNG_UST_TRACEPOINT_EVENT
 
@@ -653,24 +697,24 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  *
  *     LTTNG_UST_TP_FIELDS(
  *         * Integer, printed in base 10 *
- *         ctf_integer(int, field_a, arg0)
+ *         lttng_ust_field_integer(int, field_a, arg0)
  *
  *         * Integer, printed with 0x base 16 *
- *         ctf_integer_hex(unsigned long, field_d, arg1)
+ *         lttng_ust_field_integer_hex(unsigned long, field_d, arg1)
  *
  *         * Enumeration *
  *         ctf_enum(someproject_component, enum_name, int, field_e, arg0)
  *
  *         * Array Sequence, printed as UTF8-encoded array of bytes *
- *         ctf_array_text(char, field_b, string, FIXED_LEN)
- *         ctf_sequence_text(char, field_c, string, size_t, strlen)
+ *         lttng_ust_field_array_text(char, field_b, string, FIXED_LEN)
+ *         lttng_ust_field_sequence_text(char, field_c, string, size_t, strlen)
  *
  *         * String, printed as UTF8-encoded string *
- *         ctf_string(field_e, string)
+ *         lttng_ust_field_string(field_e, string)
  *
  *         * Array sequence of signed integer values *
- *         ctf_array(long, field_f, arg4, FIXED_LEN4)
- *         ctf_sequence(long, field_g, arg4, size_t, arg4_len)
+ *         lttng_ust_field_array(long, field_f, arg4, FIXED_LEN4)
+ *         lttng_ust_field_sequence(long, field_g, arg4, size_t, arg4_len)
  *     )
  * )
  *
@@ -737,7 +781,7 @@ lttng_ust__tracepoints__ptrs_destroy(void)
 
 #endif /* #ifndef LTTNG_UST_TRACEPOINT_EVENT */
 
-#ifndef TRACEPOINT_LOGLEVEL
+#ifndef LTTNG_UST_TRACEPOINT_LOGLEVEL
 
 /*
  * Tracepoint Loglevels
@@ -751,88 +795,112 @@ lttng_ust__tracepoints__ptrs_destroy(void)
  * semantic. Loglevels 7 through 13 offer more fine-grained selection of
  * debug information.
  *
- * TRACE_EMERG           0
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG           0
  * system is unusable
  *
- * TRACE_ALERT           1
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT           1
  * action must be taken immediately
  *
- * TRACE_CRIT            2
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT            2
  * critical conditions
  *
- * TRACE_ERR             3
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR             3
  * error conditions
  *
- * TRACE_WARNING         4
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING         4
  * warning conditions
  *
- * TRACE_NOTICE          5
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE          5
  * normal, but significant, condition
  *
- * TRACE_INFO            6
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO            6
  * informational message
  *
- * TRACE_DEBUG_SYSTEM    7
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM    7
  * debug information with system-level scope (set of programs)
  *
- * TRACE_DEBUG_PROGRAM   8
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM   8
  * debug information with program-level scope (set of processes)
  *
- * TRACE_DEBUG_PROCESS   9
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS   9
  * debug information with process-level scope (set of modules)
  *
- * TRACE_DEBUG_MODULE    10
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE    10
  * debug information with module (executable/library) scope (set of units)
  *
- * TRACE_DEBUG_UNIT      11
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT      11
  * debug information with compilation unit scope (set of functions)
  *
- * TRACE_DEBUG_FUNCTION  12
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION  12
  * debug information with function-level scope
  *
- * TRACE_DEBUG_LINE      13
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE      13
  * debug information with line-level scope (LTTNG_UST_TRACEPOINT_EVENT default)
  *
- * TRACE_DEBUG           14
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG           14
  * debug-level message
  *
  * Declare tracepoint loglevels for tracepoints. A LTTNG_UST_TRACEPOINT_EVENT
- * should be declared prior to the the TRACEPOINT_LOGLEVEL for a given
+ * should be declared prior to the the LTTNG_UST_TRACEPOINT_LOGLEVEL for a given
  * tracepoint name. The first field is the provider name, the second
  * field is the name of the tracepoint, the third field is the loglevel
  * name.
  *
- *      TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >,
+ *      LTTNG_UST_TRACEPOINT_LOGLEVEL(< [com_company_]project[_component] >, < event >,
  *              < loglevel_name >)
  *
- * The TRACEPOINT_PROVIDER must be already declared before declaring a
- * TRACEPOINT_LOGLEVEL.
+ * The LTTNG_UST_TRACEPOINT_PROVIDER must be already declared before declaring a
+ * LTTNG_UST_TRACEPOINT_LOGLEVEL.
  */
 
 enum {
-       TRACE_EMERG             = 0,
-       TRACE_ALERT             = 1,
-       TRACE_CRIT              = 2,
-       TRACE_ERR               = 3,
-       TRACE_WARNING           = 4,
-       TRACE_NOTICE            = 5,
-       TRACE_INFO              = 6,
-       TRACE_DEBUG_SYSTEM      = 7,
-       TRACE_DEBUG_PROGRAM     = 8,
-       TRACE_DEBUG_PROCESS     = 9,
-       TRACE_DEBUG_MODULE      = 10,
-       TRACE_DEBUG_UNIT        = 11,
-       TRACE_DEBUG_FUNCTION    = 12,
-       TRACE_DEBUG_LINE        = 13,
-       TRACE_DEBUG             = 14,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG             = 0,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT             = 1,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT              = 2,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR               = 3,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING           = 4,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE            = 5,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO              = 6,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM      = 7,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM     = 8,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS     = 9,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE      = 10,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT        = 11,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION    = 12,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE        = 13,
+       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG             = 14,
 };
 
-#define TRACEPOINT_LOGLEVEL(provider, name, loglevel)
+#define LTTNG_UST_TRACEPOINT_LOGLEVEL(provider, name, loglevel)
+
+#if LTTNG_UST_COMPAT_API(0)
+#define TRACEPOINT_LOGLEVEL    LTTNG_UST_TRACEPOINT_LOGLEVEL
+
+#define TRACE_EMERG            LTTNG_UST_TRACEPOINT_LOGLEVEL_EMERG
+#define TRACE_ALERT            LTTNG_UST_TRACEPOINT_LOGLEVEL_ALERT
+#define TRACE_CRIT             LTTNG_UST_TRACEPOINT_LOGLEVEL_CRIT
+#define TRACE_ERR              LTTNG_UST_TRACEPOINT_LOGLEVEL_ERR
+#define TRACE_WARNING          LTTNG_UST_TRACEPOINT_LOGLEVEL_WARNING
+#define TRACE_NOTICE           LTTNG_UST_TRACEPOINT_LOGLEVEL_NOTICE
+#define TRACE_INFO             LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO
+#define TRACE_DEBUG_SYSTEM     LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_SYSTEM
+#define TRACE_DEBUG_PROGRAM    LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROGRAM
+#define TRACE_DEBUG_PROCESS    LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_PROCESS
+#define TRACE_DEBUG_MODULE     LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_MODULE
+#define TRACE_DEBUG_UNIT       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_UNIT
+#define TRACE_DEBUG_FUNCTION   LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_FUNCTION
+#define TRACE_DEBUG_LINE       LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG_LINE
+#define TRACE_DEBUG            LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG
+#endif
 
-#endif /* #ifndef TRACEPOINT_LOGLEVEL */
+#endif /* #ifndef LTTNG_UST_TRACEPOINT_LOGLEVEL */
 
-#ifndef TRACEPOINT_MODEL_EMF_URI
+#ifndef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI
 
-#define TRACEPOINT_MODEL_EMF_URI(provider, name, uri)
+#define LTTNG_UST_TRACEPOINT_MODEL_EMF_URI(provider, name, uri)
+
+#if LTTNG_UST_COMPAT_API(0)
+#define TRACEPOINT_MODEL_EMF_URI LTTNG_UST_TRACEPOINT_MODEL_EMF_URI
+#endif
 
-#endif /* #ifndef TRACEPOINT_MODEL_EMF_URI */
+#endif /* #ifndef LTTNG_UST_TRACEPOINT_MODEL_EMF_URI */
This page took 0.038506 seconds and 4 git commands to generate.