More compile fixes
[lttng-ust.git] / liblttng-ust / ltt-events.c
index 68531bcd628e435e62805d52b5f593054ec5089b..c97727348cb18834fb4a38e3b763f30e7fab3eae 100644 (file)
 #include "lttng/core.h"
 #include "ltt-tracer.h"
 #include "ltt-tracer-core.h"
-#include "lttng/wait.h"
+#include "wait.h"
 #include "../libringbuffer/shm.h"
-
-typedef u32 uint32_t;
-#include <lttng/kcompat/jhash.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <urcu/arch.h>
 
 /*
  * The sessions mutex is the centralized mutex across UST tracing
@@ -51,7 +51,6 @@ void ust_unlock(void)
 }
 
 static CDS_LIST_HEAD(sessions);
-static CDS_LIST_HEAD(ltt_transport_list);
 
 /*
  * Pending probes hash table, containing the registered ltt events for
@@ -88,7 +87,7 @@ int add_pending_probe(struct ltt_event *event, const char *name)
        struct cds_hlist_head *head;
        struct ust_pending_probe *e;
        size_t name_len = strlen(name) + 1;
-       u32 hash = jhash(name, name_len - 1, 0);
+       uint32_t hash = jhash(name, name_len - 1, 0);
 
        head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)];
        e = zmalloc(sizeof(struct ust_pending_probe) + name_len);
@@ -127,7 +126,7 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc)
        struct ust_pending_probe *e;
        const char *name = desc->name;
        size_t name_len = strlen(name) + 1;
-       u32 hash = jhash(name, name_len - 1, 0);
+       uint32_t hash = jhash(name, name_len - 1, 0);
        int ret = 0;
 
        head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)];
@@ -287,17 +286,6 @@ int ltt_event_disable(struct ltt_event *event)
        return 0;
 }
 
-static struct ltt_transport *ltt_transport_find(const char *name)
-{
-       struct ltt_transport *transport;
-
-       cds_list_for_each_entry(transport, &ltt_transport_list, node) {
-               if (!strcmp(transport->name, name))
-                       return transport;
-       }
-       return NULL;
-}
-
 struct ltt_channel *ltt_channel_create(struct ltt_session *session,
                                       const char *transport_name,
                                       void *buf_addr,
@@ -305,9 +293,10 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session,
                                       unsigned int switch_timer_interval,
                                       unsigned int read_timer_interval,
                                       int *shm_fd, int *wait_fd,
-                                      uint64_t *memory_map_size)
+                                      uint64_t *memory_map_size,
+                                      struct ltt_channel *chan_priv_init)
 {
-       struct ltt_channel *chan;
+       struct ltt_channel *chan = NULL;
        struct ltt_transport *transport;
 
        if (session->been_active)
@@ -318,21 +307,18 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session,
                       transport_name);
                goto notransport;
        }
-       chan = zmalloc(sizeof(struct ltt_channel));
-       if (!chan)
-               goto nomem;
-       chan->session = session;
-       chan->id = session->free_chan_id++;
+       chan_priv_init->id = session->free_chan_id++;
+       chan_priv_init->session = session;
        /*
         * Note: the channel creation op already writes into the packet
         * headers. Therefore the "chan" information used as input
         * should be already accessible.
         */
-       transport->ops.channel_create("[lttng]", chan, buf_addr,
+       chan = transport->ops.channel_create("[lttng]", buf_addr,
                        subbuf_size, num_subbuf, switch_timer_interval,
                        read_timer_interval, shm_fd, wait_fd,
-                       memory_map_size);
-       if (!chan->chan)
+                       memory_map_size, chan_priv_init);
+       if (!chan)
                goto create_error;
        chan->enabled = 1;
        chan->ops = &transport->ops;
@@ -340,8 +326,6 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session,
        return chan;
 
 create_error:
-       free(chan);
-nomem:
 notransport:
 active:
        return NULL;
@@ -353,10 +337,9 @@ active:
 static
 void _ltt_channel_destroy(struct ltt_channel *chan)
 {
-       chan->ops->channel_destroy(chan);
        cds_list_del(&chan->list);
        lttng_destroy_context(chan->ctx);
-       free(chan);
+       chan->ops->channel_destroy(chan);
 }
 
 /*
@@ -735,7 +718,7 @@ int _ltt_event_metadata_statedump(struct ltt_session *session,
 
        ret = lttng_metadata_printf(session,
                "event {\n"
-               "       name = %s;\n"
+               "       name = \"%s\";\n"
                "       id = %u;\n"
                "       stream_id = %u;\n",
                event->desc->name,
@@ -979,28 +962,6 @@ end:
        return ret;
 }
 
-/**
- * ltt_transport_register - LTT transport registration
- * @transport: transport structure
- *
- * Registers a transport which can be used as output to extract the data out of
- * LTTng. Called with ust_lock held.
- */
-void ltt_transport_register(struct ltt_transport *transport)
-{
-       cds_list_add_tail(&transport->node, &ltt_transport_list);
-}
-
-/**
- * ltt_transport_unregister - LTT transport unregistration
- * @transport: transport structure
- * Called with ust_lock held.
- */
-void ltt_transport_unregister(struct ltt_transport *transport)
-{
-       cds_list_del(&transport->node);
-}
-
 void lttng_ust_events_exit(void)
 {
        struct ltt_session *session, *tmpsession;
This page took 0.02594 seconds and 4 git commands to generate.