loglevel enable fixes
[lttng-ust.git] / liblttng-ust / tracepoint.c
index 578b0f5151d3fecddf8a4321e54ac46d8f97ca23..3a50df66a08de552256a342987c153dbcdd701e0 100644 (file)
 
 #define _LGPL_SOURCE
 #include <errno.h>
-#include <lttng/tracepoint.h>
-#include <lttng/core.h>
 #include <stdint.h>
 #include <stddef.h>
+
 #include <urcu/arch.h>
 #include <urcu-bp.h>
 #include <urcu/hlist.h>
 #include <urcu/uatomic.h>
 #include <urcu/compiler.h>
 
-#include <lttng/usterr-signal-safe.h>
+#include <lttng/tracepoint.h>
+
+#include <usterr-signal-safe.h>
+#include <helper.h>
+
 #include "tracepoint-internal.h"
 #include "ltt-tracer-core.h"
 #include "jhash.h"
+#include "error.h"
 
 /* Set to 1 to enable tracepoint debug output */
 static const int tracepoint_debug;
 static int initialized;
 static void (*new_tracepoint_cb)(struct tracepoint *);
 
-/* libraries that contain tracepoints (struct tracepoint_lib) */
+/*
+ * libraries that contain tracepoints (struct tracepoint_lib).
+ * Protected by UST lock.
+ */
 static CDS_LIST_HEAD(libs);
 
 /*
@@ -54,7 +61,7 @@ static CDS_LIST_HEAD(libs);
 
 /*
  * Tracepoint hash table, containing the active tracepoints.
- * Protected by tracepoints_mutex.
+ * Protected by ust lock.
  */
 #define TRACEPOINT_HASH_BITS 6
 #define TRACEPOINT_TABLE_SIZE (1 << TRACEPOINT_HASH_BITS)
@@ -67,7 +74,7 @@ static int need_update;
  * Note about RCU :
  * It is used to to delay the free of multiple probes array until a quiescent
  * state is reached.
- * Tracepoint entries modifications are protected by the tracepoints_mutex.
+ * Tracepoint entries modifications are protected by the ust lock.
  */
 struct tracepoint_entry {
        struct cds_hlist_node hlist;
@@ -83,14 +90,14 @@ struct tp_probes {
        struct tracepoint_probe probes[0];
 };
 
-static inline void *allocate_probes(int count)
+static void *allocate_probes(int count)
 {
        struct tp_probes *p  = zmalloc(count * sizeof(struct tracepoint_probe)
                        + sizeof(struct tp_probes));
        return p == NULL ? NULL : p->probes;
 }
 
-static inline void release_probes(void *old)
+static void release_probes(void *old)
 {
        if (old) {
                struct tp_probes *tp_probes = caa_container_of(old,
@@ -192,7 +199,7 @@ tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe,
 
 /*
  * Get tracepoint if the tracepoint is present in the tracepoint hash table.
- * Must be called with tracepoints_mutex held.
+ * Must be called with ust lock held.
  * Returns NULL if not present.
  */
 static struct tracepoint_entry *get_tracepoint(const char *name)
@@ -212,7 +219,7 @@ static struct tracepoint_entry *get_tracepoint(const char *name)
 
 /*
  * Add the tracepoint to the tracepoint hash table. Must be called with
- * tracepoints_mutex held.
+ * ust lock held.
  */
 static struct tracepoint_entry *add_tracepoint(const char *name)
 {
@@ -247,7 +254,7 @@ static struct tracepoint_entry *add_tracepoint(const char *name)
  * Remove the tracepoint from the tracepoint hash table. Must be called with
  * ust_lock held.
  */
-static inline void remove_tracepoint(struct tracepoint_entry *e)
+static void remove_tracepoint(struct tracepoint_entry *e)
 {
        cds_hlist_del(&e->hlist);
        free(e);
@@ -402,8 +409,6 @@ int __tracepoint_probe_unregister(const char *name, void *probe, void *data)
 {
        void *old;
 
-       fprintf(stderr, "TEST REGISTER %s\n", name);
-
        old = tracepoint_remove_probe(name, probe, data);
        if (IS_ERR(old))
                return PTR_ERR(old);
@@ -489,105 +494,6 @@ void tracepoint_probe_update_all(void)
        }
 }
 
-/*
- * Returns 0 if current not found.
- * Returns 1 if current found.
- *
- * Called with tracepoint mutex held
- */
-int lib_get_iter_tracepoints(struct tracepoint_iter *iter)
-{
-       struct tracepoint_lib *iter_lib;
-       int found = 0;
-
-       cds_list_for_each_entry(iter_lib, &libs, list) {
-               if (iter_lib < iter->lib)
-                       continue;
-               else if (iter_lib > iter->lib)
-                       iter->tracepoint = NULL;
-               found = tracepoint_get_iter_range(&iter->tracepoint,
-                       iter_lib->tracepoints_start,
-                       iter_lib->tracepoints_start + iter_lib->tracepoints_count);
-               if (found) {
-                       iter->lib = iter_lib;
-                       break;
-               }
-       }
-       return found;
-}
-
-/**
- * tracepoint_get_iter_range - Get a next tracepoint iterator given a range.
- * @tracepoint: current tracepoints (in), next tracepoint (out)
- * @begin: beginning of the range
- * @end: end of the range
- *
- * Returns whether a next tracepoint has been found (1) or not (0).
- * Will return the first tracepoint in the range if the input tracepoint is
- * NULL.
- * Called with tracepoint mutex held.
- */
-int tracepoint_get_iter_range(struct tracepoint * const **tracepoint,
-       struct tracepoint * const *begin, struct tracepoint * const *end)
-{
-       if (!*tracepoint && begin != end)
-               *tracepoint = begin;
-       while (*tracepoint >= begin && *tracepoint < end) {
-               if (!**tracepoint)
-                       (*tracepoint)++;        /* skip dummy */
-               else
-                       return 1;
-       }
-       return 0;
-}
-
-/*
- * Called with tracepoint mutex held.
- */
-static void tracepoint_get_iter(struct tracepoint_iter *iter)
-{
-       int found = 0;
-
-       /* tracepoints in libs. */
-       found = lib_get_iter_tracepoints(iter);
-       if (!found)
-               tracepoint_iter_reset(iter);
-}
-
-/*
- * Called with UST lock held.
- */
-void tracepoint_iter_start(struct tracepoint_iter *iter)
-{
-       tracepoint_get_iter(iter);
-}
-
-/*
- * Called with UST lock held.
- */
-void tracepoint_iter_next(struct tracepoint_iter *iter)
-{
-       iter->tracepoint++;
-       /*
-        * iter->tracepoint may be invalid because we blindly incremented it.
-        * Make sure it is valid by marshalling on the tracepoints, getting the
-        * tracepoints from following modules if necessary.
-        */
-       tracepoint_get_iter(iter);
-}
-
-/*
- * Called with UST lock held.
- */
-void tracepoint_iter_stop(struct tracepoint_iter *iter)
-{
-}
-
-void tracepoint_iter_reset(struct tracepoint_iter *iter)
-{
-       iter->tracepoint = NULL;
-}
-
 void tracepoint_set_new_tracepoint_cb(void (*cb)(struct tracepoint *))
 {
        new_tracepoint_cb = cb;
This page took 0.025296 seconds and 4 git commands to generate.