Commit | Line | Data |
---|---|---|
d7bfb9b0 JG |
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 | #ifndef LTTNG_UST_FIELD_CONVERT_H | |
9 | #define LTTNG_UST_FIELD_CONVERT_H | |
10 | ||
11 | #include "field.hpp" | |
12 | #include "ust-registry.hpp" | |
b0f2e8db | 13 | #include "ust-registry-session.hpp" |
d7bfb9b0 JG |
14 | |
15 | #include <cstddef> | |
16 | #include <vector> | |
63c3462c | 17 | #include <type_traits> |
d7bfb9b0 JG |
18 | |
19 | namespace lttng { | |
20 | namespace sessiond { | |
21 | namespace ust { | |
22 | ||
63c3462c JG |
23 | enum class ctl_field_quirks : unsigned int { |
24 | NONE = 0, | |
25 | /* | |
26 | * LTTng-UST with ABI major version <= 9 express variants with a tag | |
27 | * enumeration that doesn't match the fields of the variant. The | |
28 | * tag's mapping names are systematically prefixed with an underscore. | |
29 | */ | |
30 | UNDERSCORE_PREFIXED_VARIANT_TAG_MAPPINGS = 1 << 0, | |
31 | }; | |
32 | ||
33 | inline ctl_field_quirks operator&(ctl_field_quirks lhs, ctl_field_quirks rhs) | |
34 | { | |
35 | using enum_type = std::underlying_type<ctl_field_quirks>::type; | |
36 | return ctl_field_quirks(static_cast<enum_type>(lhs) & static_cast<enum_type>(rhs)); | |
37 | } | |
38 | ||
39 | inline ctl_field_quirks operator|(ctl_field_quirks lhs, ctl_field_quirks rhs) | |
40 | { | |
41 | using enum_type = std::underlying_type<ctl_field_quirks>::type; | |
42 | return ctl_field_quirks(static_cast<enum_type>(lhs) | static_cast<enum_type>(rhs)); | |
43 | } | |
44 | ||
d7bfb9b0 | 45 | std::vector<trace::field::cuptr> create_trace_fields_from_ust_ctl_fields( |
b0f2e8db | 46 | const lttng::sessiond::ust::registry_session& session, |
d7bfb9b0 | 47 | const lttng_ust_ctl_field *fields, |
eda1aa02 | 48 | std::size_t field_count, |
63c3462c JG |
49 | trace::field_location::root lookup_root, |
50 | ctl_field_quirks quirks = ctl_field_quirks::NONE); | |
d7bfb9b0 JG |
51 | |
52 | } /* namespace ust */ | |
53 | } /* namespace sessiond */ | |
54 | } /* namespace lttng */ | |
55 | ||
56 | #endif /* LTTNG_UST_FIELD_CONVERT_H */ |