Refactoring: tracepoint: allow explicit tracepoint instance provider name
[lttng-ust.git] / src / lib / lttng-ust / lttng-probes.c
index 553770ea2954049fdaa311477c16f71e2e8521ca..911c29178f1b5439b907beb73101dd1e0d3e95f0 100644 (file)
 #include <urcu/hlist.h>
 #include <lttng/ust-events.h>
 #include <lttng/tracepoint.h>
-#include "tracepoint-internal.h"
+#include "common/tracepoint.h"
 #include <assert.h>
 #include "common/macros.h"
 #include <ctype.h>
 
 #include "lttng-tracer-core.h"
-#include "jhash.h"
-#include "error.h"
-#include "ust-events-internal.h"
+#include "common/jhash.h"
+#include "lib/lttng-ust/events.h"
 
 /*
  * probe list is protected by ust_lock()/ust_unlock().
@@ -77,7 +76,7 @@ void lttng_lazy_probe_register(struct lttng_ust_registered_probe *reg_probe)
 
        /*
         * The provider ensures there are no duplicate event names.
-        * Duplicated TRACEPOINT_EVENT event names would generate a
+        * Duplicated LTTNG_UST_TRACEPOINT_EVENT event names would generate a
         * compile-time error due to duplicated symbol names.
         */
 
@@ -138,7 +137,8 @@ int check_provider_version(const struct lttng_ust_probe_desc *desc)
        /*
         * Check tracepoint provider version compatibility.
         */
-       if (desc->major <= LTTNG_UST_PROVIDER_MAJOR) {
+       if (desc->major <= LTTNG_UST_PROVIDER_MAJOR &&
+                       desc->major >= LTTNG_UST_PROVIDER_MAJOR_OLDEST_COMPATIBLE) {
                DBG("Provider \"%s\" accepted, version %u.%u is compatible "
                        "with LTTng UST provider version %u.%u.",
                        desc->provider_name, desc->major, desc->minor,
@@ -165,7 +165,7 @@ struct lttng_ust_registered_probe *lttng_ust_probe_register(const struct lttng_u
 {
        struct lttng_ust_registered_probe *reg_probe = NULL;
 
-       lttng_ust_fixup_tls();
+       lttng_ust_alloc_tls();
 
        /*
         * If version mismatch, don't register, but don't trigger assert
@@ -203,7 +203,7 @@ end:
 
 void lttng_ust_probe_unregister(struct lttng_ust_registered_probe *reg_probe)
 {
-       lttng_ust_fixup_tls();
+       lttng_ust_alloc_tls();
 
        if (!reg_probe)
                return;
@@ -260,7 +260,7 @@ int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list)
                        cds_list_add(&list_entry->head, &list->head);
                        lttng_ust_format_event_name(event_desc, list_entry->tp.name);
                        if (!event_desc->loglevel) {
-                               list_entry->tp.loglevel = TRACE_DEFAULT;
+                               list_entry->tp.loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT;
                        } else {
                                list_entry->tp.loglevel = *(*event_desc->loglevel);
                        }
@@ -327,7 +327,7 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list)
                                probe_desc->event_desc[i];
                        int j;
 
-                       if (event_desc->nr_fields == 0) {
+                       if (event_desc->tp_class->nr_fields == 0) {
                                /* Events without fields. */
                                struct tp_field_list_entry *list_entry;
 
@@ -342,16 +342,16 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list)
                                list_entry->field.field_name[0] = '\0';
                                list_entry->field.type = LTTNG_UST_ABI_FIELD_OTHER;
                                if (!event_desc->loglevel) {
-                                       list_entry->field.loglevel = TRACE_DEFAULT;
+                                       list_entry->field.loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT;
                                } else {
                                        list_entry->field.loglevel = *(*event_desc->loglevel);
                                }
                                list_entry->field.nowrite = 1;
                        }
 
-                       for (j = 0; j < event_desc->nr_fields; j++) {
+                       for (j = 0; j < event_desc->tp_class->nr_fields; j++) {
                                const struct lttng_ust_event_field *event_field =
-                                       event_desc->fields[j];
+                                       event_desc->tp_class->fields[j];
                                struct tp_field_list_entry *list_entry;
 
                                /* Skip event if name is too long. */
@@ -395,7 +395,7 @@ int lttng_probes_get_field_list(struct lttng_ust_field_list *list)
                                        list_entry->field.type = LTTNG_UST_ABI_FIELD_OTHER;
                                }
                                if (!event_desc->loglevel) {
-                                       list_entry->field.loglevel = TRACE_DEFAULT;
+                                       list_entry->field.loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT;
                                } else {
                                        list_entry->field.loglevel = *(*event_desc->loglevel);
                                }
This page took 0.025419 seconds and 4 git commands to generate.