X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsnapshot.cpp;h=e0ffe69c0b1a5303cebfe908ab99cee7eb2220d1;hb=0114db0ec2407029052eb61a0189c9b1cd64d520;hp=03472201acfd3c68a4cdad1937b6b69095248801;hpb=7966af5763c4aaca39df9bbfa9277ff15715c720;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/snapshot.cpp b/src/bin/lttng-sessiond/snapshot.cpp index 03472201a..e0ffe69c0 100644 --- a/src/bin/lttng-sessiond/snapshot.cpp +++ b/src/bin/lttng-sessiond/snapshot.cpp @@ -10,10 +10,10 @@ #include #include -#include +#include -#include "snapshot.h" -#include "utils.h" +#include "snapshot.hpp" +#include "utils.hpp" /* * Return the atomically incremented value of next_output_id. @@ -165,7 +165,7 @@ error: struct snapshot_output *snapshot_output_alloc(void) { - return (snapshot_output *) zmalloc(sizeof(struct snapshot_output)); + return zmalloc(); } /* @@ -241,6 +241,7 @@ struct snapshot_output *snapshot_find_output_by_name(const char *name, LTTNG_ASSERT(snapshot); LTTNG_ASSERT(name); + ASSERT_RCU_READ_LOCKED(); cds_lfht_for_each_entry(snapshot->output_ht->ht, &iter.iter, output, node.node) { @@ -267,6 +268,7 @@ struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot_output *output = NULL; LTTNG_ASSERT(snapshot); + ASSERT_RCU_READ_LOCKED(); lttng_ht_lookup(snapshot->output_ht, (void *)((unsigned long) id), &iter); node = lttng_ht_iter_get_node_ulong(&iter); @@ -274,7 +276,7 @@ struct snapshot_output *snapshot_find_output_by_id(uint32_t id, DBG3("Snapshot output not found with id %" PRId32, id); goto error; } - output = caa_container_of(node, struct snapshot_output, node); + output = lttng::utils::container_of(node, &snapshot_output::node); error: return output; @@ -325,5 +327,5 @@ void snapshot_destroy(struct snapshot *obj) snapshot_output_destroy(output); } rcu_read_unlock(); - ht_cleanup_push(obj->output_ht); + lttng_ht_destroy(obj->output_ht); }