ust: generate traces readable in lttv
[ust.git] / libtracing / channels.c
index bd9c508eec0ee0c1600f4f7144cfadff8470f3f2..a8df3c48ad916a03661d786e6860491dec68aca0 100644 (file)
@@ -9,10 +9,14 @@
  *     Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
  */
 
-#include <linux/module.h>
-#include <linux/ltt-channels.h>
-#include <linux/mutex.h>
-#include <linux/vmalloc.h>
+//ust// #include <linux/module.h>
+//ust// #include <linux/ltt-channels.h>
+//ust// #include <linux/mutex.h>
+//ust// #include <linux/vmalloc.h>
+
+#include "kernelcompat.h"
+#include "channels.h"
+#include "usterr.h"
 
 /*
  * ltt_channel_mutex may be nested inside the LTT trace mutex.
@@ -63,7 +67,7 @@ static void release_channel_setting(struct kref *kref)
                        iter->index = free_index++;
                        iter->free_event_id = 0;
                }
-               markers_compact_event_ids();
+//ust//                markers_compact_event_ids();
        }
 }
 
@@ -115,7 +119,7 @@ end:
        mutex_unlock(&ltt_channel_mutex);
        return ret;
 }
-EXPORT_SYMBOL_GPL(ltt_channels_register);
+//ust// EXPORT_SYMBOL_GPL(ltt_channels_register);
 
 /**
  * ltt_channels_unregister - Unregister a trace channel.
@@ -139,7 +143,7 @@ end:
        mutex_unlock(&ltt_channel_mutex);
        return ret;
 }
-EXPORT_SYMBOL_GPL(ltt_channels_unregister);
+//ust// EXPORT_SYMBOL_GPL(ltt_channels_unregister);
 
 /**
  * ltt_channels_set_default - Set channel default behavior.
@@ -166,7 +170,7 @@ end:
        mutex_unlock(&ltt_channel_mutex);
        return ret;
 }
-EXPORT_SYMBOL_GPL(ltt_channels_set_default);
+//ust// EXPORT_SYMBOL_GPL(ltt_channels_set_default);
 
 /**
  * ltt_channels_get_name_from_index - get channel name from channel index
@@ -184,7 +188,7 @@ const char *ltt_channels_get_name_from_index(unsigned int index)
                        return iter->name;
        return NULL;
 }
-EXPORT_SYMBOL_GPL(ltt_channels_get_name_from_index);
+//ust// EXPORT_SYMBOL_GPL(ltt_channels_get_name_from_index);
 
 static struct ltt_channel_setting *
 ltt_channels_get_setting_from_name(const char *name)
@@ -216,7 +220,7 @@ int ltt_channels_get_index_from_name(const char *name)
        else
                return -1;
 }
-EXPORT_SYMBOL_GPL(ltt_channels_get_index_from_name);
+//ust// EXPORT_SYMBOL_GPL(ltt_channels_get_index_from_name);
 
 /**
  * ltt_channels_trace_alloc - Allocate channel structures for a trace
@@ -236,8 +240,10 @@ struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels,
        struct ltt_channel_setting *iter;
 
        mutex_lock(&ltt_channel_mutex);
-       if (!free_index)
+       if (!free_index) {
+               WARN("ltt_channels_trace_alloc: no free_index; are there any probes connected?");
                goto end;
+       }
        if (!atomic_read(&index_kref.refcount))
                kref_init(&index_kref);
        else
@@ -245,8 +251,10 @@ struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels,
        *nr_channels = free_index;
        channel = kzalloc(sizeof(struct ltt_channel_struct) * free_index,
                          GFP_KERNEL);
-       if (!channel)
+       if (!channel) {
+               WARN("ltt_channel_struct: channel null after alloc");
                goto end;
+       }
        list_for_each_entry(iter, &ltt_channels, list) {
                if (!atomic_read(&iter->kref.refcount))
                        continue;
@@ -260,7 +268,7 @@ end:
        mutex_unlock(&ltt_channel_mutex);
        return channel;
 }
-EXPORT_SYMBOL_GPL(ltt_channels_trace_alloc);
+//ust// EXPORT_SYMBOL_GPL(ltt_channels_trace_alloc);
 
 /**
  * ltt_channels_trace_free - Free one trace's channels
@@ -278,7 +286,7 @@ void ltt_channels_trace_free(struct ltt_channel_struct *channels)
        mutex_unlock(&ltt_channel_mutex);
        unlock_markers();
 }
-EXPORT_SYMBOL_GPL(ltt_channels_trace_free);
+//ust// EXPORT_SYMBOL_GPL(ltt_channels_trace_free);
 
 /**
  * _ltt_channels_get_event_id - get next event ID for a marker
@@ -303,6 +311,8 @@ int _ltt_channels_get_event_id(const char *channel, const char *name)
                        ret = 0;
                else if (strcmp(name, "core_marker_format") == 0)
                        ret = 1;
+               else if (strcmp(name, "testev") == 0)
+                       ret = 2;
                else
                        ret = -ENOENT;
                goto end;
@@ -333,6 +343,6 @@ int ltt_channels_get_event_id(const char *channel, const char *name)
        return ret;
 }
 
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit Next Generation Channel Management");
+//ust// MODULE_LICENSE("GPL");
+//ust// MODULE_AUTHOR("Mathieu Desnoyers");
+//ust// MODULE_DESCRIPTION("Linux Trace Toolkit Next Generation Channel Management");
This page took 0.027896 seconds and 4 git commands to generate.