Large cleanup, mostly removal of all printk's and printfs in libust
[ust.git] / libust / tracepoint.c
index d6b09737a8cd052096e31465ea90573753db8d7e..7976f7d920c3f3a6ff3e8c442e6aa2eace925e92 100644 (file)
 
 #include <errno.h>
 
-#include "kernelcompat.h"
-#include "tracepoint.h"
+#include <ust/kernelcompat.h>
+#include <ust/tracepoint.h>
 #include "usterr.h"
 //#include "list.h"
 
 #define _LGPL_SOURCE
-#include <urcu.h>
+#include <urcu-bp.h>
 
 //extern struct tracepoint __start___tracepoints[] __attribute__((visibility("hidden")));
 //extern struct tracepoint __stop___tracepoints[] __attribute__((visibility("hidden")));
@@ -115,7 +115,7 @@ static void debug_print_probes(struct tracepoint_entry *entry)
                return;
 
        for (i = 0; entry->funcs[i]; i++)
-               printk(KERN_DEBUG "Probe %d : %p\n", i, entry->funcs[i]);
+               DBG("Probe %d : %p", i, entry->funcs[i]);
 }
 
 static void *
@@ -225,8 +225,7 @@ static struct tracepoint_entry *add_tracepoint(const char *name)
        head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
        hlist_for_each_entry(e, node, head, hlist) {
                if (!strcmp(name, e->name)) {
-                       printk(KERN_NOTICE
-                               "tracepoint %s busy\n", name);
+                       DBG("tracepoint %s busy", name);
                        return ERR_PTR(-EEXIST);        /* Already there */
                }
        }
@@ -311,6 +310,17 @@ void tracepoint_update_probe_range(struct tracepoint *begin,
        mutex_unlock(&tracepoints_mutex);
 }
 
+static void lib_update_tracepoints(void)
+{
+       struct tracepoint_lib *lib;
+
+//ust//        mutex_lock(&module_mutex);
+       list_for_each_entry(lib, &libs, list)
+               tracepoint_update_probe_range(lib->tracepoints_start,
+                               lib->tracepoints_start + lib->tracepoints_count);
+//ust//        mutex_unlock(&module_mutex);
+}
+
 /*
  * Update probes, removing the faulty probes.
  */
@@ -496,6 +506,33 @@ void tracepoint_probe_update_all(void)
 }
 //ust// EXPORT_SYMBOL_GPL(tracepoint_probe_update_all);
 
+/*
+ * Returns 0 if current not found.
+ * Returns 1 if current found.
+ */
+int lib_get_iter_tracepoints(struct tracepoint_iter *iter)
+{
+       struct tracepoint_lib *iter_lib;
+       int found = 0;
+
+//ust//        mutex_lock(&module_mutex);
+       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;
+               }
+       }
+//ust//        mutex_unlock(&module_mutex);
+       return found;
+}
+
 /**
  * tracepoint_get_iter_range - Get a next tracepoint iterator given a range.
  * @tracepoint: current tracepoints (in), next tracepoint (out)
@@ -532,7 +569,7 @@ static void tracepoint_get_iter(struct tracepoint_iter *iter)
 //ust//        }
        /* tracepoints in libs. */
        found = lib_get_iter_tracepoints(iter);
-end:
+//ust// end:
        if (!found)
                tracepoint_iter_reset(iter);
 }
@@ -600,44 +637,6 @@ void tracepoint_iter_reset(struct tracepoint_iter *iter)
 
 //ust// #endif /* CONFIG_MODULES */
 
-/*
- * Returns 0 if current not found.
- * Returns 1 if current found.
- */
-int lib_get_iter_tracepoints(struct tracepoint_iter *iter)
-{
-       struct tracepoint_lib *iter_lib;
-       int found = 0;
-
-//ust//        mutex_lock(&module_mutex);
-       list_for_each_entry(iter_lib, &libs, list) {
-               if (iter_lib < iter->lib)
-                       continue;
-               else if (iter_lib > iter->lib)
-                       iter->tracepoint = NULL;
-               found = marker_get_iter_range(&iter->tracepoint,
-                       iter_lib->tracepoints_start,
-                       iter_lib->tracepoints_start + iter_lib->tracepoints_count);
-               if (found) {
-                       iter->lib = iter_lib;
-                       break;
-               }
-       }
-//ust//        mutex_unlock(&module_mutex);
-       return found;
-}
-
-void lib_update_tracepoints(void)
-{
-       struct tracepoint_lib *lib;
-
-//ust//        mutex_lock(&module_mutex);
-       list_for_each_entry(lib, &libs, list)
-               tracepoint_update_probe_range(lib->tracepoints_start,
-                               lib->tracepoints_start + lib->tracepoints_count);
-//ust//        mutex_unlock(&module_mutex);
-}
-
 static void (*new_tracepoint_cb)(struct tracepoint *) = NULL;
 
 void tracepoint_set_new_tracepoint_cb(void (*cb)(struct tracepoint *))
This page took 0.023815 seconds and 4 git commands to generate.