Fix: sessiond: work-around mismatching variant type tag field and selector names
[lttng-tools.git] / src / bin / lttng-sessiond / ust-field-convert.hpp
index e165cdf1d6e07047af40939c28aad2f41a6d9a34..c0e663983267c2315c0dcc6e0c2a921b8c7beff4 100644 (file)
 
 #include <cstddef>
 #include <vector>
+#include <type_traits>
 
 namespace lttng {
 namespace sessiond {
 namespace ust {
 
+enum class ctl_field_quirks : unsigned int {
+       NONE = 0,
+       /*
+        * LTTng-UST with ABI major version <= 9 express variants with a tag
+        * enumeration that doesn't match the fields of the variant. The
+        * tag's mapping names are systematically prefixed with an underscore.
+        */
+       UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS = 1 << 0,
+};
+
+inline ctl_field_quirks operator&(ctl_field_quirks lhs, ctl_field_quirks rhs)
+{
+       using enum_type = std::underlying_type<ctl_field_quirks>::type;
+       return ctl_field_quirks(static_cast<enum_type>(lhs) & static_cast<enum_type>(rhs));
+}
+
+inline ctl_field_quirks operator|(ctl_field_quirks lhs, ctl_field_quirks rhs)
+{
+       using enum_type = std::underlying_type<ctl_field_quirks>::type;
+       return ctl_field_quirks(static_cast<enum_type>(lhs) | static_cast<enum_type>(rhs));
+}
+
 std::vector<trace::field::cuptr> create_trace_fields_from_ust_ctl_fields(
                const lttng::sessiond::ust::registry_session& session,
                const lttng_ust_ctl_field *fields,
                std::size_t field_count,
-               trace::field_location::root lookup_root);
+               trace::field_location::root lookup_root,
+               ctl_field_quirks quirks = ctl_field_quirks::NONE);
 
 } /* namespace ust */
 } /* namespace sessiond */
This page took 0.022696 seconds and 4 git commands to generate.