Rewrite last GPL bits in relay.c and relay.h
[ust.git] / libust / tracer.c
index b0393e213e217de881dfeb4a7d7a3af599d674aa..e3538e0d5706e86368e03136fdaf98255525b86d 100644 (file)
@@ -4,6 +4,20 @@
  * (C) Copyright       2005-2008 -
  *             Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
  *
+ * 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 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
+ * Lesser General Public License for more details.
+ *
+ * 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
+ *
  * Tracing management internal kernel API. Trace buffer allocation/free, tracing
  * start/stop.
  *
 //ust// #include <linux/delay.h>
 //ust// #include <linux/vmalloc.h>
 //ust// #include <asm/atomic.h>
-#include <kcompat/rculist.h>
+#include <urcu-bp.h>
+#include <urcu/rculist.h>
 
-#include "kernelcompat.h"
+#include <ust/kernelcompat.h>
 #include "tracercore.h"
 #include "tracer.h"
 #include "usterr.h"
@@ -281,7 +296,7 @@ void notrace ltt_write_trace_header(struct ltt_trace_struct *trace,
 static void trace_async_wakeup(struct ltt_trace_struct *trace)
 {
        int i;
-       struct ltt_channel_struct *chan;
+       struct ust_channel *chan;
 
        /* Must check each channel for pending read wakeup */
        for (i = 0; i < trace->nr_channels; i++) {
@@ -360,9 +375,9 @@ struct ltt_trace_struct *_ltt_trace_find_setup(const char *trace_name)
  */
 void ltt_release_transport(struct kref *kref)
 {
-       struct ltt_trace_struct *trace = container_of(kref,
-                       struct ltt_trace_struct, ltt_transport_kref);
-//ust//        trace->ops->remove_dirs(trace);
+//ust//        struct ltt_trace_struct *trace = container_of(kref,
+//ust//                        struct ltt_trace_struct, ltt_transport_kref);
+//ust//        trace->ops->remove_dirs(trace);
 }
 //ust// EXPORT_SYMBOL_GPL(ltt_release_transport);
 
@@ -668,7 +683,7 @@ int ltt_trace_alloc(const char *trace_name)
        int err = 0;
        struct ltt_trace_struct *trace;
        unsigned int subbuf_size, subbuf_cnt;
-       unsigned long flags;
+//ust//        unsigned long flags;
        int chan;
        const char *channel_name;
 
@@ -723,7 +738,6 @@ int ltt_trace_alloc(const char *trace_name)
                subbuf_cnt = trace->channels[chan].subbuf_cnt;
                prepare_chan_size_num(&subbuf_size, &subbuf_cnt);
                err = trace->ops->create_channel(trace_name, trace,
-                               trace->dentry.trace_root,
                                channel_name,
                                &trace->channels[chan],
                                subbuf_size,
@@ -754,7 +768,7 @@ create_channel_error:
                if (trace->channels[chan].active)
                        trace->ops->remove_channel(&trace->channels[chan]);
 
-dirs_error:
+//ust// dirs_error:
 //ust//        module_put(trace->transport->owner);
 transport_error:
 //ust//        put_trace_clock();
@@ -769,31 +783,31 @@ traces_error:
  * We will make a new ltt_control based on debugfs, and control each channel's
  * buffer.
  */
-static int ltt_trace_create(const char *trace_name, const char *trace_type,
-               enum trace_mode mode,
-               unsigned int subbuf_size_low, unsigned int n_subbufs_low,
-               unsigned int subbuf_size_med, unsigned int n_subbufs_med,
-               unsigned int subbuf_size_high, unsigned int n_subbufs_high)
-{
-       int err = 0;
-
-       err = ltt_trace_setup(trace_name);
-       if (IS_ERR_VALUE(err))
-               return err;
-
-       err = ltt_trace_set_type(trace_name, trace_type);
-       if (IS_ERR_VALUE(err))
-               return err;
-
-       err = ltt_trace_alloc(trace_name);
-       if (IS_ERR_VALUE(err))
-               return err;
-
-       return err;
-}
+//ust// static int ltt_trace_create(const char *trace_name, const char *trace_type,
+//ust//                enum trace_mode mode,
+//ust//                unsigned int subbuf_size_low, unsigned int n_subbufs_low,
+//ust//                unsigned int subbuf_size_med, unsigned int n_subbufs_med,
+//ust//                unsigned int subbuf_size_high, unsigned int n_subbufs_high)
+//ust// {
+//ust//        int err = 0;
+//ust// 
+//ust//        err = ltt_trace_setup(trace_name);
+//ust//        if (IS_ERR_VALUE(err))
+//ust//                return err;
+//ust// 
+//ust//        err = ltt_trace_set_type(trace_name, trace_type);
+//ust//        if (IS_ERR_VALUE(err))
+//ust//                return err;
+//ust// 
+//ust//        err = ltt_trace_alloc(trace_name);
+//ust//        if (IS_ERR_VALUE(err))
+//ust//                return err;
+//ust// 
+//ust//        return err;
+//ust// }
 
 /* Must be called while sure that trace is in the list. */
-static int _ltt_trace_destroy(struct ltt_trace_struct  *trace)
+static int _ltt_trace_destroy(struct ltt_trace_struct *trace)
 {
        int err = -EPERM;
 
@@ -809,8 +823,8 @@ static int _ltt_trace_destroy(struct ltt_trace_struct       *trace)
                goto active_error;
        }
        /* Everything went fine */
-//ust//        list_del_rcu(&trace->list);
-//ust//        synchronize_sched();
+       list_del_rcu(&trace->list);
+       synchronize_rcu();
        if (list_empty(&ltt_traces.head)) {
 //ust//                clear_kernel_trace_flag_all_tasks();
                /*
@@ -832,7 +846,7 @@ traces_error:
 static void __ltt_trace_destroy(struct ltt_trace_struct        *trace)
 {
        int i;
-       struct ltt_channel_struct *chan;
+       struct ust_channel *chan;
 
        for (i = 0; i < trace->nr_channels; i++) {
                chan = &trace->channels[i];
@@ -932,7 +946,7 @@ static int _ltt_trace_start(struct ltt_trace_struct *trace)
        return err;
 
        /* error handling */
-get_ltt_run_filter_error:
+//ust// get_ltt_run_filter_error:
 traces_error:
        return err;
 }
@@ -1099,7 +1113,7 @@ int ltt_filter_control(enum ltt_filter_control_msg msg, const char *trace_name)
        }
 //ust//        module_put(ltt_filter_control_owner);
 
-get_module_error:
+//ust// get_module_error:
 trace_error:
        ltt_unlock_traces();
        return err;
This page took 0.026677 seconds and 4 git commands to generate.