Move kernelcompat.h to include/ust/ and share.h, usterr.h to include/
[ust.git] / libust / tracepoint.c
index ebcbe252f1a0eba3d58711d9bb2e3106c5fb66e7..cc2adf15e8e8c7ded54281be445528ac4086dcc0 100644 (file)
@@ -2,19 +2,19 @@
  * Copyright (C) 2008 Mathieu Desnoyers
  * Copyright (C) 2009 Pierre-Marc Fournier
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  *
  * Ported to userspace by Pierre-Marc Fournier.
  */
 
 #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")));
@@ -311,6 +311,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 +507,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 +570,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 +638,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.02448 seconds and 4 git commands to generate.