From: Jérémie Galarneau Date: Thu, 12 Jan 2023 22:09:05 +0000 (-0500) Subject: Clean-up: sessiond: rename public accessors X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4bcf2294f0701b731d620c38216e1922e919e1b9;p=lttng-tools.git Clean-up: sessiond: rename public accessors Signed-off-by: Jérémie Galarneau Change-Id: Icf87c518d632a176c7786a48b3921e0638545d9c --- diff --git a/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp b/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp index f2f32c168..b7ab303a1 100644 --- a/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp +++ b/src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp @@ -390,7 +390,7 @@ void lsc::trace_class_visitor::visit(const lst::trace_class& trace_class) trace_class.accept(environment_visitor); trace_class_fragment["environment"] = environment_visitor.move_fragment(); - const auto packet_header = trace_class.get_packet_header(); + const auto packet_header = trace_class.packet_header(); if (packet_header) { ::ctf2::field_visitor field_visitor; @@ -432,7 +432,7 @@ void lsc::trace_class_visitor::visit(const lst::stream_class& stream_class) *stream_class.default_clock_class_name; } - const auto packet_context = stream_class.get_packet_context(); + const auto packet_context = stream_class.packet_context(); if (packet_context) { ::ctf2::field_visitor visitor; @@ -440,7 +440,7 @@ void lsc::trace_class_visitor::visit(const lst::stream_class& stream_class) stream_class_fragment["packet-context-field-class"] = visitor.move_fragment(); } - const auto event_header = stream_class.get_event_header(); + const auto event_header = stream_class.event_header(); if (event_header) { ::ctf2::field_visitor visitor; @@ -449,7 +449,7 @@ void lsc::trace_class_visitor::visit(const lst::stream_class& stream_class) visitor.move_fragment(); } - const auto event_context = stream_class.get_event_context(); + const auto event_context = stream_class.event_context(); if (event_context) { ::ctf2::field_visitor visitor; diff --git a/src/bin/lttng-sessiond/stream-class.cpp b/src/bin/lttng-sessiond/stream-class.cpp index 883a65e41..b56f0e2a0 100644 --- a/src/bin/lttng-sessiond/stream-class.cpp +++ b/src/bin/lttng-sessiond/stream-class.cpp @@ -25,17 +25,17 @@ void lst::stream_class::accept(trace_class_visitor& visitor) const _accept_on_event_classes(visitor); } -const lttng::sessiond::trace::type *lst::stream_class::get_packet_context() const +const lttng::sessiond::trace::type *lst::stream_class::packet_context() const { return _packet_context.get(); } -const lttng::sessiond::trace::type *lst::stream_class::get_event_header() const +const lttng::sessiond::trace::type *lst::stream_class::event_header() const { return _event_header.get(); } -const lttng::sessiond::trace::type *lst::stream_class::get_event_context() const +const lttng::sessiond::trace::type *lst::stream_class::event_context() const { return _event_context.get(); } diff --git a/src/bin/lttng-sessiond/stream-class.hpp b/src/bin/lttng-sessiond/stream-class.hpp index 78f0c83cb..754b723fa 100644 --- a/src/bin/lttng-sessiond/stream-class.hpp +++ b/src/bin/lttng-sessiond/stream-class.hpp @@ -31,9 +31,9 @@ public: void accept(trace_class_visitor& visitor) const; virtual ~stream_class() = default; - virtual const type* get_packet_context() const; - virtual const type* get_event_header() const; - virtual const type* get_event_context() const; + virtual const type* packet_context() const; + virtual const type* event_header() const; + virtual const type* event_context() const; const unsigned int id; /* diff --git a/src/bin/lttng-sessiond/trace-class.hpp b/src/bin/lttng-sessiond/trace-class.hpp index ed72f3f57..72ba7559d 100644 --- a/src/bin/lttng-sessiond/trace-class.hpp +++ b/src/bin/lttng-sessiond/trace-class.hpp @@ -55,7 +55,7 @@ public: */ virtual void accept(trace_class_visitor& trace_class_visitor) const; virtual void accept(trace_class_environment_visitor& environment_visitor) const = 0; - virtual const lttng::sessiond::trace::type *get_packet_header() const noexcept = 0; + virtual const lttng::sessiond::trace::type *packet_header() const noexcept = 0; const struct abi abi; const lttng_uuid uuid; diff --git a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp index 60e1f2f6a..dce1af96c 100644 --- a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp +++ b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp @@ -828,7 +828,7 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::trace_class& tsdl_field_visitor packet_header_visitor{trace_class.abi, 1, _sanitized_types_overrides}; - trace_class.get_packet_header()->accept(packet_header_visitor); + trace_class.packet_header()->accept(packet_header_visitor); /* Declare type aliases, trace class, and packet header. */ auto trace_class_tsdl = fmt::format( @@ -903,7 +903,7 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::stream_class return _lookup_field_type(location); }); - const auto *event_header = stream_class.get_event_header(); + const auto *event_header = stream_class.event_header(); if (event_header) { tsdl_field_visitor event_header_visitor{_trace_abi, 1, _sanitized_types_overrides, stream_class.default_clock_class_name}; @@ -914,7 +914,7 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::stream_class event_header_visitor.move_description()); } - const auto *packet_context = stream_class.get_packet_context(); + const auto *packet_context = stream_class.packet_context(); if (packet_context) { tsdl_field_visitor packet_context_visitor{_trace_abi, 1, _sanitized_types_overrides, stream_class.default_clock_class_name}; @@ -925,7 +925,7 @@ void tsdl::trace_class_visitor::visit(const lttng::sessiond::trace::stream_class packet_context_visitor.move_description()); } - const auto *event_context = stream_class.get_event_context(); + const auto *event_context = stream_class.event_context(); if (event_context) { tsdl_field_visitor event_context_visitor{_trace_abi, 1, _sanitized_types_overrides}; @@ -1094,16 +1094,16 @@ const lttng::sessiond::trace::type& lttng::sessiond::tsdl::trace_class_visitor:: switch (location.root_) { case lst::field_location::root::PACKET_HEADER: return lookup_type_from_root_type( - *_current_trace_class->get_packet_header(), location); + *_current_trace_class->packet_header(), location); case lst::field_location::root::PACKET_CONTEXT: return lookup_type_from_root_type( - *_current_stream_class->get_packet_context(), location); + *_current_stream_class->packet_context(), location); case lst::field_location::root::EVENT_RECORD_HEADER: return lookup_type_from_root_type( - *_current_stream_class->get_event_header(), location); + *_current_stream_class->event_header(), location); case lst::field_location::root::EVENT_RECORD_COMMON_CONTEXT: return lookup_type_from_root_type( - *_current_stream_class->get_event_context(), location); + *_current_stream_class->event_context(), location); case lst::field_location::root::EVENT_RECORD_PAYLOAD: return lookup_type_from_root_type( *_current_event_class->payload, location); diff --git a/src/bin/lttng-sessiond/ust-app.cpp b/src/bin/lttng-sessiond/ust-app.cpp index 11d604ea9..ec8aa1c39 100644 --- a/src/bin/lttng-sessiond/ust-app.cpp +++ b/src/bin/lttng-sessiond/ust-app.cpp @@ -3454,7 +3454,7 @@ static int create_channel_per_uid(struct ust_app *app, { auto locked_registry = reg_uid->registry->reg.ust->lock(); - auto& ust_reg_chan = locked_registry->get_channel(ua_chan->tracing_channel_id); + auto& ust_reg_chan = locked_registry->channel(ua_chan->tracing_channel_id); ust_reg_chan._consumer_key = ua_chan->key; } @@ -3554,7 +3554,7 @@ static int create_channel_per_pid(struct ust_app *app, { auto locked_registry = registry->lock(); - auto& ust_reg_chan = locked_registry->get_channel(chan_reg_key); + auto& ust_reg_chan = locked_registry->channel(chan_reg_key); ust_reg_chan._consumer_key = ua_chan->key; } @@ -6408,7 +6408,7 @@ static int handle_app_register_channel_notification(int sock, chan_reg_key = ua_chan->key; } - auto& ust_reg_chan = locked_registry_session->get_channel(chan_reg_key); + auto& ust_reg_chan = locked_registry_session->channel(chan_reg_key); /* Channel id is set during the object creation. */ chan_id = ust_reg_chan.id; @@ -6439,14 +6439,14 @@ static int handle_app_register_channel_notification(int sock, 0, std::move(app_context_fields)) : nullptr; - ust_reg_chan.set_event_context(std::move(event_context)); + ust_reg_chan.event_context(std::move(event_context)); } else { /* * Validate that the context fields match between * registry and newcoming application. */ bool context_fields_match; - const auto *previous_event_context = ust_reg_chan.get_event_context(); + const auto *previous_event_context = ust_reg_chan.event_context(); if (!previous_event_context) { context_fields_match = app_context_fields.size() == 0; @@ -6559,7 +6559,7 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, const char *na * These three variables MUST NOT be read/write after this. */ try { - auto& channel = locked_registry->get_channel(chan_reg_key); + auto& channel = locked_registry->channel(chan_reg_key); /* event_id is set on success. */ channel.add_event(sobjd, cobjd, name, signature.get(), diff --git a/src/bin/lttng-sessiond/ust-consumer.cpp b/src/bin/lttng-sessiond/ust-consumer.cpp index df4689920..ef61cfc7e 100644 --- a/src/bin/lttng-sessiond/ust-consumer.cpp +++ b/src/bin/lttng-sessiond/ust-consumer.cpp @@ -108,7 +108,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess, } else { { auto locked_registry = registry->lock(); - auto& ust_reg_chan = registry->get_channel(chan_reg_key); + auto& ust_reg_chan = registry->channel(chan_reg_key); chan_id = ust_reg_chan.id; } diff --git a/src/bin/lttng-sessiond/ust-field-convert.cpp b/src/bin/lttng-sessiond/ust-field-convert.cpp index 21fd3e0c9..e7e5d3924 100644 --- a/src/bin/lttng-sessiond/ust-field-convert.cpp +++ b/src/bin/lttng-sessiond/ust-field-convert.cpp @@ -843,7 +843,7 @@ std::vector create_fields_from_ust_ctl_fields( const auto trace_native_byte_order = session.abi.byte_order; const session_attributes session_attributes{ [&session](const char *enum_name, uint64_t enum_id) { - return session.get_enumeration(enum_name, enum_id); + return session.enumeration(enum_name, enum_id); }, trace_native_byte_order}; /* Location of field being created. */ diff --git a/src/bin/lttng-sessiond/ust-registry-channel.cpp b/src/bin/lttng-sessiond/ust-registry-channel.cpp index de14432fa..f8295df45 100644 --- a/src/bin/lttng-sessiond/ust-registry-channel.cpp +++ b/src/bin/lttng-sessiond/ust-registry-channel.cpp @@ -404,13 +404,13 @@ lsu::registry_channel::~registry_channel() lttng_ht_destroy(_events); } -const lttng::sessiond::trace::type* lsu::registry_channel::get_event_context() const +const lttng::sessiond::trace::type* lsu::registry_channel::event_context() const { LTTNG_ASSERT(_is_registered); - return lst::stream_class::get_event_context(); + return lst::stream_class::event_context(); } -void lsu::registry_channel::set_event_context(lttng::sessiond::trace::type::cuptr context) +void lsu::registry_channel::event_context(lttng::sessiond::trace::type::cuptr context) { /* Must only be set once, on the first channel registration provided by an application. */ LTTNG_ASSERT(!_event_context); diff --git a/src/bin/lttng-sessiond/ust-registry-channel.hpp b/src/bin/lttng-sessiond/ust-registry-channel.hpp index 5a99c1bdb..a32b8088e 100644 --- a/src/bin/lttng-sessiond/ust-registry-channel.hpp +++ b/src/bin/lttng-sessiond/ust-registry-channel.hpp @@ -48,8 +48,8 @@ public: uint32_t& out_event_id); virtual ~registry_channel(); - virtual const lttng::sessiond::trace::type *get_event_context() const override final; - void set_event_context(lttng::sessiond::trace::type::cuptr context); + virtual const lttng::sessiond::trace::type *event_context() const override final; + void event_context(lttng::sessiond::trace::type::cuptr context); /* Channel was registered to at least one application. */ bool is_registered() const; diff --git a/src/bin/lttng-sessiond/ust-registry-session-pid.cpp b/src/bin/lttng-sessiond/ust-registry-session-pid.cpp index db7bf58ce..9060e80ba 100644 --- a/src/bin/lttng-sessiond/ust-registry-session-pid.cpp +++ b/src/bin/lttng-sessiond/ust-registry-session-pid.cpp @@ -32,7 +32,7 @@ lsu::registry_session_per_pid::registry_session_per_pid(const struct ust_app& ap _generate_metadata(); } -lttng_buffer_type lsu::registry_session_per_pid::get_buffering_scheme() const noexcept +lttng_buffer_type lsu::registry_session_per_pid::buffering_scheme() const noexcept { return LTTNG_BUFFER_PER_PID; } diff --git a/src/bin/lttng-sessiond/ust-registry-session-pid.hpp b/src/bin/lttng-sessiond/ust-registry-session-pid.hpp index 4fd541d58..4c414a1ec 100644 --- a/src/bin/lttng-sessiond/ust-registry-session-pid.hpp +++ b/src/bin/lttng-sessiond/ust-registry-session-pid.hpp @@ -33,7 +33,7 @@ public: gid_t egid, uint64_t tracing_id); - virtual lttng_buffer_type get_buffering_scheme() const noexcept override final; + virtual lttng_buffer_type buffering_scheme() const noexcept override final; virtual void accept(lttng::sessiond::trace::trace_class_environment_visitor& environment_visitor) const override final; diff --git a/src/bin/lttng-sessiond/ust-registry-session-uid.cpp b/src/bin/lttng-sessiond/ust-registry-session-uid.cpp index 77c46fd7c..bfa50f391 100644 --- a/src/bin/lttng-sessiond/ust-registry-session-uid.cpp +++ b/src/bin/lttng-sessiond/ust-registry-session-uid.cpp @@ -27,7 +27,7 @@ lsu::registry_session_per_uid::registry_session_per_uid( _generate_metadata(); } -lttng_buffer_type lsu::registry_session_per_uid::get_buffering_scheme() const noexcept +lttng_buffer_type lsu::registry_session_per_uid::buffering_scheme() const noexcept { return LTTNG_BUFFER_PER_UID; } diff --git a/src/bin/lttng-sessiond/ust-registry-session-uid.hpp b/src/bin/lttng-sessiond/ust-registry-session-uid.hpp index 10da75818..01f55fc2e 100644 --- a/src/bin/lttng-sessiond/ust-registry-session-uid.hpp +++ b/src/bin/lttng-sessiond/ust-registry-session-uid.hpp @@ -31,7 +31,7 @@ public: uint64_t tracing_id, uid_t tracing_uid); - virtual lttng_buffer_type get_buffering_scheme() const noexcept override final; + virtual lttng_buffer_type buffering_scheme() const noexcept override final; virtual void accept(lttng::sessiond::trace::trace_class_environment_visitor& environment_visitor) const override final; diff --git a/src/bin/lttng-sessiond/ust-registry-session.cpp b/src/bin/lttng-sessiond/ust-registry-session.cpp index e1089bd58..a8199bb62 100644 --- a/src/bin/lttng-sessiond/ust-registry-session.cpp +++ b/src/bin/lttng-sessiond/ust-registry-session.cpp @@ -321,7 +321,7 @@ lst::type::cuptr lsu::registry_session::_create_packet_header() const return lttng::make_unique(0, std::move(packet_header_fields)); } -const lst::type *lsu::registry_session::get_packet_header() const noexcept +const lst::type *lsu::registry_session::packet_header() const noexcept { return _packet_header.get(); } @@ -457,7 +457,7 @@ void lsu::registry_session::add_channel(uint64_t key) lttng_ht_add_unique_u64(_channels.get(), &chan->_node); } -lttng::sessiond::ust::registry_channel& lsu::registry_session::get_channel( +lttng::sessiond::ust::registry_channel& lsu::registry_session::channel( uint64_t channel_key) const { lttng::urcu::read_lock_guard read_lock_guard; @@ -487,12 +487,12 @@ void lsu::registry_session::remove_channel(uint64_t channel_key, bool notify) lttng::urcu::read_lock_guard read_lock_guard; ASSERT_LOCKED(_lock); - auto& channel = get_channel(channel_key); + auto& channel_to_remove = channel(channel_key); - iter.iter.node = &channel._node.node; + iter.iter.node = &channel_to_remove._node.node; ret = lttng_ht_del(_channels.get(), &iter); LTTNG_ASSERT(!ret); - destroy_channel(&channel, notify); + destroy_channel(&channel_to_remove, notify); } void lsu::registry_session::accept( @@ -505,7 +505,7 @@ void lsu::registry_session::accept( visitor.visit(lst::environment_field("tracer_major", _app_tracer_version.major)); visitor.visit(lst::environment_field("tracer_minor", _app_tracer_version.minor)); visitor.visit(lst::environment_field("tracer_buffering_scheme", - get_buffering_scheme() == LTTNG_BUFFER_PER_PID ? "pid" : "uid")); + buffering_scheme() == LTTNG_BUFFER_PER_PID ? "pid" : "uid")); visitor.visit(lst::environment_field("architecture_bit_width", abi.bits_per_long)); { @@ -671,7 +671,7 @@ void lsu::registry_session::regenerate_metadata() * disposes of the object. */ lsu::registry_enum::const_rcu_protected_reference -lsu::registry_session::get_enumeration(const char *enum_name, uint64_t enum_id) const +lsu::registry_session::enumeration(const char *enum_name, uint64_t enum_id) const { lsu::registry_enum *reg_enum = NULL; struct lttng_ht_node_str *node; diff --git a/src/bin/lttng-sessiond/ust-registry-session.hpp b/src/bin/lttng-sessiond/ust-registry-session.hpp index 5f59e6160..3ef3d2a4f 100644 --- a/src/bin/lttng-sessiond/ust-registry-session.hpp +++ b/src/bin/lttng-sessiond/ust-registry-session.hpp @@ -41,13 +41,13 @@ public: details::locked_registry_session_release>:: deleter>; - virtual lttng_buffer_type get_buffering_scheme() const noexcept = 0; + virtual lttng_buffer_type buffering_scheme() const noexcept = 0; locked_ptr lock() noexcept; void add_channel(uint64_t channel_key); /* A channel is protected by its parent registry session's lock. */ - lttng::sessiond::ust::registry_channel& get_channel(uint64_t channel_key) const; + lttng::sessiond::ust::registry_channel& channel(uint64_t channel_key) const; void remove_channel(uint64_t channel_key, bool notify); @@ -56,13 +56,13 @@ public: struct lttng_ust_ctl_enum_entry *raw_entries, size_t nr_entries, uint64_t *enum_id); - registry_enum::const_rcu_protected_reference get_enumeration( + registry_enum::const_rcu_protected_reference enumeration( const char *enum_name, uint64_t enum_id) const; void regenerate_metadata(); virtual ~registry_session(); - virtual const lttng::sessiond::trace::type *get_packet_header() const noexcept override; + virtual const lttng::sessiond::trace::type *packet_header() const noexcept override; /* * With multiple writers and readers, use this lock to access