Common Trace Format 2 generation
[deliverable/lttng-tools.git] / src / bin / lttng-sessiond / ust-registry.cpp
index 088e8d64fedfd36e6aa7cba44ecdc74e68df553a..96ce92455e1bb1b7eb99f9d0928075b24df2ba6f 100644 (file)
@@ -8,16 +8,16 @@
 #define _LGPL_SOURCE
 #include <inttypes.h>
 
-#include <common/common.h>
-#include <common/hashtable/utils.h>
+#include <common/common.hpp>
+#include <common/hashtable/utils.hpp>
 #include <lttng/lttng.h>
 
-#include "ust-registry.h"
-#include "ust-app.h"
-#include "ust-field-utils.h"
-#include "utils.h"
-#include "lttng-sessiond.h"
-#include "notification-thread-commands.h"
+#include "ust-registry.hpp"
+#include "ust-app.hpp"
+#include "ust-field-utils.hpp"
+#include "utils.hpp"
+#include "lttng-sessiond.hpp"
+#include "notification-thread-commands.hpp"
 
 /*
  * Hash table match function for event in the registry.
@@ -367,8 +367,8 @@ struct ust_registry_event *ust_registry_find_event(
        key.name[sizeof(key.name) - 1] = '\0';
        key.signature = sig;
 
-       cds_lfht_lookup(chan->ht->ht, chan->ht->hash_fct(&key, lttng_ht_seed),
-                       chan->ht->match_fct, &key, &iter.iter);
+       cds_lfht_lookup(chan->events->ht, chan->events->hash_fct(&key, lttng_ht_seed),
+                       chan->events->match_fct, &key, &iter.iter);
        node = lttng_ht_iter_get_node_u64(&iter);
        if (!node) {
                goto end;
@@ -445,8 +445,8 @@ int ust_registry_create_event(struct ust_registry_session *session,
         * This is an add unique with a custom match function for event. The node
         * are matched using the event name and signature.
         */
-       nptr = cds_lfht_add_unique(chan->ht->ht, chan->ht->hash_fct(event,
-                               lttng_ht_seed), chan->ht->match_fct, event, &event->node.node);
+       nptr = cds_lfht_add_unique(chan->events->ht, chan->events->hash_fct(event,
+                               lttng_ht_seed), chan->events->match_fct, event, &event->node.node);
        if (nptr != &event->node.node) {
                if (buffer_type == LTTNG_BUFFER_PER_UID) {
                        /*
@@ -512,7 +512,7 @@ void ust_registry_destroy_event(struct ust_registry_channel *chan,
 
        /* Delete the node first. */
        iter.iter.node = &event->node.node;
-       ret = lttng_ht_del(chan->ht, &iter);
+       ret = lttng_ht_del(chan->events, &iter);
        LTTNG_ASSERT(!ret);
 
        call_rcu(&event->node.head, destroy_event_rcu);
@@ -566,7 +566,7 @@ end:
  * Needs to be called from RCU read-side critical section.
  */
 struct ust_registry_enum *
-       ust_registry_lookup_enum_by_id(struct ust_registry_session *session,
+       ust_registry_lookup_enum_by_id(const ust_registry_session &session,
                const char *enum_name, uint64_t enum_id)
 {
        struct ust_registry_enum *reg_enum = NULL;
@@ -578,7 +578,7 @@ struct ust_registry_enum *
        strncpy(reg_enum_lookup.name, enum_name, LTTNG_UST_ABI_SYM_NAME_LEN);
        reg_enum_lookup.name[LTTNG_UST_ABI_SYM_NAME_LEN - 1] = '\0';
        reg_enum_lookup.id = enum_id;
-       cds_lfht_lookup(session->enums->ht,
+       cds_lfht_lookup(session.enums->ht,
                        ht_hash_enum((void *) &reg_enum_lookup, lttng_ht_seed),
                        ht_match_enum_id, &reg_enum_lookup, &iter.iter);
        node = lttng_ht_iter_get_node_str(&iter);
@@ -701,8 +701,8 @@ void destroy_channel_rcu(struct rcu_head *head)
        struct ust_registry_channel *chan =
                caa_container_of(head, struct ust_registry_channel, rcu_head);
 
-       if (chan->ht) {
-               ht_cleanup_push(chan->ht);
+       if (chan->events) {
+               ht_cleanup_push(chan->events);
        }
        free(chan->ctx_fields);
        free(chan);
@@ -730,11 +730,11 @@ static void destroy_channel(struct ust_registry_channel *chan, bool notif)
                }
        }
 
-       if (chan->ht) {
+       if (chan->events) {
                rcu_read_lock();
                /* Destroy all event associated with this registry. */
                cds_lfht_for_each_entry(
-                               chan->ht->ht, &iter.iter, event, node.node) {
+                               chan->events->ht, &iter.iter, event, node.node) {
                        /* Delete the node from the ht and free it. */
                        ust_registry_destroy_event(chan, event);
                }
@@ -761,15 +761,15 @@ int ust_registry_channel_add(struct ust_registry_session *session,
                goto error_alloc;
        }
 
-       chan->ht = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
-       if (!chan->ht) {
+       chan->events = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
+       if (!chan->events) {
                ret = -ENOMEM;
                goto error;
        }
 
        /* Set custom match function. */
-       chan->ht->match_fct = ht_match_event;
-       chan->ht->hash_fct = ht_hash_event;
+       chan->events->match_fct = ht_match_event;
+       chan->events->hash_fct = ht_hash_event;
 
        /*
         * Assign a channel ID right now since the event notification comes
This page took 0.041421 seconds and 5 git commands to generate.