| 1 | /* |
| 2 | * Copyright (C) 2022 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0-only |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "ust-registry-event.hpp" |
| 9 | |
| 10 | #include <common/make-unique.hpp> |
| 11 | |
| 12 | #include <urcu/rculfhash.h> |
| 13 | |
| 14 | namespace lst = lttng::sessiond::trace; |
| 15 | namespace lsu = lttng::sessiond::ust; |
| 16 | |
| 17 | lsu::registry_event::registry_event(unsigned int in_id, |
| 18 | unsigned int in_stream_class_id, |
| 19 | int in_session_objd, |
| 20 | int in_channel_objd, |
| 21 | std::string in_name, |
| 22 | std::string in_signature, |
| 23 | std::vector<lttng::sessiond::trace::field::cuptr> in_fields, |
| 24 | int in_loglevel_value, |
| 25 | nonstd::optional<std::string> in_model_emf_uri) : |
| 26 | lst::event_class(in_id, |
| 27 | in_stream_class_id, |
| 28 | in_loglevel_value, |
| 29 | std::move(in_name), |
| 30 | std::move(in_model_emf_uri), |
| 31 | lttng::make_unique<lst::structure_type>(0, std::move(in_fields))), |
| 32 | session_objd{in_session_objd}, |
| 33 | channel_objd{in_channel_objd}, |
| 34 | signature{std::move(in_signature)}, |
| 35 | _metadata_dumped{false} |
| 36 | { |
| 37 | cds_lfht_node_init(&_node); |
| 38 | _head = {}; |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | * Free event data structure. This does NOT delete it from any hash table. It's |
| 43 | * safe to pass a NULL pointer. This should be called inside a call RCU if the |
| 44 | * event is previously deleted from a rcu hash table. |
| 45 | */ |
| 46 | void lsu::registry_event_destroy(lsu::registry_event *event) |
| 47 | { |
| 48 | delete event; |
| 49 | } |