From 50842bdc4c21f3de2b63e29cdac730af8b6dcca6 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 21 Sep 2017 20:51:34 -0400 Subject: [PATCH] Rename bt_ctf_X -> bt_X, maintain backward compat. for pre-2.0 CTF writer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch replaces the `bt_ctf_` prefix with `bt_` for all the functions, types, and enumerations. It also replaces the `BT_CTF_` prefix with `BT_` for all the preprocessor definitions and enumerators. Since there is only one IR as of Babeltrace 2, there is no need for this superfluous prefix: there's no confusion without it, and it might even be more straightforward for the newcomer to see `bt_trace` instead of `bt_ctf_trace`, for example. Backward compatibility is maintained with the help of specific preprocessor definitions placed in each relevant public header file to create aliases for legacy function names, type names, enumerator names, and preprocessor definition names. Because Babeltrace 2 asks current applications to be rebuilt anyway (soname is bumped), it is okay to lose some symbol names as long as the API is equivalent. The only possible issue that I can see is if an application uses a new API name as a variable name, for example: struct bt_ctf_trace bt_ctf_trace; struct something_else bt_trace; This is an error after this patch is applied because, after the preprocessor pass, it is the equivalent of: struct bt_trace bt_trace; struct something_else bt_trace; because of (include/babeltrace/ctf-ir/trace.h): #define bt_ctf_trace bt_trace which affects both the type name and the variable name. This should not be a problem in most cases, and it is easy to fix otherwise. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- bindings/python/bt2/bt2/clock_class.py | 34 +- bindings/python/bt2/bt2/clock_value.py | 8 +- bindings/python/bt2/bt2/ctf_writer.py | 20 +- bindings/python/bt2/bt2/event.py | 32 +- bindings/python/bt2/bt2/event_class.py | 62 +- bindings/python/bt2/bt2/field_types.py | 158 +- bindings/python/bt2/bt2/fields.py | 66 +- bindings/python/bt2/bt2/native_bt.i | 6 +- bindings/python/bt2/bt2/native_btccpriomap.i | 10 +- bindings/python/bt2/bt2/native_btclockclass.i | 54 +- bindings/python/bt2/bt2/native_btctfwriter.i | 44 +- bindings/python/bt2/bt2/native_btevent.i | 66 +- bindings/python/bt2/bt2/native_bteventclass.i | 94 +- bindings/python/bt2/bt2/native_btfields.i | 92 +- bindings/python/bt2/bt2/native_btft.i | 338 +- .../python/bt2/bt2/native_btnotification.i | 38 +- bindings/python/bt2/bt2/native_btpacket.i | 26 +- bindings/python/bt2/bt2/native_btstream.i | 18 +- .../python/bt2/bt2/native_btstreamclass.i | 78 +- bindings/python/bt2/bt2/native_bttrace.i | 100 +- bindings/python/bt2/bt2/packet.py | 10 +- bindings/python/bt2/bt2/stream.py | 12 +- bindings/python/bt2/bt2/stream_class.py | 42 +- bindings/python/bt2/bt2/trace.py | 50 +- doc/api/README.adoc | 3 +- doc/api/dox/examples-ctfir.dox | 52 +- doc/api/dox/group-ctf-ir.dox | 2 +- .../babeltrace/ctf-ir/attributes-internal.h | 16 +- .../babeltrace/ctf-ir/clock-class-internal.h | 8 +- include/babeltrace/ctf-ir/clock-class.h | 82 +- .../babeltrace/ctf-ir/clock-value-internal.h | 6 +- include/babeltrace/ctf-ir/clock-value.h | 20 +- .../babeltrace/ctf-ir/event-class-internal.h | 92 +- include/babeltrace/ctf-ir/event-class.h | 225 +- include/babeltrace/ctf-ir/event-internal.h | 36 +- include/babeltrace/ctf-ir/event.h | 176 +- .../babeltrace/ctf-ir/field-path-internal.h | 16 +- include/babeltrace/ctf-ir/field-path.h | 26 +- .../babeltrace/ctf-ir/field-types-internal.h | 274 +- include/babeltrace/ctf-ir/field-types.h | 866 +++--- include/babeltrace/ctf-ir/fields-internal.h | 62 +- include/babeltrace/ctf-ir/fields.h | 381 +-- include/babeltrace/ctf-ir/packet-internal.h | 14 +- include/babeltrace/ctf-ir/packet.h | 66 +- include/babeltrace/ctf-ir/resolve-internal.h | 30 +- .../babeltrace/ctf-ir/stream-class-internal.h | 36 +- include/babeltrace/ctf-ir/stream-class.h | 162 +- include/babeltrace/ctf-ir/stream-internal.h | 40 +- include/babeltrace/ctf-ir/stream.h | 47 +- include/babeltrace/ctf-ir/trace-internal.h | 32 +- include/babeltrace/ctf-ir/trace.h | 315 +- include/babeltrace/ctf-ir/utils.h | 2 +- .../babeltrace/ctf-ir/validation-internal.h | 60 +- include/babeltrace/ctf-ir/visitor-internal.h | 10 +- include/babeltrace/ctf-ir/visitor.h | 49 +- .../babeltrace/ctf-writer/clock-internal.h | 2 +- include/babeltrace/ctf-writer/event-fields.h | 6 +- include/babeltrace/ctf-writer/event-types.h | 6 +- include/babeltrace/ctf-writer/event.h | 12 +- .../ctf-writer/serialize-internal.h | 32 +- include/babeltrace/ctf-writer/stream-class.h | 29 +- include/babeltrace/ctf-writer/stream.h | 80 +- .../babeltrace/ctf-writer/writer-internal.h | 2 +- include/babeltrace/ctf-writer/writer.h | 2 + include/babeltrace/endian-internal.h | 4 +- .../graph/clock-class-priority-map-internal.h | 6 +- .../graph/clock-class-priority-map.h | 12 +- ...notification-discarded-elements-internal.h | 22 +- .../graph/notification-discarded-events.h | 10 +- .../graph/notification-discarded-packets.h | 10 +- .../graph/notification-event-internal.h | 4 +- include/babeltrace/graph/notification-event.h | 8 +- .../graph/notification-inactivity.h | 8 +- .../babeltrace/graph/notification-internal.h | 2 +- .../graph/notification-iterator-internal.h | 2 +- .../graph/notification-packet-internal.h | 8 +- .../babeltrace/graph/notification-packet.h | 10 +- .../graph/notification-stream-internal.h | 8 +- .../babeltrace/graph/notification-stream.h | 12 +- lib/ctf-ir/attributes.c | 42 +- lib/ctf-ir/clock-class.c | 160 +- lib/ctf-ir/event-class.c | 290 +- lib/ctf-ir/event.c | 440 +-- lib/ctf-ir/field-path.c | 32 +- lib/ctf-ir/field-types.c | 1937 ++++++------ lib/ctf-ir/fields.c | 1418 ++++----- lib/ctf-ir/packet.c | 90 +- lib/ctf-ir/resolve.c | 287 +- lib/ctf-ir/stream-class.c | 472 +-- lib/ctf-ir/stream.c | 510 ++-- lib/ctf-ir/trace.c | 658 ++-- lib/ctf-ir/utils.c | 6 +- lib/ctf-ir/validation.c | 174 +- lib/ctf-ir/visitor.c | 11 +- lib/ctf-writer/clock.c | 34 +- lib/ctf-writer/serialize.c | 74 +- lib/ctf-writer/writer.c | 68 +- lib/graph/clock-class-priority-map.c | 38 +- lib/graph/iterator.c | 184 +- lib/graph/notification/discarded-elements.c | 22 +- lib/graph/notification/discarded-events.c | 6 +- lib/graph/notification/discarded-packets.c | 6 +- lib/graph/notification/event.c | 80 +- lib/graph/notification/inactivity.c | 16 +- lib/graph/notification/packet.c | 52 +- lib/graph/notification/stream.c | 56 +- plugins/ctf/common/btr/btr.c | 490 +-- plugins/ctf/common/btr/btr.h | 172 +- plugins/ctf/common/metadata/ast.h | 2 +- plugins/ctf/common/metadata/decoder.c | 2 +- plugins/ctf/common/metadata/decoder.h | 4 +- .../ctf/common/metadata/visitor-generate-ir.c | 530 ++-- plugins/ctf/common/notif-iter/notif-iter.c | 1146 +++---- plugins/ctf/common/notif-iter/notif-iter.h | 192 +- plugins/ctf/common/utils/utils.c | 20 +- plugins/ctf/common/utils/utils.h | 6 +- plugins/ctf/fs-sink/write.c | 154 +- plugins/ctf/fs-sink/writer.c | 10 +- plugins/ctf/fs-sink/writer.h | 16 +- plugins/ctf/fs-src/data-stream-file.c | 176 +- plugins/ctf/fs-src/data-stream-file.h | 14 +- plugins/ctf/fs-src/fs.c | 60 +- plugins/ctf/fs-src/fs.h | 8 +- plugins/ctf/fs-src/query.c | 10 +- plugins/ctf/lttng-live/data-stream.c | 34 +- plugins/ctf/lttng-live/data-stream.h | 2 +- plugins/ctf/lttng-live/lttng-live-internal.h | 30 +- plugins/ctf/lttng-live/lttng-live.c | 172 +- plugins/ctf/lttng-live/metadata.c | 34 +- plugins/ctf/lttng-live/metadata.h | 2 +- plugins/ctf/lttng-live/viewer-connection.c | 42 +- plugins/libctfcopytrace/clock-fields.c | 342 +-- plugins/libctfcopytrace/clock-fields.h | 20 +- plugins/libctfcopytrace/ctfcopytrace.c | 290 +- plugins/libctfcopytrace/ctfcopytrace.h | 64 +- plugins/lttng-utils/copy.c | 562 ++-- plugins/lttng-utils/copy.h | 32 +- plugins/lttng-utils/debug-info.c | 22 +- plugins/lttng-utils/debug-info.h | 8 +- plugins/lttng-utils/plugin.c | 20 +- plugins/text/dmesg/dmesg.c | 200 +- plugins/text/pretty/print.c | 352 +-- plugins/utils/muxer/muxer.c | 22 +- plugins/utils/trimmer/copy.c | 82 +- plugins/utils/trimmer/copy.h | 14 +- plugins/utils/trimmer/iterator.c | 86 +- tests/lib/test_bt_ctf_field_type_validation.c | 1712 +++++------ tests/lib/test_bt_notification_iterator.c | 76 +- tests/lib/test_cc_prio_map.c | 14 +- tests/lib/test_ctf_ir_ref.c | 204 +- tests/lib/test_ctf_writer.c | 2710 ++++++++--------- tests/lib/test_ir_visit.c | 132 +- tests/plugins/test-utils-muxer.c | 104 +- 153 files changed, 11275 insertions(+), 11245 deletions(-) diff --git a/bindings/python/bt2/bt2/clock_class.py b/bindings/python/bt2/bt2/clock_class.py index 161d365d..229121ed 100644 --- a/bindings/python/bt2/bt2/clock_class.py +++ b/bindings/python/bt2/bt2/clock_class.py @@ -57,7 +57,7 @@ class ClockClass(object._Object): offset=None, is_absolute=None, uuid=None): utils._check_str(name) utils._check_uint64(frequency) - ptr = native_bt.ctf_clock_class_create(name, frequency) + ptr = native_bt.clock_class_create(name, frequency) if ptr is None: raise bt2.CreationError('cannot create clock class object') @@ -131,81 +131,81 @@ class ClockClass(object._Object): @property def name(self): - name = native_bt.ctf_clock_class_get_name(self._ptr) + name = native_bt.clock_class_get_name(self._ptr) assert(name is not None) return name @name.setter def name(self, name): utils._check_str(name) - ret = native_bt.ctf_clock_class_set_name(self._ptr, name) + ret = native_bt.clock_class_set_name(self._ptr, name) utils._handle_ret(ret, "cannot set clock class object's name") @property def description(self): - return native_bt.ctf_clock_class_get_description(self._ptr) + return native_bt.clock_class_get_description(self._ptr) @description.setter def description(self, description): utils._check_str(description) - ret = native_bt.ctf_clock_class_set_description(self._ptr, description) + ret = native_bt.clock_class_set_description(self._ptr, description) utils._handle_ret(ret, "cannot set clock class object's description") @property def frequency(self): - frequency = native_bt.ctf_clock_class_get_frequency(self._ptr) + frequency = native_bt.clock_class_get_frequency(self._ptr) assert(frequency >= 1) return frequency @frequency.setter def frequency(self, frequency): utils._check_uint64(frequency) - ret = native_bt.ctf_clock_class_set_frequency(self._ptr, frequency) + ret = native_bt.clock_class_set_frequency(self._ptr, frequency) utils._handle_ret(ret, "cannot set clock class object's frequency") @property def precision(self): - precision = native_bt.ctf_clock_class_get_precision(self._ptr) + precision = native_bt.clock_class_get_precision(self._ptr) assert(precision >= 0) return precision @precision.setter def precision(self, precision): utils._check_uint64(precision) - ret = native_bt.ctf_clock_class_set_precision(self._ptr, precision) + ret = native_bt.clock_class_set_precision(self._ptr, precision) utils._handle_ret(ret, "cannot set clock class object's precision") @property def offset(self): - ret, offset_s = native_bt.ctf_clock_class_get_offset_s(self._ptr) + ret, offset_s = native_bt.clock_class_get_offset_s(self._ptr) assert(ret == 0) - ret, offset_cycles = native_bt.ctf_clock_class_get_offset_cycles(self._ptr) + ret, offset_cycles = native_bt.clock_class_get_offset_cycles(self._ptr) assert(ret == 0) return ClockClassOffset(offset_s, offset_cycles) @offset.setter def offset(self, offset): utils._check_type(offset, ClockClassOffset) - ret = native_bt.ctf_clock_class_set_offset_s(self._ptr, offset.seconds) + ret = native_bt.clock_class_set_offset_s(self._ptr, offset.seconds) utils._handle_ret(ret, "cannot set clock class object's offset (seconds)") - ret = native_bt.ctf_clock_class_set_offset_cycles(self._ptr, offset.cycles) + ret = native_bt.clock_class_set_offset_cycles(self._ptr, offset.cycles) utils._handle_ret(ret, "cannot set clock class object's offset (cycles)") @property def is_absolute(self): - is_absolute = native_bt.ctf_clock_class_is_absolute(self._ptr) + is_absolute = native_bt.clock_class_is_absolute(self._ptr) assert(is_absolute >= 0) return is_absolute > 0 @is_absolute.setter def is_absolute(self, is_absolute): utils._check_bool(is_absolute) - ret = native_bt.ctf_clock_class_set_is_absolute(self._ptr, int(is_absolute)) + ret = native_bt.clock_class_set_is_absolute(self._ptr, int(is_absolute)) utils._handle_ret(ret, "cannot set clock class object's absoluteness") @property def uuid(self): - uuid_bytes = native_bt.ctf_clock_class_get_uuid(self._ptr) + uuid_bytes = native_bt.clock_class_get_uuid(self._ptr) if uuid_bytes is None: return @@ -215,7 +215,7 @@ class ClockClass(object._Object): @uuid.setter def uuid(self, uuid): utils._check_type(uuid, uuidp.UUID) - ret = native_bt.ctf_clock_class_set_uuid(self._ptr, uuid.bytes) + ret = native_bt.clock_class_set_uuid(self._ptr, uuid.bytes) utils._handle_ret(ret, "cannot set clock class object's UUID") def __call__(self, cycles): diff --git a/bindings/python/bt2/bt2/clock_value.py b/bindings/python/bt2/bt2/clock_value.py index d662b96a..d88e2856 100644 --- a/bindings/python/bt2/bt2/clock_value.py +++ b/bindings/python/bt2/bt2/clock_value.py @@ -34,7 +34,7 @@ def _create_clock_value_from_ptr(ptr): class _ClockValue(object._Object): def __init__(self, clock_class_ptr, cycles): utils._check_uint64(cycles) - ptr = native_bt.ctf_clock_value_create(clock_class_ptr, cycles) + ptr = native_bt.clock_value_create(clock_class_ptr, cycles) if ptr is None: raise bt2.CreationError('cannot create clock value object') @@ -43,19 +43,19 @@ class _ClockValue(object._Object): @property def clock_class(self): - ptr = native_bt.ctf_clock_value_get_class(self._ptr) + ptr = native_bt.clock_value_get_class(self._ptr) assert(ptr) return bt2.ClockClass._create_from_ptr(ptr) @property def cycles(self): - ret, cycles = native_bt.ctf_clock_value_get_value(self._ptr) + ret, cycles = native_bt.clock_value_get_value(self._ptr) assert(ret == 0) return cycles @property def ns_from_epoch(self): - ret, ns = native_bt.ctf_clock_value_get_value_ns_from_epoch(self._ptr) + ret, ns = native_bt.clock_value_get_value_ns_from_epoch(self._ptr) utils._handle_ret(ret, "cannot get clock value object's nanoseconds from Epoch") return ns diff --git a/bindings/python/bt2/bt2/ctf_writer.py b/bindings/python/bt2/bt2/ctf_writer.py index 45f7b544..225c93b5 100644 --- a/bindings/python/bt2/bt2/ctf_writer.py +++ b/bindings/python/bt2/bt2/ctf_writer.py @@ -187,26 +187,26 @@ class CtfWriterClock(object._Object): class _CtfWriterStream(stream._StreamBase): @property def discarded_events_count(self): - ret, count = native_bt.ctf_stream_get_discarded_events_count(self._ptr) + ret, count = native_bt.stream_get_discarded_events_count(self._ptr) utils._handle_ret(ret, "cannot get CTF writer stream object's discarded events count") return count def append_discarded_events(self, count): utils._check_uint64(count) - native_bt.ctf_stream_append_discarded_events(self._ptr, count) + native_bt.stream_append_discarded_events(self._ptr, count) def append_event(self, event): utils._check_type(event, bt2.event._Event) - ret = native_bt.ctf_stream_append_event(self._ptr, event._ptr) + ret = native_bt.stream_append_event(self._ptr, event._ptr) utils._handle_ret(ret, 'cannot append event object to CTF writer stream object') def flush(self): - ret = native_bt.ctf_stream_flush(self._ptr) + ret = native_bt.stream_flush(self._ptr) utils._handle_ret(ret, 'cannot flush CTF writer stream object') @property def packet_header_field(self): - field_ptr = native_bt.ctf_stream_get_packet_header(self._ptr) + field_ptr = native_bt.stream_get_packet_header(self._ptr) if field_ptr is None: return @@ -221,13 +221,13 @@ class _CtfWriterStream(stream._StreamBase): utils._check_type(packet_header_field, bt2.fields._Field) packet_header_field_ptr = packet_header_field._ptr - ret = native_bt.ctf_stream_set_packet_header(self._ptr, - packet_header_field_ptr) + ret = native_bt.stream_set_packet_header(self._ptr, + packet_header_field_ptr) utils._handle_ret(ret, "cannot set CTF writer stream object's packet header field") @property def packet_context_field(self): - field_ptr = native_bt.ctf_stream_get_packet_context(self._ptr) + field_ptr = native_bt.stream_get_packet_context(self._ptr) if field_ptr is None: return @@ -242,8 +242,8 @@ class _CtfWriterStream(stream._StreamBase): utils._check_type(packet_context_field, bt2.fields._Field) packet_context_field_ptr = packet_context_field._ptr - ret = native_bt.ctf_stream_set_packet_context(self._ptr, - packet_context_field_ptr) + ret = native_bt.stream_set_packet_context(self._ptr, + packet_context_field_ptr) utils._handle_ret(ret, "cannot set CTF writer stream object's packet context field") def __eq__(self, other): diff --git a/bindings/python/bt2/bt2/event.py b/bindings/python/bt2/bt2/event.py index a6f966d0..b1b6875d 100644 --- a/bindings/python/bt2/bt2/event.py +++ b/bindings/python/bt2/bt2/event.py @@ -36,7 +36,7 @@ def _create_from_ptr(ptr): # recreate the event class wrapper of this event's class (the # identity could be different, but the underlying address should be # the same) - event_class_ptr = native_bt.ctf_event_get_class(ptr) + event_class_ptr = native_bt.event_get_class(ptr) utils._handle_ptr(event_class_ptr, "cannot get event object's class") event_class = bt2.EventClass._create_from_ptr(event_class_ptr) event = _Event._create_from_ptr(ptr) @@ -59,7 +59,7 @@ class _Event(object._Object): @property def packet(self): - packet_ptr = native_bt.ctf_event_get_packet(self._ptr) + packet_ptr = native_bt.event_get_packet(self._ptr) if packet_ptr is None: return packet_ptr @@ -69,12 +69,12 @@ class _Event(object._Object): @packet.setter def packet(self, packet): utils._check_type(packet, bt2.packet._Packet) - ret = native_bt.ctf_event_set_packet(self._ptr, packet._ptr) + ret = native_bt.event_set_packet(self._ptr, packet._ptr) utils._handle_ret(ret, "cannot set event object's packet object") @property def stream(self): - stream_ptr = native_bt.ctf_event_get_stream(self._ptr) + stream_ptr = native_bt.event_get_stream(self._ptr) if stream_ptr is None: return stream_ptr @@ -83,7 +83,7 @@ class _Event(object._Object): @property def header_field(self): - field_ptr = native_bt.ctf_event_get_header(self._ptr) + field_ptr = native_bt.event_get_header(self._ptr) if field_ptr is None: return @@ -98,12 +98,12 @@ class _Event(object._Object): utils._check_type(header_field, bt2.fields._Field) header_field_ptr = header_field._ptr - ret = native_bt.ctf_event_set_header(self._ptr, header_field_ptr) + ret = native_bt.event_set_header(self._ptr, header_field_ptr) utils._handle_ret(ret, "cannot set event object's header field") @property def stream_event_context_field(self): - field_ptr = native_bt.ctf_event_get_stream_event_context(self._ptr) + field_ptr = native_bt.event_get_stream_event_context(self._ptr) if field_ptr is None: return @@ -118,13 +118,13 @@ class _Event(object._Object): utils._check_type(stream_event_context, bt2.fields._Field) stream_event_context_ptr = stream_event_context._ptr - ret = native_bt.ctf_event_set_stream_event_context(self._ptr, + ret = native_bt.event_set_stream_event_context(self._ptr, stream_event_context_ptr) utils._handle_ret(ret, "cannot set event object's stream event context field") @property def context_field(self): - field_ptr = native_bt.ctf_event_get_event_context(self._ptr) + field_ptr = native_bt.event_get_event_context(self._ptr) if field_ptr is None: return @@ -139,12 +139,12 @@ class _Event(object._Object): utils._check_type(context, bt2.fields._Field) context_ptr = context._ptr - ret = native_bt.ctf_event_set_event_context(self._ptr, context_ptr) + ret = native_bt.event_set_event_context(self._ptr, context_ptr) utils._handle_ret(ret, "cannot set event object's context field") @property def payload_field(self): - field_ptr = native_bt.ctf_event_get_event_payload(self._ptr) + field_ptr = native_bt.event_get_event_payload(self._ptr) if field_ptr is None: return @@ -159,24 +159,24 @@ class _Event(object._Object): utils._check_type(payload, bt2.fields._Field) payload_ptr = payload._ptr - ret = native_bt.ctf_event_set_event_payload(self._ptr, payload_ptr) + ret = native_bt.event_set_event_payload(self._ptr, payload_ptr) utils._handle_ret(ret, "cannot set event object's payload field") def _get_clock_value_cycles(self, clock_class_ptr): - clock_value_ptr = native_bt.ctf_event_get_clock_value(self._ptr, + clock_value_ptr = native_bt.event_get_clock_value(self._ptr, clock_class_ptr) if clock_value_ptr is None: return - ret, cycles = native_bt.ctf_clock_value_get_value(clock_value_ptr) + ret, cycles = native_bt.clock_value_get_value(clock_value_ptr) native_bt.put(clock_value_ptr) utils._handle_ret(ret, "cannot get clock value object's cycles") return cycles def clock_value(self, clock_class): utils._check_type(clock_class, bt2.ClockClass) - clock_value_ptr = native_bt.ctf_event_get_clock_value(self._ptr, + clock_value_ptr = native_bt.event_get_clock_value(self._ptr, clock_class._ptr) if clock_value_ptr is None: @@ -187,7 +187,7 @@ class _Event(object._Object): def add_clock_value(self, clock_value): utils._check_type(clock_value, bt2.clock_value._ClockValue) - ret = native_bt.ctf_event_set_clock_value(self._ptr, + ret = native_bt.event_set_clock_value(self._ptr, clock_value._ptr) utils._handle_ret(ret, "cannot set event object's clock value") diff --git a/bindings/python/bt2/bt2/event_class.py b/bindings/python/bt2/bt2/event_class.py index fb527ad7..d55113ae 100644 --- a/bindings/python/bt2/bt2/event_class.py +++ b/bindings/python/bt2/bt2/event_class.py @@ -30,30 +30,30 @@ import bt2 class EventClassLogLevel: - UNKNOWN = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN - UNSPECIFIED = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED - EMERGENCY = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY - ALERT = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_ALERT - CRITICAL = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL - ERROR = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_ERROR - WARNING = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_WARNING - NOTICE = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_NOTICE - INFO = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_INFO - DEBUG_SYSTEM = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM - DEBUG_PROGRAM = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM - DEBUG_PROCESS = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS - DEBUG_MODULE = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE - DEBUG_UNIT = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT - DEBUG_FUNCTION = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION - DEBUG_LINE = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE - DEBUG = native_bt.CTF_EVENT_CLASS_LOG_LEVEL_DEBUG + UNKNOWN = native_bt.EVENT_CLASS_LOG_LEVEL_UNKNOWN + UNSPECIFIED = native_bt.EVENT_CLASS_LOG_LEVEL_UNSPECIFIED + EMERGENCY = native_bt.EVENT_CLASS_LOG_LEVEL_EMERGENCY + ALERT = native_bt.EVENT_CLASS_LOG_LEVEL_ALERT + CRITICAL = native_bt.EVENT_CLASS_LOG_LEVEL_CRITICAL + ERROR = native_bt.EVENT_CLASS_LOG_LEVEL_ERROR + WARNING = native_bt.EVENT_CLASS_LOG_LEVEL_WARNING + NOTICE = native_bt.EVENT_CLASS_LOG_LEVEL_NOTICE + INFO = native_bt.EVENT_CLASS_LOG_LEVEL_INFO + DEBUG_SYSTEM = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM + DEBUG_PROGRAM = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM + DEBUG_PROCESS = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS + DEBUG_MODULE = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE + DEBUG_UNIT = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT + DEBUG_FUNCTION = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION + DEBUG_LINE = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG_LINE + DEBUG = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG class EventClass(object._Object): def __init__(self, name, id=None, log_level=None, emf_uri=None, context_field_type=None, payload_field_type=None): utils._check_str(name) - ptr = native_bt.ctf_event_class_create(name) + ptr = native_bt.event_class_create(name) if ptr is None: raise bt2.CreationError('cannot create event class object') @@ -77,29 +77,29 @@ class EventClass(object._Object): @property def stream_class(self): - sc_ptr = native_bt.ctf_event_class_get_stream_class(self._ptr) + sc_ptr = native_bt.event_class_get_stream_class(self._ptr) if sc_ptr is not None: return bt2.StreamClass._create_from_ptr(sc_ptr) @property def name(self): - return native_bt.ctf_event_class_get_name(self._ptr) + return native_bt.event_class_get_name(self._ptr) @property def id(self): - id = native_bt.ctf_event_class_get_id(self._ptr) + id = native_bt.event_class_get_id(self._ptr) return id if id >= 0 else None @id.setter def id(self, id): utils._check_int64(id) - ret = native_bt.ctf_event_class_set_id(self._ptr, id) + ret = native_bt.event_class_set_id(self._ptr, id) utils._handle_ret(ret, "cannot set event class object's ID") @property def log_level(self): - log_level = native_bt.ctf_event_class_get_log_level(self._ptr) + log_level = native_bt.event_class_get_log_level(self._ptr) return log_level if log_level >= 0 else None @log_level.setter @@ -126,22 +126,22 @@ class EventClass(object._Object): if log_level not in log_levels: raise ValueError("'{}' is not a valid log level".format(log_level)) - ret = native_bt.ctf_event_class_set_log_level(self._ptr, log_level) + ret = native_bt.event_class_set_log_level(self._ptr, log_level) utils._handle_ret(ret, "cannot set event class object's log level") @property def emf_uri(self): - return native_bt.ctf_event_class_get_emf_uri(self._ptr) + return native_bt.event_class_get_emf_uri(self._ptr) @emf_uri.setter def emf_uri(self, emf_uri): utils._check_str(emf_uri) - ret = native_bt.ctf_event_class_set_emf_uri(self._ptr, emf_uri) + ret = native_bt.event_class_set_emf_uri(self._ptr, emf_uri) utils._handle_ret(ret, "cannot set event class object's EMF URI") @property def context_field_type(self): - ft_ptr = native_bt.ctf_event_class_get_context_type(self._ptr) + ft_ptr = native_bt.event_class_get_context_type(self._ptr) if ft_ptr is None: return @@ -156,12 +156,12 @@ class EventClass(object._Object): utils._check_type(context_field_type, bt2.field_types._FieldType) context_field_type_ptr = context_field_type._ptr - ret = native_bt.ctf_event_class_set_context_type(self._ptr, context_field_type_ptr) + ret = native_bt.event_class_set_context_type(self._ptr, context_field_type_ptr) utils._handle_ret(ret, "cannot set event class object's context field type") @property def payload_field_type(self): - ft_ptr = native_bt.ctf_event_class_get_payload_type(self._ptr) + ft_ptr = native_bt.event_class_get_payload_type(self._ptr) if ft_ptr is None: return @@ -176,11 +176,11 @@ class EventClass(object._Object): utils._check_type(payload_field_type, bt2.field_types._FieldType) payload_field_type_ptr = payload_field_type._ptr - ret = native_bt.ctf_event_class_set_payload_type(self._ptr, payload_field_type_ptr) + ret = native_bt.event_class_set_payload_type(self._ptr, payload_field_type_ptr) utils._handle_ret(ret, "cannot set event class object's payload field type") def __call__(self): - event_ptr = native_bt.ctf_event_create(self._ptr) + event_ptr = native_bt.event_create(self._ptr) if event_ptr is None: raise bt2.CreationError('cannot create event field object') diff --git a/bindings/python/bt2/bt2/field_types.py b/bindings/python/bt2/bt2/field_types.py index 47249372..e157492b 100644 --- a/bindings/python/bt2/bt2/field_types.py +++ b/bindings/python/bt2/bt2/field_types.py @@ -28,7 +28,7 @@ import bt2 def _create_from_ptr(ptr): - typeid = native_bt.ctf_field_type_get_type_id(ptr) + typeid = native_bt.field_type_get_type_id(ptr) return _TYPE_ID_TO_OBJ[typeid]._create_from_ptr(ptr) @@ -44,7 +44,7 @@ class _FieldType(object._Object, metaclass=abc.ABCMeta): if self.addr == other.addr: return True - ret = native_bt.ctf_field_type_compare(self._ptr, other._ptr) + ret = native_bt.field_type_compare(self._ptr, other._ptr) utils._handle_ret(ret, "cannot compare field types") return ret == 0 @@ -53,7 +53,7 @@ class _FieldType(object._Object, metaclass=abc.ABCMeta): raise bt2.CreationError('cannot create {} field type object'.format(self._NAME.lower())) def __copy__(self): - ptr = native_bt.ctf_field_type_copy(self._ptr) + ptr = native_bt.field_type_copy(self._ptr) utils._handle_ptr(ptr, 'cannot copy {} field type object'.format(self._NAME.lower())) return _create_from_ptr(ptr) @@ -63,7 +63,7 @@ class _FieldType(object._Object, metaclass=abc.ABCMeta): return cpy def __call__(self, value=None): - field_ptr = native_bt.ctf_field_create(self._ptr) + field_ptr = native_bt.field_create(self._ptr) if field_ptr is None: raise bt2.CreationError('cannot create {} field object'.format(self._NAME.lower())) @@ -80,50 +80,50 @@ class _FieldType(object._Object, metaclass=abc.ABCMeta): class ByteOrder: - NATIVE = native_bt.CTF_BYTE_ORDER_NATIVE - LITTLE_ENDIAN = native_bt.CTF_BYTE_ORDER_LITTLE_ENDIAN - BIG_ENDIAN = native_bt.CTF_BYTE_ORDER_BIG_ENDIAN - NETWORK = native_bt.CTF_BYTE_ORDER_NETWORK + NATIVE = native_bt.BYTE_ORDER_NATIVE + LITTLE_ENDIAN = native_bt.BYTE_ORDER_LITTLE_ENDIAN + BIG_ENDIAN = native_bt.BYTE_ORDER_BIG_ENDIAN + NETWORK = native_bt.BYTE_ORDER_NETWORK class Encoding: - NONE = native_bt.CTF_STRING_ENCODING_NONE - UTF8 = native_bt.CTF_STRING_ENCODING_UTF8 - ASCII = native_bt.CTF_STRING_ENCODING_ASCII + NONE = native_bt.STRING_ENCODING_NONE + UTF8 = native_bt.STRING_ENCODING_UTF8 + ASCII = native_bt.STRING_ENCODING_ASCII class Base: - BINARY = native_bt.CTF_INTEGER_BASE_BINARY - OCTAL = native_bt.CTF_INTEGER_BASE_OCTAL - DECIMAL = native_bt.CTF_INTEGER_BASE_DECIMAL - HEXADECIMAL = native_bt.CTF_INTEGER_BASE_HEXADECIMAL + BINARY = native_bt.INTEGER_BASE_BINARY + OCTAL = native_bt.INTEGER_BASE_OCTAL + DECIMAL = native_bt.INTEGER_BASE_DECIMAL + HEXADECIMAL = native_bt.INTEGER_BASE_HEXADECIMAL class _AlignmentProp: @property def alignment(self): - alignment = native_bt.ctf_field_type_get_alignment(self._ptr) + alignment = native_bt.field_type_get_alignment(self._ptr) assert(alignment >= 0) return alignment @alignment.setter def alignment(self, alignment): utils._check_alignment(alignment) - ret = native_bt.ctf_field_type_set_alignment(self._ptr, alignment) + ret = native_bt.field_type_set_alignment(self._ptr, alignment) utils._handle_ret(ret, "cannot set field type object's alignment") class _ByteOrderProp: @property def byte_order(self): - bo = native_bt.ctf_field_type_get_byte_order(self._ptr) + bo = native_bt.field_type_get_byte_order(self._ptr) assert(bo >= 0) return bo @byte_order.setter def byte_order(self, byte_order): utils._check_int(byte_order) - ret = native_bt.ctf_field_type_set_byte_order(self._ptr, byte_order) + ret = native_bt.field_type_set_byte_order(self._ptr, byte_order) utils._handle_ret(ret, "cannot set field type object's byte order") @@ -137,7 +137,7 @@ class IntegerFieldType(_FieldType, _AlignmentProp, _ByteOrderProp): if size == 0: raise ValueError('size is 0 bits') - ptr = native_bt.ctf_field_type_integer_create(size) + ptr = native_bt.field_type_integer_create(size) self._check_create_status(ptr) super().__init__(ptr) @@ -161,49 +161,49 @@ class IntegerFieldType(_FieldType, _AlignmentProp, _ByteOrderProp): @property def size(self): - size = native_bt.ctf_field_type_integer_get_size(self._ptr) + size = native_bt.field_type_integer_get_size(self._ptr) assert(size >= 1) return size @property def is_signed(self): - is_signed = native_bt.ctf_field_type_integer_is_signed(self._ptr) + is_signed = native_bt.field_type_integer_is_signed(self._ptr) assert(is_signed >= 0) return is_signed > 0 @is_signed.setter def is_signed(self, is_signed): utils._check_bool(is_signed) - ret = native_bt.ctf_field_type_integer_set_is_signed(self._ptr, int(is_signed)) + ret = native_bt.field_type_integer_set_is_signed(self._ptr, int(is_signed)) utils._handle_ret(ret, "cannot set integer field type object's signedness") @property def base(self): - base = native_bt.ctf_field_type_integer_get_base(self._ptr) + base = native_bt.field_type_integer_get_base(self._ptr) assert(base >= 0) return base @base.setter def base(self, base): utils._check_int(base) - ret = native_bt.ctf_field_type_integer_set_base(self._ptr, base) + ret = native_bt.field_type_integer_set_base(self._ptr, base) utils._handle_ret(ret, "cannot set integer field type object's base") @property def encoding(self): - encoding = native_bt.ctf_field_type_integer_get_encoding(self._ptr) + encoding = native_bt.field_type_integer_get_encoding(self._ptr) assert(encoding >= 0) return encoding @encoding.setter def encoding(self, encoding): utils._check_int(encoding) - ret = native_bt.ctf_field_type_integer_set_encoding(self._ptr, encoding) + ret = native_bt.field_type_integer_set_encoding(self._ptr, encoding) utils._handle_ret(ret, "cannot set integer field type object's encoding") @property def mapped_clock_class(self): - ptr = native_bt.ctf_field_type_integer_get_mapped_clock_class(self._ptr) + ptr = native_bt.field_type_integer_get_mapped_clock_class(self._ptr) if ptr is None: return @@ -213,7 +213,7 @@ class IntegerFieldType(_FieldType, _AlignmentProp, _ByteOrderProp): @mapped_clock_class.setter def mapped_clock_class(self, clock_class): utils._check_type(clock_class, bt2.ClockClass) - ret = native_bt.ctf_field_type_integer_set_mapped_clock_class(self._ptr, clock_class._ptr) + ret = native_bt.field_type_integer_set_mapped_clock_class(self._ptr, clock_class._ptr) utils._handle_ret(ret, "cannot set integer field type object's mapped clock class") @@ -222,7 +222,7 @@ class FloatingPointNumberFieldType(_FieldType, _AlignmentProp, _ByteOrderProp): def __init__(self, alignment=None, byte_order=None, exponent_size=None, mantissa_size=None): - ptr = native_bt.ctf_field_type_floating_point_create() + ptr = native_bt.field_type_floating_point_create() self._check_create_status(ptr) super().__init__(ptr) @@ -240,26 +240,26 @@ class FloatingPointNumberFieldType(_FieldType, _AlignmentProp, _ByteOrderProp): @property def exponent_size(self): - exp_size = native_bt.ctf_field_type_floating_point_get_exponent_digits(self._ptr) + exp_size = native_bt.field_type_floating_point_get_exponent_digits(self._ptr) assert(exp_size >= 0) return exp_size @exponent_size.setter def exponent_size(self, exponent_size): utils._check_uint64(exponent_size) - ret = native_bt.ctf_field_type_floating_point_set_exponent_digits(self._ptr, exponent_size) + ret = native_bt.field_type_floating_point_set_exponent_digits(self._ptr, exponent_size) utils._handle_ret(ret, "cannot set floating point number field type object's exponent size") @property def mantissa_size(self): - mant_size = native_bt.ctf_field_type_floating_point_get_mantissa_digits(self._ptr) + mant_size = native_bt.field_type_floating_point_get_mantissa_digits(self._ptr) assert(mant_size >= 0) return mant_size @mantissa_size.setter def mantissa_size(self, mantissa_size): utils._check_uint64(mantissa_size) - ret = native_bt.ctf_field_type_floating_point_set_mantissa_digits(self._ptr, mantissa_size) + ret = native_bt.field_type_floating_point_set_mantissa_digits(self._ptr, mantissa_size) utils._handle_ret(ret, "cannot set floating point number field type object's mantissa size") @@ -299,15 +299,15 @@ class _EnumerationFieldTypeMappingIterator(object._Object, if self._done: raise StopIteration - ret = native_bt.ctf_field_type_enumeration_mapping_iterator_next(self._ptr) + ret = native_bt.field_type_enumeration_mapping_iterator_next(self._ptr) if ret < 0: self._done = True raise StopIteration if self._is_signed: - ret, name, lower, upper = native_bt.ctf_field_type_enumeration_mapping_iterator_get_signed(self._ptr) + ret, name, lower, upper = native_bt.field_type_enumeration_mapping_iterator_get_signed(self._ptr) else: - ret, name, lower, upper = native_bt.ctf_field_type_enumeration_mapping_iterator_get_unsigned(self._ptr) + ret, name, lower, upper = native_bt.field_type_enumeration_mapping_iterator_get_unsigned(self._ptr) assert(ret == 0) mapping = _EnumerationFieldTypeMapping(name, lower, upper) @@ -329,13 +329,13 @@ class EnumerationFieldType(IntegerFieldType, collections.abc.Sequence): mapped_clock_class=mapped_clock_class) utils._check_type(int_field_type, IntegerFieldType) - ptr = native_bt.ctf_field_type_enumeration_create(int_field_type._ptr) + ptr = native_bt.field_type_enumeration_create(int_field_type._ptr) self._check_create_status(ptr) _FieldType.__init__(self, ptr) @property def integer_field_type(self): - ptr = native_bt.ctf_field_type_enumeration_get_container_type(self._ptr) + ptr = native_bt.field_type_enumeration_get_container_type(self._ptr) assert(ptr) return _create_from_ptr(ptr) @@ -392,7 +392,7 @@ class EnumerationFieldType(IntegerFieldType, collections.abc.Sequence): self.integer_field_type.mapped_clock_class = mapped_clock_class def __len__(self): - count = native_bt.ctf_field_type_enumeration_get_mapping_count(self._ptr) + count = native_bt.field_type_enumeration_get_mapping_count(self._ptr) assert(count >= 0) return count @@ -403,9 +403,9 @@ class EnumerationFieldType(IntegerFieldType, collections.abc.Sequence): raise IndexError if self.is_signed: - get_fn = native_bt.ctf_field_type_enumeration_get_mapping_signed + get_fn = native_bt.field_type_enumeration_get_mapping_signed else: - get_fn = native_bt.ctf_field_type_enumeration_get_mapping_unsigned + get_fn = native_bt.field_type_enumeration_get_mapping_unsigned ret, name, lower, upper = get_fn(self._ptr, index) assert(ret == 0) @@ -416,17 +416,17 @@ class EnumerationFieldType(IntegerFieldType, collections.abc.Sequence): def mappings_by_name(self, name): utils._check_str(name) - iter_ptr = native_bt.ctf_field_type_enumeration_find_mappings_by_name(self._ptr, name) + iter_ptr = native_bt.field_type_enumeration_find_mappings_by_name(self._ptr, name) print('iter_ptr', iter_ptr) return self._get_mapping_iter(iter_ptr) def mappings_by_value(self, value): if self.is_signed: utils._check_int64(value) - iter_ptr = native_bt.ctf_field_type_enumeration_find_mappings_by_signed_value(self._ptr, value) + iter_ptr = native_bt.field_type_enumeration_find_mappings_by_signed_value(self._ptr, value) else: utils._check_uint64(value) - iter_ptr = native_bt.ctf_field_type_enumeration_find_mappings_by_unsigned_value(self._ptr, value) + iter_ptr = native_bt.field_type_enumeration_find_mappings_by_unsigned_value(self._ptr, value) return self._get_mapping_iter(iter_ptr) @@ -437,11 +437,11 @@ class EnumerationFieldType(IntegerFieldType, collections.abc.Sequence): upper = lower if self.is_signed: - add_fn = native_bt.ctf_field_type_enumeration_add_mapping_signed + add_fn = native_bt.field_type_enumeration_add_mapping_signed utils._check_int64(lower) utils._check_int64(upper) else: - add_fn = native_bt.ctf_field_type_enumeration_add_mapping_unsigned + add_fn = native_bt.field_type_enumeration_add_mapping_unsigned utils._check_uint64(lower) utils._check_uint64(upper) @@ -459,7 +459,7 @@ class StringFieldType(_FieldType): _NAME = 'String' def __init__(self, encoding=None): - ptr = native_bt.ctf_field_type_string_create() + ptr = native_bt.field_type_string_create() self._check_create_status(ptr) super().__init__(ptr) @@ -468,14 +468,14 @@ class StringFieldType(_FieldType): @property def encoding(self): - encoding = native_bt.ctf_field_type_string_get_encoding(self._ptr) + encoding = native_bt.field_type_string_get_encoding(self._ptr) assert(encoding >= 0) return encoding @encoding.setter def encoding(self, encoding): utils._check_int(encoding) - ret = native_bt.ctf_field_type_string_set_encoding(self._ptr, encoding) + ret = native_bt.field_type_string_set_encoding(self._ptr, encoding) utils._handle_ret(ret, "cannot set string field type object's encoding") @@ -525,7 +525,7 @@ class _StructureFieldTypeFieldIterator(collections.abc.Iterator): if self._at == len(self._struct_field_type): raise StopIteration - get_ft_by_index = native_bt.ctf_field_type_structure_get_field_by_index + get_ft_by_index = native_bt.field_type_structure_get_field_by_index ret, name, field_type_ptr = get_ft_by_index(self._struct_field_type._ptr, self._at) assert(ret == 0) @@ -539,7 +539,7 @@ class StructureFieldType(_FieldType, _FieldContainer, _AlignmentProp): _ITER_CLS = _StructureFieldTypeFieldIterator def __init__(self, min_alignment=None): - ptr = native_bt.ctf_field_type_structure_create() + ptr = native_bt.field_type_structure_create() self._check_create_status(ptr) super().__init__(ptr) @@ -547,20 +547,20 @@ class StructureFieldType(_FieldType, _FieldContainer, _AlignmentProp): self.min_alignment = min_alignment def _count(self): - return native_bt.ctf_field_type_structure_get_field_count(self._ptr) + return native_bt.field_type_structure_get_field_count(self._ptr) def _get_field_by_name(self, key): - return native_bt.ctf_field_type_structure_get_field_type_by_name(self._ptr, key) + return native_bt.field_type_structure_get_field_type_by_name(self._ptr, key) def _add_field(self, ptr, name): - return native_bt.ctf_field_type_structure_add_field(self._ptr, ptr, + return native_bt.field_type_structure_add_field(self._ptr, ptr, name) def _at(self, index): if index < 0 or index >= len(self): raise IndexError - ret, name, field_type_ptr = native_bt.ctf_field_type_structure_get_field_by_index(self._ptr, index) + ret, name, field_type_ptr = native_bt.field_type_structure_get_field_by_index(self._ptr, index) assert(ret == 0) return _create_from_ptr(field_type_ptr) @@ -578,7 +578,7 @@ class _VariantFieldTypeFieldIterator(collections.abc.Iterator): if self._at == len(self._variant_field_type): raise StopIteration - ret, name, field_type_ptr = native_bt.ctf_field_type_variant_get_field_by_index(self._variant_field_type._ptr, + ret, name, field_type_ptr = native_bt.field_type_variant_get_field_by_index(self._variant_field_type._ptr, self._at) assert(ret == 0) native_bt.put(field_type_ptr) @@ -599,26 +599,26 @@ class VariantFieldType(_FieldType, _FieldContainer, _AlignmentProp): utils._check_type(tag_field_type, EnumerationFieldType) tag_ft_ptr = tag_field_type._ptr - ptr = native_bt.ctf_field_type_variant_create(tag_ft_ptr, + ptr = native_bt.field_type_variant_create(tag_ft_ptr, tag_name) self._check_create_status(ptr) super().__init__(ptr) @property def tag_name(self): - tag_name = native_bt.ctf_field_type_variant_get_tag_name(self._ptr) + tag_name = native_bt.field_type_variant_get_tag_name(self._ptr) assert(tag_name is not None) return tag_name @tag_name.setter def tag_name(self, tag_name): utils._check_str(tag_name) - ret = native_bt.ctf_field_type_variant_set_tag_name(self._ptr, tag_name) + ret = native_bt.field_type_variant_set_tag_name(self._ptr, tag_name) utils._handle_ret(ret, "cannot set variant field type object's tag name") @property def tag_field_type(self): - ft_ptr = native_bt.ctf_field_type_variant_get_tag_type(self._ptr) + ft_ptr = native_bt.field_type_variant_get_tag_type(self._ptr) if ft_ptr is None: return @@ -626,19 +626,19 @@ class VariantFieldType(_FieldType, _FieldContainer, _AlignmentProp): return _create_from_ptr(ft_ptr) def _count(self): - return native_bt.ctf_field_type_variant_get_field_count(self._ptr) + return native_bt.field_type_variant_get_field_count(self._ptr) def _get_field_by_name(self, key): - return native_bt.ctf_field_type_variant_get_field_type_by_name(self._ptr, key) + return native_bt.field_type_variant_get_field_type_by_name(self._ptr, key) def _add_field(self, ptr, name): - return native_bt.ctf_field_type_variant_add_field(self._ptr, ptr, name) + return native_bt.field_type_variant_add_field(self._ptr, ptr, name) def _at(self, index): if index < 0 or index >= len(self): raise IndexError - ret, name, field_type_ptr = native_bt.ctf_field_type_variant_get_field_by_index(self._ptr, index) + ret, name, field_type_ptr = native_bt.field_type_variant_get_field_by_index(self._ptr, index) assert(ret == 0) return _create_from_ptr(field_type_ptr) @@ -649,19 +649,19 @@ class ArrayFieldType(_FieldType): def __init__(self, element_field_type, length): utils._check_type(element_field_type, _FieldType) utils._check_uint64(length) - ptr = native_bt.ctf_field_type_array_create(element_field_type._ptr, length) + ptr = native_bt.field_type_array_create(element_field_type._ptr, length) self._check_create_status(ptr) super().__init__(ptr) @property def length(self): - length = native_bt.ctf_field_type_array_get_length(self._ptr) + length = native_bt.field_type_array_get_length(self._ptr) assert(length >= 0) return length @property def element_field_type(self): - ptr = native_bt.ctf_field_type_array_get_element_type(self._ptr) + ptr = native_bt.field_type_array_get_element_type(self._ptr) assert(ptr) return _create_from_ptr(ptr) @@ -672,31 +672,31 @@ class SequenceFieldType(_FieldType): def __init__(self, element_field_type, length_name): utils._check_type(element_field_type, _FieldType) utils._check_str(length_name) - ptr = native_bt.ctf_field_type_sequence_create(element_field_type._ptr, + ptr = native_bt.field_type_sequence_create(element_field_type._ptr, length_name) self._check_create_status(ptr) super().__init__(ptr) @property def length_name(self): - length_name = native_bt.ctf_field_type_sequence_get_length_field_name(self._ptr) + length_name = native_bt.field_type_sequence_get_length_field_name(self._ptr) assert(length_name is not None) return length_name @property def element_field_type(self): - ptr = native_bt.ctf_field_type_sequence_get_element_type(self._ptr) + ptr = native_bt.field_type_sequence_get_element_type(self._ptr) assert(ptr) return _create_from_ptr(ptr) _TYPE_ID_TO_OBJ = { - native_bt.CTF_FIELD_TYPE_ID_INTEGER: IntegerFieldType, - native_bt.CTF_FIELD_TYPE_ID_FLOAT: FloatingPointNumberFieldType, - native_bt.CTF_FIELD_TYPE_ID_ENUM: EnumerationFieldType, - native_bt.CTF_FIELD_TYPE_ID_STRING: StringFieldType, - native_bt.CTF_FIELD_TYPE_ID_STRUCT: StructureFieldType, - native_bt.CTF_FIELD_TYPE_ID_ARRAY: ArrayFieldType, - native_bt.CTF_FIELD_TYPE_ID_SEQUENCE: SequenceFieldType, - native_bt.CTF_FIELD_TYPE_ID_VARIANT: VariantFieldType, + native_bt.FIELD_TYPE_ID_INTEGER: IntegerFieldType, + native_bt.FIELD_TYPE_ID_FLOAT: FloatingPointNumberFieldType, + native_bt.FIELD_TYPE_ID_ENUM: EnumerationFieldType, + native_bt.FIELD_TYPE_ID_STRING: StringFieldType, + native_bt.FIELD_TYPE_ID_STRUCT: StructureFieldType, + native_bt.FIELD_TYPE_ID_ARRAY: ArrayFieldType, + native_bt.FIELD_TYPE_ID_SEQUENCE: SequenceFieldType, + native_bt.FIELD_TYPE_ID_VARIANT: VariantFieldType, } diff --git a/bindings/python/bt2/bt2/fields.py b/bindings/python/bt2/bt2/fields.py index e3cbbef5..8f0d3203 100644 --- a/bindings/python/bt2/bt2/fields.py +++ b/bindings/python/bt2/bt2/fields.py @@ -41,10 +41,10 @@ def _create_from_ptr(ptr): # recreate the field type wrapper of this field's type (the identity # could be different, but the underlying address should be the # same) - field_type_ptr = native_bt.ctf_field_get_type(ptr) + field_type_ptr = native_bt.field_get_type(ptr) utils._handle_ptr(field_type_ptr, "cannot get field object's type") field_type = bt2.field_types._create_from_ptr(field_type_ptr) - typeid = native_bt.ctf_field_type_get_type_id(field_type._ptr) + typeid = native_bt.field_type_get_type_id(field_type._ptr) field = _TYPE_ID_TO_OBJ[typeid]._create_from_ptr(ptr) field._field_type = field_type return field @@ -52,7 +52,7 @@ def _create_from_ptr(ptr): class _Field(object._Object, metaclass=abc.ABCMeta): def __copy__(self): - ptr = native_bt.ctf_field_copy(self._ptr) + ptr = native_bt.field_copy(self._ptr) utils._handle_ptr(ptr, 'cannot copy {} field object'.format(self._NAME.lower())) return _create_from_ptr(ptr) @@ -78,11 +78,11 @@ class _Field(object._Object, metaclass=abc.ABCMeta): @property def is_set(self): - is_set = native_bt.ctf_field_is_set(self._ptr) + is_set = native_bt.field_is_set(self._ptr) return is_set > 0 def reset(self): - ret = native_bt.ctf_field_reset(self._ptr) + ret = native_bt.field_reset(self._ptr) utils._handle_ret(ret, "cannot reset field object's value") @@ -300,9 +300,9 @@ class _IntegerField(_IntegralField): @property def _value(self): if self.field_type.is_signed: - ret, value = native_bt.ctf_field_signed_integer_get_value(self._ptr) + ret, value = native_bt.field_signed_integer_get_value(self._ptr) else: - ret, value = native_bt.ctf_field_unsigned_integer_get_value(self._ptr) + ret, value = native_bt.field_unsigned_integer_get_value(self._ptr) if ret < 0: if not self.is_set: @@ -316,9 +316,9 @@ class _IntegerField(_IntegralField): value = self._value_to_int(value) if self.field_type.is_signed: - ret = native_bt.ctf_field_signed_integer_set_value(self._ptr, value) + ret = native_bt.field_signed_integer_set_value(self._ptr, value) else: - ret = native_bt.ctf_field_unsigned_integer_set_value(self._ptr, value) + ret = native_bt.field_unsigned_integer_set_value(self._ptr, value) utils._handle_ret(ret, "cannot set integer field object's value") @@ -335,7 +335,7 @@ class _FloatingPointNumberField(_RealField): @property def _value(self): - ret, value = native_bt.ctf_field_floating_point_get_value(self._ptr) + ret, value = native_bt.field_floating_point_get_value(self._ptr) if ret < 0: if not self.is_set: @@ -347,7 +347,7 @@ class _FloatingPointNumberField(_RealField): def _set_value(self, value): value = self._value_to_float(value) - ret = native_bt.ctf_field_floating_point_set_value(self._ptr, value) + ret = native_bt.field_floating_point_set_value(self._ptr, value) utils._handle_ret(ret, "cannot set floating point number field object's value") value = property(fset=_set_value) @@ -357,7 +357,7 @@ class _EnumerationField(_IntegerField): @property def integer_field(self): - int_field_ptr = native_bt.ctf_field_enumeration_get_container(self._ptr) + int_field_ptr = native_bt.field_enumeration_get_container(self._ptr) assert(int_field_ptr) return _create_from_ptr(int_field_ptr) @@ -372,7 +372,7 @@ class _EnumerationField(_IntegerField): @property def mappings(self): - iter_ptr = native_bt.ctf_field_enumeration_get_mappings(self._ptr) + iter_ptr = native_bt.field_enumeration_get_mappings(self._ptr) assert(iter_ptr) return bt2.field_types._EnumerationFieldTypeMappingIterator(iter_ptr, self.field_type.is_signed) @@ -393,12 +393,12 @@ class _StringField(_Field, collections.abc.Sequence): @property def _value(self): - value = native_bt.ctf_field_string_get_value(self._ptr) + value = native_bt.field_string_get_value(self._ptr) return value def _set_value(self, value): value = self._value_to_str(value) - ret = native_bt.ctf_field_string_set_value(self._ptr, value) + ret = native_bt.field_string_set_value(self._ptr, value) utils._handle_ret(ret, "cannot set string field object's value") value = property(fset=_set_value) @@ -431,7 +431,7 @@ class _StringField(_Field, collections.abc.Sequence): def __iadd__(self, value): value = self._value_to_str(value) - ret = native_bt.ctf_field_string_append(self._ptr, value) + ret = native_bt.field_string_append(self._ptr, value) utils._handle_ret(ret, "cannot append to string field object's value") return self @@ -457,7 +457,7 @@ class _StructureField(_ContainerField, collections.abc.MutableMapping): def __getitem__(self, key): utils._check_str(key) - ptr = native_bt.ctf_field_structure_get_field_by_name(self._ptr, key) + ptr = native_bt.field_structure_get_field_by_name(self._ptr, key) if ptr is None: raise KeyError(key) @@ -478,7 +478,7 @@ class _StructureField(_ContainerField, collections.abc.MutableMapping): if index >= len(self): raise IndexError - field_ptr = native_bt.ctf_field_structure_get_field_by_index(self._ptr, index) + field_ptr = native_bt.field_structure_get_field_by_index(self._ptr, index) assert(field_ptr) return _create_from_ptr(field_ptr) @@ -525,7 +525,7 @@ class _VariantField(_Field): @property def tag_field(self): - field_ptr = native_bt.ctf_field_variant_get_tag(self._ptr) + field_ptr = native_bt.field_variant_get_tag(self._ptr) if field_ptr is None: return @@ -538,13 +538,13 @@ class _VariantField(_Field): def field(self, tag_field=None): if tag_field is None: - field_ptr = native_bt.ctf_field_variant_get_current_field(self._ptr) + field_ptr = native_bt.field_variant_get_current_field(self._ptr) if field_ptr is None: return else: utils._check_type(tag_field, _EnumerationField) - field_ptr = native_bt.ctf_field_variant_get_field(self._ptr, tag_field._ptr) + field_ptr = native_bt.field_variant_get_field(self._ptr, tag_field._ptr) utils._handle_ptr(field_ptr, "cannot select variant field object's field") return _create_from_ptr(field_ptr) @@ -622,7 +622,7 @@ class _ArrayField(_ArraySequenceField): return self.field_type.length def _get_field_ptr_at_index(self, index): - return native_bt.ctf_field_array_get_field(self._ptr, index) + return native_bt.field_array_get_field(self._ptr, index) def _set_value(self, values): if len(self) != len(values): @@ -651,7 +651,7 @@ class _SequenceField(_ArraySequenceField): @property def length_field(self): - field_ptr = native_bt.ctf_field_sequence_get_length(self._ptr) + field_ptr = native_bt.field_sequence_get_length(self._ptr) if field_ptr is None: return return _create_from_ptr(field_ptr) @@ -659,11 +659,11 @@ class _SequenceField(_ArraySequenceField): @length_field.setter def length_field(self, length_field): utils._check_type(length_field, _IntegerField) - ret = native_bt.ctf_field_sequence_set_length(self._ptr, length_field._ptr) + ret = native_bt.field_sequence_set_length(self._ptr, length_field._ptr) utils._handle_ret(ret, "cannot set sequence field object's length field") def _get_field_ptr_at_index(self, index): - return native_bt.ctf_field_sequence_get_field(self._ptr, index) + return native_bt.field_sequence_get_field(self._ptr, index) def _set_value(self, values): original_length_field = self.length_field @@ -694,12 +694,12 @@ class _SequenceField(_ArraySequenceField): value = property(fset=_set_value) _TYPE_ID_TO_OBJ = { - native_bt.CTF_FIELD_TYPE_ID_INTEGER: _IntegerField, - native_bt.CTF_FIELD_TYPE_ID_FLOAT: _FloatingPointNumberField, - native_bt.CTF_FIELD_TYPE_ID_ENUM: _EnumerationField, - native_bt.CTF_FIELD_TYPE_ID_STRING: _StringField, - native_bt.CTF_FIELD_TYPE_ID_STRUCT: _StructureField, - native_bt.CTF_FIELD_TYPE_ID_ARRAY: _ArrayField, - native_bt.CTF_FIELD_TYPE_ID_SEQUENCE: _SequenceField, - native_bt.CTF_FIELD_TYPE_ID_VARIANT: _VariantField, + native_bt.FIELD_TYPE_ID_INTEGER: _IntegerField, + native_bt.FIELD_TYPE_ID_FLOAT: _FloatingPointNumberField, + native_bt.FIELD_TYPE_ID_ENUM: _EnumerationField, + native_bt.FIELD_TYPE_ID_STRING: _StringField, + native_bt.FIELD_TYPE_ID_STRUCT: _StructureField, + native_bt.FIELD_TYPE_ID_ARRAY: _ArrayField, + native_bt.FIELD_TYPE_ID_SEQUENCE: _SequenceField, + native_bt.FIELD_TYPE_ID_VARIANT: _VariantField, } diff --git a/bindings/python/bt2/bt2/native_bt.i b/bindings/python/bt2/bt2/native_bt.i index ad227973..62964f25 100644 --- a/bindings/python/bt2/bt2/native_bt.i +++ b/bindings/python/bt2/bt2/native_bt.i @@ -63,14 +63,14 @@ typedef int bt_bool; } /* Output argument typemap for field type output (always appends) */ -%typemap(in, numinputs=0) struct bt_ctf_field_type **BTOUTFT (struct bt_ctf_field_type *temp_ft = NULL) { +%typemap(in, numinputs=0) struct bt_field_type **BTOUTFT (struct bt_field_type *temp_ft = NULL) { $1 = &temp_ft; } -%typemap(argout) struct bt_ctf_field_type **BTOUTFT { +%typemap(argout) struct bt_field_type **BTOUTFT { if (*$1) { /* SWIG_Python_AppendOutput() steals the created object */ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_ctf_field_type, 0)); + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_field_type, 0)); } else { /* SWIG_Python_AppendOutput() steals Py_None */ Py_INCREF(Py_None); diff --git a/bindings/python/bt2/bt2/native_btccpriomap.i b/bindings/python/bt2/bt2/native_btccpriomap.i index e128cd95..3fd3b8db 100644 --- a/bindings/python/bt2/bt2/native_btccpriomap.i +++ b/bindings/python/bt2/bt2/native_btccpriomap.i @@ -33,22 +33,22 @@ struct bt_clock_class_priority_map; struct bt_clock_class_priority_map *bt_clock_class_priority_map_create(); int64_t bt_clock_class_priority_map_get_clock_class_count( struct bt_clock_class_priority_map *clock_class_priority_map); -struct bt_ctf_clock_class * +struct bt_clock_class * bt_clock_class_priority_map_get_clock_class_by_index( struct bt_clock_class_priority_map *clock_class_priority_map, uint64_t index); -struct bt_ctf_clock_class * +struct bt_clock_class * bt_clock_class_priority_map_get_clock_class_by_name( struct bt_clock_class_priority_map *clock_class_priority_map, const char *name); -struct bt_ctf_clock_class * +struct bt_clock_class * bt_clock_class_priority_map_get_highest_priority_clock_class( struct bt_clock_class_priority_map *clock_class_priority_map); int bt_clock_class_priority_map_get_clock_class_priority( struct bt_clock_class_priority_map *clock_class_priority_map, - struct bt_ctf_clock_class *clock_class, uint64_t *OUTPUTINIT); + struct bt_clock_class *clock_class, uint64_t *OUTPUTINIT); int bt_clock_class_priority_map_add_clock_class( struct bt_clock_class_priority_map *clock_class_priority_map, - struct bt_ctf_clock_class *clock_class, uint64_t priority); + struct bt_clock_class *clock_class, uint64_t priority); struct bt_clock_class_priority_map *bt_clock_class_priority_map_copy( struct bt_clock_class_priority_map *clock_class_priority_map); diff --git a/bindings/python/bt2/bt2/native_btclockclass.i b/bindings/python/bt2/bt2/native_btclockclass.i index 5a09e894..976bad77 100644 --- a/bindings/python/bt2/bt2/native_btclockclass.i +++ b/bindings/python/bt2/bt2/native_btclockclass.i @@ -23,44 +23,44 @@ */ /* Types */ -struct bt_ctf_clock_class; -struct bt_ctf_clock_value; +struct bt_clock_class; +struct bt_clock_value; /* Clock class functions */ -struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, +struct bt_clock_class *bt_clock_class_create(const char *name, uint64_t freq); -const char *bt_ctf_clock_class_get_name(struct bt_ctf_clock_class *clock_class); -int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class, const char *name); -const char *bt_ctf_clock_class_get_description(struct bt_ctf_clock_class *clock_class); -int bt_ctf_clock_class_set_description(struct bt_ctf_clock_class *clock_class, +const char *bt_clock_class_get_name(struct bt_clock_class *clock_class); +int bt_clock_class_set_name(struct bt_clock_class *clock_class, const char *name); +const char *bt_clock_class_get_description(struct bt_clock_class *clock_class); +int bt_clock_class_set_description(struct bt_clock_class *clock_class, const char *desc); -uint64_t bt_ctf_clock_class_get_frequency(struct bt_ctf_clock_class *clock_class); -int bt_ctf_clock_class_set_frequency(struct bt_ctf_clock_class *clock_class, +uint64_t bt_clock_class_get_frequency(struct bt_clock_class *clock_class); +int bt_clock_class_set_frequency(struct bt_clock_class *clock_class, uint64_t freq); -uint64_t bt_ctf_clock_class_get_precision(struct bt_ctf_clock_class *clock_class); -int bt_ctf_clock_class_set_precision(struct bt_ctf_clock_class *clock_class, +uint64_t bt_clock_class_get_precision(struct bt_clock_class *clock_class); +int bt_clock_class_set_precision(struct bt_clock_class *clock_class, uint64_t precision); -int bt_ctf_clock_class_get_offset_s(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_get_offset_s(struct bt_clock_class *clock_class, int64_t *OUTPUT); -int bt_ctf_clock_class_set_offset_s(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_offset_s(struct bt_clock_class *clock_class, int64_t offset_s); -int bt_ctf_clock_class_get_offset_cycles(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_get_offset_cycles(struct bt_clock_class *clock_class, int64_t *OUTPUT); -int bt_ctf_clock_class_set_offset_cycles(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_offset_cycles(struct bt_clock_class *clock_class, int64_t offset); -int bt_ctf_clock_class_is_absolute(struct bt_ctf_clock_class *clock_class); -int bt_ctf_clock_class_set_is_absolute(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_is_absolute(struct bt_clock_class *clock_class); +int bt_clock_class_set_is_absolute(struct bt_clock_class *clock_class, int is_absolute); -BTUUID bt_ctf_clock_class_get_uuid(struct bt_ctf_clock_class *clock_class); -int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, +BTUUID bt_clock_class_get_uuid(struct bt_clock_class *clock_class); +int bt_clock_class_set_uuid(struct bt_clock_class *clock_class, BTUUID uuid); /* Clock value functions */ -struct bt_ctf_clock_value *bt_ctf_clock_value_create( - struct bt_ctf_clock_class *clock_class, uint64_t value); -int bt_ctf_clock_value_get_value( - struct bt_ctf_clock_value *clock_value, uint64_t *OUTPUT); -int bt_ctf_clock_value_get_value_ns_from_epoch( - struct bt_ctf_clock_value *clock_value, int64_t *OUTPUT); -struct bt_ctf_clock_class *bt_ctf_clock_value_get_class( - struct bt_ctf_clock_value *clock_value); +struct bt_clock_value *bt_clock_value_create( + struct bt_clock_class *clock_class, uint64_t value); +int bt_clock_value_get_value( + struct bt_clock_value *clock_value, uint64_t *OUTPUT); +int bt_clock_value_get_value_ns_from_epoch( + struct bt_clock_value *clock_value, int64_t *OUTPUT); +struct bt_clock_class *bt_clock_value_get_class( + struct bt_clock_value *clock_value); diff --git a/bindings/python/bt2/bt2/native_btctfwriter.i b/bindings/python/bt2/bt2/native_btctfwriter.i index 293ed254..ed4f7fbe 100644 --- a/bindings/python/bt2/bt2/native_btctfwriter.i +++ b/bindings/python/bt2/bt2/native_btctfwriter.i @@ -56,35 +56,35 @@ int bt_ctf_clock_set_time(struct bt_ctf_clock *clock, int64_t time); /* Stream functions */ -int bt_ctf_stream_get_discarded_events_count( - struct bt_ctf_stream *stream, uint64_t *OUTPUT); -void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, +int bt_stream_get_discarded_events_count( + struct bt_stream *stream, uint64_t *OUTPUT); +void bt_stream_append_discarded_events(struct bt_stream *stream, uint64_t event_count); -int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, - struct bt_ctf_event *event); -struct bt_ctf_field *bt_ctf_stream_get_packet_header( - struct bt_ctf_stream *stream); -int bt_ctf_stream_set_packet_header( - struct bt_ctf_stream *stream, - struct bt_ctf_field *packet_header); -struct bt_ctf_field *bt_ctf_stream_get_packet_context( - struct bt_ctf_stream *stream); -int bt_ctf_stream_set_packet_context( - struct bt_ctf_stream *stream, - struct bt_ctf_field *packet_context); -int bt_ctf_stream_flush(struct bt_ctf_stream *stream); -int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream); +int bt_stream_append_event(struct bt_stream *stream, + struct bt_event *event); +struct bt_field *bt_stream_get_packet_header( + struct bt_stream *stream); +int bt_stream_set_packet_header( + struct bt_stream *stream, + struct bt_field *packet_header); +struct bt_field *bt_stream_get_packet_context( + struct bt_stream *stream); +int bt_stream_set_packet_context( + struct bt_stream *stream, + struct bt_field *packet_context); +int bt_stream_flush(struct bt_stream *stream); +int bt_stream_is_writer(struct bt_stream *stream); /* Stream class functions */ -int bt_ctf_stream_class_set_clock( - struct bt_ctf_stream_class *stream_class, +int bt_stream_class_set_clock( + struct bt_stream_class *stream_class, struct bt_ctf_clock *clock); -struct bt_ctf_clock *bt_ctf_stream_class_get_clock( - struct bt_ctf_stream_class *stream_class); +struct bt_ctf_clock *bt_stream_class_get_clock( + struct bt_stream_class *stream_class); /* Writer functions */ struct bt_ctf_writer *bt_ctf_writer_create(const char *path); -struct bt_ctf_trace *bt_ctf_writer_get_trace( +struct bt_trace *bt_ctf_writer_get_trace( struct bt_ctf_writer *writer); int bt_ctf_writer_add_clock(struct bt_ctf_writer *writer, struct bt_ctf_clock *clock); diff --git a/bindings/python/bt2/bt2/native_btevent.i b/bindings/python/bt2/bt2/native_btevent.i index f6e64945..df0f8587 100644 --- a/bindings/python/bt2/bt2/native_btevent.i +++ b/bindings/python/bt2/bt2/native_btevent.i @@ -23,38 +23,38 @@ */ /* Type */ -struct bt_ctf_event; +struct bt_event; /* Functions */ -struct bt_ctf_event *bt_ctf_event_create( - struct bt_ctf_event_class *event_class); -struct bt_ctf_event_class *bt_ctf_event_get_class( - struct bt_ctf_event *event); -struct bt_ctf_packet *bt_ctf_event_get_packet( - struct bt_ctf_event *event); -int bt_ctf_event_set_packet(struct bt_ctf_event *event, - struct bt_ctf_packet *packet); -struct bt_ctf_stream *bt_ctf_event_get_stream( - struct bt_ctf_event *event); -struct bt_ctf_field *bt_ctf_event_get_header( - struct bt_ctf_event *event); -int bt_ctf_event_set_header(struct bt_ctf_event *event, - struct bt_ctf_field *header); -struct bt_ctf_field *bt_ctf_event_get_stream_event_context( - struct bt_ctf_event *event); -int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, - struct bt_ctf_field *context); -struct bt_ctf_field *bt_ctf_event_get_event_context( - struct bt_ctf_event *event); -int bt_ctf_event_set_event_context(struct bt_ctf_event *event, - struct bt_ctf_field *context); -struct bt_ctf_field *bt_ctf_event_get_event_payload( - struct bt_ctf_event *event); -int bt_ctf_event_set_event_payload(struct bt_ctf_event *event, - struct bt_ctf_field *payload); -struct bt_ctf_clock_value *bt_ctf_event_get_clock_value( - struct bt_ctf_event *event, - struct bt_ctf_clock_class *clock_class); -int bt_ctf_event_set_clock_value( - struct bt_ctf_event *event, - struct bt_ctf_clock_value *clock_value); +struct bt_event *bt_event_create( + struct bt_event_class *event_class); +struct bt_event_class *bt_event_get_class( + struct bt_event *event); +struct bt_packet *bt_event_get_packet( + struct bt_event *event); +int bt_event_set_packet(struct bt_event *event, + struct bt_packet *packet); +struct bt_stream *bt_event_get_stream( + struct bt_event *event); +struct bt_field *bt_event_get_header( + struct bt_event *event); +int bt_event_set_header(struct bt_event *event, + struct bt_field *header); +struct bt_field *bt_event_get_stream_event_context( + struct bt_event *event); +int bt_event_set_stream_event_context(struct bt_event *event, + struct bt_field *context); +struct bt_field *bt_event_get_event_context( + struct bt_event *event); +int bt_event_set_event_context(struct bt_event *event, + struct bt_field *context); +struct bt_field *bt_event_get_event_payload( + struct bt_event *event); +int bt_event_set_event_payload(struct bt_event *event, + struct bt_field *payload); +struct bt_clock_value *bt_event_get_clock_value( + struct bt_event *event, + struct bt_clock_class *clock_class); +int bt_event_set_clock_value( + struct bt_event *event, + struct bt_clock_value *clock_value); diff --git a/bindings/python/bt2/bt2/native_bteventclass.i b/bindings/python/bt2/bt2/native_bteventclass.i index c4b8c8d7..23a3a693 100644 --- a/bindings/python/bt2/bt2/native_bteventclass.i +++ b/bindings/python/bt2/bt2/native_bteventclass.i @@ -23,56 +23,56 @@ */ /* Type */ -struct bt_ctf_event_class; +struct bt_event_class; /* Log levels */ -enum bt_ctf_event_class_log_level { - BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1, - BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255, - BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0, - BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1, - BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2, - BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3, - BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4, - BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5, - BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13, - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14, +enum bt_event_class_log_level { + BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1, + BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255, + BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0, + BT_EVENT_CLASS_LOG_LEVEL_ALERT = 1, + BT_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2, + BT_EVENT_CLASS_LOG_LEVEL_ERROR = 3, + BT_EVENT_CLASS_LOG_LEVEL_WARNING = 4, + BT_EVENT_CLASS_LOG_LEVEL_NOTICE = 5, + BT_EVENT_CLASS_LOG_LEVEL_INFO = 6, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG = 14, }; /* Functions */ -struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name); -struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class( - struct bt_ctf_event_class *event_class); -const char *bt_ctf_event_class_get_name( - struct bt_ctf_event_class *event_class); -int64_t bt_ctf_event_class_get_id( - struct bt_ctf_event_class *event_class); -int bt_ctf_event_class_set_id( - struct bt_ctf_event_class *event_class, uint64_t id); -enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level( - struct bt_ctf_event_class *event_class); -int bt_ctf_event_class_set_log_level( - struct bt_ctf_event_class *event_class, - enum bt_ctf_event_class_log_level log_level); -const char *bt_ctf_event_class_get_emf_uri( - struct bt_ctf_event_class *event_class); -int bt_ctf_event_class_set_emf_uri( - struct bt_ctf_event_class *event_class, +struct bt_event_class *bt_event_class_create(const char *name); +struct bt_stream_class *bt_event_class_get_stream_class( + struct bt_event_class *event_class); +const char *bt_event_class_get_name( + struct bt_event_class *event_class); +int64_t bt_event_class_get_id( + struct bt_event_class *event_class); +int bt_event_class_set_id( + struct bt_event_class *event_class, uint64_t id); +enum bt_event_class_log_level bt_event_class_get_log_level( + struct bt_event_class *event_class); +int bt_event_class_set_log_level( + struct bt_event_class *event_class, + enum bt_event_class_log_level log_level); +const char *bt_event_class_get_emf_uri( + struct bt_event_class *event_class); +int bt_event_class_set_emf_uri( + struct bt_event_class *event_class, const char *emf_uri); -struct bt_ctf_field_type *bt_ctf_event_class_get_context_type( - struct bt_ctf_event_class *event_class); -int bt_ctf_event_class_set_context_type( - struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *context_type); -struct bt_ctf_field_type *bt_ctf_event_class_get_payload_type( - struct bt_ctf_event_class *event_class); -int bt_ctf_event_class_set_payload_type( - struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *payload_type); +struct bt_field_type *bt_event_class_get_context_type( + struct bt_event_class *event_class); +int bt_event_class_set_context_type( + struct bt_event_class *event_class, + struct bt_field_type *context_type); +struct bt_field_type *bt_event_class_get_payload_type( + struct bt_event_class *event_class); +int bt_event_class_set_payload_type( + struct bt_event_class *event_class, + struct bt_field_type *payload_type); diff --git a/bindings/python/bt2/bt2/native_btfields.i b/bindings/python/bt2/bt2/native_btfields.i index cc194406..051ae661 100644 --- a/bindings/python/bt2/bt2/native_btfields.i +++ b/bindings/python/bt2/bt2/native_btfields.i @@ -23,75 +23,75 @@ */ /* Type */ -struct bt_ctf_field; +struct bt_field; /* Common functions */ -struct bt_ctf_field *bt_ctf_field_create( - struct bt_ctf_field_type *type); -struct bt_ctf_field_type *bt_ctf_field_get_type( - struct bt_ctf_field *field); -struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field); -bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field); -int bt_ctf_field_reset(struct bt_ctf_field *field); +struct bt_field *bt_field_create( + struct bt_field_type *type); +struct bt_field_type *bt_field_get_type( + struct bt_field *field); +struct bt_field *bt_field_copy(struct bt_field *field); +bt_bool bt_field_is_set(struct bt_field *field); +int bt_field_reset(struct bt_field *field); /* Integer field functions */ -int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *integer, +int bt_field_signed_integer_get_value(struct bt_field *integer, int64_t *OUTPUT); -int bt_ctf_field_signed_integer_set_value(struct bt_ctf_field *integer, +int bt_field_signed_integer_set_value(struct bt_field *integer, int64_t value); -int bt_ctf_field_unsigned_integer_get_value(struct bt_ctf_field *integer, +int bt_field_unsigned_integer_get_value(struct bt_field *integer, uint64_t *OUTPUT); -int bt_ctf_field_unsigned_integer_set_value(struct bt_ctf_field *integer, +int bt_field_unsigned_integer_set_value(struct bt_field *integer, uint64_t value); /* Floating point number field functions */ -int bt_ctf_field_floating_point_get_value( - struct bt_ctf_field *floating_point, double *OUTPUT); -int bt_ctf_field_floating_point_set_value( - struct bt_ctf_field *floating_point, +int bt_field_floating_point_get_value( + struct bt_field *floating_point, double *OUTPUT); +int bt_field_floating_point_set_value( + struct bt_field *floating_point, double value); /* Enumeration field functions */ -struct bt_ctf_field *bt_ctf_field_enumeration_get_container( - struct bt_ctf_field *enumeration); -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_enumeration_get_mappings(struct bt_ctf_field *enum_field); +struct bt_field *bt_field_enumeration_get_container( + struct bt_field *enumeration); +struct bt_field_type_enumeration_mapping_iterator * +bt_field_enumeration_get_mappings(struct bt_field *enum_field); /* String field functions */ -const char *bt_ctf_field_string_get_value( - struct bt_ctf_field *string_field); -int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field, +const char *bt_field_string_get_value( + struct bt_field *string_field); +int bt_field_string_set_value(struct bt_field *string_field, const char *value); -int bt_ctf_field_string_append(struct bt_ctf_field *string_field, +int bt_field_string_append(struct bt_field *string_field, const char *value); -int bt_ctf_field_string_append_len( - struct bt_ctf_field *string_field, const char *value, +int bt_field_string_append_len( + struct bt_field *string_field, const char *value, unsigned int length); /* Structure field functions */ -struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( - struct bt_ctf_field *structure, int index); -struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( - struct bt_ctf_field *struct_field, const char *name); -int bt_ctf_field_structure_set_field_by_name(struct bt_ctf_field *struct_field, - const char *name, struct bt_ctf_field *field); +struct bt_field *bt_field_structure_get_field_by_index( + struct bt_field *structure, int index); +struct bt_field *bt_field_structure_get_field_by_name( + struct bt_field *struct_field, const char *name); +int bt_field_structure_set_field_by_name(struct bt_field *struct_field, + const char *name, struct bt_field *field); /* Array field functions */ -struct bt_ctf_field *bt_ctf_field_array_get_field( - struct bt_ctf_field *array, uint64_t index); +struct bt_field *bt_field_array_get_field( + struct bt_field *array, uint64_t index); /* Sequence field functions */ -struct bt_ctf_field *bt_ctf_field_sequence_get_length( - struct bt_ctf_field *sequence); -int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence, - struct bt_ctf_field *length_field); -struct bt_ctf_field *bt_ctf_field_sequence_get_field( - struct bt_ctf_field *sequence, uint64_t index); +struct bt_field *bt_field_sequence_get_length( + struct bt_field *sequence); +int bt_field_sequence_set_length(struct bt_field *sequence, + struct bt_field *length_field); +struct bt_field *bt_field_sequence_get_field( + struct bt_field *sequence, uint64_t index); /* Variant field functions */ -struct bt_ctf_field *bt_ctf_field_variant_get_field( - struct bt_ctf_field *variant, struct bt_ctf_field *tag); -struct bt_ctf_field *bt_ctf_field_variant_get_current_field( - struct bt_ctf_field *variant); -struct bt_ctf_field *bt_ctf_field_variant_get_tag( - struct bt_ctf_field *variant); +struct bt_field *bt_field_variant_get_field( + struct bt_field *variant, struct bt_field *tag); +struct bt_field *bt_field_variant_get_current_field( + struct bt_field *variant); +struct bt_field *bt_field_variant_get_tag( + struct bt_field *variant); diff --git a/bindings/python/bt2/bt2/native_btft.i b/bindings/python/bt2/bt2/native_btft.i index c24a8630..3b46e90a 100644 --- a/bindings/python/bt2/bt2/native_btft.i +++ b/bindings/python/bt2/bt2/native_btft.i @@ -23,226 +23,230 @@ */ /* Type */ -struct bt_ctf_field_type; +struct bt_field_type; /* Common enumerations */ -enum bt_ctf_scope { - BT_CTF_SCOPE_UNKNOWN = -1, - BT_CTF_SCOPE_TRACE_PACKET_HEADER = 1, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT = 2, - BT_CTF_SCOPE_STREAM_EVENT_HEADER = 3, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT = 4, - BT_CTF_SCOPE_EVENT_CONTEXT = 5, - BT_CTF_SCOPE_EVENT_PAYLOAD = 6, - BT_CTF_SCOPE_ENV = 0, - BT_CTF_SCOPE_EVENT_FIELDS = 6, +enum bt_scope { + BT_SCOPE_UNKNOWN = -1, + BT_SCOPE_TRACE_PACKET_HEADER = 1, + BT_SCOPE_STREAM_PACKET_CONTEXT = 2, + BT_SCOPE_STREAM_EVENT_HEADER = 3, + BT_SCOPE_STREAM_EVENT_CONTEXT = 4, + BT_SCOPE_EVENT_CONTEXT = 5, + BT_SCOPE_EVENT_PAYLOAD = 6, + BT_SCOPE_ENV = 0, + BT_SCOPE_EVENT_FIELDS = 6, }; -enum bt_ctf_field_type_id { - BT_CTF_FIELD_TYPE_ID_UNKNOWN = CTF_TYPE_UNKNOWN, - BT_CTF_FIELD_TYPE_ID_INTEGER = CTF_TYPE_INTEGER, - BT_CTF_FIELD_TYPE_ID_FLOAT = CTF_TYPE_FLOAT, - BT_CTF_FIELD_TYPE_ID_ENUM = CTF_TYPE_ENUM, - BT_CTF_FIELD_TYPE_ID_STRING = CTF_TYPE_STRING, - BT_CTF_FIELD_TYPE_ID_STRUCT = CTF_TYPE_STRUCT, - BT_CTF_FIELD_TYPE_ID_ARRAY = CTF_TYPE_ARRAY, - BT_CTF_FIELD_TYPE_ID_SEQUENCE = CTF_TYPE_SEQUENCE, - BT_CTF_FIELD_TYPE_ID_VARIANT = CTF_TYPE_VARIANT, - BT_CTF_NR_TYPE_IDS = NR_CTF_TYPES, +enum bt_field_type_id { + BT_FIELD_TYPE_ID_UNKNOWN = -1, + BT_FIELD_TYPE_ID_INTEGER = 0, + BT_FIELD_TYPE_ID_FLOAT = 1, + BT_FIELD_TYPE_ID_ENUM = 2, + BT_FIELD_TYPE_ID_STRING = 3, + BT_FIELD_TYPE_ID_STRUCT = 4, + BT_FIELD_TYPE_ID_ARRAY = 6, + BT_FIELD_TYPE_ID_SEQUENCE = 7, + BT_FIELD_TYPE_ID_VARIANT = 5, + BT_FIELD_TYPE_ID_NR = 8, }; -enum bt_ctf_byte_order { - BT_CTF_BYTE_ORDER_UNKNOWN = -1, - BT_CTF_BYTE_ORDER_NATIVE = 0, - BT_CTF_BYTE_ORDER_UNSPECIFIED, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN, - BT_CTF_BYTE_ORDER_BIG_ENDIAN, - BT_CTF_BYTE_ORDER_NETWORK, +enum bt_byte_order { + BT_BYTE_ORDER_UNKNOWN = -1, + BT_BYTE_ORDER_NATIVE = 0, + BT_BYTE_ORDER_UNSPECIFIED, + BT_BYTE_ORDER_LITTLE_ENDIAN, + BT_BYTE_ORDER_BIG_ENDIAN, + BT_BYTE_ORDER_NETWORK, }; -enum bt_ctf_string_encoding { - BT_CTF_STRING_ENCODING_UNKNOWN = CTF_STRING_UNKNOWN, - BT_CTF_STRING_ENCODING_NONE = CTF_STRING_NONE, - BT_CTF_STRING_ENCODING_UTF8 = CTF_STRING_UTF8, - BT_CTF_STRING_ENCODING_ASCII = CTF_STRING_ASCII, +/** +@brief String encoding of a @ft. +*/ +enum bt_string_encoding { + BT_STRING_ENCODING_UNKNOWN = -1, + BT_STRING_ENCODING_NONE, + BT_STRING_ENCODING_UTF8, + BT_STRING_ENCODING_ASCII, }; /* Common functions */ -enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id( - struct bt_ctf_field_type *field_type); -int bt_ctf_field_type_get_alignment( - struct bt_ctf_field_type *field_type); -int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *field_type, +enum bt_field_type_id bt_field_type_get_type_id( + struct bt_field_type *field_type); +int bt_field_type_get_alignment( + struct bt_field_type *field_type); +int bt_field_type_set_alignment(struct bt_field_type *field_type, unsigned int alignment); -enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order( - struct bt_ctf_field_type *field_type); -int bt_ctf_field_type_set_byte_order( - struct bt_ctf_field_type *field_type, - enum bt_ctf_byte_order byte_order); -int bt_ctf_field_type_compare(struct bt_ctf_field_type *field_type_a, - struct bt_ctf_field_type *field_type_b); -struct bt_ctf_field_type *bt_ctf_field_type_copy( - struct bt_ctf_field_type *field_type); +enum bt_byte_order bt_field_type_get_byte_order( + struct bt_field_type *field_type); +int bt_field_type_set_byte_order( + struct bt_field_type *field_type, + enum bt_byte_order byte_order); +int bt_field_type_compare(struct bt_field_type *field_type_a, + struct bt_field_type *field_type_b); +struct bt_field_type *bt_field_type_copy( + struct bt_field_type *field_type); /* Integer field type base enumeration */ -enum bt_ctf_integer_base { - BT_CTF_INTEGER_BASE_UNKNOWN = -1, - BT_CTF_INTEGER_BASE_BINARY = 2, - BT_CTF_INTEGER_BASE_OCTAL = 8, - BT_CTF_INTEGER_BASE_DECIMAL = 10, - BT_CTF_INTEGER_BASE_HEXADECIMAL = 16, +enum bt_integer_base { + BT_INTEGER_BASE_UNKNOWN = -1, + BT_INTEGER_BASE_UNSPECIFIED = 0, + BT_INTEGER_BASE_BINARY = 2, + BT_INTEGER_BASE_OCTAL = 8, + BT_INTEGER_BASE_DECIMAL = 10, + BT_INTEGER_BASE_HEXADECIMAL = 16, }; /* Integer field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_integer_create( +struct bt_field_type *bt_field_type_integer_create( unsigned int size); -int bt_ctf_field_type_integer_get_size( - struct bt_ctf_field_type *int_field_type); -int bt_ctf_field_type_integer_set_size( - struct bt_ctf_field_type *int_field_type, unsigned int size); -int bt_ctf_field_type_integer_is_signed( - struct bt_ctf_field_type *int_field_type); -int bt_ctf_field_type_integer_set_is_signed( - struct bt_ctf_field_type *int_field_type, int is_signed); -enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base( - struct bt_ctf_field_type *int_field_type); -int bt_ctf_field_type_integer_set_base( - struct bt_ctf_field_type *int_field_type, - enum bt_ctf_integer_base base); -enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding( - struct bt_ctf_field_type *int_field_type); -int bt_ctf_field_type_integer_set_encoding( - struct bt_ctf_field_type *int_field_type, - enum bt_ctf_string_encoding encoding); -struct bt_ctf_clock_class *bt_ctf_field_type_integer_get_mapped_clock_class( - struct bt_ctf_field_type *int_field_type); -int bt_ctf_field_type_integer_set_mapped_clock_class( - struct bt_ctf_field_type *int_field_type, - struct bt_ctf_clock_class *clock_class); +int bt_field_type_integer_get_size( + struct bt_field_type *int_field_type); +int bt_field_type_integer_set_size( + struct bt_field_type *int_field_type, unsigned int size); +int bt_field_type_integer_is_signed( + struct bt_field_type *int_field_type); +int bt_field_type_integer_set_is_signed( + struct bt_field_type *int_field_type, int is_signed); +enum bt_integer_base bt_field_type_integer_get_base( + struct bt_field_type *int_field_type); +int bt_field_type_integer_set_base( + struct bt_field_type *int_field_type, + enum bt_integer_base base); +enum bt_string_encoding bt_field_type_integer_get_encoding( + struct bt_field_type *int_field_type); +int bt_field_type_integer_set_encoding( + struct bt_field_type *int_field_type, + enum bt_string_encoding encoding); +struct bt_clock_class *bt_field_type_integer_get_mapped_clock_class( + struct bt_field_type *int_field_type); +int bt_field_type_integer_set_mapped_clock_class( + struct bt_field_type *int_field_type, + struct bt_clock_class *clock_class); /* Floating point number field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void); -int bt_ctf_field_type_floating_point_get_exponent_digits( - struct bt_ctf_field_type *float_field_type); -int bt_ctf_field_type_floating_point_set_exponent_digits( - struct bt_ctf_field_type *float_field_type, +struct bt_field_type *bt_field_type_floating_point_create(void); +int bt_field_type_floating_point_get_exponent_digits( + struct bt_field_type *float_field_type); +int bt_field_type_floating_point_set_exponent_digits( + struct bt_field_type *float_field_type, unsigned int exponent_size); -int bt_ctf_field_type_floating_point_get_mantissa_digits( - struct bt_ctf_field_type *float_field_type); -int bt_ctf_field_type_floating_point_set_mantissa_digits( - struct bt_ctf_field_type *float_field_type, +int bt_field_type_floating_point_get_mantissa_digits( + struct bt_field_type *float_field_type); +int bt_field_type_floating_point_set_mantissa_digits( + struct bt_field_type *float_field_type, unsigned int mantissa_sign_size); /* Enumeration field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( - struct bt_ctf_field_type *int_field_type); -struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type( - struct bt_ctf_field_type *enum_field_type); -int64_t bt_ctf_field_type_enumeration_get_mapping_count( - struct bt_ctf_field_type *enum_field_type); -int bt_ctf_field_type_enumeration_get_mapping_signed( - struct bt_ctf_field_type *enum_field_type, int index, +struct bt_field_type *bt_field_type_enumeration_create( + struct bt_field_type *int_field_type); +struct bt_field_type *bt_field_type_enumeration_get_container_type( + struct bt_field_type *enum_field_type); +int64_t bt_field_type_enumeration_get_mapping_count( + struct bt_field_type *enum_field_type); +int bt_field_type_enumeration_get_mapping_signed( + struct bt_field_type *enum_field_type, int index, const char **BTOUTSTR, int64_t *OUTPUT, int64_t *OUTPUT); -int bt_ctf_field_type_enumeration_get_mapping_unsigned( - struct bt_ctf_field_type *enum_field_type, int index, +int bt_field_type_enumeration_get_mapping_unsigned( + struct bt_field_type *enum_field_type, int index, const char **BTOUTSTR, uint64_t *OUTPUT, uint64_t *OUTPUT); -int bt_ctf_field_type_enumeration_add_mapping_signed( - struct bt_ctf_field_type *enum_field_type, const char *name, +int bt_field_type_enumeration_add_mapping_signed( + struct bt_field_type *enum_field_type, const char *name, int64_t range_begin, int64_t range_end); -int bt_ctf_field_type_enumeration_add_mapping_unsigned( - struct bt_ctf_field_type *enum_field_type, const char *name, +int bt_field_type_enumeration_add_mapping_unsigned( + struct bt_field_type *enum_field_type, const char *name, uint64_t range_begin, uint64_t range_end); -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_name( - struct bt_ctf_field_type *enum_field_type, +struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_name( + struct bt_field_type *enum_field_type, const char *name); -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_signed_value( - struct bt_ctf_field_type *enum_field_type, +struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_signed_value( + struct bt_field_type *enum_field_type, int64_t value); -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value( - struct bt_ctf_field_type *enum_field_type, +struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_unsigned_value( + struct bt_field_type *enum_field_type, uint64_t value); /* Enumeration field type mapping iterator functions */ -int bt_ctf_field_type_enumeration_mapping_iterator_get_signed( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter, +int bt_field_type_enumeration_mapping_iterator_get_signed( + struct bt_field_type_enumeration_mapping_iterator *iter, const char **BTOUTSTR, int64_t *OUTPUT, int64_t *OUTPUT); -int bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter, +int bt_field_type_enumeration_mapping_iterator_get_unsigned( + struct bt_field_type_enumeration_mapping_iterator *iter, const char **BTOUTSTR, uint64_t *OUTPUT, uint64_t *OUTPUT); -int bt_ctf_field_type_enumeration_mapping_iterator_next( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter); +int bt_field_type_enumeration_mapping_iterator_next( + struct bt_field_type_enumeration_mapping_iterator *iter); /* String field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_string_create(void); -enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding( - struct bt_ctf_field_type *string_field_type); -int bt_ctf_field_type_string_set_encoding( - struct bt_ctf_field_type *string_field_type, - enum bt_ctf_string_encoding encoding); +struct bt_field_type *bt_field_type_string_create(void); +enum bt_string_encoding bt_field_type_string_get_encoding( + struct bt_field_type *string_field_type); +int bt_field_type_string_set_encoding( + struct bt_field_type *string_field_type, + enum bt_string_encoding encoding); /* Structure field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void); -int64_t bt_ctf_field_type_structure_get_field_count( - struct bt_ctf_field_type *struct_field_type); -int bt_ctf_field_type_structure_get_field_by_index( - struct bt_ctf_field_type *struct_field_type, - const char **BTOUTSTR, struct bt_ctf_field_type **BTOUTFT, +struct bt_field_type *bt_field_type_structure_create(void); +int64_t bt_field_type_structure_get_field_count( + struct bt_field_type *struct_field_type); +int bt_field_type_structure_get_field_by_index( + struct bt_field_type *struct_field_type, + const char **BTOUTSTR, struct bt_field_type **BTOUTFT, uint64_t index); -struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name( - struct bt_ctf_field_type *struct_field_type, +struct bt_field_type *bt_field_type_structure_get_field_type_by_name( + struct bt_field_type *struct_field_type, const char *field_name); -int bt_ctf_field_type_structure_add_field( - struct bt_ctf_field_type *struct_field_type, - struct bt_ctf_field_type *field_type, +int bt_field_type_structure_add_field( + struct bt_field_type *struct_field_type, + struct bt_field_type *field_type, const char *field_name); /* Array field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_array_create( - struct bt_ctf_field_type *element_field_type, +struct bt_field_type *bt_field_type_array_create( + struct bt_field_type *element_field_type, unsigned int length); -struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type( - struct bt_ctf_field_type *array_field_type); -int64_t bt_ctf_field_type_array_get_length( - struct bt_ctf_field_type *array_field_type); +struct bt_field_type *bt_field_type_array_get_element_type( + struct bt_field_type *array_field_type); +int64_t bt_field_type_array_get_length( + struct bt_field_type *array_field_type); /* Sequence field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_sequence_create( - struct bt_ctf_field_type *element_field_type, +struct bt_field_type *bt_field_type_sequence_create( + struct bt_field_type *element_field_type, const char *length_name); -struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_type( - struct bt_ctf_field_type *sequence_field_type); -const char *bt_ctf_field_type_sequence_get_length_field_name( - struct bt_ctf_field_type *sequence_field_type); -struct bt_ctf_field_path *bt_ctf_field_type_sequence_get_length_field_path( - struct bt_ctf_field_type *sequence_field_type); +struct bt_field_type *bt_field_type_sequence_get_element_type( + struct bt_field_type *sequence_field_type); +const char *bt_field_type_sequence_get_length_field_name( + struct bt_field_type *sequence_field_type); +struct bt_field_path *bt_field_type_sequence_get_length_field_path( + struct bt_field_type *sequence_field_type); /* Variant field type functions */ -struct bt_ctf_field_type *bt_ctf_field_type_variant_create( - struct bt_ctf_field_type *tag_field_type, +struct bt_field_type *bt_field_type_variant_create( + struct bt_field_type *tag_field_type, const char *tag_name); -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_type( - struct bt_ctf_field_type *variant_field_type); -const char *bt_ctf_field_type_variant_get_tag_name( - struct bt_ctf_field_type *variant_field_type); -int bt_ctf_field_type_variant_set_tag_name( - struct bt_ctf_field_type *variant_field_type, +struct bt_field_type *bt_field_type_variant_get_tag_type( + struct bt_field_type *variant_field_type); +const char *bt_field_type_variant_get_tag_name( + struct bt_field_type *variant_field_type); +int bt_field_type_variant_set_tag_name( + struct bt_field_type *variant_field_type, const char *tag_name); -struct bt_ctf_field_path *bt_ctf_field_type_variant_get_tag_field_path( - struct bt_ctf_field_type *variant_field_type); -int64_t bt_ctf_field_type_variant_get_field_count( - struct bt_ctf_field_type *variant_field_type); -int bt_ctf_field_type_variant_get_field_by_index( - struct bt_ctf_field_type *variant_field_type, +struct bt_field_path *bt_field_type_variant_get_tag_field_path( + struct bt_field_type *variant_field_type); +int64_t bt_field_type_variant_get_field_count( + struct bt_field_type *variant_field_type); +int bt_field_type_variant_get_field_by_index( + struct bt_field_type *variant_field_type, const char **BTOUTSTR, - struct bt_ctf_field_type **BTOUTFT, uint64_t index); -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name( - struct bt_ctf_field_type *variant_field_type, + struct bt_field_type **BTOUTFT, uint64_t index); +struct bt_field_type *bt_field_type_variant_get_field_type_by_name( + struct bt_field_type *variant_field_type, const char *field_name); -int bt_ctf_field_type_variant_add_field( - struct bt_ctf_field_type *variant_field_type, - struct bt_ctf_field_type *field_type, +int bt_field_type_variant_add_field( + struct bt_field_type *variant_field_type, + struct bt_field_type *field_type, const char *field_name); diff --git a/bindings/python/bt2/bt2/native_btnotification.i b/bindings/python/bt2/bt2/native_btnotification.i index 41922785..5b4843ec 100644 --- a/bindings/python/bt2/bt2/native_btnotification.i +++ b/bindings/python/bt2/bt2/native_btnotification.i @@ -46,9 +46,9 @@ enum bt_notification_type bt_notification_get_type( /* Event notification functions */ struct bt_notification *bt_notification_event_create( - struct bt_ctf_event *event, + struct bt_event *event, struct bt_clock_class_priority_map *clock_class_priority_map); -struct bt_ctf_event *bt_notification_event_get_event( +struct bt_event *bt_notification_event_get_event( struct bt_notification *notification); struct bt_clock_class_priority_map * bt_notification_event_get_clock_class_priority_map( @@ -60,53 +60,53 @@ struct bt_notification *bt_notification_inactivity_create( struct bt_clock_class_priority_map * bt_notification_inactivity_get_clock_class_priority_map( struct bt_notification *notification); -struct bt_ctf_clock_value *bt_notification_inactivity_get_clock_value( +struct bt_clock_value *bt_notification_inactivity_get_clock_value( struct bt_notification *notification, - struct bt_ctf_clock_class *clock_class); + struct bt_clock_class *clock_class); int bt_notification_inactivity_set_clock_value( struct bt_notification *notification, - struct bt_ctf_clock_value *clock_value); + struct bt_clock_value *clock_value); /* Packet notification functions */ struct bt_notification *bt_notification_packet_begin_create( - struct bt_ctf_packet *packet); + struct bt_packet *packet); struct bt_notification *bt_notification_packet_end_create( - struct bt_ctf_packet *packet); -struct bt_ctf_packet *bt_notification_packet_begin_get_packet( + struct bt_packet *packet); +struct bt_packet *bt_notification_packet_begin_get_packet( struct bt_notification *notification); -struct bt_ctf_packet *bt_notification_packet_end_get_packet( +struct bt_packet *bt_notification_packet_end_get_packet( struct bt_notification *notification); /* Stream notification functions */ struct bt_notification *bt_notification_stream_begin_create( - struct bt_ctf_stream *stream); + struct bt_stream *stream); struct bt_notification *bt_notification_stream_end_create( - struct bt_ctf_stream *stream); -struct bt_ctf_stream *bt_notification_stream_begin_get_stream( + struct bt_stream *stream); +struct bt_stream *bt_notification_stream_begin_get_stream( struct bt_notification *notification); -struct bt_ctf_stream *bt_notification_stream_end_get_stream( +struct bt_stream *bt_notification_stream_end_get_stream( struct bt_notification *notification); /* Discarded packets notification functions */ -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_packets_get_begin_clock_value( struct bt_notification *notification); -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_packets_get_end_clock_value( struct bt_notification *notification); int64_t bt_notification_discarded_packets_get_count( struct bt_notification *notification); -struct bt_ctf_stream *bt_notification_discarded_packets_get_stream( +struct bt_stream *bt_notification_discarded_packets_get_stream( struct bt_notification *notification); /* Discarded events notification functions */ -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_events_get_begin_clock_value( struct bt_notification *notification); -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_events_get_end_clock_value( struct bt_notification *notification); int64_t bt_notification_discarded_events_get_count( struct bt_notification *notification); -struct bt_ctf_stream *bt_notification_discarded_events_get_stream( +struct bt_stream *bt_notification_discarded_events_get_stream( struct bt_notification *notification); diff --git a/bindings/python/bt2/bt2/native_btpacket.i b/bindings/python/bt2/bt2/native_btpacket.i index 68877110..4e677ecd 100644 --- a/bindings/python/bt2/bt2/native_btpacket.i +++ b/bindings/python/bt2/bt2/native_btpacket.i @@ -23,18 +23,18 @@ */ /* Type */ -struct bt_ctf_packet; +struct bt_packet; /* Functions */ -struct bt_ctf_packet *bt_ctf_packet_create( - struct bt_ctf_stream *stream); -struct bt_ctf_stream *bt_ctf_packet_get_stream( - struct bt_ctf_packet *packet); -struct bt_ctf_field *bt_ctf_packet_get_header( - struct bt_ctf_packet *packet); -int bt_ctf_packet_set_header( - struct bt_ctf_packet *packet, struct bt_ctf_field *header); -struct bt_ctf_field *bt_ctf_packet_get_context( - struct bt_ctf_packet *packet); -int bt_ctf_packet_set_context( - struct bt_ctf_packet *packet, struct bt_ctf_field *context); +struct bt_packet *bt_packet_create( + struct bt_stream *stream); +struct bt_stream *bt_packet_get_stream( + struct bt_packet *packet); +struct bt_field *bt_packet_get_header( + struct bt_packet *packet); +int bt_packet_set_header( + struct bt_packet *packet, struct bt_field *header); +struct bt_field *bt_packet_get_context( + struct bt_packet *packet); +int bt_packet_set_context( + struct bt_packet *packet, struct bt_field *context); diff --git a/bindings/python/bt2/bt2/native_btstream.i b/bindings/python/bt2/bt2/native_btstream.i index 39747bc7..255834c6 100644 --- a/bindings/python/bt2/bt2/native_btstream.i +++ b/bindings/python/bt2/bt2/native_btstream.i @@ -23,16 +23,16 @@ */ /* Type */ -struct bt_ctf_stream; +struct bt_stream; /* Functions */ -struct bt_ctf_stream *bt_ctf_stream_create( - struct bt_ctf_stream_class *stream_class, +struct bt_stream *bt_stream_create( + struct bt_stream_class *stream_class, const char *name); -struct bt_ctf_stream *bt_ctf_stream_create_with_id( - struct bt_ctf_stream_class *stream_class, +struct bt_stream *bt_stream_create_with_id( + struct bt_stream_class *stream_class, const char *name, uint64_t id); -const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream); -int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream); -struct bt_ctf_stream_class *bt_ctf_stream_get_class( - struct bt_ctf_stream *stream); +const char *bt_stream_get_name(struct bt_stream *stream); +int64_t bt_stream_get_id(struct bt_stream *stream); +struct bt_stream_class *bt_stream_get_class( + struct bt_stream *stream); diff --git a/bindings/python/bt2/bt2/native_btstreamclass.i b/bindings/python/bt2/bt2/native_btstreamclass.i index 82440571..733563c3 100644 --- a/bindings/python/bt2/bt2/native_btstreamclass.i +++ b/bindings/python/bt2/bt2/native_btstreamclass.i @@ -23,45 +23,45 @@ */ /* Type */ -struct bt_ctf_stream_class; +struct bt_stream_class; /* Functions */ -struct bt_ctf_stream_class *bt_ctf_stream_class_create_empty( +struct bt_stream_class *bt_stream_class_create_empty( const char *name); -struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name); -struct bt_ctf_trace *bt_ctf_stream_class_get_trace( - struct bt_ctf_stream_class *stream_class); -const char *bt_ctf_stream_class_get_name( - struct bt_ctf_stream_class *stream_class); -int bt_ctf_stream_class_set_name( - struct bt_ctf_stream_class *stream_class, const char *name); -int64_t bt_ctf_stream_class_get_id( - struct bt_ctf_stream_class *stream_class); -int bt_ctf_stream_class_set_id( - struct bt_ctf_stream_class *stream_class, uint64_t id); -struct bt_ctf_field_type *bt_ctf_stream_class_get_packet_context_type( - struct bt_ctf_stream_class *stream_class); -int bt_ctf_stream_class_set_packet_context_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *packet_context_type); -struct bt_ctf_field_type * -bt_ctf_stream_class_get_event_header_type( - struct bt_ctf_stream_class *stream_class); -int bt_ctf_stream_class_set_event_header_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *event_header_type); -struct bt_ctf_field_type * -bt_ctf_stream_class_get_event_context_type( - struct bt_ctf_stream_class *stream_class); -int bt_ctf_stream_class_set_event_context_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *event_context_type); -int64_t bt_ctf_stream_class_get_event_class_count( - struct bt_ctf_stream_class *stream_class); -struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index( - struct bt_ctf_stream_class *stream_class, uint64_t index); -struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id( - struct bt_ctf_stream_class *stream_class, uint64_t id); -int bt_ctf_stream_class_add_event_class( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_event_class *event_class); +struct bt_stream_class *bt_stream_class_create(const char *name); +struct bt_trace *bt_stream_class_get_trace( + struct bt_stream_class *stream_class); +const char *bt_stream_class_get_name( + struct bt_stream_class *stream_class); +int bt_stream_class_set_name( + struct bt_stream_class *stream_class, const char *name); +int64_t bt_stream_class_get_id( + struct bt_stream_class *stream_class); +int bt_stream_class_set_id( + struct bt_stream_class *stream_class, uint64_t id); +struct bt_field_type *bt_stream_class_get_packet_context_type( + struct bt_stream_class *stream_class); +int bt_stream_class_set_packet_context_type( + struct bt_stream_class *stream_class, + struct bt_field_type *packet_context_type); +struct bt_field_type * +bt_stream_class_get_event_header_type( + struct bt_stream_class *stream_class); +int bt_stream_class_set_event_header_type( + struct bt_stream_class *stream_class, + struct bt_field_type *event_header_type); +struct bt_field_type * +bt_stream_class_get_event_context_type( + struct bt_stream_class *stream_class); +int bt_stream_class_set_event_context_type( + struct bt_stream_class *stream_class, + struct bt_field_type *event_context_type); +int64_t bt_stream_class_get_event_class_count( + struct bt_stream_class *stream_class); +struct bt_event_class *bt_stream_class_get_event_class_by_index( + struct bt_stream_class *stream_class, uint64_t index); +struct bt_event_class *bt_stream_class_get_event_class_by_id( + struct bt_stream_class *stream_class, uint64_t id); +int bt_stream_class_add_event_class( + struct bt_stream_class *stream_class, + struct bt_event_class *event_class); diff --git a/bindings/python/bt2/bt2/native_bttrace.i b/bindings/python/bt2/bt2/native_bttrace.i index 8947ae07..3f78f450 100644 --- a/bindings/python/bt2/bt2/native_bttrace.i +++ b/bindings/python/bt2/bt2/native_bttrace.i @@ -23,70 +23,70 @@ */ /* Type */ -struct bt_ctf_trace; +struct bt_trace; /* Functions */ -struct bt_ctf_trace *bt_ctf_trace_create(void); -const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace_class); -int bt_ctf_trace_set_name(struct bt_ctf_trace *trace_class, +struct bt_trace *bt_trace_create(void); +const char *bt_trace_get_name(struct bt_trace *trace_class); +int bt_trace_set_name(struct bt_trace *trace_class, const char *name); -enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order( - struct bt_ctf_trace *trace_class); -int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace_class, - enum bt_ctf_byte_order native_byte_order); -BTUUID bt_ctf_trace_get_uuid( - struct bt_ctf_trace *trace_class); -int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace_class, +enum bt_byte_order bt_trace_get_native_byte_order( + struct bt_trace *trace_class); +int bt_trace_set_native_byte_order(struct bt_trace *trace_class, + enum bt_byte_order native_byte_order); +BTUUID bt_trace_get_uuid( + struct bt_trace *trace_class); +int bt_trace_set_uuid(struct bt_trace *trace_class, BTUUID uuid); -int64_t bt_ctf_trace_get_environment_field_count( - struct bt_ctf_trace *trace_class); +int64_t bt_trace_get_environment_field_count( + struct bt_trace *trace_class); const char * -bt_ctf_trace_get_environment_field_name_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); +bt_trace_get_environment_field_name_by_index( + struct bt_trace *trace_class, uint64_t index); struct bt_value * -bt_ctf_trace_get_environment_field_value_by_index(struct bt_ctf_trace *trace_class, +bt_trace_get_environment_field_value_by_index(struct bt_trace *trace_class, uint64_t index); struct bt_value * -bt_ctf_trace_get_environment_field_value_by_name( - struct bt_ctf_trace *trace_class, const char *name); -int bt_ctf_trace_set_environment_field( - struct bt_ctf_trace *trace_class, const char *name, +bt_trace_get_environment_field_value_by_name( + struct bt_trace *trace_class, const char *name); +int bt_trace_set_environment_field( + struct bt_trace *trace_class, const char *name, struct bt_value *value); -struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_type( - struct bt_ctf_trace *trace_class); -int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace_class, - struct bt_ctf_field_type *packet_header_type); -int64_t bt_ctf_trace_get_clock_class_count( - struct bt_ctf_trace *trace_class); -struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); -struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_name( - struct bt_ctf_trace *trace_class, const char *name); -int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace_class, - struct bt_ctf_clock_class *clock_class); -int64_t bt_ctf_trace_get_stream_class_count( - struct bt_ctf_trace *trace_class); -struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); -struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id( - struct bt_ctf_trace *trace_class, uint64_t id); -int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace_class, - struct bt_ctf_stream_class *stream_class); -int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace_class); -struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); -int bt_ctf_trace_is_static(struct bt_ctf_trace *trace_class); -int bt_ctf_trace_set_is_static(struct bt_ctf_trace *trace_class); +struct bt_field_type *bt_trace_get_packet_header_type( + struct bt_trace *trace_class); +int bt_trace_set_packet_header_type(struct bt_trace *trace_class, + struct bt_field_type *packet_header_type); +int64_t bt_trace_get_clock_class_count( + struct bt_trace *trace_class); +struct bt_clock_class *bt_trace_get_clock_class_by_index( + struct bt_trace *trace_class, uint64_t index); +struct bt_clock_class *bt_trace_get_clock_class_by_name( + struct bt_trace *trace_class, const char *name); +int bt_trace_add_clock_class(struct bt_trace *trace_class, + struct bt_clock_class *clock_class); +int64_t bt_trace_get_stream_class_count( + struct bt_trace *trace_class); +struct bt_stream_class *bt_trace_get_stream_class_by_index( + struct bt_trace *trace_class, uint64_t index); +struct bt_stream_class *bt_trace_get_stream_class_by_id( + struct bt_trace *trace_class, uint64_t id); +int bt_trace_add_stream_class(struct bt_trace *trace_class, + struct bt_stream_class *stream_class); +int64_t bt_trace_get_stream_count(struct bt_trace *trace_class); +struct bt_stream *bt_trace_get_stream_by_index( + struct bt_trace *trace_class, uint64_t index); +int bt_trace_is_static(struct bt_trace *trace_class); +int bt_trace_set_is_static(struct bt_trace *trace_class); /* Helper functions for Python */ %{ -void trace_is_static_listener(struct bt_ctf_trace *trace, void *py_callable) +void trace_is_static_listener(struct bt_trace *trace, void *py_callable) { PyObject *py_trace_ptr = NULL; PyObject *py_res = NULL; py_trace_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(trace), - SWIGTYPE_p_bt_ctf_trace, 0); + SWIGTYPE_p_bt_trace, 0); if (!py_trace_ptr) { BT_LOGF_STR("Failed to create a SWIG pointer object."); abort(); @@ -98,7 +98,7 @@ void trace_is_static_listener(struct bt_ctf_trace *trace, void *py_callable) Py_DECREF(py_res); } -void trace_listener_removed(struct bt_ctf_trace *trace, void *py_callable) +void trace_listener_removed(struct bt_trace *trace, void *py_callable) { assert(py_callable); Py_DECREF(py_callable); @@ -107,12 +107,12 @@ void trace_listener_removed(struct bt_ctf_trace *trace, void *py_callable) static int bt_py3_trace_add_is_staitc_listener(unsigned long long trace_addr, PyObject *py_callable) { - struct bt_ctf_trace *trace = (void *) trace_addr; + struct bt_trace *trace = (void *) trace_addr; int ret = 0; assert(trace); assert(py_callable); - ret = bt_ctf_trace_add_is_static_listener(trace, + ret = bt_trace_add_is_static_listener(trace, trace_is_static_listener, trace_listener_removed, py_callable); if (ret >= 0) { Py_INCREF(py_callable); diff --git a/bindings/python/bt2/bt2/packet.py b/bindings/python/bt2/bt2/packet.py index 1fba03ca..84302fa0 100644 --- a/bindings/python/bt2/bt2/packet.py +++ b/bindings/python/bt2/bt2/packet.py @@ -31,13 +31,13 @@ import bt2 class _Packet(object._Object): @property def stream(self): - stream_ptr = native_bt.ctf_packet_get_stream(self._ptr) + stream_ptr = native_bt.packet_get_stream(self._ptr) assert(stream_ptr) return bt2.stream._Stream._create_from_ptr(stream_ptr) @property def header_field(self): - field_ptr = native_bt.ctf_packet_get_header(self._ptr) + field_ptr = native_bt.packet_get_header(self._ptr) if field_ptr is None: return @@ -52,12 +52,12 @@ class _Packet(object._Object): utils._check_type(header_field, bt2.fields._Field) header_field_ptr = header_field._ptr - ret = native_bt.ctf_packet_set_header(self._ptr, header_field_ptr) + ret = native_bt.packet_set_header(self._ptr, header_field_ptr) utils._handle_ret(ret, "cannot set packet object's header field") @property def context_field(self): - field_ptr = native_bt.ctf_packet_get_context(self._ptr) + field_ptr = native_bt.packet_get_context(self._ptr) if field_ptr is None: return @@ -72,7 +72,7 @@ class _Packet(object._Object): utils._check_type(context_field, bt2.fields._Field) context_field_ptr = context_field._ptr - ret = native_bt.ctf_packet_set_context(self._ptr, context_field_ptr) + ret = native_bt.packet_set_context(self._ptr, context_field_ptr) utils._handle_ret(ret, "cannot set packet object's context field") def __eq__(self, other): diff --git a/bindings/python/bt2/bt2/stream.py b/bindings/python/bt2/bt2/stream.py index 0f76b6a2..3d313cd5 100644 --- a/bindings/python/bt2/bt2/stream.py +++ b/bindings/python/bt2/bt2/stream.py @@ -28,9 +28,9 @@ import bt2 def _create_from_ptr(stream_ptr): - if native_bt.ctf_stream_is_writer(stream_ptr): - import bt2.ctf_writer + import bt2.ctf_writer + if native_bt.stream_is_writer(stream_ptr): cls = bt2.ctf_writer._CtfWriterStream else: cls = _Stream @@ -41,17 +41,17 @@ def _create_from_ptr(stream_ptr): class _StreamBase(object._Object): @property def stream_class(self): - stream_class_ptr = native_bt.ctf_stream_get_class(self._ptr) + stream_class_ptr = native_bt.stream_get_class(self._ptr) assert(stream_class_ptr) return bt2.StreamClass._create_from_ptr(stream_class_ptr) @property def name(self): - return native_bt.ctf_stream_get_name(self._ptr) + return native_bt.stream_get_name(self._ptr) @property def id(self): - id = native_bt.ctf_stream_get_id(self._ptr) + id = native_bt.stream_get_id(self._ptr) return id if id >= 0 else None def __eq__(self, other): @@ -63,7 +63,7 @@ class _StreamBase(object._Object): class _Stream(_StreamBase): def create_packet(self): - packet_ptr = native_bt.ctf_packet_create(self._ptr) + packet_ptr = native_bt.packet_create(self._ptr) if packet_ptr is None: raise bt2.CreationError('cannot create packet object') diff --git a/bindings/python/bt2/bt2/stream_class.py b/bindings/python/bt2/bt2/stream_class.py index 17c6de0f..24ac9d99 100644 --- a/bindings/python/bt2/bt2/stream_class.py +++ b/bindings/python/bt2/bt2/stream_class.py @@ -38,10 +38,10 @@ class _EventClassIterator(collections.abc.Iterator): if self._at == len(self._stream_class): raise StopIteration - ec_ptr = native_bt.ctf_stream_class_get_event_class_by_index(self._stream_class._ptr, + ec_ptr = native_bt.stream_class_get_event_class_by_index(self._stream_class._ptr, self._at) assert(ec_ptr) - ev_id = native_bt.ctf_event_class_get_id(ec_ptr) + ev_id = native_bt.event_class_get_id(ec_ptr) native_bt.put(ec_ptr) utils._handle_ret(ev_id, "cannot get event class object's ID") self._at += 1 @@ -52,7 +52,7 @@ class StreamClass(object._Object, collections.abc.Mapping): def __init__(self, name=None, id=None, packet_context_field_type=None, event_header_field_type=None, event_context_field_type=None, event_classes=None): - ptr = native_bt.ctf_stream_class_create_empty(None) + ptr = native_bt.stream_class_create_empty(None) if ptr is None: raise bt2.CreationError('cannot create stream class object') @@ -80,7 +80,7 @@ class StreamClass(object._Object, collections.abc.Mapping): def __getitem__(self, key): utils._check_int64(key) - ec_ptr = native_bt.ctf_stream_class_get_event_class_by_id(self._ptr, + ec_ptr = native_bt.stream_class_get_event_class_by_id(self._ptr, key) if ec_ptr is None: @@ -89,7 +89,7 @@ class StreamClass(object._Object, collections.abc.Mapping): return bt2.EventClass._create_from_ptr(ec_ptr) def __len__(self): - count = native_bt.ctf_stream_class_get_event_class_count(self._ptr) + count = native_bt.stream_class_get_event_class_count(self._ptr) assert(count >= 0) return count @@ -98,29 +98,29 @@ class StreamClass(object._Object, collections.abc.Mapping): def add_event_class(self, event_class): utils._check_type(event_class, bt2.EventClass) - ret = native_bt.ctf_stream_class_add_event_class(self._ptr, event_class._ptr) + ret = native_bt.stream_class_add_event_class(self._ptr, event_class._ptr) utils._handle_ret(ret, "cannot add event class object to stream class object's") @property def trace(self): - tc_ptr = native_bt.ctf_stream_class_get_trace(self._ptr) + tc_ptr = native_bt.stream_class_get_trace(self._ptr) if tc_ptr is not None: return bt2.Trace._create_from_ptr(tc_ptr) @property def name(self): - return native_bt.ctf_stream_class_get_name(self._ptr) + return native_bt.stream_class_get_name(self._ptr) @name.setter def name(self, name): utils._check_str(name) - ret = native_bt.ctf_stream_class_set_name(self._ptr, name) + ret = native_bt.stream_class_set_name(self._ptr, name) utils._handle_ret(ret, "cannot set stream class object's name") @property def id(self): - id = native_bt.ctf_stream_class_get_id(self._ptr) + id = native_bt.stream_class_get_id(self._ptr) if id < 0: return @@ -130,12 +130,12 @@ class StreamClass(object._Object, collections.abc.Mapping): @id.setter def id(self, id): utils._check_int64(id) - ret = native_bt.ctf_stream_class_set_id(self._ptr, id) + ret = native_bt.stream_class_set_id(self._ptr, id) utils._handle_ret(ret, "cannot set stream class object's ID") @property def clock(self): - clock_ptr = native_bt.ctf_stream_class_get_clock(self._ptr) + clock_ptr = native_bt.stream_class_get_clock(self._ptr) if clock_ptr is None: return @@ -145,12 +145,12 @@ class StreamClass(object._Object, collections.abc.Mapping): @clock.setter def clock(self, clock): utils._check_type(clock, bt2.ctf_writer.CtfWriterClock) - ret = native_bt.ctf_stream_class_set_clock(self._ptr, clock._ptr) + ret = native_bt.stream_class_set_clock(self._ptr, clock._ptr) utils._handle_ret(ret, "cannot set stream class object's CTF writer clock object") @property def packet_context_field_type(self): - ft_ptr = native_bt.ctf_stream_class_get_packet_context_type(self._ptr) + ft_ptr = native_bt.stream_class_get_packet_context_type(self._ptr) if ft_ptr is None: return @@ -165,13 +165,13 @@ class StreamClass(object._Object, collections.abc.Mapping): utils._check_type(packet_context_field_type, bt2.field_types._FieldType) packet_context_field_type_ptr = packet_context_field_type._ptr - ret = native_bt.ctf_stream_class_set_packet_context_type(self._ptr, + ret = native_bt.stream_class_set_packet_context_type(self._ptr, packet_context_field_type_ptr) utils._handle_ret(ret, "cannot set stream class object's packet context field type") @property def event_header_field_type(self): - ft_ptr = native_bt.ctf_stream_class_get_event_header_type(self._ptr) + ft_ptr = native_bt.stream_class_get_event_header_type(self._ptr) if ft_ptr is None: return @@ -186,13 +186,13 @@ class StreamClass(object._Object, collections.abc.Mapping): utils._check_type(event_header_field_type, bt2.field_types._FieldType) event_header_field_type_ptr = event_header_field_type._ptr - ret = native_bt.ctf_stream_class_set_event_header_type(self._ptr, + ret = native_bt.stream_class_set_event_header_type(self._ptr, event_header_field_type_ptr) utils._handle_ret(ret, "cannot set stream class object's event header field type") @property def event_context_field_type(self): - ft_ptr = native_bt.ctf_stream_class_get_event_context_type(self._ptr) + ft_ptr = native_bt.stream_class_get_event_context_type(self._ptr) if ft_ptr is None: return @@ -207,7 +207,7 @@ class StreamClass(object._Object, collections.abc.Mapping): utils._check_type(event_context_field_type, bt2.field_types._FieldType) event_context_field_type_ptr = event_context_field_type._ptr - ret = native_bt.ctf_stream_class_set_event_context_type(self._ptr, + ret = native_bt.stream_class_set_event_context_type(self._ptr, event_context_field_type_ptr) utils._handle_ret(ret, "cannot set stream class object's event context field type") @@ -216,9 +216,9 @@ class StreamClass(object._Object, collections.abc.Mapping): utils._check_str(name) if id is None: - stream_ptr = native_bt.ctf_stream_create(self._ptr, name) + stream_ptr = native_bt.stream_create(self._ptr, name) else: - stream_ptr = native_bt.ctf_stream_create_with_id(self._ptr, name, id) + stream_ptr = native_bt.stream_create_with_id(self._ptr, name, id) if stream_ptr is None: raise bt2.CreationError('cannot create stream object') diff --git a/bindings/python/bt2/bt2/trace.py b/bindings/python/bt2/bt2/trace.py index 3d5c4e3f..98182487 100644 --- a/bindings/python/bt2/bt2/trace.py +++ b/bindings/python/bt2/bt2/trace.py @@ -38,10 +38,10 @@ class _StreamClassIterator(collections.abc.Iterator): if self._at == len(self._trace): raise StopIteration - sc_ptr = native_bt.ctf_trace_get_stream_class_by_index(self._trace._ptr, + sc_ptr = native_bt.trace_get_stream_class_by_index(self._trace._ptr, self._at) assert(sc_ptr) - id = native_bt.ctf_stream_class_get_id(sc_ptr) + id = native_bt.stream_class_get_id(sc_ptr) native_bt.put(sc_ptr) assert(id >= 0) self._at += 1 @@ -53,7 +53,7 @@ class _TraceStreams(collections.abc.Sequence): self._trace = trace def __len__(self): - count = native_bt.ctf_trace_get_stream_count(self._trace._ptr) + count = native_bt.trace_get_stream_count(self._trace._ptr) assert(count >= 0) return count @@ -63,7 +63,7 @@ class _TraceStreams(collections.abc.Sequence): if index >= len(self): raise IndexError - stream_ptr = native_bt.ctf_trace_get_stream_by_index(self._trace._ptr, + stream_ptr = native_bt.trace_get_stream_by_index(self._trace._ptr, index) assert(stream_ptr) return bt2.stream._create_from_ptr(stream_ptr) @@ -79,9 +79,9 @@ class _TraceClockClassesIterator(collections.abc.Iterator): raise StopIteration trace_ptr = self._trace_clock_classes._trace._ptr - cc_ptr = native_bt.ctf_trace_get_clock_class_by_index(trace_ptr, self._at) + cc_ptr = native_bt.trace_get_clock_class_by_index(trace_ptr, self._at) assert(cc_ptr) - name = native_bt.ctf_clock_class_get_name(cc_ptr) + name = native_bt.clock_class_get_name(cc_ptr) native_bt.put(cc_ptr) assert(name is not None) self._at += 1 @@ -94,7 +94,7 @@ class _TraceClockClasses(collections.abc.Mapping): def __getitem__(self, key): utils._check_str(key) - cc_ptr = native_bt.ctf_trace_get_clock_class_by_name(self._trace._ptr, + cc_ptr = native_bt.trace_get_clock_class_by_name(self._trace._ptr, key) if cc_ptr is None: @@ -103,7 +103,7 @@ class _TraceClockClasses(collections.abc.Mapping): return bt2.ClockClass._create_from_ptr(cc_ptr) def __len__(self): - count = native_bt.ctf_trace_get_clock_class_count(self._trace._ptr) + count = native_bt.trace_get_clock_class_count(self._trace._ptr) assert(count >= 0) return count @@ -121,7 +121,7 @@ class _TraceEnvIterator(collections.abc.Iterator): raise StopIteration trace_ptr = self._trace_env._trace._ptr - entry_name = native_bt.ctf_trace_get_environment_field_name_by_index(trace_ptr, + entry_name = native_bt.trace_get_environment_field_name_by_index(trace_ptr, self._at) assert(entry_name is not None) self._at += 1 @@ -134,7 +134,7 @@ class _TraceEnv(collections.abc.MutableMapping): def __getitem__(self, key): utils._check_str(key) - value_ptr = native_bt.ctf_trace_get_environment_field_value_by_name(self._trace._ptr, + value_ptr = native_bt.trace_get_environment_field_value_by_name(self._trace._ptr, key) if value_ptr is None: @@ -145,7 +145,7 @@ class _TraceEnv(collections.abc.MutableMapping): def __setitem__(self, key, value): utils._check_str(key) value = bt2.create_value(value) - ret = native_bt.ctf_trace_set_environment_field(self._trace._ptr, + ret = native_bt.trace_set_environment_field(self._trace._ptr, key, value._ptr) utils._handle_ret(ret, "cannot set trace class object's environment entry") @@ -153,7 +153,7 @@ class _TraceEnv(collections.abc.MutableMapping): raise NotImplementedError def __len__(self): - count = native_bt.ctf_trace_get_environment_field_count(self._trace._ptr) + count = native_bt.trace_get_environment_field_count(self._trace._ptr) assert(count >= 0) return count @@ -165,7 +165,7 @@ class Trace(object._Object, collections.abc.Mapping): def __init__(self, name=None, native_byte_order=None, env=None, packet_header_field_type=None, clock_classes=None, stream_classes=None): - ptr = native_bt.ctf_trace_create() + ptr = native_bt.trace_create() if ptr is None: raise bt2.CreationError('cannot create trace class object') @@ -195,7 +195,7 @@ class Trace(object._Object, collections.abc.Mapping): def __getitem__(self, key): utils._check_int64(key) - sc_ptr = native_bt.ctf_trace_get_stream_class_by_id(self._ptr, key) + sc_ptr = native_bt.trace_get_stream_class_by_id(self._ptr, key) if sc_ptr is None: raise KeyError(key) @@ -203,7 +203,7 @@ class Trace(object._Object, collections.abc.Mapping): return bt2.StreamClass._create_from_ptr(sc_ptr) def __len__(self): - count = native_bt.ctf_trace_get_stream_class_count(self._ptr) + count = native_bt.trace_get_stream_class_count(self._ptr) assert(count >= 0) return count @@ -212,38 +212,38 @@ class Trace(object._Object, collections.abc.Mapping): def add_stream_class(self, stream_class): utils._check_type(stream_class, bt2.StreamClass) - ret = native_bt.ctf_trace_add_stream_class(self._ptr, stream_class._ptr) + ret = native_bt.trace_add_stream_class(self._ptr, stream_class._ptr) utils._handle_ret(ret, "cannot add stream class object to trace class object") @property def name(self): - return native_bt.ctf_trace_get_name(self._ptr) + return native_bt.trace_get_name(self._ptr) @name.setter def name(self, name): utils._check_str(name) - ret = native_bt.ctf_trace_set_name(self._ptr, name) + ret = native_bt.trace_set_name(self._ptr, name) utils._handle_ret(ret, "cannot set trace class object's name") @property def native_byte_order(self): - bo = native_bt.ctf_trace_get_native_byte_order(self._ptr) + bo = native_bt.trace_get_native_byte_order(self._ptr) assert(bo >= 0) return bo @native_byte_order.setter def native_byte_order(self, native_byte_order): utils._check_int(native_byte_order) - ret = native_bt.ctf_trace_set_native_byte_order(self._ptr, native_byte_order) + ret = native_bt.trace_set_native_byte_order(self._ptr, native_byte_order) utils._handle_ret(ret, "cannot set trace class object's native byte order") @property def is_static(self): - is_static = native_bt.ctf_trace_is_static(self._ptr) + is_static = native_bt.trace_is_static(self._ptr) return is_static > 0 def set_is_static(self): - ret = native_bt.ctf_trace_set_is_static(self._ptr) + ret = native_bt.trace_set_is_static(self._ptr) utils._handle_ret(ret, "cannot set trace object as static") @property @@ -256,7 +256,7 @@ class Trace(object._Object, collections.abc.Mapping): def add_clock_class(self, clock_class): utils._check_type(clock_class, bt2.ClockClass) - ret = native_bt.ctf_trace_add_clock_class(self._ptr, clock_class._ptr) + ret = native_bt.trace_add_clock_class(self._ptr, clock_class._ptr) utils._handle_ret(ret, "cannot add clock class object to trace class object") @property @@ -265,7 +265,7 @@ class Trace(object._Object, collections.abc.Mapping): @property def packet_header_field_type(self): - ft_ptr = native_bt.ctf_trace_get_packet_header_type(self._ptr) + ft_ptr = native_bt.trace_get_packet_header_type(self._ptr) if ft_ptr is None: return @@ -280,7 +280,7 @@ class Trace(object._Object, collections.abc.Mapping): utils._check_type(packet_header_field_type, bt2.field_types._FieldType) packet_header_field_type_ptr = packet_header_field_type._ptr - ret = native_bt.ctf_trace_set_packet_header_type(self._ptr, + ret = native_bt.trace_set_packet_header_type(self._ptr, packet_header_field_type_ptr) utils._handle_ret(ret, "cannot set trace class object's packet header field type") diff --git a/doc/api/README.adoc b/doc/api/README.adoc index 903988f4..3e6ce69f 100644 --- a/doc/api/README.adoc +++ b/doc/api/README.adoc @@ -38,8 +38,7 @@ Use a warning command if this message is really important. @postrefcountsame{stream_class} @post Some custom postcondition. -@sa bt_ctf_stream_class_get_name(): Returns the name of a given - stream class. +@sa btstream_class_get_name(): Returns the name of a given stream class. */ ---- diff --git a/doc/api/dox/examples-ctfir.dox b/doc/api/dox/examples-ctfir.dox index 1dc632f7..1c411add 100644 --- a/doc/api/dox/examples-ctfir.dox +++ b/doc/api/dox/examples-ctfir.dox @@ -25,11 +25,11 @@ This page contains usage examples of the \ref ctfirfieldtypes API. #include #include -struct bt_ctf_field_type *create_int_field_type(void) +struct bt_field_type *create_int_field_type(void) { - struct bt_ctf_field_type *field_type; + struct bt_field_type *field_type; - field_type = bt_ctf_field_type_integer_create(16); + field_type = bt_field_type_integer_create(16); assert(field_type); return field_type; @@ -42,19 +42,19 @@ struct bt_ctf_field_type *create_int_field_type(void) #include #include -struct bt_ctf_field_type *create_int_field_type(void) +struct bt_field_type *create_int_field_type(void) { int ret; - struct bt_ctf_field_type *field_type; + struct bt_field_type *field_type; - field_type = bt_ctf_field_type_integer_create(23); + field_type = bt_field_type_integer_create(23); assert(field_type); - ret = bt_ctf_field_type_set_byte_order(field_type, - BT_CTF_BYTE_ORDER_BIG_ENDIAN); + ret = bt_field_type_set_byte_order(field_type, + BT_BYTE_ORDER_BIG_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_signed(field_type, 1); + ret = bt_field_type_integer_set_signed(field_type, 1); assert(ret == 0); return field_type; @@ -67,20 +67,20 @@ struct bt_ctf_field_type *create_int_field_type(void) #include #include -struct bt_ctf_field_type *create_int_field_type( - struct bt_ctf_clock_class *clock_class) +struct bt_field_type *create_int_field_type( + struct bt_clock_class *clock_class) { int ret; - struct bt_ctf_field_type *field_type; + struct bt_field_type *field_type; - field_type = bt_ctf_field_type_integer_create(8); + field_type = bt_field_type_integer_create(8); assert(field_type); - ret = bt_ctf_field_type_integer_set_base(field_type, - BT_CTF_INTEGER_BASE_HEXADECIMAL); + ret = bt_field_type_integer_set_base(field_type, + BT_INTEGER_BASE_HEXADECIMAL); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_mapped_clock(field_type, clock_class); + ret = bt_field_type_integer_set_mapped_clock(field_type, clock_class); assert(ret == 0); return field_type; @@ -98,11 +98,11 @@ struct bt_ctf_field_type *create_int_field_type( #include #include -struct bt_ctf_field_type *create_float_field_type(void) +struct bt_field_type *create_float_field_type(void) { - struct bt_ctf_field_type *field_type; + struct bt_field_type *field_type; - field_type = bt_ctf_field_type_floating_point_create(); + field_type = bt_field_type_floating_point_create(); assert(field_type); return field_type; @@ -115,22 +115,22 @@ struct bt_ctf_field_type *create_float_field_type(void) #include #include -struct bt_ctf_field_type *create_float_field_type(void) +struct bt_field_type *create_float_field_type(void) { int ret; - struct bt_ctf_field_type *field_type; + struct bt_field_type *field_type; - field_type = bt_ctf_field_type_floating_point_create(); + field_type = bt_field_type_floating_point_create(); assert(field_type); - ret = bt_ctf_field_type_set_byte_order(field_type, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(field_type, + BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_floating_point_set_exponent_digits(field_type, 11); + ret = bt_field_type_floating_point_set_exponent_digits(field_type, 11); assert(ret == 0); - ret = bt_ctf_field_type_floating_point_set_mantissa_digits(field_type, 53); + ret = bt_field_type_floating_point_set_mantissa_digits(field_type, 53); assert(ret == 0); return field_type; diff --git a/doc/api/dox/group-ctf-ir.dox b/doc/api/dox/group-ctf-ir.dox index 4052b3d9..f7878da1 100644 --- a/doc/api/dox/group-ctf-ir.dox +++ b/doc/api/dox/group-ctf-ir.dox @@ -15,7 +15,7 @@ management of Babeltrace objects. When the documentation says that a given \link ctfirfieldtypes CTF IR field type\endlink must be equivalent to another one, it means that -bt_ctf_field_type_compare() \em must return 0. +bt_field_type_compare() \em must return 0. @sa \ref ctfirexamples "Examples" */ diff --git a/include/babeltrace/ctf-ir/attributes-internal.h b/include/babeltrace/ctf-ir/attributes-internal.h index 359e75ed..b820a70d 100644 --- a/include/babeltrace/ctf-ir/attributes-internal.h +++ b/include/babeltrace/ctf-ir/attributes-internal.h @@ -37,32 +37,32 @@ extern "C" { #include BT_HIDDEN -struct bt_value *bt_ctf_attributes_create(void); +struct bt_value *bt_attributes_create(void); BT_HIDDEN -void bt_ctf_attributes_destroy(struct bt_value *attr_obj); +void bt_attributes_destroy(struct bt_value *attr_obj); BT_HIDDEN -int64_t bt_ctf_attributes_get_count(struct bt_value *attr_obj); +int64_t bt_attributes_get_count(struct bt_value *attr_obj); BT_HIDDEN -const char *bt_ctf_attributes_get_field_name(struct bt_value *attr_obj, +const char *bt_attributes_get_field_name(struct bt_value *attr_obj, uint64_t index); BT_HIDDEN -struct bt_value *bt_ctf_attributes_get_field_value(struct bt_value *attr_obj, +struct bt_value *bt_attributes_get_field_value(struct bt_value *attr_obj, uint64_t index); BT_HIDDEN -int bt_ctf_attributes_set_field_value(struct bt_value *attr_obj, +int bt_attributes_set_field_value(struct bt_value *attr_obj, const char *name, struct bt_value *value_obj); BT_HIDDEN -struct bt_value *bt_ctf_attributes_get_field_value_by_name( +struct bt_value *bt_attributes_get_field_value_by_name( struct bt_value *attr_obj, const char *name); BT_HIDDEN -int bt_ctf_attributes_freeze(struct bt_value *attr_obj); +int bt_attributes_freeze(struct bt_value *attr_obj); #ifdef __cplusplus } diff --git a/include/babeltrace/ctf-ir/clock-class-internal.h b/include/babeltrace/ctf-ir/clock-class-internal.h index 2b4fdcf4..b984d456 100644 --- a/include/babeltrace/ctf-ir/clock-class-internal.h +++ b/include/babeltrace/ctf-ir/clock-class-internal.h @@ -37,7 +37,7 @@ #include #include -struct bt_ctf_clock_class { +struct bt_clock_class { struct bt_object base; GString *name; GString *description; @@ -57,13 +57,13 @@ struct bt_ctf_clock_class { }; BT_HIDDEN -void bt_ctf_clock_class_freeze(struct bt_ctf_clock_class *clock_class); +void bt_clock_class_freeze(struct bt_clock_class *clock_class); BT_HIDDEN -void bt_ctf_clock_class_serialize(struct bt_ctf_clock_class *clock_class, +void bt_clock_class_serialize(struct bt_clock_class *clock_class, struct metadata_context *context); BT_HIDDEN -bt_bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class); +bt_bool bt_clock_class_is_valid(struct bt_clock_class *clock_class); #endif /* BABELTRACE_CTF_IR_CLOCK_CLASS_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/clock-class.h b/include/babeltrace/ctf-ir/clock-class.h index d399d137..3dde3d76 100644 --- a/include/babeltrace/ctf-ir/clock-class.h +++ b/include/babeltrace/ctf-ir/clock-class.h @@ -40,52 +40,52 @@ extern "C" { #endif -struct bt_ctf_clock_class; -struct bt_ctf_clock_value; +struct bt_clock_class; +struct bt_clock_value; -extern struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, +extern struct bt_clock_class *bt_clock_class_create(const char *name, uint64_t freq); -extern const char *bt_ctf_clock_class_get_name( - struct bt_ctf_clock_class *clock_class); -extern int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class, +extern const char *bt_clock_class_get_name( + struct bt_clock_class *clock_class); +extern int bt_clock_class_set_name(struct bt_clock_class *clock_class, const char *name); -extern const char *bt_ctf_clock_class_get_description( - struct bt_ctf_clock_class *clock_class); -extern int bt_ctf_clock_class_set_description( - struct bt_ctf_clock_class *clock_class, +extern const char *bt_clock_class_get_description( + struct bt_clock_class *clock_class); +extern int bt_clock_class_set_description( + struct bt_clock_class *clock_class, const char *desc); -extern uint64_t bt_ctf_clock_class_get_frequency( - struct bt_ctf_clock_class *clock_class); -extern int bt_ctf_clock_class_set_frequency( - struct bt_ctf_clock_class *clock_class, uint64_t freq); -extern uint64_t bt_ctf_clock_class_get_precision( - struct bt_ctf_clock_class *clock_class); -extern int bt_ctf_clock_class_set_precision( - struct bt_ctf_clock_class *clock_class, uint64_t precision); -extern int bt_ctf_clock_class_get_offset_s( - struct bt_ctf_clock_class *clock_class, int64_t *seconds); -extern int bt_ctf_clock_class_set_offset_s( - struct bt_ctf_clock_class *clock_class, int64_t seconds); -extern int bt_ctf_clock_class_get_offset_cycles( - struct bt_ctf_clock_class *clock_class, int64_t *cycles); -extern int bt_ctf_clock_class_set_offset_cycles( - struct bt_ctf_clock_class *clock_class, int64_t cycles); -extern bt_bool bt_ctf_clock_class_is_absolute( - struct bt_ctf_clock_class *clock_class); -extern int bt_ctf_clock_class_set_is_absolute( - struct bt_ctf_clock_class *clock_class, bt_bool is_absolute); -extern const unsigned char *bt_ctf_clock_class_get_uuid( - struct bt_ctf_clock_class *clock_class); -extern int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, +extern uint64_t bt_clock_class_get_frequency( + struct bt_clock_class *clock_class); +extern int bt_clock_class_set_frequency( + struct bt_clock_class *clock_class, uint64_t freq); +extern uint64_t bt_clock_class_get_precision( + struct bt_clock_class *clock_class); +extern int bt_clock_class_set_precision( + struct bt_clock_class *clock_class, uint64_t precision); +extern int bt_clock_class_get_offset_s( + struct bt_clock_class *clock_class, int64_t *seconds); +extern int bt_clock_class_set_offset_s( + struct bt_clock_class *clock_class, int64_t seconds); +extern int bt_clock_class_get_offset_cycles( + struct bt_clock_class *clock_class, int64_t *cycles); +extern int bt_clock_class_set_offset_cycles( + struct bt_clock_class *clock_class, int64_t cycles); +extern bt_bool bt_clock_class_is_absolute( + struct bt_clock_class *clock_class); +extern int bt_clock_class_set_is_absolute( + struct bt_clock_class *clock_class, bt_bool is_absolute); +extern const unsigned char *bt_clock_class_get_uuid( + struct bt_clock_class *clock_class); +extern int bt_clock_class_set_uuid(struct bt_clock_class *clock_class, const unsigned char *uuid); -extern struct bt_ctf_clock_value *bt_ctf_clock_value_create( - struct bt_ctf_clock_class *clock_class, uint64_t value); -extern struct bt_ctf_clock_class *bt_ctf_clock_value_get_class( - struct bt_ctf_clock_value *clock_value); -extern int bt_ctf_clock_value_get_value( - struct bt_ctf_clock_value *clock_value, uint64_t *raw_value); -extern int bt_ctf_clock_value_get_value_ns_from_epoch( - struct bt_ctf_clock_value *clock_value, int64_t *value_ns); +extern struct bt_clock_value *bt_clock_value_create( + struct bt_clock_class *clock_class, uint64_t value); +extern struct bt_clock_class *bt_clock_value_get_class( + struct bt_clock_value *clock_value); +extern int bt_clock_value_get_value( + struct bt_clock_value *clock_value, uint64_t *raw_value); +extern int bt_clock_value_get_value_ns_from_epoch( + struct bt_clock_value *clock_value, int64_t *value_ns); #ifdef __cplusplus } diff --git a/include/babeltrace/ctf-ir/clock-value-internal.h b/include/babeltrace/ctf-ir/clock-value-internal.h index 7284a35f..a33a71ca 100644 --- a/include/babeltrace/ctf-ir/clock-value-internal.h +++ b/include/babeltrace/ctf-ir/clock-value-internal.h @@ -27,11 +27,11 @@ #include #include -struct bt_ctf_clock_class; +struct bt_clock_class; -struct bt_ctf_clock_value { +struct bt_clock_value { struct bt_object base; - struct bt_ctf_clock_class *clock_class; + struct bt_clock_class *clock_class; uint64_t value; bool ns_from_epoch_overflows; int64_t ns_from_epoch; diff --git a/include/babeltrace/ctf-ir/clock-value.h b/include/babeltrace/ctf-ir/clock-value.h index d0464d36..c40c8284 100644 --- a/include/babeltrace/ctf-ir/clock-value.h +++ b/include/babeltrace/ctf-ir/clock-value.h @@ -37,17 +37,17 @@ extern "C" { #endif -struct bt_ctf_clock_class; -struct bt_ctf_clock_value; +struct bt_clock_class; +struct bt_clock_value; -extern struct bt_ctf_clock_value *bt_ctf_clock_value_create( - struct bt_ctf_clock_class *clock_class, uint64_t value); -extern struct bt_ctf_clock_class *bt_ctf_clock_value_get_class( - struct bt_ctf_clock_value *clock_value); -extern int bt_ctf_clock_value_get_value( - struct bt_ctf_clock_value *clock_value, uint64_t *raw_value); -extern int bt_ctf_clock_value_get_value_ns_from_epoch( - struct bt_ctf_clock_value *clock_value, int64_t *value_ns); +extern struct bt_clock_value *bt_clock_value_create( + struct bt_clock_class *clock_class, uint64_t value); +extern struct bt_clock_class *bt_clock_value_get_class( + struct bt_clock_value *clock_value); +extern int bt_clock_value_get_value( + struct bt_clock_value *clock_value, uint64_t *raw_value); +extern int bt_clock_value_get_value_ns_from_epoch( + struct bt_clock_value *clock_value, int64_t *value_ns); #ifdef __cplusplus } diff --git a/include/babeltrace/ctf-ir/event-class-internal.h b/include/babeltrace/ctf-ir/event-class-internal.h index 0844061b..8bf9f416 100644 --- a/include/babeltrace/ctf-ir/event-class-internal.h +++ b/include/babeltrace/ctf-ir/event-class-internal.h @@ -38,12 +38,12 @@ #include #include -struct bt_ctf_event_class { +struct bt_event_class { struct bt_object base; /* Structure type containing the event's context */ - struct bt_ctf_field_type *context; + struct bt_field_type *context; /* Structure type containing the event's fields */ - struct bt_ctf_field_type *fields; + struct bt_field_type *fields; int frozen; /* @@ -57,69 +57,69 @@ struct bt_ctf_event_class { /* Attributes */ GString *name; int64_t id; - enum bt_ctf_event_class_log_level log_level; + enum bt_event_class_log_level log_level; GString *emf_uri; }; BT_HIDDEN -void bt_ctf_event_class_freeze(struct bt_ctf_event_class *event_class); +void bt_event_class_freeze(struct bt_event_class *event_class); BT_HIDDEN -int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, +int bt_event_class_serialize(struct bt_event_class *event_class, struct metadata_context *context); BT_HIDDEN -void bt_ctf_event_class_set_native_byte_order( - struct bt_ctf_event_class *event_class, +void bt_event_class_set_native_byte_order( + struct bt_event_class *event_class, int byte_order); static inline -struct bt_ctf_stream_class *bt_ctf_event_class_borrow_stream_class( - struct bt_ctf_event_class *event_class) +struct bt_stream_class *bt_event_class_borrow_stream_class( + struct bt_event_class *event_class) { assert(event_class); return (void *) bt_object_borrow_parent(event_class); } static inline -const char *bt_ctf_event_class_log_level_string( - enum bt_ctf_event_class_log_level level) +const char *bt_event_class_log_level_string( + enum bt_event_class_log_level level) { switch (level) { - case BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE"; - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG: - return "BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG"; + case BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN: + return "BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN"; + case BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED: + return "BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED"; + case BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY: + return "BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY"; + case BT_EVENT_CLASS_LOG_LEVEL_ALERT: + return "BT_EVENT_CLASS_LOG_LEVEL_ALERT"; + case BT_EVENT_CLASS_LOG_LEVEL_CRITICAL: + return "BT_EVENT_CLASS_LOG_LEVEL_CRITICAL"; + case BT_EVENT_CLASS_LOG_LEVEL_ERROR: + return "BT_EVENT_CLASS_LOG_LEVEL_ERROR"; + case BT_EVENT_CLASS_LOG_LEVEL_WARNING: + return "BT_EVENT_CLASS_LOG_LEVEL_WARNING"; + case BT_EVENT_CLASS_LOG_LEVEL_NOTICE: + return "BT_EVENT_CLASS_LOG_LEVEL_NOTICE"; + case BT_EVENT_CLASS_LOG_LEVEL_INFO: + return "BT_EVENT_CLASS_LOG_LEVEL_INFO"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE"; + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG: + return "BT_EVENT_CLASS_LOG_LEVEL_DEBUG"; default: return "(unknown)"; } diff --git a/include/babeltrace/ctf-ir/event-class.h b/include/babeltrace/ctf-ir/event-class.h index e4f587d5..0b0a0581 100644 --- a/include/babeltrace/ctf-ir/event-class.h +++ b/include/babeltrace/ctf-ir/event-class.h @@ -81,8 +81,8 @@ class\endlink contains zero or more \link ctfirstreamclass stream classes\endlink, and a stream class contains zero or more event classes. Before you can create an event from an event class with -bt_ctf_event_create(), you \em must add the prepared event class to a -stream class by calling bt_ctf_stream_class_add_event_class(). This +bt_event_create(), you \em must add the prepared event class to a +stream class by calling bt_stream_class_add_event_class(). This function, when successful, \em freezes the event class, disallowing any future modification of its properties and field types by the user. @@ -91,7 +91,7 @@ As with any Babeltrace object, CTF IR event class objects have counts. See \ref refs to learn more about the reference counting management of Babeltrace objects. -bt_ctf_stream_class_add_event_class() \em freezes its event class +bt_stream_class_add_event_class() \em freezes its event class parameter on success. You cannot modify a frozen event class: it is considered immutable, except for \link refs reference counting\endlink. @@ -107,69 +107,69 @@ considered immutable, except for \link refs reference counting\endlink. */ /** -@struct bt_ctf_event_class +@struct bt_event_class @brief A CTF IR event class. @sa ctfireventclass */ -struct bt_ctf_event_class; -struct bt_ctf_field; -struct bt_ctf_field_type; -struct bt_ctf_stream_class; +struct bt_event_class; +struct bt_field; +struct bt_field_type; +struct bt_stream_class; /** @brief Log level of an event class. */ -enum bt_ctf_event_class_log_level { +enum bt_event_class_log_level { /// Unknown, used for errors. - BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1, + BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN = -1, /// Unspecified log level. - BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255, + BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED = 255, /// System is unusable. - BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0, + BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY = 0, /// Action must be taken immediately. - BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT = 1, + BT_EVENT_CLASS_LOG_LEVEL_ALERT = 1, /// Critical conditions. - BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2, + BT_EVENT_CLASS_LOG_LEVEL_CRITICAL = 2, /// Error conditions. - BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR = 3, + BT_EVENT_CLASS_LOG_LEVEL_ERROR = 3, /// Warning conditions. - BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING = 4, + BT_EVENT_CLASS_LOG_LEVEL_WARNING = 4, /// Normal, but significant, condition. - BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE = 5, + BT_EVENT_CLASS_LOG_LEVEL_NOTICE = 5, /// Informational message. - BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO = 6, + BT_EVENT_CLASS_LOG_LEVEL_INFO = 6, /// Debug information with system-level scope (set of programs). - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM = 7, /// Debug information with program-level scope (set of processes). - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM = 8, /// Debug information with process-level scope (set of modules). - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS = 9, /// Debug information with module (executable/library) scope (set of units). - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE = 10, /// Debug information with compilation unit scope (set of functions). - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT = 11, /// Debug information with function-level scope. - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION = 12, /// Debug information with line-level scope (default log level). - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE = 13, /// Debug-level message. - BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG = 14, + BT_EVENT_CLASS_LOG_LEVEL_DEBUG = 14, }; /** @@ -183,17 +183,17 @@ enum bt_ctf_event_class_log_level { On success, the context and payload field types are empty structure field types. You can modify those default field types after the event class is created with -bt_ctf_event_class_set_context_type() and -bt_ctf_event_class_set_payload_type(). +bt_event_class_set_context_type() and +bt_event_class_set_payload_type(). Upon creation, the event class's ID is not set. You -can set it to a specific value with bt_ctf_event_class_set_id(). If it -is still unset when you call bt_ctf_stream_class_add_event_class(), then +can set it to a specific value with bt_event_class_set_id(). If it +is still unset when you call bt_stream_class_add_event_class(), then the stream class assigns a unique ID to this event class before freezing it. The created event class's log level is initially set to -#BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED and it has no Eclipse Modeling +#BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED and it has no Eclipse Modeling Framework URI. @param[in] name Name of the event class to create (copied on success). @@ -202,7 +202,7 @@ Framework URI. @prenotnull{name} @postsuccessrefcountret1 */ -extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name); +extern struct bt_event_class *bt_event_class_create(const char *name); /** @brief Returns the parent CTF IR stream class of the CTF IR event @@ -211,7 +211,7 @@ extern struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name); It is possible that the event class was not added to a stream class yet, in which case this function returns \c NULL. You can add an event class to a stream class with -bt_ctf_stream_class_add_event_class(). +bt_stream_class_add_event_class(). @param[in] event_class Event class of which to get the parent stream class. @@ -223,11 +223,11 @@ bt_ctf_stream_class_add_event_class(). @postrefcountsame{event_class} @postsuccessrefcountretinc -@sa bt_ctf_stream_class_add_event_class(): Add an event class to +@sa bt_stream_class_add_event_class(): Add an event class to a stream class. */ -extern struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class( - struct bt_ctf_event_class *event_class); +extern struct bt_stream_class *bt_event_class_get_stream_class( + struct bt_event_class *event_class); /** @} */ @@ -249,8 +249,8 @@ string. @prenotnull{event_class} @postrefcountsame{event_class} */ -extern const char *bt_ctf_event_class_get_name( - struct bt_ctf_event_class *event_class); +extern const char *bt_event_class_get_name( + struct bt_event_class *event_class); /** @brief Returns the numeric ID of the CTF IR event class \p event_class. @@ -262,11 +262,11 @@ extern const char *bt_ctf_event_class_get_name( @prenotnull{event_class} @postrefcountsame{event_class} -@sa bt_ctf_event_class_set_id(): Sets the numeric ID of a given +@sa bt_event_class_set_id(): Sets the numeric ID of a given event class. */ -extern int64_t bt_ctf_event_class_get_id( - struct bt_ctf_event_class *event_class); +extern int64_t bt_event_class_get_id( + struct bt_event_class *event_class); /** @brief Sets the numeric ID of the CTF IR event class @@ -284,29 +284,29 @@ of the stream class to which you eventually add \p event_class. @pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX). @postrefcountsame{event_class} -@sa bt_ctf_event_class_get_id(): Returns the numeric ID of a given +@sa bt_event_class_get_id(): Returns the numeric ID of a given event class. */ -extern int bt_ctf_event_class_set_id( - struct bt_ctf_event_class *event_class, uint64_t id); +extern int bt_event_class_set_id( + struct bt_event_class *event_class, uint64_t id); /** @brief Returns the log level of the CTF IR event class \p event_class. @param[in] event_class Event class of which to get the log level. @returns Log level of event class \p event_class, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED if + #BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED if not specified, or - #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN on error. + #BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN on error. @prenotnull{event_class} @postrefcountsame{event_class} -@sa bt_ctf_event_class_set_log_level(): Sets the log level of a given +@sa bt_event_class_set_log_level(): Sets the log level of a given event class. */ -extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level( - struct bt_ctf_event_class *event_class); +extern enum bt_event_class_log_level bt_event_class_get_log_level( + struct bt_event_class *event_class); /** @brief Sets the log level of the CTF IR event class @@ -318,30 +318,30 @@ extern enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level( @prenotnull{event_class} @prehot{event_class} -@pre \p log_level is #BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION, - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE, or - #BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG. +@pre \p log_level is #BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED, + #BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY, + #BT_EVENT_CLASS_LOG_LEVEL_ALERT, + #BT_EVENT_CLASS_LOG_LEVEL_CRITICAL, + #BT_EVENT_CLASS_LOG_LEVEL_ERROR, + #BT_EVENT_CLASS_LOG_LEVEL_WARNING, + #BT_EVENT_CLASS_LOG_LEVEL_NOTICE, + #BT_EVENT_CLASS_LOG_LEVEL_INFO, + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM, + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM, + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS, + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE, + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT, + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION, + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE, or + #BT_EVENT_CLASS_LOG_LEVEL_DEBUG. @postrefcountsame{event_class} -@sa bt_ctf_event_class_get_log_level(): Returns the log level of a given +@sa bt_event_class_get_log_level(): Returns the log level of a given event class. */ -extern int bt_ctf_event_class_set_log_level( - struct bt_ctf_event_class *event_class, - enum bt_ctf_event_class_log_level log_level); +extern int bt_event_class_set_log_level( + struct bt_event_class *event_class, + enum bt_event_class_log_level log_level); /** @brief Returns the Eclipse Modeling Framework URI of the CTF IR event @@ -355,11 +355,11 @@ extern int bt_ctf_event_class_set_log_level( @prenotnull{event_class} @postrefcountsame{event_class} -@sa bt_ctf_event_class_set_emf_uri(): Sets the Eclipse Modeling +@sa bt_event_class_set_emf_uri(): Sets the Eclipse Modeling Framework URI of a given event class. */ -extern const char *bt_ctf_event_class_get_emf_uri( - struct bt_ctf_event_class *event_class); +extern const char *bt_event_class_get_emf_uri( + struct bt_event_class *event_class); /** @brief Sets the Eclipse Modeling Framework URI of the CTF IR event class @@ -378,11 +378,11 @@ extern const char *bt_ctf_event_class_get_emf_uri( @prehot{event_class} @postrefcountsame{event_class} -@sa bt_ctf_event_class_get_emf_uri(): Returns the Eclipse Modeling +@sa bt_event_class_get_emf_uri(): Returns the Eclipse Modeling Framework URI of a given event class. */ -extern int bt_ctf_event_class_set_emf_uri( - struct bt_ctf_event_class *event_class, +extern int bt_event_class_set_emf_uri( + struct bt_event_class *event_class, const char *emf_uri); /** @} */ @@ -405,11 +405,11 @@ extern int bt_ctf_event_class_set_emf_uri( @post On success, if the return value is a field type, its reference count is incremented. -@sa bt_ctf_event_class_set_context_type(): Sets the context field type of a +@sa bt_event_class_set_context_type(): Sets the context field type of a given event class. */ -extern struct bt_ctf_field_type *bt_ctf_event_class_get_context_type( - struct bt_ctf_event_class *event_class); +extern struct bt_field_type *bt_event_class_get_context_type( + struct bt_event_class *event_class); /** @brief Sets the context field type of the CTF IR event class \p event_class to @@ -437,12 +437,12 @@ As of Babeltrace \btversion, if \p context_type is not \c NULL, @post On success, if \p context_type is not \c NULL, the reference count of \p context_type is incremented. -@sa bt_ctf_event_class_get_context_type(): Returns the context field type of a +@sa bt_event_class_get_context_type(): Returns the context field type of a given event class. */ -extern int bt_ctf_event_class_set_context_type( - struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *context_type); +extern int bt_event_class_set_context_type( + struct bt_event_class *event_class, + struct bt_field_type *context_type); /** @brief Returns the payload field type of the CTF IR event class @@ -457,11 +457,11 @@ extern int bt_ctf_event_class_set_context_type( @post On success, if the return value is a field type, its reference count is incremented. -@sa bt_ctf_event_class_set_payload_type(): Sets the payload field type of a +@sa bt_event_class_set_payload_type(): Sets the payload field type of a given event class. */ -extern struct bt_ctf_field_type *bt_ctf_event_class_get_payload_type( - struct bt_ctf_event_class *event_class); +extern struct bt_field_type *bt_event_class_get_payload_type( + struct bt_event_class *event_class); /** @brief Sets the payload field type of the CTF IR event class \p event_class to @@ -489,12 +489,12 @@ As of Babeltrace \btversion, if \p payload_type is not \c NULL, @post On success, if \p payload_type is not \c NULL, the reference count of \p payload_type is incremented. -@sa bt_ctf_event_class_get_payload_type(): Returns the payload field type of a +@sa bt_event_class_get_payload_type(): Returns the payload field type of a given event class. */ -extern int bt_ctf_event_class_set_payload_type( - struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *payload_type); +extern int bt_event_class_set_payload_type( + struct bt_event_class *event_class, + struct bt_field_type *payload_type); /** @brief Returns the number of fields contained in the @@ -502,9 +502,9 @@ extern int bt_ctf_event_class_set_payload_type( @remarks Calling this function is the equivalent of getting the payload field -type of \p event_class with bt_ctf_event_class_get_payload_type() and +type of \p event_class with bt_event_class_get_payload_type() and getting its field count with -bt_ctf_field_type_structure_get_field_count(). +bt_field_type_structure_get_field_count(). @param[in] event_class Event class of which to get the number of fields contained in its payload field type. @@ -514,8 +514,8 @@ bt_ctf_field_type_structure_get_field_count(). @prenotnull{event_class} @postrefcountsame{event_class} */ -extern int64_t bt_ctf_event_class_get_payload_type_field_count( - struct bt_ctf_event_class *event_class); +extern int64_t bt_event_class_get_payload_type_field_count( + struct bt_event_class *event_class); /** @brief Returns the type and the name of the field at index \p index @@ -532,9 +532,9 @@ interested in one of them. @remarks Calling this function is the equivalent of getting the payload field -type of \p event_class with bt_ctf_event_class_get_payload_type() and +type of \p event_class with bt_event_class_get_payload_type() and getting the type and name of one of its field with -bt_ctf_field_type_structure_get_field(). +bt_field_type_structure_get_field(). @param[in] event_class Event class of which to get the type and name of a field in its payload field type. @@ -550,14 +550,14 @@ bt_ctf_field_type_structure_get_field(). @prenotnull{event_class} @pre \p index is lesser than the number of fields contained in the payload field type of \p event_class (see - bt_ctf_event_class_get_payload_type_field_count()). + bt_event_class_get_payload_type_field_count()). @postrefcountsame{event_class} @post On success, if \p field_type is not \c NULL, the reference count of \p *field_type is incremented. */ -extern int bt_ctf_event_class_get_payload_type_field_by_index( - struct bt_ctf_event_class *event_class, - const char **field_name, struct bt_ctf_field_type **field_type, +extern int bt_event_class_get_payload_type_field_by_index( + struct bt_event_class *event_class, + const char **field_name, struct bt_field_type **field_type, uint64_t index); /** @@ -566,9 +566,9 @@ extern int bt_ctf_event_class_get_payload_type_field_by_index( @remarks Calling this function is the equivalent of getting the payload field -type of \p event_class with bt_ctf_event_class_get_payload_type() and +type of \p event_class with bt_event_class_get_payload_type() and getting the type of one of its field with -bt_ctf_field_type_structure_get_field_type_by_name(). +bt_field_type_structure_get_field_type_by_name(). @param[in] event_class Event class of which to get the type of a payload field type's field. @@ -583,12 +583,9 @@ bt_ctf_field_type_structure_get_field_type_by_name(). @postrefcountsame{event_class} @postsuccessrefcountretinc */ -extern struct bt_ctf_field_type * -bt_ctf_event_class_get_payload_type_field_type_by_name( - struct bt_ctf_event_class *event_class, const char *name); - -/* Pre-2.0 CTF writer compatibility */ -#define bt_ctf_event_class_get_field_by_name bt_ctf_event_class_get_payload_type_field_type_by_name +extern struct bt_field_type * +bt_event_class_get_payload_type_field_type_by_name( + struct bt_event_class *event_class, const char *name); /** @brief Adds a field named \p name with the type \p field_type to the @@ -596,8 +593,8 @@ bt_ctf_event_class_get_payload_type_field_type_by_name( @remarks Calling this function is the equivalent of getting the payload field -type of \p event_class with bt_ctf_event_class_get_payload_type() and -adding a field to it with bt_ctf_field_type_structure_add_field(). +type of \p event_class with bt_event_class_get_payload_type() and +adding a field to it with bt_field_type_structure_add_field(). @param[in] event_class Event class containing the payload field type in which to add a field. @@ -613,14 +610,20 @@ adding a field to it with bt_ctf_field_type_structure_add_field(). @postrefcountsame{event_class} @postsuccessrefcountinc{field_type} */ -extern int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *field_type, +extern int bt_event_class_add_field(struct bt_event_class *event_class, + struct bt_field_type *field_type, const char *name); /** @} */ /** @} */ +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_event_class bt_event_class +#define bt_ctf_event_class_create bt_event_class_create +#define bt_ctf_event_class_get_field_by_name bt_event_class_get_payload_type_field_type_by_name +#define bt_ctf_event_class_add_field bt_event_class_add_field + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/ctf-ir/event-internal.h b/include/babeltrace/ctf-ir/event-internal.h index 553a8687..b15af110 100644 --- a/include/babeltrace/ctf-ir/event-internal.h +++ b/include/babeltrace/ctf-ir/event-internal.h @@ -38,42 +38,42 @@ #include #include -struct bt_ctf_stream_pos; +struct bt_stream_pos; -struct bt_ctf_event { +struct bt_event { struct bt_object base; - struct bt_ctf_event_class *event_class; - struct bt_ctf_packet *packet; - struct bt_ctf_field *event_header; - struct bt_ctf_field *stream_event_context; - struct bt_ctf_field *context_payload; - struct bt_ctf_field *fields_payload; - /* Maps clock classes to bt_ctf_clock_value. */ + struct bt_event_class *event_class; + struct bt_packet *packet; + struct bt_field *event_header; + struct bt_field *stream_event_context; + struct bt_field *context_payload; + struct bt_field *fields_payload; + /* Maps clock classes to bt_clock_value. */ GHashTable *clock_values; int frozen; }; BT_HIDDEN -int bt_ctf_event_validate(struct bt_ctf_event *event); +int bt_event_validate(struct bt_event *event); BT_HIDDEN -int bt_ctf_event_serialize(struct bt_ctf_event *event, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order); +int bt_event_serialize(struct bt_event *event, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order); BT_HIDDEN -void bt_ctf_event_freeze(struct bt_ctf_event *event); +void bt_event_freeze(struct bt_event *event); -static inline struct bt_ctf_packet *bt_ctf_event_borrow_packet( - struct bt_ctf_event *event) +static inline struct bt_packet *bt_event_borrow_packet( + struct bt_event *event) { assert(event); return event->packet; } static inline -struct bt_ctf_event_class *bt_ctf_event_borrow_event_class( - struct bt_ctf_event *event) +struct bt_event_class *bt_event_borrow_event_class( + struct bt_event *event) { assert(event); return event->event_class; diff --git a/include/babeltrace/ctf-ir/event.h b/include/babeltrace/ctf-ir/event.h index abd48d4b..e416627a 100644 --- a/include/babeltrace/ctf-ir/event.h +++ b/include/babeltrace/ctf-ir/event.h @@ -38,7 +38,7 @@ extern "C" { #endif struct bt_value; -struct bt_ctf_clock_class; +struct bt_clock_class; /** @defgroup ctfirevent CTF IR event @@ -69,7 +69,7 @@ As a reminder, here's the structure of a CTF packet: You can create a CTF IR event \em from a \link ctfireventclass CTF IR event class\endlink with -bt_ctf_event_create(). The event class you use to create an event +bt_event_create(). The event class you use to create an event object becomes its parent. If the \link ctfirtraceclass CTF IR trace class\endlink of an event @@ -78,19 +78,19 @@ which is the parent of its event class) was created by a \link ctfwriter CTF writer\endlink object, then the only possible action you can do with this event object is to append it to a \link ctfirstream CTF IR stream\endlink with -bt_ctf_stream_append_event(). Otherwise, you can create an event +bt_stream_append_event(). Otherwise, you can create an event notification with bt_notification_event_create(). The event you pass to this function \em must have an attached packet object first. You can attach a \link ctfirpacket CTF IR packet object\endlink to an -event object with bt_ctf_event_set_packet(). +event object with bt_event_set_packet(). A CTF IR event has a mapping of \link ctfirclockvalue CTF IR clock values\endlink. A clock value is an instance of a specific \link ctfirclockclass CTF IR clock class\endlink when the event is emitted. You can set an event object's clock value with -bt_ctf_event_set_clock_value(). +bt_event_set_clock_value(). As with any Babeltrace object, CTF IR event objects have reference @@ -113,18 +113,18 @@ immutable, except for \link refs reference counting\endlink. */ /** -@struct bt_ctf_event +@struct bt_event @brief A CTF IR event. @sa ctfirevent */ -struct bt_ctf_event; -struct bt_ctf_clock; -struct bt_ctf_clock_value; -struct bt_ctf_event_class; -struct bt_ctf_field; -struct bt_ctf_field_type; -struct bt_ctf_stream_class; -struct bt_ctf_packet; +struct bt_event; +struct bt_clock; +struct bt_clock_value; +struct bt_event_class; +struct bt_field; +struct bt_field_type; +struct bt_stream_class; +struct bt_packet; /** @name Creation and parent access functions @@ -139,9 +139,9 @@ struct bt_ctf_packet; \link ctfirstreamclass CTF IR stream class\endlink. On success, the four fields of the created event object are not set. You -can set them with bt_ctf_event_set_header(), -bt_ctf_event_set_stream_event_context(), -bt_ctf_event_set_event_context(), and bt_ctf_event_set_event_payload(). +can set them with bt_event_set_header(), +bt_event_set_stream_event_context(), +bt_event_set_event_context(), and bt_event_set_event_payload(). This function tries to resolve the needed \link ctfirfieldtypes CTF IR field type\endlink of the dynamic field @@ -152,7 +152,7 @@ this function fails. This means that, if any dynamic field type need a field type which should be found in the trace packet header root field type, and if the parent stream class of \p event_class was not added to a \link ctfirtraceclass CTF IR trace class\endlink yet -with bt_ctf_trace_add_stream_class(), then this function fails. +with bt_trace_add_stream_class(), then this function fails. @param[in] event_class CTF IR event class to use to create the CTF IR event. @@ -162,15 +162,15 @@ with bt_ctf_trace_add_stream_class(), then this function fails. @pre \p event_class has a parent stream class. @postsuccessrefcountret1 */ -extern struct bt_ctf_event *bt_ctf_event_create( - struct bt_ctf_event_class *event_class); +extern struct bt_event *bt_event_create( + struct bt_event_class *event_class); /** @brief Returns the parent CTF IR event class of the CTF IR event \p event. This function returns a reference to the event class which was used to -create the event object in the first place with bt_ctf_event_create(). +create the event object in the first place with bt_event_create(). @param[in] event Event of which to get the parent event class. @returns Parent event class of \p event, @@ -180,15 +180,15 @@ create the event object in the first place with bt_ctf_event_create(). @postrefcountsame{event} @postsuccessrefcountretinc */ -extern struct bt_ctf_event_class *bt_ctf_event_get_class( - struct bt_ctf_event *event); +extern struct bt_event_class *bt_event_get_class( + struct bt_event *event); /** @brief Returns the CTF IR packet associated to the CTF IR event \p event. This function returns a reference to the event class which was set to -\p event in the first place with bt_ctf_event_set_packet(). +\p event in the first place with bt_event_set_packet(). @param[in] event Event of which to get the associated packet. @returns Packet associated to \p event, @@ -199,11 +199,11 @@ This function returns a reference to the event class which was set to @postrefcountsame{event} @postsuccessrefcountretinc -@sa bt_ctf_event_set_packet(): Associates a given event to a given +@sa bt_event_set_packet(): Associates a given event to a given packet. */ -extern struct bt_ctf_packet *bt_ctf_event_get_packet( - struct bt_ctf_event *event); +extern struct bt_packet *bt_event_get_packet( + struct bt_event *event); /** @brief Associates the CTF IR event \p event to the CTF IR packet @@ -213,7 +213,7 @@ The \link ctfirstreamclass CTF IR stream class\endlink of the parent \link ctfirstream CTF IR stream\endlink of \p packet \em must be the same as the parent stream class of the \link ctfireventclass CTF IR event class\endlink returned -by bt_ctf_event_get_class() for \p event. +by bt_event_get_class() for \p event. You \em must call this function to create an event-packet association before you call bt_notification_event_create() with \p event. @@ -232,11 +232,11 @@ On success, this function also sets the parent stream object of stream class of \p event. @postsuccessrefcountretinc -@sa bt_ctf_event_get_packet(): Returns the associated packet of a +@sa bt_event_get_packet(): Returns the associated packet of a given event object. */ -extern int bt_ctf_event_set_packet(struct bt_ctf_event *event, - struct bt_ctf_packet *packet); +extern int bt_event_set_packet(struct bt_event *event, + struct bt_packet *packet); /** @brief Returns the parent CTF IR stream associated to the CTF IR event @@ -249,8 +249,8 @@ extern int bt_ctf_event_set_packet(struct bt_ctf_event *event, @postrefcountsame{event} @postsuccessrefcountretinc */ -extern struct bt_ctf_stream *bt_ctf_event_get_stream( - struct bt_ctf_event *event); +extern struct bt_stream *bt_event_get_stream( + struct bt_event *event); /** @} */ @@ -273,11 +273,11 @@ extern struct bt_ctf_stream *bt_ctf_event_get_stream( @postrefcountsame{event} @postsuccessrefcountretinc -@sa bt_ctf_event_get_header(): Sets the stream event header +@sa bt_event_get_header(): Sets the stream event header field of a given event. */ -extern struct bt_ctf_field *bt_ctf_event_get_header( - struct bt_ctf_event *event); +extern struct bt_field *bt_event_get_header( + struct bt_event *event); /** @brief Sets the stream event header field of the CTF IR event @@ -285,8 +285,8 @@ extern struct bt_ctf_field *bt_ctf_event_get_header( from \p event. If \p header is not \c NULL, the field type of \p header, as returned by -bt_ctf_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_stream_class_get_event_header_type() for the parent stream class +bt_field_get_type(), \em must be equivalent to the field type returned by +bt_stream_class_get_event_header_type() for the parent stream class of \p event. @param[in] event Event of which to set the stream event header @@ -297,17 +297,17 @@ of \p event. @prenotnull{event} @prehot{event} @pre \p header, if not \c NULL, has a field type equivalent to - the field type returned by bt_ctf_stream_class_get_event_header_type() + the field type returned by bt_stream_class_get_event_header_type() for the parent stream class of \p event. @postrefcountsame{event} @post On success, if \p header is not \c NULL, the reference count of \p header is incremented. -@sa bt_ctf_event_get_header(): Returns the stream event header field +@sa bt_event_get_header(): Returns the stream event header field of a given event. */ -extern int bt_ctf_event_set_header(struct bt_ctf_event *event, - struct bt_ctf_field *header); +extern int bt_event_set_header(struct bt_event *event, + struct bt_field *header); /** @brief Returns the stream event context field of the CTF IR event @@ -323,11 +323,11 @@ extern int bt_ctf_event_set_header(struct bt_ctf_event *event, @postrefcountsame{event} @postsuccessrefcountretinc -@sa bt_ctf_event_set_stream_event_context(): Sets the stream event context +@sa bt_event_set_stream_event_context(): Sets the stream event context field of a given event. */ -extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context( - struct bt_ctf_event *event); +extern struct bt_field *bt_event_get_stream_event_context( + struct bt_event *event); /** @brief Sets the stream event context field of the CTF IR event @@ -335,8 +335,8 @@ extern struct bt_ctf_field *bt_ctf_event_get_stream_event_context( from \p event. If \p context is not \c NULL, the field type of \p context, as returned by -bt_ctf_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_stream_class_get_event_context_type() for the parent stream class +bt_field_get_type(), \em must be equivalent to the field type returned by +bt_stream_class_get_event_context_type() for the parent stream class of \p event. @param[in] event Event of which to set the stream event context field. @@ -346,17 +346,17 @@ of \p event. @prenotnull{event} @prehot{event} @pre \p context, if not \c NULL, has a field type equivalent to - the field type returned by bt_ctf_stream_class_get_event_context_type() + the field type returned by bt_stream_class_get_event_context_type() for the parent stream class of \p event. @postrefcountsame{event} @post On success, if \p context is not \c NULL, the reference count of \p context is incremented. -@sa bt_ctf_event_get_stream_event_context(): Returns the stream event context +@sa bt_event_get_stream_event_context(): Returns the stream event context field of a given event. */ -extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, - struct bt_ctf_field *context); +extern int bt_event_set_stream_event_context(struct bt_event *event, + struct bt_field *context); /** @brief Returns the event context field of the CTF IR event \p event. @@ -369,19 +369,19 @@ extern int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, @postrefcountsame{event} @postsuccessrefcountretinc -@sa bt_ctf_event_set_event_context(): Sets the event context field of a given +@sa bt_event_set_event_context(): Sets the event context field of a given event. */ -extern struct bt_ctf_field *bt_ctf_event_get_event_context( - struct bt_ctf_event *event); +extern struct bt_field *bt_event_get_event_context( + struct bt_event *event); /** @brief Sets the event context field of the CTF IR event \p event to \p context, or unsets the current event context field from \p event. If \p context is not \c NULL, the field type of \p context, as returned by -bt_ctf_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_event_class_get_context_type() for the parent class of \p event. +bt_field_get_type(), \em must be equivalent to the field type returned by +bt_event_class_get_context_type() for the parent class of \p event. @param[in] event Event of which to set the context field. @param[in] context Event context field. @@ -390,16 +390,16 @@ bt_ctf_event_class_get_context_type() for the parent class of \p event. @prenotnull{event} @prehot{event} @pre \p context, if not \c NULL, has a field type equivalent to - the field type returned by bt_ctf_event_class_get_context_type() for the + the field type returned by bt_event_class_get_context_type() for the parent class of \p event. @postrefcountsame{event} @post On success, if \p context is not \c NULL, the reference count of \p context is incremented. -@sa bt_ctf_event_get_context(): Returns the context field of a given event. +@sa bt_event_get_context(): Returns the context field of a given event. */ -extern int bt_ctf_event_set_event_context(struct bt_ctf_event *event, - struct bt_ctf_field *context); +extern int bt_event_set_event_context(struct bt_event *event, + struct bt_field *context); /** @brief Returns the payload field of the CTF IR event \p event. @@ -412,19 +412,19 @@ extern int bt_ctf_event_set_event_context(struct bt_ctf_event *event, @postrefcountsame{event} @postsuccessrefcountretinc -@sa bt_ctf_event_set_event_payload(): Sets the payload field of a given +@sa bt_event_set_event_payload(): Sets the payload field of a given event. */ -extern struct bt_ctf_field *bt_ctf_event_get_event_payload( - struct bt_ctf_event *event); +extern struct bt_field *bt_event_get_event_payload( + struct bt_event *event); /** @brief Sets the payload field of the CTF IR event \p event to \p payload, or unsets the current event payload field from \p event. If \p payload is not \c NULL, the field type of \p payload, as returned by -bt_ctf_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_event_class_get_payload_type() for the parent class of \p event. +bt_field_get_type(), \em must be equivalent to the field type returned by +bt_event_class_get_payload_type() for the parent class of \p event. @param[in] event Event of which to set the payload field. @param[in] payload Event payload field. @@ -433,23 +433,23 @@ bt_ctf_event_class_get_payload_type() for the parent class of \p event. @prenotnull{event} @prehot{event} @pre \p payload, if not \c NULL, has a field type equivalent to - the field typereturned by bt_ctf_event_class_get_payload_type() for the + the field typereturned by bt_event_class_get_payload_type() for the parent class of \p event. @postrefcountsame{event} @post On success, if \p payload is not \c NULL, the reference count of \p payload is incremented. -@sa bt_ctf_event_get_payload(): Returns the payload field of a given event. +@sa bt_event_get_payload(): Returns the payload field of a given event. */ -extern int bt_ctf_event_set_event_payload(struct bt_ctf_event *event, - struct bt_ctf_field *payload); +extern int bt_event_set_event_payload(struct bt_event *event, + struct bt_field *payload); /** @cond DOCUMENT */ /* * TODO: Doxygenize. * - * bt_ctf_event_get_payload: get an event's field. + * bt_event_get_payload: get an event's field. * * Returns the field matching "name". bt_put() must be called on the * returned value. @@ -463,13 +463,13 @@ extern int bt_ctf_event_set_event_payload(struct bt_ctf_event *event, * name assuming the event's payload is a structure. This will return * the raw payload instance if name is NULL. */ -extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event, +extern struct bt_field *bt_event_get_payload(struct bt_event *event, const char *name); /* * TODO: Doxygenize. * - * bt_ctf_event_get_payload_by_index: Get event's field by index. + * bt_event_get_payload_by_index: Get event's field by index. * * Returns the field associated with the provided index. bt_put() * must be called on the returned value. The indexes to be provided are @@ -482,13 +482,13 @@ extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event, * * Note: Will return an error if the payload's type is not a structure. */ -extern struct bt_ctf_field *bt_ctf_event_get_payload_by_index( - struct bt_ctf_event *event, uint64_t index); +extern struct bt_field *bt_event_get_payload_by_index( + struct bt_event *event, uint64_t index); /* * TODO: Doxygenize. * - * bt_ctf_event_set_payload: set an event's field. + * bt_event_set_payload: set an event's field. * * Set a manually allocated field as an event's payload. The event will share * the field's ownership by using its reference count. @@ -504,9 +504,9 @@ extern struct bt_ctf_field *bt_ctf_event_get_payload_by_index( * type is not a structure. If name is NULL, the payload field will be set * directly and must match the event class' payload's type. */ -extern int bt_ctf_event_set_payload(struct bt_ctf_event *event, +extern int bt_event_set_payload(struct bt_event *event, const char *name, - struct bt_ctf_field *value); + struct bt_field *value); /** @endcond */ @@ -534,11 +534,11 @@ extern int bt_ctf_event_set_payload(struct bt_ctf_event *event, @postrefcountsame{clock_class} @postsuccessrefcountretinc -@sa bt_ctf_event_set_clock_value(): Sets the clock value of a given event. +@sa bt_event_set_clock_value(): Sets the clock value of a given event. */ -extern struct bt_ctf_clock_value *bt_ctf_event_get_clock_value( - struct bt_ctf_event *event, - struct bt_ctf_clock_class *clock_class); +extern struct bt_clock_value *bt_event_get_clock_value( + struct bt_event *event, + struct bt_clock_class *clock_class); /** @brief Sets the value, as of the CTF IR event \p event, of the @@ -556,17 +556,23 @@ extern struct bt_ctf_clock_value *bt_ctf_event_get_clock_value( @prehot{event} @postrefcountsame{event} -@sa bt_ctf_event_get_clock_value(): Returns the clock value of +@sa bt_event_get_clock_value(): Returns the clock value of a given event. */ -extern int bt_ctf_event_set_clock_value( - struct bt_ctf_event *event, - struct bt_ctf_clock_value *clock_value); +extern int bt_event_set_clock_value( + struct bt_event *event, + struct bt_clock_value *clock_value); /** @} */ /** @} */ +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_event bt_event +#define bt_ctf_event_create bt_event_create +#define bt_ctf_event_get_payload bt_event_get_payload +#define bt_ctf_event_set_payload bt_event_set_payload + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/ctf-ir/field-path-internal.h b/include/babeltrace/ctf-ir/field-path-internal.h index 66f44cfa..a65ffe10 100644 --- a/include/babeltrace/ctf-ir/field-path-internal.h +++ b/include/babeltrace/ctf-ir/field-path-internal.h @@ -32,9 +32,9 @@ #include #include -struct bt_ctf_field_path { +struct bt_field_path { struct bt_object base; - enum bt_ctf_scope root; + enum bt_scope root; /* * Array of integers (int) indicating the index in either @@ -46,17 +46,17 @@ struct bt_ctf_field_path { }; BT_HIDDEN -struct bt_ctf_field_path *bt_ctf_field_path_create(void); +struct bt_field_path *bt_field_path_create(void); BT_HIDDEN -void bt_ctf_field_path_clear(struct bt_ctf_field_path *field_path); +void bt_field_path_clear(struct bt_field_path *field_path); BT_HIDDEN -struct bt_ctf_field_path *bt_ctf_field_path_copy( - struct bt_ctf_field_path *path); +struct bt_field_path *bt_field_path_copy( + struct bt_field_path *path); static inline -GString *bt_ctf_field_path_string(struct bt_ctf_field_path *path) +GString *bt_field_path_string(struct bt_field_path *path) { GString *str = g_string_new(NULL); size_t i; @@ -67,7 +67,7 @@ GString *bt_ctf_field_path_string(struct bt_ctf_field_path *path) goto end; } - g_string_append_printf(str, "[%s", bt_ctf_scope_string(path->root)); + g_string_append_printf(str, "[%s", bt_scope_string(path->root)); for (i = 0; i < path->indexes->len; i++) { int index = g_array_index(path->indexes, int, i); diff --git a/include/babeltrace/ctf-ir/field-path.h b/include/babeltrace/ctf-ir/field-path.h index 45f681fb..d5e5e43d 100644 --- a/include/babeltrace/ctf-ir/field-path.h +++ b/include/babeltrace/ctf-ir/field-path.h @@ -34,7 +34,7 @@ extern "C" { #endif -struct bt_ctf_field_type; +struct bt_field_type; /** @defgroup ctfirfieldpath CTF IR field path @@ -57,8 +57,8 @@ As a reminder, here's the structure of a CTF packet: Sequence and variant \link ctfirfieldtypes CTF IR field types\endlink can return a field path to resp. their length field and tag field -with resp. bt_ctf_field_type_sequence_get_length_field_path() and -bt_ctf_field_type_variant_get_tag_field_path(). +with resp. bt_field_type_sequence_get_length_field_path() and +bt_field_type_variant_get_tag_field_path(). A field path has a root scope which indicates from which of the six CTF scopes to begin. It also has a list of structure field path @@ -80,24 +80,24 @@ management of Babeltrace objects. */ /** -@struct bt_ctf_field_path +@struct bt_field_path @brief A CTF IR field path. @sa ctfirfieldpath */ -struct bt_ctf_field_path; +struct bt_field_path; /** @brief Returns the root scope of the CTF IR field path \p field_path. @param[in] field_path Field path of which to get the root scope. @returns Root scope of \p field_path, or - #BT_CTF_SCOPE_UNKNOWN on error. + #BT_SCOPE_UNKNOWN on error. @prenotnull{field_path} @postrefcountsame{field_path} */ -extern enum bt_ctf_scope bt_ctf_field_path_get_root_scope( - const struct bt_ctf_field_path *field_path); +extern enum bt_scope bt_field_path_get_root_scope( + const struct bt_field_path *field_path); /** @brief Returns the number of path indexes contained in the CTF IR field @@ -111,8 +111,8 @@ extern enum bt_ctf_scope bt_ctf_field_path_get_root_scope( @prenotnull{field_path} @postrefcountsame{field_path} */ -extern int64_t bt_ctf_field_path_get_index_count( - const struct bt_ctf_field_path *field_path); +extern int64_t bt_field_path_get_index_count( + const struct bt_field_path *field_path); /** @brief Returns the path index contained in the CTF IR field @@ -127,11 +127,11 @@ extern int64_t bt_ctf_field_path_get_index_count( @prenotnull{field_path} @pre \p index is lesser than the number of path indexes contained in the field path \p field_path (see - bt_ctf_field_path_get_index_count()). + bt_field_path_get_index_count()). @postrefcountsame{field_path} */ -extern int bt_ctf_field_path_get_index( - const struct bt_ctf_field_path *field_path, uint64_t index); +extern int bt_field_path_get_index( + const struct bt_field_path *field_path, uint64_t index); /** @} */ diff --git a/include/babeltrace/ctf-ir/field-types-internal.h b/include/babeltrace/ctf-ir/field-types-internal.h index a4f4c833..3d478ae7 100644 --- a/include/babeltrace/ctf-ir/field-types-internal.h +++ b/include/babeltrace/ctf-ir/field-types-internal.h @@ -39,13 +39,13 @@ #include #include -typedef void (*type_freeze_func)(struct bt_ctf_field_type *); -typedef int (*type_serialize_func)(struct bt_ctf_field_type *, +typedef void (*type_freeze_func)(struct bt_field_type *); +typedef int (*type_serialize_func)(struct bt_field_type *, struct metadata_context *); -struct bt_ctf_field_type { +struct bt_field_type { struct bt_object base; - enum bt_ctf_field_type_id id; + enum bt_field_type_id id; unsigned int alignment; type_freeze_func freeze; type_serialize_func serialize; @@ -63,14 +63,14 @@ struct bt_ctf_field_type { int valid; }; -struct bt_ctf_field_type_integer { - struct bt_ctf_field_type parent; - struct bt_ctf_clock_class *mapped_clock; - enum bt_ctf_byte_order user_byte_order; +struct bt_field_type_integer { + struct bt_field_type parent; + struct bt_clock_class *mapped_clock; + enum bt_byte_order user_byte_order; bt_bool is_signed; unsigned int size; - enum bt_ctf_integer_base base; - enum bt_ctf_string_encoding encoding; + enum bt_integer_base base; + enum bt_string_encoding encoding; }; struct enumeration_mapping { @@ -86,24 +86,24 @@ struct enumeration_mapping { GQuark string; }; -struct bt_ctf_field_type_enumeration { - struct bt_ctf_field_type parent; - struct bt_ctf_field_type *container; +struct bt_field_type_enumeration { + struct bt_field_type parent; + struct bt_field_type *container; GPtrArray *entries; /* Array of ptrs to struct enumeration_mapping */ /* Only set during validation. */ bt_bool has_overlapping_ranges; }; -enum bt_ctf_field_type_enumeration_mapping_iterator_type { +enum bt_field_type_enumeration_mapping_iterator_type { ITERATOR_BY_NAME, ITERATOR_BY_SIGNED_VALUE, ITERATOR_BY_UNSIGNED_VALUE, }; -struct bt_ctf_field_type_enumeration_mapping_iterator { +struct bt_field_type_enumeration_mapping_iterator { struct bt_object base; - struct bt_ctf_field_type_enumeration *enumeration_type; - enum bt_ctf_field_type_enumeration_mapping_iterator_type type; + struct bt_field_type_enumeration *enumeration_type; + enum bt_field_type_enumeration_mapping_iterator_type type; int index; union { GQuark name_quark; @@ -112,220 +112,220 @@ struct bt_ctf_field_type_enumeration_mapping_iterator { } u; }; -struct bt_ctf_field_type_floating_point { - struct bt_ctf_field_type parent; - enum bt_ctf_byte_order user_byte_order; +struct bt_field_type_floating_point { + struct bt_field_type parent; + enum bt_byte_order user_byte_order; unsigned int exp_dig; unsigned int mant_dig; }; struct structure_field { GQuark name; - struct bt_ctf_field_type *type; + struct bt_field_type *type; }; -struct bt_ctf_field_type_structure { - struct bt_ctf_field_type parent; +struct bt_field_type_structure { + struct bt_field_type parent; GHashTable *field_name_to_index; GPtrArray *fields; /* Array of pointers to struct structure_field */ }; -struct bt_ctf_field_type_variant { - struct bt_ctf_field_type parent; +struct bt_field_type_variant { + struct bt_field_type parent; GString *tag_name; - struct bt_ctf_field_type_enumeration *tag; - struct bt_ctf_field_path *tag_field_path; + struct bt_field_type_enumeration *tag; + struct bt_field_path *tag_field_path; GHashTable *field_name_to_index; GPtrArray *fields; /* Array of pointers to struct structure_field */ }; -struct bt_ctf_field_type_array { - struct bt_ctf_field_type parent; - struct bt_ctf_field_type *element_type; +struct bt_field_type_array { + struct bt_field_type parent; + struct bt_field_type *element_type; unsigned int length; /* Number of elements */ }; -struct bt_ctf_field_type_sequence { - struct bt_ctf_field_type parent; - struct bt_ctf_field_type *element_type; +struct bt_field_type_sequence { + struct bt_field_type parent; + struct bt_field_type *element_type; GString *length_field_name; - struct bt_ctf_field_path *length_field_path; + struct bt_field_path *length_field_path; }; -struct bt_ctf_field_type_string { - struct bt_ctf_field_type parent; - enum bt_ctf_string_encoding encoding; +struct bt_field_type_string { + struct bt_field_type parent; + enum bt_string_encoding encoding; }; BT_HIDDEN -void bt_ctf_field_type_freeze(struct bt_ctf_field_type *type); +void bt_field_type_freeze(struct bt_field_type *type); BT_HIDDEN -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_signed( - struct bt_ctf_field_type_variant *variant, int64_t tag_value); +struct bt_field_type *bt_field_type_variant_get_field_type_signed( + struct bt_field_type_variant *variant, int64_t tag_value); BT_HIDDEN -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_unsigned( - struct bt_ctf_field_type_variant *variant, uint64_t tag_value); +struct bt_field_type *bt_field_type_variant_get_field_type_unsigned( + struct bt_field_type_variant *variant, uint64_t tag_value); BT_HIDDEN -int bt_ctf_field_type_serialize(struct bt_ctf_field_type *type, +int bt_field_type_serialize(struct bt_field_type *type, struct metadata_context *context); BT_HIDDEN -int bt_ctf_field_type_validate(struct bt_ctf_field_type *type); +int bt_field_type_validate(struct bt_field_type *type); BT_HIDDEN -int bt_ctf_field_type_structure_get_field_name_index( - struct bt_ctf_field_type *structure, const char *name); +int bt_field_type_structure_get_field_name_index( + struct bt_field_type *structure, const char *name); BT_HIDDEN -int bt_ctf_field_type_variant_get_field_name_index( - struct bt_ctf_field_type *variant, const char *name); +int bt_field_type_variant_get_field_name_index( + struct bt_field_type *variant, const char *name); BT_HIDDEN -int bt_ctf_field_type_sequence_set_length_field_path( - struct bt_ctf_field_type *type, - struct bt_ctf_field_path *path); +int bt_field_type_sequence_set_length_field_path( + struct bt_field_type *type, + struct bt_field_path *path); BT_HIDDEN -int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type, - struct bt_ctf_field_path *path); +int bt_field_type_variant_set_tag_field_path(struct bt_field_type *type, + struct bt_field_path *path); BT_HIDDEN -int bt_ctf_field_type_variant_set_tag_field_type(struct bt_ctf_field_type *type, - struct bt_ctf_field_type *tag_type); +int bt_field_type_variant_set_tag_field_type(struct bt_field_type *type, + struct bt_field_type *tag_type); BT_HIDDEN -int bt_ctf_field_type_array_set_element_type(struct bt_ctf_field_type *array, - struct bt_ctf_field_type *element_type); +int bt_field_type_array_set_element_type(struct bt_field_type *array, + struct bt_field_type *element_type); BT_HIDDEN -int bt_ctf_field_type_sequence_set_element_type(struct bt_ctf_field_type *array, - struct bt_ctf_field_type *element_type); +int bt_field_type_sequence_set_element_type(struct bt_field_type *array, + struct bt_field_type *element_type); BT_HIDDEN -int64_t bt_ctf_field_type_get_field_count(struct bt_ctf_field_type *type); +int64_t bt_field_type_get_field_count(struct bt_field_type *type); BT_HIDDEN -struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( - struct bt_ctf_field_type *type, int index); +struct bt_field_type *bt_field_type_get_field_at_index( + struct bt_field_type *type, int index); BT_HIDDEN -int bt_ctf_field_type_get_field_index(struct bt_ctf_field_type *type, +int bt_field_type_get_field_index(struct bt_field_type *type, const char *name); BT_HIDDEN -int bt_ctf_field_type_integer_set_mapped_clock_class_no_check( - struct bt_ctf_field_type *int_field_type, - struct bt_ctf_clock_class *clock_class); +int bt_field_type_integer_set_mapped_clock_class_no_check( + struct bt_field_type *int_field_type, + struct bt_clock_class *clock_class); static inline -const char *bt_ctf_field_type_id_string(enum bt_ctf_field_type_id type_id) +const char *bt_field_type_id_string(enum bt_field_type_id type_id) { switch (type_id) { - case BT_CTF_FIELD_TYPE_ID_UNKNOWN: - return "BT_CTF_FIELD_TYPE_ID_UNKNOWN"; - case BT_CTF_FIELD_TYPE_ID_INTEGER: - return "BT_CTF_FIELD_TYPE_ID_INTEGER"; - case BT_CTF_FIELD_TYPE_ID_FLOAT: - return "BT_CTF_FIELD_TYPE_ID_FLOAT"; - case BT_CTF_FIELD_TYPE_ID_ENUM: - return "BT_CTF_FIELD_TYPE_ID_ENUM"; - case BT_CTF_FIELD_TYPE_ID_STRING: - return "BT_CTF_FIELD_TYPE_ID_STRING"; - case BT_CTF_FIELD_TYPE_ID_STRUCT: - return "BT_CTF_FIELD_TYPE_ID_STRUCT"; - case BT_CTF_FIELD_TYPE_ID_ARRAY: - return "BT_CTF_FIELD_TYPE_ID_ARRAY"; - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: - return "BT_CTF_FIELD_TYPE_ID_SEQUENCE"; - case BT_CTF_FIELD_TYPE_ID_VARIANT: - return "BT_CTF_FIELD_TYPE_ID_VARIANT"; + case BT_FIELD_TYPE_ID_UNKNOWN: + return "BT_FIELD_TYPE_ID_UNKNOWN"; + case BT_FIELD_TYPE_ID_INTEGER: + return "BT_FIELD_TYPE_ID_INTEGER"; + case BT_FIELD_TYPE_ID_FLOAT: + return "BT_FIELD_TYPE_ID_FLOAT"; + case BT_FIELD_TYPE_ID_ENUM: + return "BT_FIELD_TYPE_ID_ENUM"; + case BT_FIELD_TYPE_ID_STRING: + return "BT_FIELD_TYPE_ID_STRING"; + case BT_FIELD_TYPE_ID_STRUCT: + return "BT_FIELD_TYPE_ID_STRUCT"; + case BT_FIELD_TYPE_ID_ARRAY: + return "BT_FIELD_TYPE_ID_ARRAY"; + case BT_FIELD_TYPE_ID_SEQUENCE: + return "BT_FIELD_TYPE_ID_SEQUENCE"; + case BT_FIELD_TYPE_ID_VARIANT: + return "BT_FIELD_TYPE_ID_VARIANT"; default: return "(unknown)"; } }; static inline -const char *bt_ctf_byte_order_string(enum bt_ctf_byte_order bo) +const char *bt_byte_order_string(enum bt_byte_order bo) { switch (bo) { - case BT_CTF_BYTE_ORDER_UNKNOWN: - return "BT_CTF_BYTE_ORDER_UNKNOWN"; - case BT_CTF_BYTE_ORDER_UNSPECIFIED: - return "BT_CTF_BYTE_ORDER_UNSPECIFIED"; - case BT_CTF_BYTE_ORDER_NATIVE: - return "BT_CTF_BYTE_ORDER_NATIVE"; - case BT_CTF_BYTE_ORDER_LITTLE_ENDIAN: - return "BT_CTF_BYTE_ORDER_LITTLE_ENDIAN"; - case BT_CTF_BYTE_ORDER_BIG_ENDIAN: - return "BT_CTF_BYTE_ORDER_BIG_ENDIAN"; - case BT_CTF_BYTE_ORDER_NETWORK: - return "BT_CTF_BYTE_ORDER_NETWORK"; + case BT_BYTE_ORDER_UNKNOWN: + return "BT_BYTE_ORDER_UNKNOWN"; + case BT_BYTE_ORDER_UNSPECIFIED: + return "BT_BYTE_ORDER_UNSPECIFIED"; + case BT_BYTE_ORDER_NATIVE: + return "BT_BYTE_ORDER_NATIVE"; + case BT_BYTE_ORDER_LITTLE_ENDIAN: + return "BT_BYTE_ORDER_LITTLE_ENDIAN"; + case BT_BYTE_ORDER_BIG_ENDIAN: + return "BT_BYTE_ORDER_BIG_ENDIAN"; + case BT_BYTE_ORDER_NETWORK: + return "BT_BYTE_ORDER_NETWORK"; default: return "(unknown)"; } }; static inline -const char *bt_ctf_string_encoding_string(enum bt_ctf_string_encoding encoding) +const char *bt_string_encoding_string(enum bt_string_encoding encoding) { switch (encoding) { - case BT_CTF_STRING_ENCODING_UNKNOWN: - return "BT_CTF_STRING_ENCODING_UNKNOWN"; - case BT_CTF_STRING_ENCODING_NONE: - return "BT_CTF_STRING_ENCODING_NONE"; - case BT_CTF_STRING_ENCODING_UTF8: - return "BT_CTF_STRING_ENCODING_UTF8"; - case BT_CTF_STRING_ENCODING_ASCII: - return "BT_CTF_STRING_ENCODING_ASCII"; + case BT_STRING_ENCODING_UNKNOWN: + return "BT_STRING_ENCODING_UNKNOWN"; + case BT_STRING_ENCODING_NONE: + return "BT_STRING_ENCODING_NONE"; + case BT_STRING_ENCODING_UTF8: + return "BT_STRING_ENCODING_UTF8"; + case BT_STRING_ENCODING_ASCII: + return "BT_STRING_ENCODING_ASCII"; default: return "(unknown)"; } }; static inline -const char *bt_ctf_integer_base_string(enum bt_ctf_integer_base base) +const char *bt_integer_base_string(enum bt_integer_base base) { switch (base) { - case BT_CTF_INTEGER_BASE_UNKNOWN: - return "BT_CTF_INTEGER_BASE_UNKNOWN"; - case BT_CTF_INTEGER_BASE_UNSPECIFIED: - return "BT_CTF_INTEGER_BASE_UNSPECIFIED"; - case BT_CTF_INTEGER_BASE_BINARY: - return "BT_CTF_INTEGER_BASE_BINARY"; - case BT_CTF_INTEGER_BASE_OCTAL: - return "BT_CTF_INTEGER_BASE_OCTAL"; - case BT_CTF_INTEGER_BASE_DECIMAL: - return "BT_CTF_INTEGER_BASE_DECIMAL"; - case BT_CTF_INTEGER_BASE_HEXADECIMAL: - return "BT_CTF_INTEGER_BASE_HEXADECIMAL"; + case BT_INTEGER_BASE_UNKNOWN: + return "BT_INTEGER_BASE_UNKNOWN"; + case BT_INTEGER_BASE_UNSPECIFIED: + return "BT_INTEGER_BASE_UNSPECIFIED"; + case BT_INTEGER_BASE_BINARY: + return "BT_INTEGER_BASE_BINARY"; + case BT_INTEGER_BASE_OCTAL: + return "BT_INTEGER_BASE_OCTAL"; + case BT_INTEGER_BASE_DECIMAL: + return "BT_INTEGER_BASE_DECIMAL"; + case BT_INTEGER_BASE_HEXADECIMAL: + return "BT_INTEGER_BASE_HEXADECIMAL"; default: return "(unknown)"; } } static inline -const char *bt_ctf_scope_string(enum bt_ctf_scope scope) +const char *bt_scope_string(enum bt_scope scope) { switch (scope) { - case BT_CTF_SCOPE_UNKNOWN: - return "BT_CTF_SCOPE_UNKNOWN"; - case BT_CTF_SCOPE_TRACE_PACKET_HEADER: - return "BT_CTF_SCOPE_TRACE_PACKET_HEADER"; - case BT_CTF_SCOPE_STREAM_PACKET_CONTEXT: - return "BT_CTF_SCOPE_STREAM_PACKET_CONTEXT"; - case BT_CTF_SCOPE_STREAM_EVENT_HEADER: - return "BT_CTF_SCOPE_STREAM_EVENT_HEADER"; - case BT_CTF_SCOPE_STREAM_EVENT_CONTEXT: - return "BT_CTF_SCOPE_STREAM_EVENT_CONTEXT"; - case BT_CTF_SCOPE_EVENT_CONTEXT: - return "BT_CTF_SCOPE_EVENT_CONTEXT"; - case BT_CTF_SCOPE_EVENT_PAYLOAD: - return "BT_CTF_SCOPE_EVENT_PAYLOAD"; - case BT_CTF_SCOPE_ENV: - return "BT_CTF_SCOPE_ENV"; + case BT_SCOPE_UNKNOWN: + return "BT_SCOPE_UNKNOWN"; + case BT_SCOPE_TRACE_PACKET_HEADER: + return "BT_SCOPE_TRACE_PACKET_HEADER"; + case BT_SCOPE_STREAM_PACKET_CONTEXT: + return "BT_SCOPE_STREAM_PACKET_CONTEXT"; + case BT_SCOPE_STREAM_EVENT_HEADER: + return "BT_SCOPE_STREAM_EVENT_HEADER"; + case BT_SCOPE_STREAM_EVENT_CONTEXT: + return "BT_SCOPE_STREAM_EVENT_CONTEXT"; + case BT_SCOPE_EVENT_CONTEXT: + return "BT_SCOPE_EVENT_CONTEXT"; + case BT_SCOPE_EVENT_PAYLOAD: + return "BT_SCOPE_EVENT_PAYLOAD"; + case BT_SCOPE_ENV: + return "BT_SCOPE_ENV"; default: return "(unknown)"; } diff --git a/include/babeltrace/ctf-ir/field-types.h b/include/babeltrace/ctf-ir/field-types.h index 69a89e5c..6c69bb70 100644 --- a/include/babeltrace/ctf-ir/field-types.h +++ b/include/babeltrace/ctf-ir/field-types.h @@ -53,23 +53,23 @@ A CTF IR field type is a field type that you can use to create concrete @fields. You can create a @field object from a CTF IR field type object -with bt_ctf_field_create(). +with bt_field_create(). In the CTF IR hierarchy, you can set the root field types of three objects: - \ref ctfirtraceclass - - Trace packet header field type: bt_ctf_trace_set_packet_header_type(). + - Trace packet header field type: bt_trace_set_packet_header_type(). - \ref ctfirstreamclass - Stream packet context field type: - bt_ctf_stream_class_set_packet_context_type(). + bt_stream_class_set_packet_context_type(). - Stream event header field type: - bt_ctf_stream_class_set_event_header_type(). + bt_stream_class_set_event_header_type(). - Stream event context field type: - bt_ctf_stream_class_set_event_context_type(). + bt_stream_class_set_event_context_type(). - \ref ctfireventclass - - Event context field type: bt_ctf_event_class_set_context_type(). - - Event payload field type: bt_ctf_event_class_set_payload_type(). + - Event context field type: bt_event_class_set_context_type(). + - Event payload field type: bt_event_class_set_payload_type(). As of Babeltrace \btversion, those six previous "root" field types \em must be @structft objects. @@ -84,10 +84,10 @@ types contained in a given \link ctfirstreamclass CTF IR stream class\endlink (and in its children \link ctfireventclass CTF IR event classes\endlink) once you add it to a \link ctfirtraceclass CTF IR trace class\endlink with -bt_ctf_trace_add_stream_class(). Once a stream class is the child of +bt_trace_add_stream_class(). Once a stream class is the child of a trace class, this automatic resolving is performed for the field types of an event class when you add it with -bt_ctf_stream_class_add_event_class(). If the system cannot find a path +bt_stream_class_add_event_class(). If the system cannot find a path to a field in the hierarchy for a dynamic field type, the adding function fails. @@ -100,59 +100,59 @@ The standard CTF field types are: CTF IR field which you can create from this field type - #BT_CTF_FIELD_TYPE_ID_INTEGER + #BT_FIELD_TYPE_ID_INTEGER \ref ctfirintfieldtype \ref ctfirintfield - #BT_CTF_FIELD_TYPE_ID_FLOAT + #BT_FIELD_TYPE_ID_FLOAT \ref ctfirfloatfieldtype \ref ctfirfloatfield - #BT_CTF_FIELD_TYPE_ID_ENUM + #BT_FIELD_TYPE_ID_ENUM \ref ctfirenumfieldtype \ref ctfirenumfield - #BT_CTF_FIELD_TYPE_ID_STRING + #BT_FIELD_TYPE_ID_STRING \ref ctfirstringfieldtype \ref ctfirstringfield - #BT_CTF_FIELD_TYPE_ID_STRUCT + #BT_FIELD_TYPE_ID_STRUCT \ref ctfirstructfieldtype \ref ctfirstructfield - #BT_CTF_FIELD_TYPE_ID_ARRAY + #BT_FIELD_TYPE_ID_ARRAY \ref ctfirarrayfieldtype \ref ctfirarrayfield - #BT_CTF_FIELD_TYPE_ID_SEQUENCE + #BT_FIELD_TYPE_ID_SEQUENCE \ref ctfirseqfieldtype \ref ctfirseqfield - #BT_CTF_FIELD_TYPE_ID_VARIANT + #BT_FIELD_TYPE_ID_VARIANT \ref ctfirvarfieldtype \ref ctfirvarfield Each field type has its own type ID (see -#bt_ctf_field_type_id). You get the type ID of a field type object -with bt_ctf_field_type_get_type_id(). +#bt_field_type_id). You get the type ID of a field type object +with bt_field_type_get_type_id(). -You can get a deep copy of a field type with bt_ctf_field_type_copy(). +You can get a deep copy of a field type with bt_field_type_copy(). This function resets, in the field type copy, the resolved field type of the dynamic field types. The automatic resolving can be done again -when you eventually call bt_ctf_event_create(), -bt_ctf_stream_class_add_event_class(), or -bt_ctf_trace_add_stream_class(). +when you eventually call bt_event_create(), +bt_stream_class_add_event_class(), or +bt_trace_add_stream_class(). -You \em must always use bt_ctf_field_type_compare() to compare two +You \em must always use bt_field_type_compare() to compare two field types. Since some parts of the Babeltrace system can copy field types behind the scenes, you \em cannot rely on a simple field type pointer comparison. @@ -164,18 +164,18 @@ management of Babeltrace objects. The following functions can \em freeze field type objects: -- bt_ctf_field_create() freezes its field type parameter. -- bt_ctf_stream_class_add_event_class(), if its +- bt_field_create() freezes its field type parameter. +- bt_stream_class_add_event_class(), if its \link ctfirstreamclass CTF IR stream class\endlink parameter has a \link ctfirtraceclass CTF IR trace class\endlink parent, freezes the root field types of its \link ctfireventclass CTF IR event class\endlink parameter. -- bt_ctf_trace_add_stream_class() freezes the root field types of the +- bt_trace_add_stream_class() freezes the root field types of the whole trace class hierarchy (trace class, children stream classes, and their children event classes). -- bt_ctf_writer_create_stream() freezes the root field types of the +- bt_writer_create_stream() freezes the root field types of the whole CTF writer's trace class hierarchy. -- bt_ctf_event_create() freezes the root field types of its event class +- bt_event_create() freezes the root field types of its event class parameter and of ther parent stream class of this event class. You cannot modify a frozen field type object: it is considered @@ -193,80 +193,45 @@ immutable, except for \link refs reference counting\endlink. */ /** -@struct bt_ctf_field_type +@struct bt_field_type @brief A CTF IR field type. @sa ctfirfieldtypes */ -struct bt_ctf_field_type; -struct bt_ctf_event_class; -struct bt_ctf_event; -struct bt_ctf_field; -struct bt_ctf_field_path; -struct bt_ctf_field_type_enumeration_mapping_iterator; - -/** @cond DOCUMENT */ - -/* - * Babeltrace 1.x enumerations that were also used in CTF writer's API. - * They are left here for backward compatibility reasons, but - * enum bt_ctf_field_type_id and enum bt_ctf_string_encoding should be used - * in new code. Both new enumerations are compatible with their legacy - * counterpart. - */ -enum ctf_type_id { - CTF_TYPE_UNKNOWN = -1, - CTF_TYPE_INTEGER = 0, - CTF_TYPE_FLOAT = 1, - CTF_TYPE_ENUM = 2, - CTF_TYPE_STRING = 3, - CTF_TYPE_STRUCT = 4, - CTF_TYPE_UNTAGGED_VARIANT = 5, - CTF_TYPE_VARIANT = 5, - CTF_TYPE_ARRAY = 6, - CTF_TYPE_SEQUENCE = 7, - NR_CTF_TYPES, -}; - -/* - * Old enum. - */ -enum ctf_string_encoding { - CTF_STRING_NONE = 0, - CTF_STRING_UTF8, - CTF_STRING_ASCII, - CTF_STRING_UNKNOWN, -}; - -/** @endcond */ +struct bt_field_type; +struct bt_event_class; +struct bt_event; +struct bt_field; +struct bt_field_path; +struct bt_field_type_enumeration_mapping_iterator; /** @brief CTF scope. */ -enum bt_ctf_scope { +enum bt_scope { /// Unknown, used for errors. - BT_CTF_SCOPE_UNKNOWN = -1, + BT_SCOPE_UNKNOWN = -1, /// Trace packet header. - BT_CTF_SCOPE_TRACE_PACKET_HEADER = 1, + BT_SCOPE_TRACE_PACKET_HEADER = 1, /// Stream packet context. - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT = 2, + BT_SCOPE_STREAM_PACKET_CONTEXT = 2, /// Stream event header. - BT_CTF_SCOPE_STREAM_EVENT_HEADER = 3, + BT_SCOPE_STREAM_EVENT_HEADER = 3, /// Stream event context. - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT = 4, + BT_SCOPE_STREAM_EVENT_CONTEXT = 4, /// Event context. - BT_CTF_SCOPE_EVENT_CONTEXT = 5, + BT_SCOPE_EVENT_CONTEXT = 5, /// Event payload. - BT_CTF_SCOPE_EVENT_PAYLOAD = 6, + BT_SCOPE_EVENT_PAYLOAD = 6, /// @cond DOCUMENT - BT_CTF_SCOPE_ENV = 0, - BT_CTF_SCOPE_EVENT_FIELDS = 6, + BT_SCOPE_ENV = 0, + BT_SCOPE_EVENT_FIELDS = 6, /// @endcond }; @@ -278,36 +243,36 @@ enum bt_ctf_scope { /** @brief Type ID of a @ft. */ -enum bt_ctf_field_type_id { +enum bt_field_type_id { /// Unknown, used for errors. - BT_CTF_FIELD_TYPE_ID_UNKNOWN = CTF_TYPE_UNKNOWN, + BT_FIELD_TYPE_ID_UNKNOWN = -1, /// \ref ctfirintfieldtype - BT_CTF_FIELD_TYPE_ID_INTEGER = CTF_TYPE_INTEGER, + BT_FIELD_TYPE_ID_INTEGER = 0, /// \ref ctfirfloatfieldtype - BT_CTF_FIELD_TYPE_ID_FLOAT = CTF_TYPE_FLOAT, + BT_FIELD_TYPE_ID_FLOAT = 1, /// \ref ctfirenumfieldtype - BT_CTF_FIELD_TYPE_ID_ENUM = CTF_TYPE_ENUM, + BT_FIELD_TYPE_ID_ENUM = 2, /// \ref ctfirstringfieldtype - BT_CTF_FIELD_TYPE_ID_STRING = CTF_TYPE_STRING, + BT_FIELD_TYPE_ID_STRING = 3, /// \ref ctfirstructfieldtype - BT_CTF_FIELD_TYPE_ID_STRUCT = CTF_TYPE_STRUCT, + BT_FIELD_TYPE_ID_STRUCT = 4, /// \ref ctfirarrayfieldtype - BT_CTF_FIELD_TYPE_ID_ARRAY = CTF_TYPE_ARRAY, + BT_FIELD_TYPE_ID_ARRAY = 6, /// \ref ctfirseqfieldtype - BT_CTF_FIELD_TYPE_ID_SEQUENCE = CTF_TYPE_SEQUENCE, + BT_FIELD_TYPE_ID_SEQUENCE = 7, /// \ref ctfirvarfieldtype - BT_CTF_FIELD_TYPE_ID_VARIANT = CTF_TYPE_VARIANT, + BT_FIELD_TYPE_ID_VARIANT = 5, /// Number of enumeration entries. - BT_CTF_NR_TYPE_IDS = NR_CTF_TYPES, + BT_FIELD_TYPE_ID_NR = 8, }; /** @@ -315,31 +280,31 @@ enum bt_ctf_field_type_id { @param[in] field_type Field type of which to get the type ID. @returns Type ID of \p field_type, - or #BT_CTF_FIELD_TYPE_ID_UNKNOWN on error. + or #BT_FIELD_TYPE_ID_UNKNOWN on error. @prenotnull{field_type} @postrefcountsame{field_type} -@sa #bt_ctf_field_type_id: CTF IR field type ID. -@sa bt_ctf_field_type_is_integer(): Returns whether or not a given +@sa #bt_field_type_id: CTF IR field type ID. +@sa bt_field_type_is_integer(): Returns whether or not a given field type is a @intft. -@sa bt_ctf_field_type_is_floating_point(): Returns whether or not a +@sa bt_field_type_is_floating_point(): Returns whether or not a given field type is a @floatft. -@sa bt_ctf_field_type_is_enumeration(): Returns whether or not a given +@sa bt_field_type_is_enumeration(): Returns whether or not a given field type is a @enumft. -@sa bt_ctf_field_type_is_string(): Returns whether or not a given +@sa bt_field_type_is_string(): Returns whether or not a given field type is a @stringft. -@sa bt_ctf_field_type_is_structure(): Returns whether or not a given +@sa bt_field_type_is_structure(): Returns whether or not a given field type is a @structft. -@sa bt_ctf_field_type_is_array(): Returns whether or not a given +@sa bt_field_type_is_array(): Returns whether or not a given field type is a @arrayft. -@sa bt_ctf_field_type_is_sequence(): Returns whether or not a given +@sa bt_field_type_is_sequence(): Returns whether or not a given field type is a @seqft. -@sa bt_ctf_field_type_is_variant(): Returns whether or not a given +@sa bt_field_type_is_variant(): Returns whether or not a given field type is a @varft. */ -extern enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id( - struct bt_ctf_field_type *field_type); +extern enum bt_field_type_id bt_field_type_get_type_id( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @intft. @@ -352,11 +317,11 @@ extern enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id( @prenotnull{field_type} @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_integer( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_integer( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @floatft. @@ -369,11 +334,11 @@ extern bt_bool bt_ctf_field_type_is_integer( @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_floating_point( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_floating_point( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @enumft. @@ -385,11 +350,11 @@ extern bt_bool bt_ctf_field_type_is_floating_point( @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_enumeration( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_enumeration( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @stringft. @@ -401,11 +366,11 @@ extern bt_bool bt_ctf_field_type_is_enumeration( @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_string( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_string( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @structft. @@ -417,11 +382,11 @@ extern bt_bool bt_ctf_field_type_is_string( @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_structure( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_structure( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @arrayft. @@ -433,11 +398,11 @@ extern bt_bool bt_ctf_field_type_is_structure( @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_array( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_array( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @seqft. @@ -449,11 +414,11 @@ extern bt_bool bt_ctf_field_type_is_array( @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_sequence( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_sequence( + struct bt_field_type *field_type); /** @brief Returns whether or not the @ft \p field_type is a @varft. @@ -465,11 +430,11 @@ extern bt_bool bt_ctf_field_type_is_sequence( @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_type_id(): Returns the type ID of a given +@sa bt_field_type_get_type_id(): Returns the type ID of a given field type. */ -extern bt_bool bt_ctf_field_type_is_variant( - struct bt_ctf_field_type *field_type); +extern bt_bool bt_field_type_is_variant( + struct bt_field_type *field_type); /** @} */ @@ -482,9 +447,9 @@ extern bt_bool bt_ctf_field_type_is_variant( @brief Byte order of a @ft. */ -enum bt_ctf_byte_order { +enum bt_byte_order { /// Unknown, used for errors. - BT_CTF_BYTE_ORDER_UNKNOWN = -1, + BT_BYTE_ORDER_UNKNOWN = -1, /* * Note that native, in the context of the CTF specification, is defined @@ -492,39 +457,39 @@ enum bt_ctf_byte_order { * host's endianness will be used. */ /// Native (default) byte order. - BT_CTF_BYTE_ORDER_NATIVE = 0, + BT_BYTE_ORDER_NATIVE = 0, /** Unspecified byte order; the initial native byte order of a \link ctfirtraceclass CTF IR trace class\endlink. */ - BT_CTF_BYTE_ORDER_UNSPECIFIED, + BT_BYTE_ORDER_UNSPECIFIED, /// Little-endian. - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN, + BT_BYTE_ORDER_LITTLE_ENDIAN, /// Big-endian. - BT_CTF_BYTE_ORDER_BIG_ENDIAN, + BT_BYTE_ORDER_BIG_ENDIAN, /// Network byte order (big-endian). - BT_CTF_BYTE_ORDER_NETWORK, + BT_BYTE_ORDER_NETWORK, }; /** @brief String encoding of a @ft. */ -enum bt_ctf_string_encoding { +enum bt_string_encoding { /// Unknown, used for errors. - BT_CTF_STRING_ENCODING_UNKNOWN = CTF_STRING_UNKNOWN, + BT_STRING_ENCODING_UNKNOWN = -1, /// No encoding. - BT_CTF_STRING_ENCODING_NONE = CTF_STRING_NONE, + BT_STRING_ENCODING_NONE, /// UTF-8. - BT_CTF_STRING_ENCODING_UTF8 = CTF_STRING_UTF8, + BT_STRING_ENCODING_UTF8, /// ASCII. - BT_CTF_STRING_ENCODING_ASCII = CTF_STRING_ASCII, + BT_STRING_ENCODING_ASCII, }; /** @@ -539,11 +504,11 @@ enum bt_ctf_string_encoding { @prenotnull{field_type} @postrefcountsame{field_type} -@sa bt_ctf_field_type_set_alignment(): Sets the alignment +@sa bt_field_type_set_alignment(): Sets the alignment of the fields described by a given field type. */ -extern int bt_ctf_field_type_get_alignment( - struct bt_ctf_field_type *field_type); +extern int bt_field_type_get_alignment( + struct bt_field_type *field_type); /** @brief Sets the alignment of the @fields described by the @@ -562,10 +527,10 @@ extern int bt_ctf_field_type_get_alignment( @pre \p alignment is greater than 0 and a power of two. @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_alignment(): Returns the alignment of the +@sa bt_field_type_get_alignment(): Returns the alignment of the fields described by a given field type. */ -extern int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *field_type, +extern int bt_field_type_set_alignment(struct bt_field_type *field_type, unsigned int alignment); /** @@ -578,18 +543,18 @@ You can only call this function if \p field_type is a @intft, a @param[in] field_type Field type which describes the fields of which to get the byte order. @returns Byte order of the fields described by - \p field_type, or #BT_CTF_BYTE_ORDER_UNKNOWN on + \p field_type, or #BT_BYTE_ORDER_UNKNOWN on error. @prenotnull{field_type} @pre \p field_type is a @intft, a @floatft, or a @enumft. @postrefcountsame{field_type} -@sa bt_ctf_field_type_set_byte_order(): Sets the byte order +@sa bt_field_type_set_byte_order(): Sets the byte order of the fields described by a given field type. */ -extern enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order( - struct bt_ctf_field_type *field_type); +extern enum bt_byte_order bt_field_type_get_byte_order( + struct bt_field_type *field_type); /** @brief Sets the byte order of the @fields described by the @@ -606,17 +571,17 @@ recursively sets the byte order of its children to \p byte_order. @prenotnull{field_type} @prehot{field_type} -@pre \p byte_order is #BT_CTF_BYTE_ORDER_NATIVE, - #BT_CTF_BYTE_ORDER_LITTLE_ENDIAN, #BT_CTF_BYTE_ORDER_BIG_ENDIAN, - or #BT_CTF_BYTE_ORDER_NETWORK. +@pre \p byte_order is #BT_BYTE_ORDER_NATIVE, + #BT_BYTE_ORDER_LITTLE_ENDIAN, #BT_BYTE_ORDER_BIG_ENDIAN, + or #BT_BYTE_ORDER_NETWORK. @postrefcountsame{field_type} -@sa bt_ctf_field_type_get_byte_order(): Returns the byte order of the +@sa bt_field_type_get_byte_order(): Returns the byte order of the fields described by a given field type. */ -extern int bt_ctf_field_type_set_byte_order( - struct bt_ctf_field_type *field_type, - enum bt_ctf_byte_order byte_order); +extern int bt_field_type_set_byte_order( + struct bt_field_type *field_type, + enum bt_byte_order byte_order); /** @} */ @@ -645,8 +610,8 @@ and discard the original ones. @postrefcountsame{field_type_a} @postrefcountsame{field_type_b} */ -extern int bt_ctf_field_type_compare(struct bt_ctf_field_type *field_type_a, - struct bt_ctf_field_type *field_type_b); +extern int bt_field_type_compare(struct bt_field_type *field_type_a, + struct bt_field_type *field_type_b); /** @brief Creates a \em deep copy of the @ft \p field_type. @@ -668,8 +633,8 @@ in the detailed description of this module). @postsuccessrefcountret1 @post On success, the returned field type is not frozen. */ -extern struct bt_ctf_field_type *bt_ctf_field_type_copy( - struct bt_ctf_field_type *field_type); +extern struct bt_field_type *bt_field_type_copy( + struct bt_field_type *field_type); /** @} */ @@ -688,7 +653,7 @@ A CTF IR integer field type is a field type that you can use to create concrete @intfield objects. You can create an integer field type -with bt_ctf_field_type_integer_create(). +with bt_field_type_integer_create(). An integer field type has the following properties: @@ -702,47 +667,47 @@ An integer field type has the following properties: \b Alignment (bits) of the described integer fields 1 - bt_ctf_field_type_get_alignment() - bt_ctf_field_type_set_alignment() + bt_field_type_get_alignment() + bt_field_type_set_alignment() Byte order of the described integer fields - #BT_CTF_BYTE_ORDER_NATIVE - bt_ctf_field_type_get_byte_order() - bt_ctf_field_type_set_byte_order() + #BT_BYTE_ORDER_NATIVE + bt_field_type_get_byte_order() + bt_field_type_set_byte_order() Storage size (bits) of the described integer fields Specified at creation - bt_ctf_field_type_integer_get_size() - bt_ctf_field_type_integer_set_size() + bt_field_type_integer_get_size() + bt_field_type_integer_set_size() Signedness of the described integer fields Unsigned - bt_ctf_field_type_integer_is_signed() - bt_ctf_field_type_integer_set_is_signed() + bt_field_type_integer_is_signed() + bt_field_type_integer_set_is_signed() Preferred display base of the described integer fields - #BT_CTF_INTEGER_BASE_DECIMAL - bt_ctf_field_type_integer_get_base() - bt_ctf_field_type_integer_set_base() + #BT_INTEGER_BASE_DECIMAL + bt_field_type_integer_get_base() + bt_field_type_integer_set_base() \b Encoding of the described integer fields - #BT_CTF_STRING_ENCODING_NONE - bt_ctf_field_type_integer_get_encoding() - bt_ctf_field_type_integer_set_encoding() + #BT_STRING_ENCODING_NONE + bt_field_type_integer_get_encoding() + bt_field_type_integer_set_encoding() Mapped \link ctfirclockclass CTF IR clock class\endlink None - bt_ctf_field_type_integer_get_mapped_clock_class() - bt_ctf_field_type_integer_set_mapped_clock_class() + bt_field_type_integer_get_mapped_clock_class() + bt_field_type_integer_set_mapped_clock_class() @@ -757,24 +722,24 @@ An integer field type has the following properties: /** @brief Preferred display base (radix) of a @intft. */ -enum bt_ctf_integer_base { +enum bt_integer_base { /// Unknown, used for errors. - BT_CTF_INTEGER_BASE_UNKNOWN = -1, + BT_INTEGER_BASE_UNKNOWN = -1, /// Unspecified by the tracer. - BT_CTF_INTEGER_BASE_UNSPECIFIED = 0, + BT_INTEGER_BASE_UNSPECIFIED = 0, /// Binary. - BT_CTF_INTEGER_BASE_BINARY = 2, + BT_INTEGER_BASE_BINARY = 2, /// Octal. - BT_CTF_INTEGER_BASE_OCTAL = 8, + BT_INTEGER_BASE_OCTAL = 8, /// Decimal. - BT_CTF_INTEGER_BASE_DECIMAL = 10, + BT_INTEGER_BASE_DECIMAL = 10, /// Hexadecimal. - BT_CTF_INTEGER_BASE_HEXADECIMAL = 16, + BT_INTEGER_BASE_HEXADECIMAL = 16, }; /** @@ -783,7 +748,7 @@ enum bt_ctf_integer_base { You can change the storage size of the integer fields described by the created integer field type later with -bt_ctf_field_type_integer_set_size(). +bt_field_type_integer_set_size(). @param[in] size Storage size (bits) of the described integer fields. @returns Created integer field type, or \c NULL on error. @@ -791,7 +756,7 @@ bt_ctf_field_type_integer_set_size(). @pre \p size is greater than 0 and lesser than or equal to 64. @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_integer_create( +extern struct bt_field_type *bt_field_type_integer_create( unsigned int size); /** @@ -809,11 +774,11 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_integer_create( @preisintft{int_field_type} @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_set_size(): Sets the storage size of the +@sa bt_field_type_integer_set_size(): Sets the storage size of the integer fields described by a given integer field type. */ -extern int bt_ctf_field_type_integer_get_size( - struct bt_ctf_field_type *int_field_type); +extern int bt_field_type_integer_get_size( + struct bt_field_type *int_field_type); /** @brief Sets the storage size, in bits, of the @intfields described by @@ -832,11 +797,11 @@ extern int bt_ctf_field_type_integer_get_size( @pre \p size is greater than 0 and lesser than or equal to 64. @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_get_size(): Returns the storage size of +@sa bt_field_type_integer_get_size(): Returns the storage size of the integer fields described by a given integer field type. */ -extern int bt_ctf_field_type_integer_set_size( - struct bt_ctf_field_type *int_field_type, unsigned int size); +extern int bt_field_type_integer_set_size( + struct bt_field_type *int_field_type, unsigned int size); /** @brief Returns whether or not the @intfields described by the @intft @@ -853,18 +818,11 @@ extern int bt_ctf_field_type_integer_set_size( @preisintft{int_field_type} @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_set_is_signed(): Sets the signedness of the +@sa bt_field_type_integer_set_is_signed(): Sets the signedness of the integer fields described by a given integer field type. */ -extern bt_bool bt_ctf_field_type_integer_is_signed( - struct bt_ctf_field_type *int_field_type); - -/** @cond DOCUMENT */ - -extern int bt_ctf_field_type_integer_get_signed( - struct bt_ctf_field_type *int_field_type); - -/** @endcond */ +extern bt_bool bt_field_type_integer_is_signed( + struct bt_field_type *int_field_type); /** @brief Sets whether or not the @intfields described by @@ -883,14 +841,11 @@ extern int bt_ctf_field_type_integer_get_signed( @prehot{int_field_type} @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_is_signed(): Returns the signedness of +@sa bt_field_type_integer_is_signed(): Returns the signedness of the integer fields described by a given integer field type. */ -extern int bt_ctf_field_type_integer_set_is_signed( - struct bt_ctf_field_type *int_field_type, bt_bool is_signed); - -/* Pre-2.0 CTF writer compatibility */ -#define bt_ctf_field_type_integer_set_signed bt_ctf_field_type_integer_set_is_signed +extern int bt_field_type_integer_set_is_signed( + struct bt_field_type *int_field_type, bt_bool is_signed); /** @brief Returns the preferred display base (radix) of the @intfields @@ -901,20 +856,20 @@ extern int bt_ctf_field_type_integer_set_is_signed( preferred display base. @returns Preferred display base of the integer fields described by \p int_field_type, - #BT_CTF_INTEGER_BASE_UNSPECIFIED if + #BT_INTEGER_BASE_UNSPECIFIED if not specified, or - #BT_CTF_INTEGER_BASE_UNKNOWN on error. + #BT_INTEGER_BASE_UNKNOWN on error. @prenotnull{int_field_type} @preisintft{int_field_type} @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_set_base(): Sets the preferred display +@sa bt_field_type_integer_set_base(): Sets the preferred display base of the integer fields described by a given integer field type. */ -extern enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base( - struct bt_ctf_field_type *int_field_type); +extern enum bt_integer_base bt_field_type_integer_get_base( + struct bt_field_type *int_field_type); /** @brief Sets the preferred display base (radix) of the @intfields @@ -930,18 +885,18 @@ extern enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base( @prenotnull{int_field_type} @preisintft{int_field_type} @prehot{int_field_type} -@pre \p base is #BT_CTF_INTEGER_BASE_UNSPECIFIED, - #BT_CTF_INTEGER_BASE_BINARY, #BT_CTF_INTEGER_BASE_OCTAL, - #BT_CTF_INTEGER_BASE_DECIMAL, or #BT_CTF_INTEGER_BASE_HEXADECIMAL. +@pre \p base is #BT_INTEGER_BASE_UNSPECIFIED, + #BT_INTEGER_BASE_BINARY, #BT_INTEGER_BASE_OCTAL, + #BT_INTEGER_BASE_DECIMAL, or #BT_INTEGER_BASE_HEXADECIMAL. @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_get_base(): Returns the preferred display +@sa bt_field_type_integer_get_base(): Returns the preferred display base of the integer fields described by a given integer field type. */ -extern int bt_ctf_field_type_integer_set_base( - struct bt_ctf_field_type *int_field_type, - enum bt_ctf_integer_base base); +extern int bt_field_type_integer_set_base( + struct bt_field_type *int_field_type, + enum bt_integer_base base); /** @brief Returns the encoding of the @intfields described by @@ -952,18 +907,18 @@ extern int bt_ctf_field_type_integer_set_base( encoding. @returns Encoding of the integer fields described by \p int_field_type, - or #BT_CTF_STRING_ENCODING_UNKNOWN on + or #BT_STRING_ENCODING_UNKNOWN on error. @prenotnull{int_field_type} @preisintft{int_field_type} @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_set_encoding(): Sets the encoding +@sa bt_field_type_integer_set_encoding(): Sets the encoding of the integer fields described by a given integer field type. */ -extern enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding( - struct bt_ctf_field_type *int_field_type); +extern enum bt_string_encoding bt_field_type_integer_get_encoding( + struct bt_field_type *int_field_type); /** @brief Sets the encoding of the @intfields described by the @intft @@ -983,17 +938,17 @@ You can use this property, in CTF IR, to create "text" @arrayfts or @prenotnull{int_field_type} @preisintft{int_field_type} @prehot{int_field_type} -@pre \p encoding is #BT_CTF_STRING_ENCODING_NONE, - #BT_CTF_STRING_ENCODING_ASCII, or - #BT_CTF_STRING_ENCODING_UTF8. +@pre \p encoding is #BT_STRING_ENCODING_NONE, + #BT_STRING_ENCODING_ASCII, or + #BT_STRING_ENCODING_UTF8. @postrefcountsame{int_field_type} -@sa bt_ctf_field_type_integer_get_encoding(): Returns the encoding of +@sa bt_field_type_integer_get_encoding(): Returns the encoding of the integer fields described by a given integer field type. */ -extern int bt_ctf_field_type_integer_set_encoding( - struct bt_ctf_field_type *int_field_type, - enum bt_ctf_string_encoding encoding); +extern int bt_field_type_integer_set_encoding( + struct bt_field_type *int_field_type, + enum bt_string_encoding encoding); /** @brief Returns the \link ctfirclockclass CTF IR clock class\endlink @@ -1014,11 +969,11 @@ This mapped clock class is only indicative. @postrefcountsame{int_field_type} @postsuccessrefcountretinc -@sa bt_ctf_field_type_integer_set_mapped_clock_class(): Sets the mapped +@sa bt_field_type_integer_set_mapped_clock_class(): Sets the mapped clock class of a given integer field type. */ -extern struct bt_ctf_clock_class *bt_ctf_field_type_integer_get_mapped_clock_class( - struct bt_ctf_field_type *int_field_type); +extern struct bt_clock_class *bt_field_type_integer_get_mapped_clock_class( + struct bt_field_type *int_field_type); /** @brief Sets the \link ctfirclockclass CTF IR clock class\endlink mapped @@ -1040,12 +995,12 @@ This mapped clock class is only indicative. @postrefcountsame{int_field_type} @postsuccessrefcountinc{clock_class} -@sa bt_ctf_field_type_integer_get_mapped_clock_class(): Returns the mapped +@sa bt_field_type_integer_get_mapped_clock_class(): Returns the mapped clock class of a given integer field type. */ -extern int bt_ctf_field_type_integer_set_mapped_clock_class( - struct bt_ctf_field_type *int_field_type, - struct bt_ctf_clock_class *clock_class); +extern int bt_field_type_integer_set_mapped_clock_class( + struct bt_field_type *int_field_type, + struct bt_clock_class *clock_class); /** @} */ @@ -1062,7 +1017,7 @@ A CTF IR floating point number field type is a field type that you can use to create concrete @floatfields. You can create a floating point number field type -with bt_ctf_field_type_floating_point_create(). +with bt_field_type_floating_point_create(). A floating point number field type has the following properties: @@ -1077,29 +1032,29 @@ A floating point number field type has the following properties: \b Alignment (bits) of the described floating point number fields 1 - bt_ctf_field_type_get_alignment() - bt_ctf_field_type_set_alignment() + bt_field_type_get_alignment() + bt_field_type_set_alignment() Byte order of the described floating point number fields - #BT_CTF_BYTE_ORDER_NATIVE - bt_ctf_field_type_get_byte_order() - bt_ctf_field_type_set_byte_order() + #BT_BYTE_ORDER_NATIVE + bt_field_type_get_byte_order() + bt_field_type_set_byte_order() Exponent storage size (bits) of the described floating point number fields 8 - bt_ctf_field_type_floating_point_get_exponent_digits() - bt_ctf_field_type_floating_point_set_exponent_digits() + bt_field_type_floating_point_get_exponent_digits() + bt_field_type_floating_point_set_exponent_digits() Mantissa and sign storage size (bits) of the described floating point number fields 24 (23-bit mantissa, 1-bit sign) - bt_ctf_field_type_floating_point_get_mantissa_digits() - bt_ctf_field_type_floating_point_set_mantissa_digits() + bt_field_type_floating_point_get_mantissa_digits() + bt_field_type_floating_point_set_mantissa_digits() @@ -1119,7 +1074,7 @@ A floating point number field type has the following properties: @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void); +extern struct bt_field_type *bt_field_type_floating_point_create(void); /** @brief Returns the exponent storage size of the @floatfields @@ -1138,12 +1093,12 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void); @preisfloatft{float_field_type} @postrefcountsame{float_field_type} -@sa bt_ctf_field_type_floating_point_set_exponent_digits(): Sets the +@sa bt_field_type_floating_point_set_exponent_digits(): Sets the exponent storage size of the floating point number fields described by a given floating point number field type. */ -extern int bt_ctf_field_type_floating_point_get_exponent_digits( - struct bt_ctf_field_type *float_field_type); +extern int bt_field_type_floating_point_get_exponent_digits( + struct bt_field_type *float_field_type); /** @brief Sets the exponent storage size of the @floatfields described by @@ -1166,12 +1121,12 @@ As of Babeltrace \btversion, \p exponent_size can only be 8 or 11. @pre \p exponent_size is 8 or 11. @postrefcountsame{float_field_type} -@sa bt_ctf_field_type_floating_point_get_exponent_digits(): Returns the +@sa bt_field_type_floating_point_get_exponent_digits(): Returns the exponent storage size of the floating point number fields described by a given floating point number field type. */ -extern int bt_ctf_field_type_floating_point_set_exponent_digits( - struct bt_ctf_field_type *float_field_type, +extern int bt_field_type_floating_point_set_exponent_digits( + struct bt_field_type *float_field_type, unsigned int exponent_size); /** @@ -1194,12 +1149,12 @@ sign storage sizes. @preisfloatft{float_field_type} @postrefcountsame{float_field_type} -@sa bt_ctf_field_type_floating_point_set_mantissa_digits(): Sets the +@sa bt_field_type_floating_point_set_mantissa_digits(): Sets the mantissa and size storage size of the floating point number fields described by a given floating point number field type. */ -extern int bt_ctf_field_type_floating_point_get_mantissa_digits( - struct bt_ctf_field_type *float_field_type); +extern int bt_field_type_floating_point_get_mantissa_digits( + struct bt_field_type *float_field_type); /** @brief Sets the mantissa and sign storage size of the @floatfields @@ -1223,12 +1178,12 @@ As of Babeltrace \btversion, \p mantissa_sign_size can only be 24 or 53. @pre \p mantissa_sign_size is 24 or 53. @postrefcountsame{float_field_type} -@sa bt_ctf_field_type_floating_point_get_mantissa_digits(): Returns the +@sa bt_field_type_floating_point_get_mantissa_digits(): Returns the mantissa and sign storage size of the floating point number fields described by a given floating point number field type. */ -extern int bt_ctf_field_type_floating_point_set_mantissa_digits( - struct bt_ctf_field_type *float_field_type, +extern int bt_field_type_floating_point_set_mantissa_digits( + struct bt_field_type *float_field_type, unsigned int mantissa_sign_size); /** @} */ @@ -1246,7 +1201,7 @@ A CTF IR enumeration field type is a field type that you can use to create concrete @enumfields. You can create an enumeration field type with -bt_ctf_field_type_enumeration_create(). This function needs a @intft +bt_field_type_enumeration_create(). This function needs a @intft which represents the storage field type of the created enumeration field type. In other words, an enumeration field type wraps an integer field type and adds label-value mappings to it. @@ -1258,19 +1213,19 @@ An enumeration mapping has: value, both included in the range. You can add a mapping to an enumeration field type with -bt_ctf_field_type_enumeration_add_mapping_signed() or -bt_ctf_field_type_enumeration_add_mapping_unsigned(), depending on the +bt_field_type_enumeration_add_mapping_signed() or +bt_field_type_enumeration_add_mapping_unsigned(), depending on the signedness of the wrapped @intft. You can find mappings by name or by value with the following find operations: -- bt_ctf_field_type_enumeration_find_mappings_by_name(): Finds the +- bt_field_type_enumeration_find_mappings_by_name(): Finds the mappings with a given name. -- bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(): +- bt_field_type_enumeration_find_mappings_by_unsigned_value(): Finds the mappings which contain a given unsigned value in their range. -- bt_ctf_field_type_enumeration_find_mappings_by_signed_value(): +- bt_field_type_enumeration_find_mappings_by_signed_value(): Finds the mappings which contain a given signed value in their range. Those functions return a @enumftiter on the result set of the find @@ -1320,8 +1275,8 @@ the \c CHERRY mapping. @postsuccessrefcountinc{int_field_type} @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( - struct bt_ctf_field_type *int_field_type); +extern struct bt_field_type *bt_field_type_enumeration_create( + struct bt_field_type *int_field_type); /** @brief Returns the @intft wrapped by the @enumft \p enum_field_type. @@ -1338,8 +1293,8 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( @postsuccessrefcountretinc */ extern -struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type( - struct bt_ctf_field_type *enum_field_type); +struct bt_field_type *bt_field_type_enumeration_get_container_type( + struct bt_field_type *enum_field_type); /** @brief Returns the number of mappings contained in the @@ -1355,15 +1310,15 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type( @preisenumft{enum_field_type} @postrefcountsame{enum_field_type} */ -extern int64_t bt_ctf_field_type_enumeration_get_mapping_count( - struct bt_ctf_field_type *enum_field_type); +extern int64_t bt_field_type_enumeration_get_mapping_count( + struct bt_field_type *enum_field_type); /** @brief Returns the signed mapping of the @enumft \p enum_field_type at index \p index. The @intft wrapped by \p enum_field_type, as returned by -bt_ctf_field_type_enumeration_get_container_type(), must be \b signed +bt_field_type_enumeration_get_container_type(), must be \b signed to use this function. On success, \p enum_field_type remains the sole owner of \p *name. @@ -1389,15 +1344,15 @@ On success, \p enum_field_type remains the sole owner of \p *name. @pre The wrapped @intft of \p enum_field_type is signed. @pre \p index is lesser than the number of mappings contained in the enumeration field type \p enum_field_type (see - bt_ctf_field_type_enumeration_get_mapping_count()). + bt_field_type_enumeration_get_mapping_count()). @postrefcountsame{enum_field_type} -@sa bt_ctf_field_type_enumeration_get_mapping_unsigned(): Returns the +@sa bt_field_type_enumeration_get_mapping_unsigned(): Returns the unsigned mapping contained by a given enumeration field type at a given index. */ -extern int bt_ctf_field_type_enumeration_get_mapping_signed( - struct bt_ctf_field_type *enum_field_type, uint64_t index, +extern int bt_field_type_enumeration_get_mapping_signed( + struct bt_field_type *enum_field_type, uint64_t index, const char **name, int64_t *range_begin, int64_t *range_end); /** @@ -1405,7 +1360,7 @@ extern int bt_ctf_field_type_enumeration_get_mapping_signed( \p enum_field_type at index \p index. The @intft wrapped by \p enum_field_type, as returned by -bt_ctf_field_type_enumeration_get_container_type(), must be +bt_field_type_enumeration_get_container_type(), must be \b unsigned to use this function. On success, \p enum_field_type remains the sole owner of \p *name. @@ -1431,15 +1386,15 @@ On success, \p enum_field_type remains the sole owner of \p *name. @pre The wrapped @intft of \p enum_field_type is unsigned. @pre \p index is lesser than the number of mappings contained in the enumeration field type \p enum_field_type (see - bt_ctf_field_type_enumeration_get_mapping_count()). + bt_field_type_enumeration_get_mapping_count()). @postrefcountsame{enum_field_type} -@sa bt_ctf_field_type_enumeration_get_mapping_signed(): Returns the +@sa bt_field_type_enumeration_get_mapping_signed(): Returns the signed mapping contained by a given enumeration field type at a given index. */ -extern int bt_ctf_field_type_enumeration_get_mapping_unsigned( - struct bt_ctf_field_type *enum_field_type, uint64_t index, +extern int bt_field_type_enumeration_get_mapping_unsigned( + struct bt_field_type *enum_field_type, uint64_t index, const char **name, uint64_t *range_begin, uint64_t *range_end); @@ -1467,16 +1422,16 @@ operation. See \ref ctfirenumftmappingiter for more details. @post On success, the returned @enumftiter can iterate on at least one mapping. -@sa bt_ctf_field_type_enumeration_find_mappings_by_signed_value(): Finds +@sa bt_field_type_enumeration_find_mappings_by_signed_value(): Finds the mappings of a given enumeration field type which contain a given signed value in their range. -@sa bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(): Finds +@sa bt_field_type_enumeration_find_mappings_by_unsigned_value(): Finds the mappings of a given enumeration field type which contain a given unsigned value in their range. */ -extern struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_name( - struct bt_ctf_field_type *enum_field_type, +extern struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_name( + struct bt_field_type *enum_field_type, const char *name); /** @@ -1502,16 +1457,16 @@ operation. See \ref ctfirenumftmappingiter for more details. @post On success, the returned @enumftiter can iterate on at least one mapping. -@sa bt_ctf_field_type_enumeration_find_mappings_by_name(): Finds the +@sa bt_field_type_enumeration_find_mappings_by_name(): Finds the mappings of a given enumeration field type which have a given name. -@sa bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(): Finds +@sa bt_field_type_enumeration_find_mappings_by_unsigned_value(): Finds the mappings of a given enumeration field type which contain a given unsigned value in their range. */ -extern struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_signed_value( - struct bt_ctf_field_type *enum_field_type, +extern struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_signed_value( + struct bt_field_type *enum_field_type, int64_t value); /** @@ -1538,16 +1493,16 @@ operation. See \ref ctfirenumftmappingiter for more details. @post On success, the returned @enumftiter can iterate on at least one mapping. -@sa bt_ctf_field_type_enumeration_find_mappings_by_name(): Finds the +@sa bt_field_type_enumeration_find_mappings_by_name(): Finds the mappings of a given enumeration field type which have a given name. -@sa bt_ctf_field_type_enumeration_find_mappings_by_signed_value(): Finds +@sa bt_field_type_enumeration_find_mappings_by_signed_value(): Finds the mappings of a given enumeration field type which contain a given unsigned value in their range. */ -extern struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value( - struct bt_ctf_field_type *enum_field_type, +extern struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_unsigned_value( + struct bt_field_type *enum_field_type, uint64_t value); /** @@ -1559,7 +1514,7 @@ Make \p range_begin and \p range_end the same value to add a mapping to a single value. The @intft wrapped by \p enum_field_type, as returned by -bt_ctf_field_type_enumeration_get_container_type(), must be +bt_field_type_enumeration_get_container_type(), must be \b signed to use this function. A mapping in \p enum_field_type can exist with the name \p name. @@ -1582,16 +1537,13 @@ A mapping in \p enum_field_type can exist with the name \p name. @pre \p range_end is greater than or equal to \p range_begin. @postrefcountsame{enum_field_type} -@sa bt_ctf_field_type_enumeration_add_mapping_unsigned(): Adds an +@sa bt_field_type_enumeration_add_mapping_unsigned(): Adds an unsigned mapping to a given enumeration field type. */ -extern int bt_ctf_field_type_enumeration_add_mapping_signed( - struct bt_ctf_field_type *enum_field_type, const char *name, +extern int bt_field_type_enumeration_add_mapping_signed( + struct bt_field_type *enum_field_type, const char *name, int64_t range_begin, int64_t range_end); -/* Pre-2.0 CTF writer compatibility */ -#define bt_ctf_field_type_enumeration_add_mapping bt_ctf_field_type_enumeration_add_mapping_signed - /** @brief Adds a mapping to the @enumft \p enum_field_type which maps the name \p name to the unsigned @@ -1601,7 +1553,7 @@ Make \p range_begin and \p range_end the same value to add a mapping to a single value. The @intft wrapped by \p enum_field_type, as returned by -bt_ctf_field_type_enumeration_get_container_type(), must be +bt_field_type_enumeration_get_container_type(), must be \b unsigned to use this function. A mapping in \p enum_field_type can exist with the name \p name. @@ -1624,11 +1576,11 @@ A mapping in \p enum_field_type can exist with the name \p name. @pre \p range_end is greater than or equal to \p range_begin. @postrefcountsame{enum_field_type} -@sa bt_ctf_field_type_enumeration_add_mapping_signed(): Adds a signed +@sa bt_field_type_enumeration_add_mapping_signed(): Adds a signed mapping to a given enumeration field type. */ -extern int bt_ctf_field_type_enumeration_add_mapping_unsigned( - struct bt_ctf_field_type *enum_field_type, const char *name, +extern int bt_field_type_enumeration_add_mapping_unsigned( + struct bt_field_type *enum_field_type, const char *name, uint64_t range_begin, uint64_t range_end); /** @} */ @@ -1649,14 +1601,14 @@ You can get an enumeration mapping iterator from one of the following functions: - Find operations of an @enumft object: - - bt_ctf_field_type_enumeration_find_mappings_by_name(): Finds the + - bt_field_type_enumeration_find_mappings_by_name(): Finds the mappings with a given name. - - bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(): + - bt_field_type_enumeration_find_mappings_by_unsigned_value(): Finds the mappings which contain a given unsigned value in their range. - - bt_ctf_field_type_enumeration_find_mappings_by_signed_value(): + - bt_field_type_enumeration_find_mappings_by_signed_value(): Finds the mappings which contain a given signed value in their range. -- bt_ctf_field_enumeration_get_mappings(): Finds the mappings in the +- bt_field_enumeration_get_mappings(): Finds the mappings in the @enumft of an @enumfield containing its current integral value in their range. @@ -1665,9 +1617,9 @@ at least one mapping. Otherwise, they return \c NULL. You can get the name and the range of a mapping iterator's current mapping with -bt_ctf_field_type_enumeration_mapping_iterator_get_signed() +bt_field_type_enumeration_mapping_iterator_get_signed() or -bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(), +bt_field_type_enumeration_mapping_iterator_get_unsigned(), depending on the signedness of the @intft wrapped by the @enumft. If you only need the name of the current mapping, you can use any of the two functions and set the \p range_begin and \p range_end @@ -1675,7 +1627,7 @@ parameters to \c NULL. You can advance an enumeration field type mapping iterator to the next mapping with -bt_ctf_field_type_enumeration_mapping_iterator_next(). This +bt_field_type_enumeration_mapping_iterator_next(). This function returns a negative value when you reach the end of the result set. @@ -1692,7 +1644,7 @@ management of Babeltrace objects. */ /** -@struct bt_ctf_field_type_enumeration_mapping_iterator +@struct bt_field_type_enumeration_mapping_iterator @brief A CTF IR enumeration field type mapping iterator. @sa ctfirenumftmappingiter */ @@ -1703,14 +1655,14 @@ management of Babeltrace objects. If one of \p range_begin or \p range_end is not \c NULL, the @intft wrapped by the @enumft from which \p iter was obtained, as returned by -bt_ctf_field_type_enumeration_get_container_type(), must be +bt_field_type_enumeration_get_container_type(), must be \b signed to use this function. Otherwise, if you only need to get the name of the current mapping, set \p range_begin and \p range_end to \c NULL. On success, if \p name is not \c NULL, \p *name remains valid as long as \p iter exists and -bt_ctf_field_type_enumeration_mapping_iterator_next() is +bt_field_type_enumeration_mapping_iterator_next() is \em not called on \p iter. @param[in] iter Enumeration field type mapping iterator @@ -1729,12 +1681,12 @@ bt_ctf_field_type_enumeration_mapping_iterator_next() is @prenotnull{iter} @postrefcountsame{iter} -@sa bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(): +@sa bt_field_type_enumeration_mapping_iterator_get_unsigned(): Returns the name and the unsigned range of the current mapping of a given enumeration field type mapping iterator. */ -extern int bt_ctf_field_type_enumeration_mapping_iterator_get_signed( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter, +extern int bt_field_type_enumeration_mapping_iterator_get_signed( + struct bt_field_type_enumeration_mapping_iterator *iter, const char **name, int64_t *range_begin, int64_t *range_end); /** @@ -1743,14 +1695,14 @@ extern int bt_ctf_field_type_enumeration_mapping_iterator_get_signed( If one of \p range_begin or \p range_end is not \c NULL, the @intft wrapped by the @enumft from which \p iter was obtained, as returned by -bt_ctf_field_type_enumeration_get_container_type(), must be +bt_field_type_enumeration_get_container_type(), must be \b unsigned to use this function. Otherwise, if you only need to get the name of the current mapping, set \p range_begin and \p range_end to \c NULL. On success, if \p name is not \c NULL, \p *name remains valid as long as \p iter exists and -bt_ctf_field_type_enumeration_mapping_iterator_next() is +bt_field_type_enumeration_mapping_iterator_next() is \em not called on \p iter. @param[in] iter Enumeration field type mapping iterator @@ -1770,12 +1722,12 @@ bt_ctf_field_type_enumeration_mapping_iterator_next() is @postrefcountsame{iter} @sa - bt_ctf_field_type_enumeration_mapping_iterator_get_signed(): + bt_field_type_enumeration_mapping_iterator_get_signed(): Returns the name and the signed range of the current mapping of a given enumeration field type mapping iterator. */ -extern int bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter, +extern int bt_field_type_enumeration_mapping_iterator_get_unsigned( + struct bt_field_type_enumeration_mapping_iterator *iter, const char **name, uint64_t *range_begin, uint64_t *range_end); /** @@ -1789,8 +1741,8 @@ extern int bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned( @prenotnull{iter} @postrefcountsame{iter} */ -extern int bt_ctf_field_type_enumeration_mapping_iterator_next( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter); +extern int bt_field_type_enumeration_mapping_iterator_next( + struct bt_field_type_enumeration_mapping_iterator *iter); /** @} */ @@ -1807,13 +1759,13 @@ A CTF IR string field type is a field type that you can use to create concrete @stringfields. You can create a string field type -with bt_ctf_field_type_string_create(). +with bt_field_type_string_create(). A string field type has only one property: the \b encoding of its described @stringfields. By default, the encoding of the string fields -described by a string field type is #BT_CTF_STRING_ENCODING_UTF8. You +described by a string field type is #BT_STRING_ENCODING_UTF8. You can set the encoding of the string fields described by a string field -type with bt_ctf_field_type_string_set_encoding(). +type with bt_field_type_string_set_encoding(). @sa ctfirstringfield @sa ctfirfieldtypes @@ -1829,7 +1781,7 @@ type with bt_ctf_field_type_string_set_encoding(). @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_string_create(void); +extern struct bt_field_type *bt_field_type_string_create(void); /** @brief Returns the encoding of the @stringfields described by @@ -1840,18 +1792,18 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_string_create(void); encoding. @returns Encoding of the string fields described by \p string_field_type, - or #BT_CTF_STRING_ENCODING_UNKNOWN on + or #BT_STRING_ENCODING_UNKNOWN on error. @prenotnull{string_field_type} @preisstringft{string_field_type} @postrefcountsame{string_field_type} -@sa bt_ctf_field_type_string_set_encoding(): Sets the encoding +@sa bt_field_type_string_set_encoding(): Sets the encoding of the string fields described by a given string field type. */ -extern enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding( - struct bt_ctf_field_type *string_field_type); +extern enum bt_string_encoding bt_field_type_string_get_encoding( + struct bt_field_type *string_field_type); /** @brief Sets the encoding of the @stringfields described by the @@ -1867,16 +1819,16 @@ extern enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding( @prenotnull{string_field_type} @preisstringft{string_field_type} @prehot{string_field_type} -@pre \p encoding is #BT_CTF_STRING_ENCODING_ASCII or - #BT_CTF_STRING_ENCODING_UTF8. +@pre \p encoding is #BT_STRING_ENCODING_ASCII or + #BT_STRING_ENCODING_UTF8. @postrefcountsame{string_field_type} -@sa bt_ctf_field_type_string_get_encoding(): Returns the encoding of +@sa bt_field_type_string_get_encoding(): Returns the encoding of the string fields described by a given string field type. */ -extern int bt_ctf_field_type_string_set_encoding( - struct bt_ctf_field_type *string_field_type, - enum bt_ctf_string_encoding encoding); +extern int bt_field_type_string_set_encoding( + struct bt_field_type *string_field_type, + enum bt_string_encoding encoding); /** @} */ @@ -1893,16 +1845,16 @@ A CTF IR structure field type is a field type that you can use to create concrete @structfields. You can create a structure field type -with bt_ctf_field_type_structure_create(). This function creates +with bt_field_type_structure_create(). This function creates an empty structure field type, with no fields. You can add a field to a structure field type with -bt_ctf_field_type_structure_add_field(). Two fields in a structure +bt_field_type_structure_add_field(). Two fields in a structure field type cannot have the same name. You can set the \em minimum alignment of the structure fields described by a structure field type with the common -bt_ctf_field_type_set_alignment() function. The \em effective alignment +bt_field_type_set_alignment() function. The \em effective alignment of the structure fields described by a structure field type, as per CTF, is the \em maximum value amongst the effective alignments of all its fields. Note that the effective @@ -1910,7 +1862,7 @@ alignment of @varfields is always 1. You can set the byte order of all the contained fields, recursively, of a structure field type with the common -bt_ctf_field_type_set_byte_order() function. +bt_field_type_set_byte_order() function. @sa ctfirstructfield @sa ctfirfieldtypes @@ -1927,7 +1879,7 @@ bt_ctf_field_type_set_byte_order() function. @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void); +extern struct bt_field_type *bt_field_type_structure_create(void); /** @brief Returns the number of fields contained in the @@ -1943,8 +1895,8 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void); @preisstructft{struct_field_type} @postrefcountsame{struct_field_type} */ -extern int64_t bt_ctf_field_type_structure_get_field_count( - struct bt_ctf_field_type *struct_field_type); +extern int64_t bt_field_type_structure_get_field_count( + struct bt_field_type *struct_field_type); /** @brief Returns the field of the @structft \p struct_field_type @@ -1969,22 +1921,19 @@ On success, the field's type is placed in \p *field_type if @preisstructft{struct_field_type} @pre \p index is lesser than the number of fields contained in the structure field type \p struct_field_type (see - bt_ctf_field_type_structure_get_field_count()). + bt_field_type_structure_get_field_count()). @postrefcountsame{struct_field_type} @post On success, the returned field's type is placed in \p *field_type and its reference count is incremented. -@sa bt_ctf_field_type_structure_get_field_type_by_name(): Finds a +@sa bt_field_type_structure_get_field_type_by_name(): Finds a structure field type's field by name. */ -extern int bt_ctf_field_type_structure_get_field_by_index( - struct bt_ctf_field_type *struct_field_type, - const char **field_name, struct bt_ctf_field_type **field_type, +extern int bt_field_type_structure_get_field_by_index( + struct bt_field_type *struct_field_type, + const char **field_name, struct bt_field_type **field_type, uint64_t index); -/* Pre-2.0 CTF writer compatibility */ -#define bt_ctf_field_type_structure_get_field bt_ctf_field_type_structure_get_field_by_index - /** @brief Returns the type of the field named \p field_name found in the @structft \p struct_field_type. @@ -2002,12 +1951,12 @@ extern int bt_ctf_field_type_structure_get_field_by_index( @postrefcountsame{struct_field_type} @postsuccessrefcountretinc -@sa bt_ctf_field_type_structure_get_field_by_index(): Finds a +@sa bt_field_type_structure_get_field_by_index(): Finds a structure field type's field by index. */ extern -struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name( - struct bt_ctf_field_type *struct_field_type, +struct bt_field_type *bt_field_type_structure_get_field_type_by_name( + struct bt_field_type *struct_field_type, const char *field_name); /** @@ -2041,9 +1990,9 @@ field named \p field_name in \p struct_field_type. @postrefcountsame{struct_field_type} @postsuccessrefcountinc{field_type} */ -extern int bt_ctf_field_type_structure_add_field( - struct bt_ctf_field_type *struct_field_type, - struct bt_ctf_field_type *field_type, +extern int bt_field_type_structure_add_field( + struct bt_field_type *struct_field_type, + struct bt_field_type *field_type, const char *field_name); /** @} */ @@ -2061,7 +2010,7 @@ A CTF IR array field type is a field type that you can use to create concrete @arrayfields. You can create an array field type -with bt_ctf_field_type_array_create(). This function needs +with bt_field_type_array_create(). This function needs the @ft of the fields contained by the array fields described by the array field type to create. @@ -2089,8 +2038,8 @@ array field type to create. @postsuccessrefcountinc{element_field_type} @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_array_create( - struct bt_ctf_field_type *element_field_type, +extern struct bt_field_type *bt_field_type_array_create( + struct bt_field_type *element_field_type, unsigned int length); /** @@ -2110,8 +2059,8 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_array_create( @postrefcountsame{array_field_type} @postsuccessrefcountretinc */ -extern struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type( - struct bt_ctf_field_type *array_field_type); +extern struct bt_field_type *bt_field_type_array_get_element_type( + struct bt_field_type *array_field_type); /** @brief Returns the number of @fields contained in the @@ -2129,8 +2078,8 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type( @preisarrayft{array_field_type} @postrefcountsame{array_field_type} */ -extern int64_t bt_ctf_field_type_array_get_length( - struct bt_ctf_field_type *array_field_type); +extern int64_t bt_field_type_array_get_length( + struct bt_field_type *array_field_type); /** @} */ @@ -2147,7 +2096,7 @@ A CTF IR sequence field type is a field type that you can use to create concrete @seqfields. You can create a sequence field type with -bt_ctf_field_type_sequence_create(). This function needs the @ft +bt_field_type_sequence_create(). This function needs the @ft of the fields contained by the sequence fields described by the created sequence field type. This function also needs the length name of the sequence field type to create. The length name is used to automatically @@ -2181,8 +2130,8 @@ about the automatic resolving. @postsuccessrefcountinc{element_field_type} @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_create( - struct bt_ctf_field_type *element_field_type, +extern struct bt_field_type *bt_field_type_sequence_create( + struct bt_field_type *element_field_type, const char *length_name); /** @@ -2202,8 +2151,8 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_create( @postrefcountsame{sequence_field_type} @postsuccessrefcountretinc */ -extern struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_type( - struct bt_ctf_field_type *sequence_field_type); +extern struct bt_field_type *bt_field_type_sequence_get_element_type( + struct bt_field_type *sequence_field_type); /** @brief Returns the length name of the @seqft \p sequence_field_type. @@ -2219,11 +2168,11 @@ the returned string. @prenotnull{sequence_field_type} @preisseqft{sequence_field_type} -@sa bt_ctf_field_type_sequence_get_length_field_path(): Returns the +@sa bt_field_type_sequence_get_length_field_path(): Returns the length's CTF IR field path of a given sequence field type. */ -extern const char *bt_ctf_field_type_sequence_get_length_field_name( - struct bt_ctf_field_type *sequence_field_type); +extern const char *bt_field_type_sequence_get_length_field_name( + struct bt_field_type *sequence_field_type); /** @brief Returns the length's CTF IR field path of the @seqft @@ -2243,11 +2192,11 @@ resolving is performed (see \ref ctfirfieldtypes). @preisseqft{sequence_field_type} @postsuccessrefcountretinc -@sa bt_ctf_field_type_sequence_get_length_field_name(): Returns the +@sa bt_field_type_sequence_get_length_field_name(): Returns the length's name of a given sequence field type. */ -extern struct bt_ctf_field_path *bt_ctf_field_type_sequence_get_length_field_path( - struct bt_ctf_field_type *sequence_field_type); +extern struct bt_field_path *bt_field_type_sequence_get_length_field_path( + struct bt_field_type *sequence_field_type); /** @} */ @@ -2264,18 +2213,18 @@ A CTF IR variant field type is a field type that you can use to create concrete @varfields. You can create a variant field type with -bt_ctf_field_type_variant_create(). This function expects you to pass +bt_field_type_variant_create(). This function expects you to pass both the tag's @enumft and the tag name of the variant field type to create. The tag's field type is optional, as the Babeltrace system can automatically resolve it using the tag name. You can leave the tag name to \c NULL initially, and set it later with -bt_ctf_field_type_variant_set_tag_name(). The tag name must be set when +bt_field_type_variant_set_tag_name(). The tag name must be set when the variant field type is frozen. See \ref ctfirfieldtypes to learn more about the automatic resolving and the conditions under which a field type can be frozen. You can add a field to a variant field type with -bt_ctf_field_type_variant_add_field(). All the field names of a +bt_field_type_variant_add_field(). All the field names of a variant field type \em must exist as mapping names in its tag's @enumft. The effective alignment of the @varfields described by a @@ -2284,7 +2233,7 @@ variant field type is always 1, but the individual fields of a You can set the byte order of all the contained fields, recursively, of a variant field type with the common -bt_ctf_field_type_set_byte_order() function. +bt_field_type_set_byte_order() function. @sa ctfirvarfield @sa ctfirfieldtypes @@ -2300,7 +2249,7 @@ bt_ctf_field_type_set_byte_order() function. \p tag_field_type can be \c NULL; the tag's field type can be automatically resolved from the variant field type's tag name (see \ref ctfirfieldtypes). If \p tag_name is \c NULL, it \em must be set -with bt_ctf_field_type_variant_set_tag_name() \em before the variant +with bt_field_type_variant_set_tag_name() \em before the variant field type is frozen. \p tag_name can be an absolute or relative reference. See @@ -2318,8 +2267,8 @@ field type is frozen. its reference count is incremented. @postsuccessrefcountret1 */ -extern struct bt_ctf_field_type *bt_ctf_field_type_variant_create( - struct bt_ctf_field_type *tag_field_type, +extern struct bt_field_type *bt_field_type_variant_create( + struct bt_field_type *tag_field_type, const char *tag_name); /** @@ -2337,8 +2286,8 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_variant_create( @postrefcountsame{variant_field_type} @postsuccessrefcountretinc */ -extern struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_type( - struct bt_ctf_field_type *variant_field_type); +extern struct bt_field_type *bt_field_type_variant_get_tag_type( + struct bt_field_type *variant_field_type); /** @brief Returns the tag name of the @varft \p variant_field_type. @@ -2355,13 +2304,13 @@ the returned string. @prenotnull{variant_field_type} @preisvarft{variant_field_type} -@sa bt_ctf_field_type_variant_set_tag_name(): Sets the tag name of +@sa bt_field_type_variant_set_tag_name(): Sets the tag name of a given variant field type. -@sa bt_ctf_field_type_variant_get_tag_field_path(): Returns the tag's +@sa bt_field_type_variant_get_tag_field_path(): Returns the tag's CTF IR field path of a given variant field type. */ -extern const char *bt_ctf_field_type_variant_get_tag_name( - struct bt_ctf_field_type *variant_field_type); +extern const char *bt_field_type_variant_get_tag_name( + struct bt_field_type *variant_field_type); /** @brief Sets the tag name of the @varft \p variant_field_type. @@ -2380,11 +2329,11 @@ extern const char *bt_ctf_field_type_variant_get_tag_name( @prehot{variant_field_type} @postrefcountsame{variant_field_type} -@sa bt_ctf_field_type_variant_get_tag_name(): Returns the tag name of +@sa bt_field_type_variant_get_tag_name(): Returns the tag name of a given variant field type. */ -extern int bt_ctf_field_type_variant_set_tag_name( - struct bt_ctf_field_type *variant_field_type, +extern int bt_field_type_variant_set_tag_name( + struct bt_field_type *variant_field_type, const char *tag_name); /** @@ -2405,11 +2354,11 @@ resolving is performed (see \ref ctfirfieldtypes). @preisvarft{variant_field_type} @postsuccessrefcountretinc -@sa bt_ctf_field_type_variant_get_tag_name(): Returns the tag's +@sa bt_field_type_variant_get_tag_name(): Returns the tag's name of a given variant field type. */ -extern struct bt_ctf_field_path *bt_ctf_field_type_variant_get_tag_field_path( - struct bt_ctf_field_type *variant_field_type); +extern struct bt_field_path *bt_field_type_variant_get_tag_field_path( + struct bt_field_type *variant_field_type); /** @brief Returns the number of fields (choices) contained in the @varft @@ -2425,8 +2374,8 @@ extern struct bt_ctf_field_path *bt_ctf_field_type_variant_get_tag_field_path( @preisvarft{variant_field_type} @postrefcountsame{variant_field_type} */ -extern int64_t bt_ctf_field_type_variant_get_field_count( - struct bt_ctf_field_type *variant_field_type); +extern int64_t bt_field_type_variant_get_field_count( + struct bt_field_type *variant_field_type); /** @brief Returns the field (choice) of the @varft \p variant_field_type @@ -2451,23 +2400,20 @@ On success, the field's type is placed in \p *field_type if @preisvarft{variant_field_type} @pre \p index is lesser than the number of fields contained in the variant field type \p variant_field_type (see - bt_ctf_field_type_variant_get_field_count()). + bt_field_type_variant_get_field_count()). @postrefcountsame{variant_field_type} @post On success, the returned field's type is placed in \p *field_type and its reference count is incremented. -@sa bt_ctf_field_type_variant_get_field_type_by_name(): Finds a variant +@sa bt_field_type_variant_get_field_type_by_name(): Finds a variant field type's field by name. -@sa bt_ctf_field_type_variant_get_field_type_from_tag(): Finds a variant +@sa bt_field_type_variant_get_field_type_from_tag(): Finds a variant field type's field by current tag value. */ -extern int bt_ctf_field_type_variant_get_field_by_index( - struct bt_ctf_field_type *variant_field_type, +extern int bt_field_type_variant_get_field_by_index( + struct bt_field_type *variant_field_type, const char **field_name, - struct bt_ctf_field_type **field_type, uint64_t index); - -/* Pre-2.0 CTF writer compatibility */ -#define bt_ctf_field_type_variant_get_field bt_ctf_field_type_variant_get_field_by_index + struct bt_field_type **field_type, uint64_t index); /** @brief Returns the type of the field (choice) named \p field_name @@ -2486,14 +2432,14 @@ extern int bt_ctf_field_type_variant_get_field_by_index( @postrefcountsame{variant_field_type} @postsuccessrefcountretinc -@sa bt_ctf_field_type_variant_get_field_by_index(): Finds a variant field type's +@sa bt_field_type_variant_get_field_by_index(): Finds a variant field type's field by index. -@sa bt_ctf_field_type_variant_get_field_type_from_tag(): Finds a variant +@sa bt_field_type_variant_get_field_type_from_tag(): Finds a variant field type's field by current tag value. */ extern -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name( - struct bt_ctf_field_type *variant_field_type, +struct bt_field_type *bt_field_type_variant_get_field_type_by_name( + struct bt_field_type *variant_field_type, const char *field_name); /** @@ -2502,9 +2448,9 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name( \p tag_field is the current tag value. -The field type of \p tag_field, as returned by bt_ctf_field_get_type(), +The field type of \p tag_field, as returned by bt_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_field_type_variant_get_tag_type() for \p variant_field_type. +bt_field_type_variant_get_tag_type() for \p variant_field_type. @param[in] variant_field_type Variant field type of which to get a field's type. @@ -2522,15 +2468,15 @@ bt_ctf_field_type_variant_get_tag_type() for \p variant_field_type. @postrefcountsame{tag_field} @postsuccessrefcountretinc -@sa bt_ctf_field_type_variant_get_field_by_index(): Finds a variant field type's +@sa bt_field_type_variant_get_field_by_index(): Finds a variant field type's field by index. -@sa bt_ctf_field_type_variant_get_field_type_by_name(): Finds a variant +@sa bt_field_type_variant_get_field_type_by_name(): Finds a variant field type's field by name. */ extern -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( - struct bt_ctf_field_type *variant_field_type, - struct bt_ctf_field *tag_field); +struct bt_field_type *bt_field_type_variant_get_field_type_from_tag( + struct bt_field_type *variant_field_type, + struct bt_field *tag_field); /** @brief Adds a field (a choice) named \p field_name with the @ft @@ -2563,13 +2509,79 @@ enumeration field type of \p variant_field_type. @postrefcountsame{variant_field_type} @postsuccessrefcountinc{field_type} */ -extern int bt_ctf_field_type_variant_add_field( - struct bt_ctf_field_type *variant_field_type, - struct bt_ctf_field_type *field_type, +extern int bt_field_type_variant_add_field( + struct bt_field_type *variant_field_type, + struct bt_field_type *field_type, const char *field_name); /** @} */ +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_field_type bt_field_type +#define bt_ctf_field_type_integer_create bt_field_type_integer_create +#define bt_ctf_field_type_integer_set_signed bt_field_type_integer_set_is_signed +#define bt_ctf_field_type_integer_set_base bt_field_type_integer_set_base +#define bt_ctf_field_type_integer_set_encoding bt_field_type_integer_set_encoding +#define bt_ctf_field_type_enumeration_create bt_field_type_enumeration_create +#define bt_ctf_field_type_enumeration_add_mapping bt_field_type_enumeration_add_mapping_signed +#define bt_ctf_field_type_floating_point_create bt_field_type_floating_point_create +#define bt_ctf_field_type_floating_point_set_exponent_digits bt_field_type_floating_point_set_exponent_digits +#define bt_ctf_field_type_floating_point_set_mantissa_digits bt_field_type_floating_point_set_mantissa_digits +#define bt_ctf_field_type_structure_create bt_field_type_structure_create +#define bt_ctf_field_type_structure_add_field bt_field_type_structure_add_field +#define bt_ctf_field_type_structure_add_field bt_field_type_structure_add_field +#define bt_ctf_field_type_structure_get_field bt_field_type_structure_get_field_by_index +#define bt_ctf_field_type_variant_create bt_field_type_variant_create +#define bt_ctf_field_type_variant_add_field bt_field_type_variant_add_field +#define bt_ctf_field_type_array_create bt_field_type_array_create +#define bt_ctf_field_type_sequence_create bt_field_type_sequence_create +#define bt_ctf_field_type_string_create bt_field_type_string_create +#define bt_ctf_field_type_string_set_encoding bt_field_type_string_set_encoding +#define bt_ctf_field_type_set_alignment bt_field_type_set_alignment +#define bt_ctf_field_type_set_byte_order bt_field_type_set_byte_order + +extern int bt_ctf_field_type_integer_get_signed( + struct bt_ctf_field_type *int_field_type); + +#define ctf_type_id bt_field_type_id +#define CTF_TYPE_UNKNOWN BT_FIELD_TYPE_ID_UNKNOWN +#define CTF_TYPE_INTEGER BT_FIELD_TYPE_ID_INTEGER +#define CTF_TYPE_FLOAT BT_FIELD_TYPE_ID_FLOAT +#define CTF_TYPE_ENUM BT_FIELD_TYPE_ID_ENUM +#define CTF_TYPE_STRING BT_FIELD_TYPE_ID_STRING +#define CTF_TYPE_STRUCT BT_FIELD_TYPE_ID_STRUCT +#define CTF_TYPE_UNTAGGED_VARIANT BT_FIELD_TYPE_ID_VARIANT +#define CTF_TYPE_VARIANT BT_FIELD_TYPE_ID_VARIANT +#define CTF_TYPE_ARRAY BT_FIELD_TYPE_ID_ARRAY +#define CTF_TYPE_SEQUENCE BT_FIELD_TYPE_ID_SEQUENCE +#define NR_CTF_TYPES BT_FIELD_TYPE_ID_NR + +#define ctf_string_encoding bt_string_encoding +#define CTF_STRING_NONE BT_STRING_ENCODING_NONE +#define CTF_STRING_UTF8 BT_STRING_ENCODING_UTF8 +#define CTF_STRING_ASCII BT_STRING_ENCODING_ASCII +#define CTF_STRING_UNKNOWN BT_STRING_ENCODING_UNKNOWN + +#define bt_ctf_string_encoding bt_string_encoding +#define BT_CTF_STRING_ENCODING_NONE BT_STRING_ENCODING_NONE +#define BT_CTF_STRING_ENCODING_UTF8 BT_STRING_ENCODING_UTF8 +#define BT_CTF_STRING_ENCODING_ASCII BT_STRING_ENCODING_ASCII +#define BT_CTF_STRING_ENCODING_UNKNOWN BT_STRING_ENCODING_UNKNOWN + +#define bt_ctf_byte_order bt_byte_order +#define BT_CTF_BYTE_ORDER_UNKNOWN BT_BYTE_ORDER_UNKNOWN +#define BT_CTF_BYTE_ORDER_NATIVE BT_BYTE_ORDER_NATIVE +#define BT_CTF_BYTE_ORDER_LITTLE_ENDIAN BT_BYTE_ORDER_LITTLE_ENDIAN +#define BT_CTF_BYTE_ORDER_BIG_ENDIAN BT_BYTE_ORDER_BIG_ENDIAN +#define BT_CTF_BYTE_ORDER_NETWORK BT_BYTE_ORDER_NETWORK + +#define bt_ctf_integer_base bt_integer_base +#define BT_CTF_INTEGER_BASE_UNKNOWN BT_INTEGER_BASE_UNKNOWN +#define BT_CTF_INTEGER_BASE_BINARY BT_INTEGER_BASE_BINARY +#define BT_CTF_INTEGER_BASE_OCTAL BT_INTEGER_BASE_OCTAL +#define BT_CTF_INTEGER_BASE_DECIMAL BT_INTEGER_BASE_DECIMAL +#define BT_CTF_INTEGER_BASE_HEXADECIMAL BT_INTEGER_BASE_HEXADECIMAL + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/ctf-ir/fields-internal.h b/include/babeltrace/ctf-ir/fields-internal.h index 61b60aac..43e79b72 100644 --- a/include/babeltrace/ctf-ir/fields-internal.h +++ b/include/babeltrace/ctf-ir/fields-internal.h @@ -36,70 +36,70 @@ #include #include -struct bt_ctf_stream_pos; +struct bt_stream_pos; -struct bt_ctf_field { +struct bt_field { struct bt_object base; - struct bt_ctf_field_type *type; + struct bt_field_type *type; bool payload_set; bool frozen; }; -struct bt_ctf_field_integer { - struct bt_ctf_field parent; +struct bt_field_integer { + struct bt_field parent; union { int64_t signd; uint64_t unsignd; } payload; }; -struct bt_ctf_field_enumeration { - struct bt_ctf_field parent; - struct bt_ctf_field *payload; +struct bt_field_enumeration { + struct bt_field parent; + struct bt_field *payload; }; -struct bt_ctf_field_floating_point { - struct bt_ctf_field parent; +struct bt_field_floating_point { + struct bt_field parent; double payload; }; -struct bt_ctf_field_structure { - struct bt_ctf_field parent; - GPtrArray *fields; /* Array of pointers to struct bt_ctf_field */ +struct bt_field_structure { + struct bt_field parent; + GPtrArray *fields; /* Array of pointers to struct bt_field */ }; -struct bt_ctf_field_variant { - struct bt_ctf_field parent; - struct bt_ctf_field *tag; - struct bt_ctf_field *payload; +struct bt_field_variant { + struct bt_field parent; + struct bt_field *tag; + struct bt_field *payload; }; -struct bt_ctf_field_array { - struct bt_ctf_field parent; - GPtrArray *elements; /* Array of pointers to struct bt_ctf_field */ +struct bt_field_array { + struct bt_field parent; + GPtrArray *elements; /* Array of pointers to struct bt_field */ }; -struct bt_ctf_field_sequence { - struct bt_ctf_field parent; - struct bt_ctf_field *length; - GPtrArray *elements; /* Array of pointers to struct bt_ctf_field */ +struct bt_field_sequence { + struct bt_field parent; + struct bt_field *length; + GPtrArray *elements; /* Array of pointers to struct bt_field */ }; -struct bt_ctf_field_string { - struct bt_ctf_field parent; +struct bt_field_string { + struct bt_field parent; GString *payload; }; /* Validate that the field's payload is set (returns 0 if set). */ BT_HIDDEN -int bt_ctf_field_validate(struct bt_ctf_field *field); +int bt_field_validate(struct bt_field *field); BT_HIDDEN -int bt_ctf_field_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order); +int bt_field_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order); BT_HIDDEN -void bt_ctf_field_freeze(struct bt_ctf_field *field); +void bt_field_freeze(struct bt_field *field); #endif /* BABELTRACE_CTF_IR_FIELDS_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/fields.h b/include/babeltrace/ctf-ir/fields.h index a6250ed7..a5e22b5c 100644 --- a/include/babeltrace/ctf-ir/fields.h +++ b/include/babeltrace/ctf-ir/fields.h @@ -40,7 +40,7 @@ extern "C" { #endif -struct bt_ctf_field_type; +struct bt_field_type; /** @defgroup ctfirfields CTF IR fields @@ -57,13 +57,13 @@ concrete value, and which is described by a @ft. In the CTF IR hierarchy, you can set the root fields of two objects: - \ref ctfirpacket - - Trace packet header field: bt_ctf_packet_set_header(). - - Stream packet context field: bt_ctf_packet_set_context(). + - Trace packet header field: bt_packet_set_header(). + - Stream packet context field: bt_packet_set_context(). - \ref ctfirevent - - Stream event header field: bt_ctf_event_set_header(). - - Stream event context field: bt_ctf_event_set_stream_event_context(). - - Event context field: bt_ctf_event_set_event_context(). - - Event payload field: bt_ctf_event_set_payload_field(). + - Stream event header field: bt_event_set_header(). + - Stream event context field: bt_event_set_stream_event_context(). + - Event context field: bt_event_set_event_context(). + - Event payload field: bt_event_set_payload_field(). There are two categories of fields: @@ -83,26 +83,26 @@ There are two categories of fields: - @varfield: contains a single, current field. You can create a field object from a @ft object with -bt_ctf_field_create(). The enumeration and compound fields create their +bt_field_create(). The enumeration and compound fields create their contained fields with the following getters if such fields do not exist yet: -- bt_ctf_field_enumeration_get_container() -- bt_ctf_field_structure_get_field_by_name() -- bt_ctf_field_array_get_field() -- bt_ctf_field_sequence_get_field() -- bt_ctf_field_variant_get_field() +- bt_field_enumeration_get_container() +- bt_field_structure_get_field_by_name() +- bt_field_array_get_field() +- bt_field_sequence_get_field() +- bt_field_variant_get_field() If you already have a field object, you can also assign it to a specific name within a @structfield with -bt_ctf_field_structure_set_field_by_name(). +bt_field_structure_set_field_by_name(). You can get a reference to the @ft which was used to create a field with -bt_ctf_field_get_type(). You can get the -\link #bt_ctf_field_type_id type ID\endlink of this field type directly with -bt_ctf_field_get_type_id(). +bt_field_get_type(). You can get the +\link #bt_field_type_id type ID\endlink of this field type directly with +bt_field_get_type_id(). -You can get a deep copy of a field with bt_ctf_field_copy(). The field +You can get a deep copy of a field with bt_field_copy(). The field copy, and its contained field copies if it's the case, have the same field type as the originals. @@ -127,15 +127,15 @@ immutable, except for \link refs reference counting\endlink. */ /** -@struct bt_ctf_field +@struct bt_field @brief A CTF IR field. @sa ctfirfields */ -struct bt_ctf_field; -struct bt_ctf_event_class; -struct bt_ctf_event; -struct bt_ctf_field_type; -struct bt_ctf_field_type_enumeration_mapping_iterator; +struct bt_field; +struct bt_event_class; +struct bt_event; +struct bt_field_type; +struct bt_field_type_enumeration_mapping_iterator; /** @name Creation and parent field type access functions @@ -160,14 +160,14 @@ its specific setters. @postsuccessrefcountret1 @postsuccessfrozen{field_type} */ -extern struct bt_ctf_field *bt_ctf_field_create( - struct bt_ctf_field_type *field_type); +extern struct bt_field *bt_field_create( + struct bt_field_type *field_type); /** @brief Returns the parent @ft of the @field \p field. This function returns a reference to the field type which was used to -create the field object in the first place with bt_ctf_field_create(). +create the field object in the first place with bt_field_create(). @param[in] field Field of which to get the parent field type. @returns Parent field type of \p event, @@ -177,8 +177,8 @@ create the field object in the first place with bt_ctf_field_create(). @postrefcountsame{field} @postsuccessrefcountretinc */ -extern struct bt_ctf_field_type *bt_ctf_field_get_type( - struct bt_ctf_field *field); +extern struct bt_field_type *bt_field_get_type( + struct bt_field *field); /** @} */ @@ -193,39 +193,39 @@ extern struct bt_ctf_field_type *bt_ctf_field_get_type( @param[in] field Field of which to get the type ID of its parent field type.. @returns Type ID of the parent field type of \p field, - or #BT_CTF_FIELD_TYPE_ID_UNKNOWN on error. + or #BT_FIELD_TYPE_ID_UNKNOWN on error. @prenotnull{field} @postrefcountsame{field} -@sa #bt_ctf_field_type_id: CTF IR field type ID. -@sa bt_ctf_field_is_integer(): Returns whether or not a given field is a +@sa #bt_field_type_id: CTF IR field type ID. +@sa bt_field_is_integer(): Returns whether or not a given field is a @intfield. -@sa bt_ctf_field_is_floating_point(): Returns whether or not a given +@sa bt_field_is_floating_point(): Returns whether or not a given field is a @floatfield. -@sa bt_ctf_field_is_enumeration(): Returns whether or not a given field +@sa bt_field_is_enumeration(): Returns whether or not a given field is a @enumfield. -@sa bt_ctf_field_is_string(): Returns whether or not a given field is a +@sa bt_field_is_string(): Returns whether or not a given field is a @stringfield. -@sa bt_ctf_field_is_structure(): Returns whether or not a given field is +@sa bt_field_is_structure(): Returns whether or not a given field is a @structfield. -@sa bt_ctf_field_is_array(): Returns whether or not a given field is a +@sa bt_field_is_array(): Returns whether or not a given field is a @arrayfield. -@sa bt_ctf_field_is_sequence(): Returns whether or not a given field is +@sa bt_field_is_sequence(): Returns whether or not a given field is a @seqfield. -@sa bt_ctf_field_is_variant(): Returns whether or not a given field is a +@sa bt_field_is_variant(): Returns whether or not a given field is a @varfield. */ -extern enum bt_ctf_field_type_id bt_ctf_field_get_type_id( - struct bt_ctf_field *field); +extern enum bt_field_type_id bt_field_get_type_id( + struct bt_field *field); -extern bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field); +extern bt_bool bt_field_is_set(struct bt_field *field); -extern int bt_ctf_field_reset(struct bt_ctf_field *field); +extern int bt_field_reset(struct bt_field *field); /* - * bt_ctf_field_signed_integer_get_value: get a signed integer field's value + * bt_field_signed_integer_get_value: get a signed integer field's value * * Get a signed integer field's value. * @@ -234,7 +234,7 @@ extern int bt_ctf_field_reset(struct bt_ctf_field *field); * * Returns 0 on success, a negative value on error. */ -extern int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *integer, +extern int bt_field_signed_integer_get_value(struct bt_field *integer, int64_t *value); /** @@ -248,10 +248,10 @@ extern int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *integer, @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_integer(struct bt_ctf_field *field); +extern bt_bool bt_field_is_integer(struct bt_field *field); /** @brief Returns whether or not the @field \p field is a @floatfield. @@ -264,10 +264,10 @@ extern bt_bool bt_ctf_field_is_integer(struct bt_ctf_field *field); @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_floating_point(struct bt_ctf_field *field); +extern bt_bool bt_field_is_floating_point(struct bt_field *field); /** @brief Returns whether or not the @field \p field is a @enumfield. @@ -280,10 +280,10 @@ extern bt_bool bt_ctf_field_is_floating_point(struct bt_ctf_field *field); @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_enumeration(struct bt_ctf_field *field); +extern bt_bool bt_field_is_enumeration(struct bt_field *field); /** @brief Returns whether or not the @field \p field is a @stringfield. @@ -296,10 +296,10 @@ extern bt_bool bt_ctf_field_is_enumeration(struct bt_ctf_field *field); @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_string(struct bt_ctf_field *field); +extern bt_bool bt_field_is_string(struct bt_field *field); /** @brief Returns whether or not the @field \p field is a @structfield. @@ -312,10 +312,10 @@ extern bt_bool bt_ctf_field_is_string(struct bt_ctf_field *field); @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_structure(struct bt_ctf_field *field); +extern bt_bool bt_field_is_structure(struct bt_field *field); /** @brief Returns whether or not the @field \p field is a @arrayfield. @@ -328,10 +328,10 @@ extern bt_bool bt_ctf_field_is_structure(struct bt_ctf_field *field); @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_array(struct bt_ctf_field *field); +extern bt_bool bt_field_is_array(struct bt_field *field); /** @brief Returns whether or not the @field \p field is a @seqfield. @@ -344,10 +344,10 @@ extern bt_bool bt_ctf_field_is_array(struct bt_ctf_field *field); @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_sequence(struct bt_ctf_field *field); +extern bt_bool bt_field_is_sequence(struct bt_field *field); /** @brief Returns whether or not the @field \p field is a @varfield. @@ -360,10 +360,10 @@ extern bt_bool bt_ctf_field_is_sequence(struct bt_ctf_field *field); @prenotnull{field} @postrefcountsame{field} -@sa bt_ctf_field_get_type_id(): Returns the type ID of a given +@sa bt_field_get_type_id(): Returns the type ID of a given field's type. */ -extern bt_bool bt_ctf_field_is_variant(struct bt_ctf_field *field); +extern bt_bool bt_field_is_variant(struct bt_field *field); /** @} */ @@ -386,7 +386,7 @@ You can copy a frozen field: the resulting copy is not frozen. @postsuccessrefcountret1 @post On success, the returned field is not frozen. */ -extern struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field); +extern struct bt_field *bt_field_copy(struct bt_field *field); /** @} */ @@ -406,19 +406,19 @@ holds a signed or unsigned integral value, and which is described by a @intft. An integer field object is considered \em unsigned if -bt_ctf_field_type_integer_get_signed() on its parent field type returns +bt_field_type_integer_get_signed() on its parent field type returns 0. Otherwise it is considered \em signed. You \em must use -bt_ctf_field_unsigned_integer_get_value() and -bt_ctf_field_unsigned_integer_set_value() with an unsigned integer -field, and bt_ctf_field_signed_integer_get_value() and -bt_ctf_field_signed_integer_set_value() with a signed integer field. +bt_field_unsigned_integer_get_value() and +bt_field_unsigned_integer_set_value() with an unsigned integer +field, and bt_field_signed_integer_get_value() and +bt_field_signed_integer_set_value() with a signed integer field. -After you create an integer field with bt_ctf_field_create(), you +After you create an integer field with bt_field_create(), you \em must set an integral value with -bt_ctf_field_unsigned_integer_set_value() or -bt_ctf_field_signed_integer_set_value() before you can get the -field's value with bt_ctf_field_unsigned_integer_get_value() or -bt_ctf_field_signed_integer_get_value(). +bt_field_unsigned_integer_set_value() or +bt_field_signed_integer_set_value() before you can get the +field's value with bt_field_unsigned_integer_get_value() or +bt_field_signed_integer_get_value(). @sa ctfirintfieldtype @sa ctfirfields @@ -442,17 +442,17 @@ bt_ctf_field_signed_integer_get_value(). @prenotnull{integer_field} @prenotnull{value} @preisintfield{integer_field} -@pre bt_ctf_field_type_integer_get_signed() returns 1 for the parent +@pre bt_field_type_integer_get_signed() returns 1 for the parent @ft of \p integer_field. @pre \p integer_field contains a signed integral value previously - set with bt_ctf_field_signed_integer_set_value(). + set with bt_field_signed_integer_set_value(). @postrefcountsame{integer_field} -@sa bt_ctf_field_signed_integer_set_value(): Sets the signed integral +@sa bt_field_signed_integer_set_value(): Sets the signed integral value of a given integer field. */ -extern int bt_ctf_field_signed_integer_get_value( - struct bt_ctf_field *integer_field, int64_t *value); +extern int bt_field_signed_integer_get_value( + struct bt_field *integer_field, int64_t *value); /** @brief Sets the signed integral value of the @intfield @@ -467,15 +467,15 @@ extern int bt_ctf_field_signed_integer_get_value( @prenotnull{integer_field} @preisintfield{integer_field} @prehot{integer_field} -@pre bt_ctf_field_type_integer_get_signed() returns 1 for the parent +@pre bt_field_type_integer_get_signed() returns 1 for the parent @ft of \p integer_field. @postrefcountsame{integer_field} -@sa bt_ctf_field_signed_integer_get_value(): Returns the signed integral +@sa bt_field_signed_integer_get_value(): Returns the signed integral value of a given integer field. */ -extern int bt_ctf_field_signed_integer_set_value( - struct bt_ctf_field *integer_field, int64_t value); +extern int bt_field_signed_integer_set_value( + struct bt_field *integer_field, int64_t value); /** @brief Returns the unsigned integral value of the @intfield @@ -492,17 +492,17 @@ extern int bt_ctf_field_signed_integer_set_value( @prenotnull{integer_field} @prenotnull{value} @preisintfield{integer_field} -@pre bt_ctf_field_type_integer_get_signed() returns 0 for the parent +@pre bt_field_type_integer_get_signed() returns 0 for the parent @ft of \p integer_field. @pre \p integer_field contains an unsigned integral value previously - set with bt_ctf_field_unsigned_integer_set_value(). + set with bt_field_unsigned_integer_set_value(). @postrefcountsame{integer_field} -@sa bt_ctf_field_unsigned_integer_set_value(): Sets the unsigned +@sa bt_field_unsigned_integer_set_value(): Sets the unsigned integral value of a given integer field. */ -extern int bt_ctf_field_unsigned_integer_get_value( - struct bt_ctf_field *integer_field, uint64_t *value); +extern int bt_field_unsigned_integer_get_value( + struct bt_field *integer_field, uint64_t *value); /** @brief Sets the unsigned integral value of the @intfield @@ -517,15 +517,15 @@ extern int bt_ctf_field_unsigned_integer_get_value( @prenotnull{integer_field} @preisintfield{integer_field} @prehot{integer_field} -@pre bt_ctf_field_type_integer_get_signed() returns 0 for the parent +@pre bt_field_type_integer_get_signed() returns 0 for the parent @ft of \p integer_field. @postrefcountsame{integer_field} -@sa bt_ctf_field_unsigned_integer_get_value(): Returns the unsigned +@sa bt_field_unsigned_integer_get_value(): Returns the unsigned integral value of a given integer field. */ -extern int bt_ctf_field_unsigned_integer_set_value( - struct bt_ctf_field *integer_field, uint64_t value); +extern int bt_field_unsigned_integer_set_value( + struct bt_field *integer_field, uint64_t value); /** @} */ @@ -542,10 +542,10 @@ A CTF IR floating point number field is a @field which holds a floating point number value, and which is described by a @floatft. -After you create a floating point number field with bt_ctf_field_create(), you +After you create a floating point number field with bt_field_create(), you \em must set a floating point number value with -bt_ctf_field_floating_point_set_value() before you can get the -field's value with bt_ctf_field_floating_point_get_value(). +bt_field_floating_point_set_value() before you can get the +field's value with bt_field_floating_point_get_value(). @sa ctfirfloatfieldtype @sa ctfirfields @@ -570,14 +570,14 @@ field's value with bt_ctf_field_floating_point_get_value(). @prenotnull{value} @preisfloatfield{float_field} @pre \p float_field contains a floating point number value previously - set with bt_ctf_field_floating_point_set_value(). + set with bt_field_floating_point_set_value(). @postrefcountsame{float_field} -@sa bt_ctf_field_floating_point_set_value(): Sets the floating point +@sa bt_field_floating_point_set_value(): Sets the floating point number value of a given floating point number field. */ -extern int bt_ctf_field_floating_point_get_value( - struct bt_ctf_field *float_field, double *value); +extern int bt_field_floating_point_get_value( + struct bt_field *float_field, double *value); /** @brief Sets the floating point number value of the @floatfield @@ -594,11 +594,11 @@ extern int bt_ctf_field_floating_point_get_value( @prehot{float_field} @postrefcountsame{float_field} -@sa bt_ctf_field_floating_point_get_value(): Returns the floating point +@sa bt_field_floating_point_get_value(): Returns the floating point number value of a given floating point number field. */ -extern int bt_ctf_field_floating_point_set_value( - struct bt_ctf_field *float_field, +extern int bt_field_floating_point_set_value( + struct bt_field *float_field, double value); /** @} */ @@ -616,14 +616,14 @@ A CTF IR enumeration field is a @field which holds a @intfield, and which is described by a @enumft. To set the current integral value of an enumeration field, you need to -get its wrapped @intfield with bt_ctf_field_enumeration_get_container(), +get its wrapped @intfield with bt_field_enumeration_get_container(), and then set the integral value with either -bt_ctf_field_signed_integer_set_value() or -bt_ctf_field_unsigned_integer_set_value(). +bt_field_signed_integer_set_value() or +bt_field_unsigned_integer_set_value(). Once you set the integral value of an enumeration field by following the previous paragraph, you can get the mappings containing this value in -their range with bt_ctf_field_enumeration_get_mappings(). This function +their range with bt_field_enumeration_get_mappings(). This function returns a @enumftiter. @sa ctfirenumfieldtype @@ -650,8 +650,8 @@ exist. @postrefcountsame{enum_field} @postsuccessrefcountretinc */ -extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container( - struct bt_ctf_field *enum_field); +extern struct bt_field *bt_field_enumeration_get_container( + struct bt_field *enum_field); /** @brief Returns a @enumftiter on all the mappings of the field type of @@ -659,8 +659,8 @@ extern struct bt_ctf_field *bt_ctf_field_enumeration_get_container( @enumfield \p enum_field in their range. This function is the equivalent of using -bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value() or -bt_ctf_field_type_enumeration_find_mappings_by_signed_value() with the +bt_field_type_enumeration_find_mappings_by_unsigned_value() or +bt_field_type_enumeration_find_mappings_by_signed_value() with the current integral value of \p enum_field. @param[in] enum_field Enumeration field of which to get the mappings @@ -681,8 +681,8 @@ current integral value of \p enum_field. @post On success, the returned @enumftiter can iterate on at least one mapping. */ -extern struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_enumeration_get_mappings(struct bt_ctf_field *enum_field); +extern struct bt_field_type_enumeration_mapping_iterator * +bt_field_enumeration_get_mappings(struct bt_field *enum_field); /** @} */ @@ -698,16 +698,16 @@ bt_ctf_field_enumeration_get_mappings(struct bt_ctf_field *enum_field); A CTF IR string field is a @field which holds a string value, and which is described by a @stringft. -Use bt_ctf_field_string_set_value() to set the current string value -of a string field object. You can also use bt_ctf_field_string_append() -and bt_ctf_field_string_append_len() to append a string to the current +Use bt_field_string_set_value() to set the current string value +of a string field object. You can also use bt_field_string_append() +and bt_field_string_append_len() to append a string to the current value of a string field. -After you create a string field with bt_ctf_field_create(), you +After you create a string field with bt_field_create(), you \em must set a string value with -bt_ctf_field_string_set_value(), bt_ctf_field_string_append(), or -bt_ctf_field_string_append_len() before you can get the -field's value with bt_ctf_field_string_get_value(). +bt_field_string_set_value(), bt_field_string_append(), or +bt_field_string_append_len() before you can get the +field's value with bt_field_string_get_value(). @sa ctfirstringfieldtype @sa ctfirfields @@ -730,16 +730,16 @@ value. @prenotnull{value} @preisstringfield{string_field} @pre \p string_field contains a string value previously - set with bt_ctf_field_string_set_value(), - bt_ctf_field_string_append(), or - bt_ctf_field_string_append_len(). + set with bt_field_string_set_value(), + bt_field_string_append(), or + bt_field_string_append_len(). @postrefcountsame{string_field} -@sa bt_ctf_field_string_set_value(): Sets the string value of a given +@sa bt_field_string_set_value(): Sets the string value of a given string field. */ -extern const char *bt_ctf_field_string_get_value( - struct bt_ctf_field *string_field); +extern const char *bt_field_string_get_value( + struct bt_field *string_field); /** @brief Sets the string value of the @stringfield \p string_field to @@ -757,10 +757,10 @@ extern const char *bt_ctf_field_string_get_value( @prehot{string_field} @postrefcountsame{string_field} -@sa bt_ctf_field_string_get_value(): Returns the string value of a +@sa bt_field_string_get_value(): Returns the string value of a given string field. */ -extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field, +extern int bt_field_string_set_value(struct bt_field *string_field, const char *value); /** @@ -770,7 +770,7 @@ extern int bt_ctf_field_string_set_value(struct bt_ctf_field *string_field, This function is the equivalent of: @code -bt_ctf_field_string_append_len(string_field, value, strlen(value)); +bt_field_string_append_len(string_field, value, strlen(value)); @endcode @param[in] string_field String field of which to append \p value to @@ -785,10 +785,10 @@ bt_ctf_field_string_append_len(string_field, value, strlen(value)); @prehot{string_field} @postrefcountsame{string_field} -@sa bt_ctf_field_string_set_value(): Sets the string value of a given +@sa bt_field_string_set_value(): Sets the string value of a given string field. */ -extern int bt_ctf_field_string_append(struct bt_ctf_field *string_field, +extern int bt_field_string_append(struct bt_field *string_field, const char *value); /** @@ -815,11 +815,11 @@ appends the first \p length characters of \p value. @prehot{string_field} @postrefcountsame{string_field} -@sa bt_ctf_field_string_set_value(): Sets the string value of a given +@sa bt_field_string_set_value(): Sets the string value of a given string field. */ -extern int bt_ctf_field_string_append_len( - struct bt_ctf_field *string_field, const char *value, +extern int bt_field_string_append_len( + struct bt_field *string_field, const char *value, unsigned int length); /** @} */ @@ -838,10 +838,10 @@ contains an ordered list of zero or more named @fields which can be different @fts, and which is described by a @structft. To set the value of a specific field of a structure field, you need to -first get the field with bt_ctf_field_structure_get_field_by_name() or -bt_ctf_field_structure_get_field_by_index(). If you already have a +first get the field with bt_field_structure_get_field_by_name() or +bt_field_structure_get_field_by_index(). If you already have a field object, you can assign it to a specific name within a structure -field with bt_ctf_field_structure_set_field_by_name(). +field with bt_field_structure_set_field_by_name(). @sa ctfirstructfieldtype @sa ctfirfields @@ -869,16 +869,13 @@ exist. @postrefcountsame{struct_field} @postsuccessrefcountretinc -@sa bt_ctf_field_structure_get_field_by_index(): Returns the field of a +@sa bt_field_structure_get_field_by_index(): Returns the field of a given structure field by index. -@sa bt_ctf_field_structure_set_field_by_name(): Sets the field of a +@sa bt_field_structure_set_field_by_name(): Sets the field of a given structure field by name. */ -extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( - struct bt_ctf_field *struct_field, const char *name); - -/* Pre-2.0 CTF writer compatibility */ -#define bt_ctf_field_structure_get_field bt_ctf_field_structure_get_field_by_name +extern struct bt_field *bt_field_structure_get_field_by_name( + struct bt_field *struct_field, const char *name); /** @brief Returns the @field at index \p index in the @structfield @@ -894,17 +891,17 @@ extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( @preisstructfield{struct_field} @pre \p index is lesser than the number of fields contained in the parent field type of \p struct_field (see - bt_ctf_field_type_structure_get_field_count()). + bt_field_type_structure_get_field_count()). @postrefcountsame{struct_field} @postsuccessrefcountretinc -@sa bt_ctf_field_structure_get_field_by_name(): Returns the field of a +@sa bt_field_structure_get_field_by_name(): Returns the field of a given structure field by name. -@sa bt_ctf_field_structure_set_field_by_name(): Sets the field of a +@sa bt_field_structure_set_field_by_name(): Sets the field of a given structure field by name. */ -extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( - struct bt_ctf_field *struct_field, uint64_t index); +extern struct bt_field *bt_field_structure_get_field_by_index( + struct bt_field *struct_field, uint64_t index); /** @brief Sets the field of the @structfield \p struct_field named \p name @@ -914,12 +911,12 @@ If \p struct_field already contains a field named \p name, then it may either be replaced by \p field and its reference count is decremented, or \p field's value is assigned to it. -The field type of \p field, as returned by bt_ctf_field_get_type(), +The field type of \p field, as returned by bt_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_field_type_structure_get_field_type_by_name() with the field +bt_field_type_structure_get_field_type_by_name() with the field type of \p struct_field and the same name, \p name. -bt_ctf_trace_get_packet_header_type() for the parent trace class of +bt_trace_get_packet_header_type() for the parent trace class of \p packet. @param[in] struct_field Structure field of which to set the field @@ -934,21 +931,21 @@ bt_ctf_trace_get_packet_header_type() for the parent trace class of @prehot{struct_field} @preisstructfield{struct_field} @pre \p field has a field type equivalent to the field type returned by - bt_ctf_field_type_structure_get_field_type_by_name() for the + bt_field_type_structure_get_field_type_by_name() for the field type of \p struct_field with the name \p name. @postrefcountsame{struct_field} @post On success, the field in \p struct_field named \p name may either be replaced by \p field or have the same value as \p field. @postsuccessrefcountinc{field} -@sa bt_ctf_field_structure_get_field_by_index(): Returns the field of a +@sa bt_field_structure_get_field_by_index(): Returns the field of a given structure field by index. -@sa bt_ctf_field_structure_get_field_by_name(): Returns the field of a +@sa bt_field_structure_get_field_by_name(): Returns the field of a given structure field by name. */ -extern int bt_ctf_field_structure_set_field_by_name( - struct bt_ctf_field *struct_field, - const char *name, struct bt_ctf_field *field); +extern int bt_field_structure_set_field_by_name( + struct bt_field *struct_field, + const char *name, struct bt_field *field); /** @} */ @@ -966,7 +963,7 @@ contains an ordered list of zero or more @fields sharing the same @ft, and which is described by a @arrayft. To set the value of a specific field of an array field, you need to -first get the field with bt_ctf_field_array_get_field(). +first get the field with bt_field_array_get_field(). @sa ctfirarrayfieldtype @sa ctfirfields @@ -990,13 +987,13 @@ exist. @prenotnull{array_field} @preisarrayfield{array_field} -@pre \p index is lesser than bt_ctf_field_type_array_get_length() called +@pre \p index is lesser than bt_field_type_array_get_length() called on the field type of \p array_field. @postrefcountsame{array_field} @postsuccessrefcountretinc */ -extern struct bt_ctf_field *bt_ctf_field_array_get_field( - struct bt_ctf_field *array_field, uint64_t index); +extern struct bt_field *bt_field_array_get_field( + struct bt_field *array_field, uint64_t index); /** @} */ @@ -1014,8 +1011,8 @@ contains an ordered list of zero or more @fields sharing the same @ft, and which is described by a @seqft. Before you can get a specific field of a sequence field with -bt_ctf_field_sequence_get_field(), you need to set its current length -@intfield with bt_ctf_field_sequence_set_length(). The integral value of +bt_field_sequence_get_field(), you need to set its current length +@intfield with bt_field_sequence_set_length(). The integral value of the length field of a sequence field indicates the number of fields it contains. @@ -1043,15 +1040,15 @@ exist. @prenotnull{sequence_field} @preisseqfield{sequence_field} @pre \p sequence_field has a length field previously set with - bt_ctf_field_sequence_set_length(). + bt_field_sequence_set_length(). @pre \p index is lesser than the current integral value of the current length field of \p sequence_field (see - bt_ctf_field_sequence_get_length()). + bt_field_sequence_get_length()). @postrefcountsame{sequence_field} @postsuccessrefcountretinc */ -extern struct bt_ctf_field *bt_ctf_field_sequence_get_field( - struct bt_ctf_field *sequence_field, uint64_t index); +extern struct bt_field *bt_field_sequence_get_field( + struct bt_field *sequence_field, uint64_t index); /** @brief Returns the length @intfield of the @seqfield \p sequence_field. @@ -1067,16 +1064,16 @@ number of fields contained in \p sequence_field. @prenotnull{sequence_field} @preisseqfield{sequence_field} @pre \p sequence_field has a length field previously set with - bt_ctf_field_sequence_set_length(). + bt_field_sequence_set_length(). @postrefcountsame{sequence_field} @postsuccessrefcountretinc @post On success, the returned field is a @intfield. -@sa bt_ctf_field_sequence_set_length(): Sets the length field of a given +@sa bt_field_sequence_set_length(): Sets the length field of a given sequence field. */ -extern struct bt_ctf_field *bt_ctf_field_sequence_get_length( - struct bt_ctf_field *sequence_field); +extern struct bt_field *bt_field_sequence_get_length( + struct bt_field *sequence_field); /** @brief Sets the length @intfield of the @seqfield \p sequence_field @@ -1098,11 +1095,11 @@ fields contained in \p sequence_field. @postrefcountsame{sequence_field} @postsuccessrefcountinc{length_field} -@sa bt_ctf_field_sequence_get_length(): Returns the length field of a +@sa bt_field_sequence_get_length(): Returns the length field of a given sequence field. */ -extern int bt_ctf_field_sequence_set_length(struct bt_ctf_field *sequence_field, - struct bt_ctf_field *length_field); +extern int bt_field_sequence_set_length(struct bt_field *sequence_field, + struct bt_field *length_field); /** @} */ @@ -1119,9 +1116,9 @@ A CTF IR variant field is a @field which contains a current @field amongst one or more choices, and which is described by a @varft. -Use bt_ctf_field_variant_get_field() to get the @field selected by +Use bt_field_variant_get_field() to get the @field selected by a specific tag @enumfield. Once you call this function, you can call -bt_ctf_field_variant_get_current_field() afterwards to get this last +bt_field_variant_get_current_field() afterwards to get this last field again. @sa ctfirvarfieldtype @@ -1139,8 +1136,8 @@ This function creates the @field to return if it does not currently exist. Once you call this function, you can call -bt_ctf_field_variant_get_current_field() to get the same field again, -and you can call bt_ctf_field_variant_get_tag() to get \p tag_field. +bt_field_variant_get_current_field() to get the same field again, +and you can call bt_field_variant_get_tag() to get \p tag_field. @param[in] variant_field Variant field of which to get the field selected by \p tag_field. @@ -1156,9 +1153,9 @@ and you can call bt_ctf_field_variant_get_tag() to get \p tag_field. @postsuccessrefcountinc{tag_field} @postsuccessrefcountretinc */ -extern struct bt_ctf_field *bt_ctf_field_variant_get_field( - struct bt_ctf_field *variant_field, - struct bt_ctf_field *tag_field); +extern struct bt_field *bt_field_variant_get_field( + struct bt_field *variant_field, + struct bt_field *tag_field); /** @brief Returns the currently selected @field of the @varfield @@ -1173,12 +1170,12 @@ extern struct bt_ctf_field *bt_ctf_field_variant_get_field( @prenotnull{variant_field} @preisvarfield{variant_field} @pre \p variant_field contains has a current selected field previously - set with bt_ctf_field_variant_get_field(). + set with bt_field_variant_get_field(). @postrefcountsame{variant_field} @postsuccessrefcountretinc */ -extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field( - struct bt_ctf_field *variant_field); +extern struct bt_field *bt_field_variant_get_current_field( + struct bt_field *variant_field); /** @brief Returns the tag @enumfield of the @varfield \p variant_field. @@ -1191,16 +1188,30 @@ extern struct bt_ctf_field *bt_ctf_field_variant_get_current_field( @prenotnull{variant_field} @preisvarfield{variant_field} @pre \p variant_field contains has a current selected field previously - set with bt_ctf_field_variant_get_field(). + set with bt_field_variant_get_field(). @postrefcountsame{variant_field} @postsuccessrefcountretinc @post On success, the returned field is a @enumfield. */ -extern struct bt_ctf_field *bt_ctf_field_variant_get_tag( - struct bt_ctf_field *variant_field); +extern struct bt_field *bt_field_variant_get_tag( + struct bt_field *variant_field); /** @} */ +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_field bt_field +#define bt_ctf_field_create bt_field_create +#define bt_ctf_field_structure_get_field bt_field_structure_get_field_by_name +#define bt_ctf_field_variant_get_field bt_field_variant_get_field +#define bt_ctf_field_array_get_field bt_field_array_get_field +#define bt_ctf_field_sequence_set_length bt_field_sequence_set_length +#define bt_ctf_field_sequence_get_field bt_field_sequence_get_field +#define bt_ctf_field_enumeration_get_container bt_field_enumeration_get_container +#define bt_ctf_field_signed_integer_set_value bt_field_signed_integer_set_value +#define bt_ctf_field_unsigned_integer_set_value bt_field_unsigned_integer_set_value +#define bt_ctf_field_floating_point_set_value bt_field_floating_point_set_value +#define bt_ctf_field_string_set_value bt_field_string_set_value + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/ctf-ir/packet-internal.h b/include/babeltrace/ctf-ir/packet-internal.h index 609717f6..20cded11 100644 --- a/include/babeltrace/ctf-ir/packet-internal.h +++ b/include/babeltrace/ctf-ir/packet-internal.h @@ -31,20 +31,20 @@ #include #include -struct bt_ctf_packet { +struct bt_packet { struct bt_object base; - struct bt_ctf_field *header; - struct bt_ctf_field *context; - struct bt_ctf_stream *stream; + struct bt_field *header; + struct bt_field *context; + struct bt_stream *stream; int frozen; }; BT_HIDDEN -void bt_ctf_packet_freeze(struct bt_ctf_packet *packet); +void bt_packet_freeze(struct bt_packet *packet); static inline -struct bt_ctf_stream *bt_ctf_packet_borrow_stream( - struct bt_ctf_packet *packet) +struct bt_stream *bt_packet_borrow_stream( + struct bt_packet *packet) { assert(packet); return packet->stream; diff --git a/include/babeltrace/ctf-ir/packet.h b/include/babeltrace/ctf-ir/packet.h index 80278c47..996f6e7c 100644 --- a/include/babeltrace/ctf-ir/packet.h +++ b/include/babeltrace/ctf-ir/packet.h @@ -52,18 +52,18 @@ As a reminder, here's the structure of a CTF packet: @imgpacketstructure You can create a CTF IR packet \em from a -\link ctfirstream CTF IR stream\endlink with bt_ctf_packet_create(). The +\link ctfirstream CTF IR stream\endlink with bt_packet_create(). The stream you use to create a packet object becomes its parent. When you set the trace packet header and stream packet context fields of -a packet with resp. bt_ctf_packet_set_header() and -bt_ctf_packet_set_context(), their field type \em must be equivalent to -the field types returned by resp. bt_ctf_trace_get_packet_header_type() -and bt_ctf_stream_class_get_packet_context_type() for its parent trace +a packet with resp. bt_packet_set_header() and +bt_packet_set_context(), their field type \em must be equivalent to +the field types returned by resp. bt_trace_get_packet_header_type() +and bt_stream_class_get_packet_context_type() for its parent trace class and stream class. You can attach a packet object to a \link ctfirevent CTF IR -event\endlink object with bt_ctf_event_set_packet(). +event\endlink object with bt_event_set_packet(). As with any Babeltrace object, CTF IR packet objects have reference @@ -89,12 +89,12 @@ except for \link refs reference counting\endlink. */ /** -@struct bt_ctf_packet +@struct bt_packet @brief A CTF IR packet. @sa ctfirpacket */ -struct bt_ctf_packet; -struct bt_ctf_stream; +struct bt_packet; +struct bt_stream; /** @name Creation and parent access functions @@ -107,7 +107,7 @@ struct bt_ctf_stream; On success, the packet object's trace packet header and stream packet context fields are not set. You can set them with resp. -bt_ctf_packet_set_header() and bt_ctf_packet_set_context(). +bt_packet_set_header() and bt_packet_set_context(). @param[in] stream Parent CTF IR stream of the packet to create. @returns Created packet, or \c NULL on error. @@ -115,14 +115,14 @@ bt_ctf_packet_set_header() and bt_ctf_packet_set_context(). @prenotnull{stream} @postsuccessrefcountret1 */ -extern struct bt_ctf_packet *bt_ctf_packet_create( - struct bt_ctf_stream *stream); +extern struct bt_packet *bt_packet_create( + struct bt_stream *stream); /** @brief Returns the parent CTF IR stream of the CTF IR packet \p packet. This function returns a reference to the stream which was used to create -the packet object in the first place with bt_ctf_packet_create(). +the packet object in the first place with bt_packet_create(). @param[in] packet Packet of which to get the parent stream. @returns Parent stream of \p packet, or \c NULL on error. @@ -131,8 +131,8 @@ the packet object in the first place with bt_ctf_packet_create(). @postrefcountsame{packet} @postsuccessrefcountretinc */ -extern struct bt_ctf_stream *bt_ctf_packet_get_stream( - struct bt_ctf_packet *packet); +extern struct bt_stream *bt_packet_get_stream( + struct bt_packet *packet); /** @} */ @@ -155,11 +155,11 @@ extern struct bt_ctf_stream *bt_ctf_packet_get_stream( @postrefcountsame{packet} @postsuccessrefcountretinc -@sa bt_ctf_packet_set_header(): Sets the trace packet header +@sa bt_packet_set_header(): Sets the trace packet header field of a given packet. */ -extern struct bt_ctf_field *bt_ctf_packet_get_header( - struct bt_ctf_packet *packet); +extern struct bt_field *bt_packet_get_header( + struct bt_packet *packet); /** @brief Sets the trace packet header field of the CTF IR packet \p packet to @@ -167,8 +167,8 @@ extern struct bt_ctf_field *bt_ctf_packet_get_header( \p packet. If \p header is not \c NULL, the field type of \p header, as returned by -bt_ctf_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_trace_get_packet_header_type() for the parent trace class of +bt_field_get_type(), \em must be equivalent to the field type returned by +bt_trace_get_packet_header_type() for the parent trace class of \p packet. @param[in] packet Packet of which to set the trace packet header field. @@ -178,17 +178,17 @@ bt_ctf_trace_get_packet_header_type() for the parent trace class of @prenotnull{packet} @prehot{packet} @pre \p header, if not \c NULL, has a field type equivalent to - the field type returned by bt_ctf_trace_get_packet_header_type() for the + the field type returned by bt_trace_get_packet_header_type() for the parent trace class of \p packet. @postrefcountsame{event} @post On success, if \p header is not \c NULL, the reference count of \p header is incremented. -@sa bt_ctf_packet_get_header(): Returns the trace packet header field of a given +@sa bt_packet_get_header(): Returns the trace packet header field of a given packet. */ -extern int bt_ctf_packet_set_header( - struct bt_ctf_packet *packet, struct bt_ctf_field *header); +extern int bt_packet_set_header( + struct bt_packet *packet, struct bt_field *header); /** @brief Returns the stream packet context field of the CTF IR packet @@ -204,19 +204,19 @@ extern int bt_ctf_packet_set_header( @postrefcountsame{packet} @postsuccessrefcountretinc -@sa bt_ctf_packet_set_context(): Sets the stream packet context +@sa bt_packet_set_context(): Sets the stream packet context field of a given packet. */ -extern struct bt_ctf_field *bt_ctf_packet_get_context( - struct bt_ctf_packet *packet); +extern struct bt_field *bt_packet_get_context( + struct bt_packet *packet); /** @brief Sets the stream packet context field of the CTF IR packet \p packet to \p context, or unsets the current packet context field from \p packet. If \p context is not \c NULL, the field type of \p context, as returned by -bt_ctf_field_get_type(), \em must be equivalent to the field type returned by -bt_ctf_stream_class_get_packet_context_type() for the parent stream class of +bt_field_get_type(), \em must be equivalent to the field type returned by +bt_stream_class_get_packet_context_type() for the parent stream class of \p packet. @param[in] packet Packet of which to set the stream packet context field. @@ -226,17 +226,17 @@ bt_ctf_stream_class_get_packet_context_type() for the parent stream class of @prenotnull{packet} @prehot{packet} @pre \p context, if not \c NULL, has a field type equivalent to - the field type returned by bt_ctf_stream_class_get_packet_context_type() + the field type returned by bt_stream_class_get_packet_context_type() for the parent stream class of \p packet. @postrefcountsame{packet} @post On success, if \p context is not \c NULL, the reference count of \p context is incremented. -@sa bt_ctf_packet_get_context(): Returns the stream packet context field of a +@sa bt_packet_get_context(): Returns the stream packet context field of a given packet. */ -extern int bt_ctf_packet_set_context( - struct bt_ctf_packet *packet, struct bt_ctf_field *context); +extern int bt_packet_set_context( + struct bt_packet *packet, struct bt_field *context); /** @} */ diff --git a/include/babeltrace/ctf-ir/resolve-internal.h b/include/babeltrace/ctf-ir/resolve-internal.h index 5479d44f..dad97907 100644 --- a/include/babeltrace/ctf-ir/resolve-internal.h +++ b/include/babeltrace/ctf-ir/resolve-internal.h @@ -35,13 +35,13 @@ #include #include -enum bt_ctf_resolve_flag { - BT_CTF_RESOLVE_FLAG_PACKET_HEADER = 0x01, - BT_CTF_RESOLVE_FLAG_PACKET_CONTEXT = 0x02, - BT_CTF_RESOLVE_FLAG_EVENT_HEADER = 0x04, - BT_CTF_RESOLVE_FLAG_STREAM_EVENT_CTX = 0x08, - BT_CTF_RESOLVE_FLAG_EVENT_CONTEXT = 0x10, - BT_CTF_RESOLVE_FLAG_EVENT_PAYLOAD = 0x20, +enum bt_resolve_flag { + BT_RESOLVE_FLAG_PACKET_HEADER = 0x01, + BT_RESOLVE_FLAG_PACKET_CONTEXT = 0x02, + BT_RESOLVE_FLAG_EVENT_HEADER = 0x04, + BT_RESOLVE_FLAG_STREAM_EVENT_CTX = 0x08, + BT_RESOLVE_FLAG_EVENT_CONTEXT = 0x10, + BT_RESOLVE_FLAG_EVENT_PAYLOAD = 0x20, }; /* @@ -60,13 +60,13 @@ enum bt_ctf_resolve_flag { * All parameters are owned by the caller. */ BT_HIDDEN -int bt_ctf_resolve_types(struct bt_value *environment, - struct bt_ctf_field_type *packet_header_type, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type, - struct bt_ctf_field_type *stream_event_ctx_type, - struct bt_ctf_field_type *event_context_type, - struct bt_ctf_field_type *event_payload_type, - enum bt_ctf_resolve_flag flags); +int bt_resolve_types(struct bt_value *environment, + struct bt_field_type *packet_header_type, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type, + struct bt_field_type *stream_event_ctx_type, + struct bt_field_type *event_context_type, + struct bt_field_type *event_payload_type, + enum bt_resolve_flag flags); #endif /* BABELTRACE_CTF_IR_RESOLVE_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/stream-class-internal.h b/include/babeltrace/ctf-ir/stream-class-internal.h index a7c98266..3bde4ed9 100644 --- a/include/babeltrace/ctf-ir/stream-class-internal.h +++ b/include/babeltrace/ctf-ir/stream-class-internal.h @@ -37,20 +37,20 @@ #include #include -struct bt_ctf_stream_class { +struct bt_stream_class { struct bt_object base; GString *name; struct bt_ctf_clock *clock; - GPtrArray *event_classes; /* Array of pointers to bt_ctf_event_class */ + GPtrArray *event_classes; /* Array of pointers to bt_event_class */ /* event class id (int64_t) to event class */ GHashTable *event_classes_ht; int id_set; int64_t id; int64_t next_event_id; int64_t next_stream_id; - struct bt_ctf_field_type *packet_context_type; - struct bt_ctf_field_type *event_header_type; - struct bt_ctf_field_type *event_context_type; + struct bt_field_type *packet_context_type; + struct bt_field_type *event_header_type; + struct bt_field_type *event_context_type; int frozen; int byte_order; @@ -62,34 +62,34 @@ struct bt_ctf_stream_class { }; BT_HIDDEN -void bt_ctf_stream_class_freeze(struct bt_ctf_stream_class *stream_class); +void bt_stream_class_freeze(struct bt_stream_class *stream_class); BT_HIDDEN -int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, +int bt_stream_class_serialize(struct bt_stream_class *stream_class, struct metadata_context *context); BT_HIDDEN -void bt_ctf_stream_class_set_byte_order( - struct bt_ctf_stream_class *stream_class, int byte_order); +void bt_stream_class_set_byte_order( + struct bt_stream_class *stream_class, int byte_order); /* Set stream_class id without checking if the stream class is frozen */ BT_HIDDEN -void _bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class, +void _bt_stream_class_set_id(struct bt_stream_class *stream_class, int64_t id); BT_HIDDEN -int bt_ctf_stream_class_set_id_no_check( - struct bt_ctf_stream_class *stream_class, int64_t id); +int bt_stream_class_set_id_no_check( + struct bt_stream_class *stream_class, int64_t id); BT_HIDDEN -int bt_ctf_stream_class_map_clock_class( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type); +int bt_stream_class_map_clock_class( + struct bt_stream_class *stream_class, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type); static inline -struct bt_ctf_trace *bt_ctf_stream_class_borrow_trace( - struct bt_ctf_stream_class *stream_class) +struct bt_trace *bt_stream_class_borrow_trace( + struct bt_stream_class *stream_class) { assert(stream_class); return (void *) bt_object_borrow_parent(stream_class); diff --git a/include/babeltrace/ctf-ir/stream-class.h b/include/babeltrace/ctf-ir/stream-class.h index 96a2dee7..175bb688 100644 --- a/include/babeltrace/ctf-ir/stream-class.h +++ b/include/babeltrace/ctf-ir/stream-class.h @@ -32,7 +32,7 @@ #include -/* For bt_ctf_visitor */ +/* For bt_visitor */ #include #ifdef __cplusplus @@ -67,9 +67,9 @@ contains zero or more stream classes, and a stream class contains zero or more \link ctfireventclass event classes\endlink. You can add an event class -to a stream class with bt_ctf_stream_class_add_event_class(). +to a stream class with bt_stream_class_add_event_class(). You can add a stream class to a trace class with -bt_ctf_trace_add_stream_class(). +bt_trace_add_stream_class(). A stream class owns three \link ctfirfieldtypes field types\endlink: @@ -92,8 +92,8 @@ As a reminder, here's the structure of a CTF packet: @imgpacketstructure Before you can create a stream from a stream class with -bt_ctf_stream_create(), you \em must add the prepared stream class to a -trace class by calling bt_ctf_trace_add_stream_class(). +bt_stream_create(), you \em must add the prepared stream class to a +trace class by calling bt_trace_add_stream_class(). As with any Babeltrace object, CTF IR stream class objects have reference @@ -103,19 +103,19 @@ management of Babeltrace objects. The following functions \em freeze their stream class parameter on success: -- bt_ctf_trace_add_stream_class() -- bt_ctf_event_create() -- bt_ctf_writer_create_stream() +- bt_trace_add_stream_class() +- bt_event_create() +- bt_writer_create_stream() (\link ctfwriter CTF writer\endlink mode only) You cannot modify a frozen stream class: it is considered immutable, except for: - Adding an event class to it with - bt_ctf_stream_class_add_event_class(). If the stream class's parent + bt_stream_class_add_event_class(). If the stream class's parent \link ctfirtraceclass trace class\endlink is static, however, - you cannot call bt_ctf_stream_class_add_event_class() - (see bt_ctf_trace_is_static() and bt_ctf_trace_set_is_static()). + you cannot call bt_stream_class_add_event_class() + (see bt_trace_is_static() and bt_trace_set_is_static()). - \link refs Reference counting\endlink. @sa ctfirstream @@ -132,13 +132,13 @@ except for: */ /** -@struct bt_ctf_stream_class +@struct bt_stream_class @brief A CTF IR stream class. @sa ctfirstreamclass */ -struct bt_ctf_stream_class; -struct bt_ctf_event_class; -struct bt_ctf_clock; +struct bt_stream_class; +struct bt_event_class; +struct bt_clock; /** @name Creation and parent access functions @@ -152,9 +152,9 @@ struct bt_ctf_clock; On success, the packet context, event header, and event context field types are empty structure field types. You can modify those default field types after the stream class is created with -bt_ctf_stream_class_set_packet_context_type(), -bt_ctf_stream_class_set_event_header_type(), and -bt_ctf_stream_class_set_event_context_type(). +bt_stream_class_set_packet_context_type(), +bt_stream_class_set_event_header_type(), and +bt_stream_class_set_event_context_type(). @param[in] name Name of the stream class to create (copied on success), or \c NULL to create an unnamed stream class. @@ -162,9 +162,9 @@ bt_ctf_stream_class_set_event_context_type(). @postsuccessrefcountret1 -@sa bt_ctf_stream_class_create(): Creates a default stream class. +@sa bt_stream_class_create(): Creates a default stream class. */ -extern struct bt_ctf_stream_class *bt_ctf_stream_class_create_empty( +extern struct bt_stream_class *bt_stream_class_create_empty( const char *name); /** @@ -187,8 +187,8 @@ has the following fields: - timestamp: a 64-bit unsigned integer field type. You can modify those default field types after the stream class is -created with bt_ctf_stream_class_set_packet_context_type() and -bt_ctf_stream_class_set_event_header_type(). +created with bt_stream_class_set_packet_context_type() and +bt_stream_class_set_event_header_type(). @param[in] name Name of the stream class to create (copied on success), or \c NULL to create an unnamed stream class. @@ -196,9 +196,9 @@ bt_ctf_stream_class_set_event_header_type(). @postsuccessrefcountret1 -@sa bt_ctf_stream_class_create_empty(): Creates an empty stream class. +@sa bt_stream_class_create_empty(): Creates an empty stream class. */ -extern struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name); +extern struct bt_stream_class *bt_stream_class_create(const char *name); /** @brief Returns the parent CTF IR trace class of the CTF IR stream @@ -207,7 +207,7 @@ extern struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name); It is possible that the stream class was not added to a trace class yet, in which case this function returns \c NULL. You can add a stream class to a trace class with -bt_ctf_trace_add_stream_class(). +bt_trace_add_stream_class(). @param[in] stream_class Stream class of which to get the parent trace class. @@ -219,11 +219,11 @@ bt_ctf_trace_add_stream_class(). @postrefcountsame{stream_class} @postsuccessrefcountretinc -@sa bt_ctf_trace_add_stream_class(): Add a stream class to +@sa bt_trace_add_stream_class(): Add a stream class to a trace class. */ -extern struct bt_ctf_trace *bt_ctf_stream_class_get_trace( - struct bt_ctf_stream_class *stream_class); +extern struct bt_trace *bt_stream_class_get_trace( + struct bt_stream_class *stream_class); /** @} */ @@ -246,11 +246,11 @@ string. @prenotnull{stream_class} @postrefcountsame{stream_class} -@sa bt_ctf_stream_class_set_name(): Sets the name of a given +@sa bt_stream_class_set_name(): Sets the name of a given stream class. */ -extern const char *bt_ctf_stream_class_get_name( - struct bt_ctf_stream_class *stream_class); +extern const char *bt_stream_class_get_name( + struct bt_stream_class *stream_class); /** @brief Sets the name of the CTF IR stream class @@ -271,11 +271,11 @@ the stream classes of the trace class to which you eventually add @prehot{stream_class} @postrefcountsame{stream_class} -@sa bt_ctf_stream_class_get_name(): Returns the name of a given +@sa bt_stream_class_get_name(): Returns the name of a given stream class. */ -extern int bt_ctf_stream_class_set_name( - struct bt_ctf_stream_class *stream_class, const char *name); +extern int bt_stream_class_set_name( + struct bt_stream_class *stream_class, const char *name); /** @brief Returns the numeric ID of the CTF IR stream class \p stream_class. @@ -287,11 +287,11 @@ extern int bt_ctf_stream_class_set_name( @prenotnull{stream_class} @postrefcountsame{stream_class} -@sa bt_ctf_stream_class_set_id(): Sets the numeric ID of a given +@sa bt_stream_class_set_id(): Sets the numeric ID of a given stream class. */ -extern int64_t bt_ctf_stream_class_get_id( - struct bt_ctf_stream_class *stream_class); +extern int64_t bt_stream_class_get_id( + struct bt_stream_class *stream_class); /** @brief Sets the numeric ID of the CTF IR stream class @@ -309,11 +309,11 @@ of the trace class to which you eventually add \p stream_class. @pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX). @postrefcountsame{stream_class} -@sa bt_ctf_stream_class_get_id(): Returns the numeric ID of a given +@sa bt_stream_class_get_id(): Returns the numeric ID of a given stream class. */ -extern int bt_ctf_stream_class_set_id( - struct bt_ctf_stream_class *stream_class, uint64_t id); +extern int bt_stream_class_set_id( + struct bt_stream_class *stream_class, uint64_t id); /** @} */ @@ -337,11 +337,11 @@ extern int bt_ctf_stream_class_set_id( @post On success, if the return value is a field type, its reference count is incremented. -@sa bt_ctf_stream_class_set_packet_context_type(): Sets the packet +@sa bt_stream_class_set_packet_context_type(): Sets the packet context field type of a given stream class. */ -extern struct bt_ctf_field_type *bt_ctf_stream_class_get_packet_context_type( - struct bt_ctf_stream_class *stream_class); +extern struct bt_field_type *bt_stream_class_get_packet_context_type( + struct bt_stream_class *stream_class); /** @brief Sets the packet context field type of the CTF IR stream class @@ -369,12 +369,12 @@ As of Babeltrace \btversion, if \p packet_context_type is not \c NULL, @post On success, if \p packet_context_type is not \c NULL, the reference count of \p packet_context_type is incremented. -@sa bt_ctf_stream_class_get_packet_context_type(): Returns the packet +@sa bt_stream_class_get_packet_context_type(): Returns the packet context field type of a given stream class. */ -extern int bt_ctf_stream_class_set_packet_context_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *packet_context_type); +extern int bt_stream_class_set_packet_context_type( + struct bt_stream_class *stream_class, + struct bt_field_type *packet_context_type); /** @brief Returns the event header field type of the CTF IR stream class @@ -391,12 +391,12 @@ extern int bt_ctf_stream_class_set_packet_context_type( @post On success, if the return value is a field type, its reference count is incremented. -@sa bt_ctf_stream_class_set_event_header_type(): Sets the event +@sa bt_stream_class_set_event_header_type(): Sets the event header field type of a given stream class. */ -extern struct bt_ctf_field_type * -bt_ctf_stream_class_get_event_header_type( - struct bt_ctf_stream_class *stream_class); +extern struct bt_field_type * +bt_stream_class_get_event_header_type( + struct bt_stream_class *stream_class); /** @brief Sets the event header field type of the CTF IR stream class @@ -424,12 +424,12 @@ As of Babeltrace \btversion, if \p event_header_type is not \c NULL, @post On success, if \p event_header_type is not \c NULL, the reference count of \p event_header_type is incremented. -@sa bt_ctf_stream_class_get_event_header_type(): Returns the event +@sa bt_stream_class_get_event_header_type(): Returns the event header field type of a given stream class. */ -extern int bt_ctf_stream_class_set_event_header_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *event_header_type); +extern int bt_stream_class_set_event_header_type( + struct bt_stream_class *stream_class, + struct bt_field_type *event_header_type); /** @brief Returns the event context field type of the CTF IR stream class @@ -447,12 +447,12 @@ extern int bt_ctf_stream_class_set_event_header_type( its reference count is incremented. -@sa bt_ctf_stream_class_set_event_context_type(): Sets the event +@sa bt_stream_class_set_event_context_type(): Sets the event context field type of a given stream class. */ -extern struct bt_ctf_field_type * -bt_ctf_stream_class_get_event_context_type( - struct bt_ctf_stream_class *stream_class); +extern struct bt_field_type * +bt_stream_class_get_event_context_type( + struct bt_stream_class *stream_class); /** @brief Sets the event context field type of the CTF IR stream class @@ -480,12 +480,12 @@ As of Babeltrace \btversion, if \p event_context_type is not \c NULL, @post On success, if \p event_context_type is not \c NULL, the reference count of \p event_context_type is incremented. -@sa bt_ctf_stream_class_get_event_context_type(): Returns the event context +@sa bt_stream_class_get_event_context_type(): Returns the event context field type of a given stream class. */ -extern int bt_ctf_stream_class_set_event_context_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *event_context_type); +extern int bt_stream_class_set_event_context_type( + struct bt_stream_class *stream_class, + struct bt_field_type *event_context_type); /** @} */ @@ -507,8 +507,8 @@ extern int bt_ctf_stream_class_set_event_context_type( @prenotnull{stream_class} @postrefcountsame{stream_class} */ -extern int64_t bt_ctf_stream_class_get_event_class_count( - struct bt_ctf_stream_class *stream_class); +extern int64_t bt_stream_class_get_event_class_count( + struct bt_stream_class *stream_class); /** @brief Returns the event class at index \p index in the CTF IR stream @@ -522,15 +522,15 @@ extern int64_t bt_ctf_stream_class_get_event_class_count( @prenotnull{stream_class} @pre \p index is lesser than the number of event classes contained in the stream class \p stream_class (see - bt_ctf_stream_class_get_event_class_count()). + bt_stream_class_get_event_class_count()). @postrefcountsame{stream_class} @postsuccessrefcountretinc -@sa bt_ctf_stream_class_get_event_class_by_id(): Finds an event class +@sa bt_stream_class_get_event_class_by_id(): Finds an event class by ID. */ -extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index( - struct bt_ctf_stream_class *stream_class, uint64_t index); +extern struct bt_event_class *bt_stream_class_get_event_class_by_index( + struct bt_stream_class *stream_class, uint64_t index); /** @brief Returns the event class with ID \c id found in the CTF IR stream @@ -545,8 +545,8 @@ extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index( @postrefcountsame{stream_class} @postsuccessrefcountretinc */ -extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id( - struct bt_ctf_stream_class *stream_class, uint64_t id); +extern struct bt_event_class *bt_stream_class_get_event_class_by_id( + struct bt_stream_class *stream_class, uint64_t id); /** @brief Adds the CTF IR event class \p event_class to the @@ -569,10 +569,10 @@ types of \p event_class. If any automatic resolving fails: types of \p event_class or \p stream_class, this function fails. - If \p stream_class is the child of a \link ctfirtraceclass CTF IR trace class\endlink (it was added - with bt_ctf_trace_add_stream_class()), this function fails. + with bt_trace_add_stream_class()), this function fails. - If \p stream_class is not the child of a trace class yet, the automatic resolving is reported to the next call to - bt_ctf_trace_add_stream_class() with \p stream_class. + bt_trace_add_stream_class() with \p stream_class. @param[in] stream_class Stream class to which to add \p event_class. @param[in] event_class Event class to add to \p stream_class. @@ -585,9 +585,9 @@ types of \p event_class. If any automatic resolving fails: @postsuccessrefcountinc{event_class} @postsuccessfrozen{event_class} */ -extern int bt_ctf_stream_class_add_event_class( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_event_class *event_class); +extern int bt_stream_class_add_event_class( + struct bt_stream_class *stream_class, + struct bt_event_class *event_class); /** @} */ @@ -614,13 +614,19 @@ event classes. @prenotnull{stream_class} @prenotnull{visitor} */ -extern int bt_ctf_stream_class_visit(struct bt_ctf_stream_class *stream_class, - bt_ctf_visitor visitor, void *data); +extern int bt_stream_class_visit(struct bt_stream_class *stream_class, + bt_visitor visitor, void *data); /** @} */ /** @} */ +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_stream_class bt_stream_class +#define bt_ctf_stream_class_create bt_stream_class_create +#define bt_ctf_stream_class_add_event_class bt_stream_class_add_event_class +#define bt_ctf_stream_class_get_packet_context_type bt_stream_class_get_packet_context_type + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/ctf-ir/stream-internal.h b/include/babeltrace/ctf-ir/stream-internal.h index 41fe247d..f76f2626 100644 --- a/include/babeltrace/ctf-ir/stream-internal.h +++ b/include/babeltrace/ctf-ir/stream-internal.h @@ -39,21 +39,21 @@ struct bt_port; struct bt_component; -typedef void (*bt_ctf_stream_destroy_listener_func)( - struct bt_ctf_stream *stream, void *data); +typedef void (*bt_stream_destroy_listener_func)( + struct bt_stream *stream, void *data); -struct bt_ctf_stream_destroy_listener { - bt_ctf_stream_destroy_listener_func func; +struct bt_stream_destroy_listener { + bt_stream_destroy_listener_func func; void *data; }; -struct bt_ctf_stream { +struct bt_stream { struct bt_object base; int64_t id; - struct bt_ctf_stream_class *stream_class; + struct bt_stream_class *stream_class; GString *name; - struct bt_ctf_field *packet_header; - struct bt_ctf_field *packet_context; + struct bt_field *packet_header; + struct bt_field *packet_context; /* * When a notification which contains a reference to a stream @@ -76,40 +76,40 @@ struct bt_ctf_stream { GHashTable *comp_cur_port; /* Writer-specific members. */ - /* Array of pointers to bt_ctf_event for the current packet */ + /* Array of pointers to bt_event for the current packet */ GPtrArray *events; - struct bt_ctf_stream_pos pos; + struct bt_stream_pos pos; unsigned int flushed_packet_count; uint64_t discarded_events; uint64_t size; - /* Array of struct bt_ctf_stream_destroy_listener */ + /* Array of struct bt_stream_destroy_listener */ GArray *destroy_listeners; }; BT_HIDDEN -int bt_ctf_stream_set_fd(struct bt_ctf_stream *stream, int fd); +int bt_stream_set_fd(struct bt_stream *stream, int fd); BT_HIDDEN -void bt_ctf_stream_map_component_to_port(struct bt_ctf_stream *stream, +void bt_stream_map_component_to_port(struct bt_stream *stream, struct bt_component *comp, struct bt_port *port); BT_HIDDEN -struct bt_port *bt_ctf_stream_port_for_component(struct bt_ctf_stream *stream, +struct bt_port *bt_stream_port_for_component(struct bt_stream *stream, struct bt_component *comp); BT_HIDDEN -void bt_ctf_stream_add_destroy_listener(struct bt_ctf_stream *stream, - bt_ctf_stream_destroy_listener_func func, void *data); +void bt_stream_add_destroy_listener(struct bt_stream *stream, + bt_stream_destroy_listener_func func, void *data); BT_HIDDEN -void bt_ctf_stream_remove_destroy_listener(struct bt_ctf_stream *stream, - bt_ctf_stream_destroy_listener_func func, void *data); +void bt_stream_remove_destroy_listener(struct bt_stream *stream, + bt_stream_destroy_listener_func func, void *data); static inline -struct bt_ctf_stream_class *bt_ctf_stream_borrow_stream_class( - struct bt_ctf_stream *stream) +struct bt_stream_class *bt_stream_borrow_stream_class( + struct bt_stream *stream) { assert(stream); return stream->stream_class; diff --git a/include/babeltrace/ctf-ir/stream.h b/include/babeltrace/ctf-ir/stream.h index e2aa3ef9..443e757e 100644 --- a/include/babeltrace/ctf-ir/stream.h +++ b/include/babeltrace/ctf-ir/stream.h @@ -36,7 +36,7 @@ extern "C" { #endif -struct bt_ctf_stream_class; +struct bt_stream_class; /** @defgroup ctfirstream CTF IR stream @@ -56,14 +56,14 @@ A CTF IR stream is an instance of a You can obtain a CTF IR stream object in two different modes: -- Normal mode: use bt_ctf_stream_create() or - bt_ctf_stream_create_with_id() with a stream class having a +- Normal mode: use bt_stream_create() or + bt_stream_create_with_id() with a stream class having a \link ctfirtraceclass CTF IR trace class\endlink parent \em not created by a \link ctfwriter CTF writer\endlink object to create a default stream. -- CTF writer mode: use bt_ctf_stream_create() with +- CTF writer mode: use bt_stream_create() with a stream class having a trace class parent created by a CTF writer - object, or use bt_ctf_writer_create_stream(). + object, or use bt_writer_create_stream(). A CTF IR stream object represents a CTF stream, that is, a sequence of packets containing events: @@ -92,13 +92,13 @@ management of Babeltrace objects. */ /** -@struct bt_ctf_stream +@struct bt_stream @brief A CTF IR stream. @sa ctfirstream @sa ctfwriterstream */ -struct bt_ctf_stream; -struct bt_ctf_event; +struct bt_stream; +struct bt_event; /** @brief Creates a default CTF IR stream named \p name from the CTF IR @@ -126,11 +126,11 @@ functions documented in this module on it. @pre \p stream_class has a parent trace class. @postsuccessrefcountret1 -@sa bt_ctf_stream_create_with_id(): Create a CTF IR stream with a +@sa bt_stream_create_with_id(): Create a CTF IR stream with a specific ID. */ -extern struct bt_ctf_stream *bt_ctf_stream_create( - struct bt_ctf_stream_class *stream_class, +extern struct bt_stream *bt_stream_create( + struct bt_stream_class *stream_class, const char *name); /** @@ -141,11 +141,11 @@ extern struct bt_ctf_stream *bt_ctf_stream_create( \link ctfirtraceclass CTF IR trace class\endlink. You \em must have created the trace class of \p stream class directly -with bt_ctf_trace_create(), not through bt_ctf_writer_create() (use -bt_ctf_stream_create() for this). +with bt_trace_create(), not through bt_writer_create() (use +bt_stream_create() for this). \p id \em must be unique amongst the IDs of all the streams created -from \p stream_class with bt_ctf_stream_create_with_id(). +from \p stream_class with bt_stream_create_with_id(). \p name can be \c NULL to create an unnamed stream object. @@ -161,10 +161,10 @@ from \p stream_class with bt_ctf_stream_create_with_id(). @pre \p stream_class has a parent trace class. @postsuccessrefcountret1 -@sa bt_ctf_stream_create(): Create a CTF IR stream without an ID. +@sa bt_stream_create(): Create a CTF IR stream without an ID. */ -extern struct bt_ctf_stream *bt_ctf_stream_create_with_id( - struct bt_ctf_stream_class *stream_class, +extern struct bt_stream *bt_stream_create_with_id( + struct bt_stream_class *stream_class, const char *name, uint64_t id); /** @@ -179,7 +179,7 @@ On success, \p stream remains the sole owner of the returned string. @prenotnull{stream} @postrefcountsame{stream} */ -extern const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream); +extern const char *bt_stream_get_name(struct bt_stream *stream); /** @brief Returns the numeric ID of the CTF IR stream \p stream. @@ -191,7 +191,7 @@ extern const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream); @prenotnull{stream} @postrefcountsame{stream} */ -extern int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream); +extern int64_t bt_stream_get_id(struct bt_stream *stream); /** @brief Returns the parent CTF IR stream class of the CTF IR @@ -199,7 +199,7 @@ extern int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream); This function returns a reference to the stream class which was used to create the stream object in the first place with -bt_ctf_stream_create(). +bt_stream_create(). @param[in] stream Stream of which to get the parent stream class. @returns Parent stream class of \p stream, @@ -209,11 +209,14 @@ bt_ctf_stream_create(). @postrefcountsame{stream} @postsuccessrefcountretinc */ -extern struct bt_ctf_stream_class *bt_ctf_stream_get_class( - struct bt_ctf_stream *stream); +extern struct bt_stream_class *bt_stream_get_class( + struct bt_stream *stream); /** @} */ +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_stream bt_stream + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/ctf-ir/trace-internal.h b/include/babeltrace/ctf-ir/trace-internal.h index f2275fb7..1ea43f69 100644 --- a/include/babeltrace/ctf-ir/trace-internal.h +++ b/include/babeltrace/ctf-ir/trace-internal.h @@ -48,18 +48,18 @@ enum field_type_alias { NR_FIELD_TYPE_ALIAS, }; -struct bt_ctf_trace { +struct bt_trace { struct bt_object base; GString *name; int frozen; unsigned char uuid[BABELTRACE_UUID_LEN]; bt_bool uuid_set; - enum bt_ctf_byte_order native_byte_order; + enum bt_byte_order native_byte_order; struct bt_value *environment; - GPtrArray *clocks; /* Array of pointers to bt_ctf_clock_class */ - GPtrArray *stream_classes; /* Array of ptrs to bt_ctf_stream_class */ - GPtrArray *streams; /* Array of ptrs to bt_ctf_stream */ - struct bt_ctf_field_type *packet_header_type; + GPtrArray *clocks; /* Array of pointers to bt_clock_class */ + GPtrArray *stream_classes; /* Array of ptrs to bt_stream_class */ + GPtrArray *streams; /* Array of ptrs to bt_stream */ + struct bt_field_type *packet_header_type; int64_t next_stream_id; int is_created_by_writer; @@ -84,18 +84,18 @@ BT_HIDDEN const char *get_byte_order_string(int byte_order); BT_HIDDEN -struct bt_ctf_field_type *get_field_type(enum field_type_alias alias); +struct bt_field_type *get_field_type(enum field_type_alias alias); BT_HIDDEN -int bt_ctf_trace_object_modification(struct bt_ctf_object *object, +int bt_trace_object_modification(struct bt_visitor_object *object, void *trace_ptr); BT_HIDDEN -bt_bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, - struct bt_ctf_clock_class *clock_class); +bt_bool bt_trace_has_clock_class(struct bt_trace *trace, + struct bt_clock_class *clock_class); /** -@brief User function type to use with bt_ctf_trace_add_listener(). +@brief User function type to use with bt_trace_add_listener(). @param[in] obj New CTF IR object which is part of the trace class hierarchy. @@ -103,7 +103,7 @@ bt_bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, @prenotnull{obj} */ -typedef void (*bt_ctf_listener_cb)(struct bt_ctf_object *obj, void *data); +typedef void (*bt_listener_cb)(struct bt_visitor_object *obj, void *data); /** @brief Adds the trace class modification listener \p listener to @@ -123,11 +123,11 @@ is modified, \p listener is called with the new element and with @postrefcountsame{trace_class} */ BT_HIDDEN -int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace_class, - bt_ctf_listener_cb listener, void *data); +int bt_trace_add_listener(struct bt_trace *trace_class, + bt_listener_cb listener, void *data); /* - * bt_ctf_trace_get_metadata_string: get metadata string. + * bt_trace_get_metadata_string: get metadata string. * * Get the trace's TSDL metadata. The caller assumes the ownership of the * returned string. @@ -137,6 +137,6 @@ int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace_class, * Returns the metadata string on success, NULL on error. */ BT_HIDDEN -char *bt_ctf_trace_get_metadata_string(struct bt_ctf_trace *trace); +char *bt_trace_get_metadata_string(struct bt_trace *trace); #endif /* BABELTRACE_CTF_IR_TRACE_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/trace.h b/include/babeltrace/ctf-ir/trace.h index 09acda62..4035c2bd 100644 --- a/include/babeltrace/ctf-ir/trace.h +++ b/include/babeltrace/ctf-ir/trace.h @@ -30,7 +30,7 @@ * http://www.efficios.com/ctf */ -/* For bt_ctf_visitor */ +/* For bt_visitor */ #include /* For bt_bool */ @@ -41,7 +41,7 @@ extern "C" { #endif -struct bt_ctf_field_type; +struct bt_field_type; struct bt_value; /** @@ -58,9 +58,9 @@ traces. You can obtain a trace class in two different modes: -- Normal mode: use bt_ctf_trace_create() to create a +- Normal mode: use bt_trace_create() to create a default, empty trace class. -- CTF writer mode: use bt_ctf_writer_get_trace() to +- CTF writer mode: use bt_writer_get_trace() to get the trace class created by a given CTF writer object. A trace class has the following properties: @@ -68,7 +68,7 @@ A trace class has the following properties: - A \b name. - A native byte order: all the \link ctfirfieldtypes field types\endlink eventually part of the trace - class with a byte order set to #BT_CTF_BYTE_ORDER_NATIVE have this + class with a byte order set to #BT_BYTE_ORDER_NATIVE have this "real" byte order. - A \b UUID. - An \b environment, which is a custom key-value mapping. Keys are @@ -78,12 +78,12 @@ In the Babeltrace CTF IR system, a trace class contains zero or more \link ctfirstreamclass stream classes\endlink, and a stream class contains zero or more \link ctfireventclass event classes\endlink. You can add an event class to a stream class with -bt_ctf_stream_class_add_event_class(). You can add a stream class to a -trace class with bt_ctf_trace_add_stream_class(). +bt_stream_class_add_event_class(). You can add a stream class to a +trace class with bt_trace_add_stream_class(). You can access the streams of a trace, that is, the streams which were -created from the trace's stream classes with bt_ctf_stream_create(), -with bt_ctf_trace_get_stream_by_index(). +created from the trace's stream classes with bt_stream_create(), +with bt_trace_get_stream_by_index(). A trace class owns the trace packet header \link ctfirfieldtypes field type\endlink, which represents the @@ -116,16 +116,16 @@ management of Babeltrace objects. The following functions \em freeze their trace class parameter on success: -- bt_ctf_trace_add_stream_class() -- bt_ctf_writer_create_stream() +- bt_trace_add_stream_class() +- bt_writer_create_stream() (\link ctfwriter CTF writer\endlink mode only) You cannot modify a frozen trace class: it is considered immutable, except for: - Adding a stream class to it with - bt_ctf_trace_add_stream_class(). -- Adding a CTF IR clock class to it with bt_ctf_trace_add_clock_class(). + bt_trace_add_stream_class(). +- Adding a CTF IR clock class to it with bt_trace_add_clock_class(). - \link refs Reference counting\endlink. @sa ctfirstreamclass @@ -141,42 +141,42 @@ except for: */ /** -@struct bt_ctf_trace +@struct bt_trace @brief A CTF IR trace class. @sa ctfirtraceclass */ -struct bt_ctf_trace; -struct bt_ctf_stream; -struct bt_ctf_stream_class; -struct bt_ctf_clock_class; +struct bt_trace; +struct bt_stream; +struct bt_stream_class; +struct bt_clock_class; /** @brief User function type to use with - bt_ctf_trace_add_is_static_listener(). + bt_trace_add_is_static_listener(). @param[in] trace_class Trace class which is now static. @param[in] data User data as passed to - bt_ctf_trace_add_is_static_listener() when + bt_trace_add_is_static_listener() when you added the listener. @prenotnull{trace_class} */ -typedef void (* bt_ctf_trace_is_static_listener)( - struct bt_ctf_trace *trace_class, void *data); +typedef void (* bt_trace_is_static_listener)( + struct bt_trace *trace_class, void *data); /** @brief User function type to use with - bt_ctf_trace_add_is_static_listener(). + bt_trace_add_is_static_listener(). @param[in] trace_class Trace class to which the listener was added. @param[in] data User data as passed to - bt_ctf_trace_add_is_static_listener() when + bt_trace_add_is_static_listener() when you added the listener. @prenotnull{trace_class} */ -typedef void (* bt_ctf_trace_listener_removed)( - struct bt_ctf_trace *trace_class, void *data); +typedef void (* bt_trace_listener_removed)( + struct bt_trace *trace_class, void *data); /** @name Creation function @@ -189,28 +189,28 @@ typedef void (* bt_ctf_trace_listener_removed)( On success, the trace packet header field type of the created trace class is an empty structure field type. You can modify this default trace packet header field type after the trace class is created with -bt_ctf_trace_get_packet_header_type() and -bt_ctf_trace_set_packet_header_type(). +bt_trace_get_packet_header_type() and +bt_trace_set_packet_header_type(). The created trace class has the following initial properties: - Name: none. You can set a name - with bt_ctf_trace_set_name(). + with bt_trace_set_name(). - UUID: none. You can set a UUID with - bt_ctf_trace_set_uuid(). -- Native byte order: #BT_CTF_BYTE_ORDER_UNSPECIFIED. + bt_trace_set_uuid(). +- Native byte order: #BT_BYTE_ORDER_UNSPECIFIED. You can set a native byte order with - bt_ctf_trace_set_native_byte_order(). + bt_trace_set_native_byte_order(). - Environment: empty. You can add environment entries - with bt_ctf_trace_set_environment_field(), - bt_ctf_trace_set_environment_field_integer(), and - bt_ctf_trace_set_environment_field_string(). + with bt_trace_set_environment_field(), + bt_trace_set_environment_field_integer(), and + bt_trace_set_environment_field_string(). @returns Created trace class, or \c NULL on error. @postsuccessrefcountret1 */ -extern struct bt_ctf_trace *bt_ctf_trace_create(void); +extern struct bt_trace *bt_trace_create(void); /** @} */ @@ -234,9 +234,9 @@ and is not modified. @prenotnull{trace_class} @postrefcountsame{trace_class} -@sa bt_ctf_trace_set_name(): Sets the name of a given trace class. +@sa bt_trace_set_name(): Sets the name of a given trace class. */ -extern const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace_class); +extern const char *bt_trace_get_name(struct bt_trace *trace_class); /** @brief Sets the name of the CTF IR trace class \p trace_class @@ -251,9 +251,9 @@ extern const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace_class); @prehot{trace_class} @postrefcountsame{trace_class} -@sa bt_ctf_trace_get_name(): Returns the name of a given trace class. +@sa bt_trace_get_name(): Returns the name of a given trace class. */ -extern int bt_ctf_trace_set_name(struct bt_ctf_trace *trace_class, +extern int bt_trace_set_name(struct bt_trace *trace_class, const char *name); /** @@ -263,16 +263,16 @@ extern int bt_ctf_trace_set_name(struct bt_ctf_trace *trace_class, @param[in] trace_class Trace class of which to get the default byte order. @returns Native byte order of \p trace_class, - or #BT_CTF_BYTE_ORDER_UNKNOWN on error. + or #BT_BYTE_ORDER_UNKNOWN on error. @prenotnull{trace_class} @postrefcountsame{trace_class} -@sa bt_ctf_trace_set_native_byte_order(): Sets the native byte order of +@sa bt_trace_set_native_byte_order(): Sets the native byte order of a given trace class. */ -extern enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order( - struct bt_ctf_trace *trace_class); +extern enum bt_byte_order bt_trace_get_native_byte_order( + struct bt_trace *trace_class); /** @brief Sets the native byte order of the CTF IR trace class @@ -280,11 +280,11 @@ extern enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order( \p native_byte_order \em must be one of: -- #BT_CTF_BYTE_ORDER_LITTLE_ENDIAN -- #BT_CTF_BYTE_ORDER_BIG_ENDIAN -- #BT_CTF_BYTE_ORDER_NETWORK +- #BT_BYTE_ORDER_LITTLE_ENDIAN +- #BT_BYTE_ORDER_BIG_ENDIAN +- #BT_BYTE_ORDER_NETWORK - If the trace is not in CTF writer mode, - #BT_CTF_BYTE_ORDER_UNSPECIFIED. + #BT_BYTE_ORDER_UNSPECIFIED. @param[in] trace_class Trace class of which to set the native byte order. @@ -293,17 +293,17 @@ extern enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order( @prenotnull{trace_class} @prehot{trace_class} -@pre \p native_byte_order is either #BT_CTF_BYTE_ORDER_UNSPECIFIED (if the +@pre \p native_byte_order is either #BT_BYTE_ORDER_UNSPECIFIED (if the trace is not in CTF writer mode), - #BT_CTF_BYTE_ORDER_LITTLE_ENDIAN, #BT_CTF_BYTE_ORDER_BIG_ENDIAN, or - #BT_CTF_BYTE_ORDER_NETWORK. + #BT_BYTE_ORDER_LITTLE_ENDIAN, #BT_BYTE_ORDER_BIG_ENDIAN, or + #BT_BYTE_ORDER_NETWORK. @postrefcountsame{trace_class} -@sa bt_ctf_trace_get_native_byte_order(): Returns the native byte order of a +@sa bt_trace_get_native_byte_order(): Returns the native byte order of a given trace class. */ -extern int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace_class, - enum bt_ctf_byte_order native_byte_order); +extern int bt_trace_set_native_byte_order(struct bt_trace *trace_class, + enum bt_byte_order native_byte_order); /** @brief Returns the UUID of the CTF IR trace class \p trace_class. @@ -317,10 +317,10 @@ On success, the return value is an array of 16 bytes. @prenotnull{trace_class} @postrefcountsame{trace_class} -@sa bt_ctf_trace_set_uuid(): Sets the UUID of a given trace class. +@sa bt_trace_set_uuid(): Sets the UUID of a given trace class. */ -extern const unsigned char *bt_ctf_trace_get_uuid( - struct bt_ctf_trace *trace_class); +extern const unsigned char *bt_trace_get_uuid( + struct bt_trace *trace_class); /** @brief Sets the UUID of the CTF IR trace class \p trace_class to @@ -339,9 +339,9 @@ extern const unsigned char *bt_ctf_trace_get_uuid( @pre \p uuid is an array of 16 bytes. @postrefcountsame{trace_class} -@sa bt_ctf_trace_get_uuid(): Returns the UUID of a given trace class. +@sa bt_trace_get_uuid(): Returns the UUID of a given trace class. */ -extern int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace_class, +extern int bt_trace_set_uuid(struct bt_trace *trace_class, const unsigned char *uuid); /** @@ -357,8 +357,8 @@ extern int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace_class, @prenotnull{trace_class} @postrefcountsame{trace_class} */ -extern int64_t bt_ctf_trace_get_environment_field_count( - struct bt_ctf_trace *trace_class); +extern int64_t bt_trace_get_environment_field_count( + struct bt_trace *trace_class); /** @brief Returns the field name of the environment entry at index @@ -376,19 +376,19 @@ the returned string. @prenotnull{trace_class} @pre \p index is lesser than the number of environment entries in - \p trace_class (see bt_ctf_trace_get_environment_field_count()). + \p trace_class (see bt_trace_get_environment_field_count()). @postrefcountsame{trace_class} -@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's +@sa bt_trace_get_environment_field_value_by_index(): Finds a trace class's environment entry by index. -@sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace +@sa bt_trace_get_environment_field_value_by_name(): Finds a trace class's environment entry by name. -@sa bt_ctf_trace_set_environment_field(): Sets the value of a trace +@sa bt_trace_set_environment_field(): Sets the value of a trace class's environment entry. */ extern const char * -bt_ctf_trace_get_environment_field_name_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); +bt_trace_get_environment_field_name_by_index( + struct bt_trace *trace_class, uint64_t index); /** @brief Returns the value of the environment entry at index @@ -402,17 +402,17 @@ bt_ctf_trace_get_environment_field_name_by_index( @prenotnull{trace_class} @pre \p index is lesser than the number of environment entries in - \p trace_class (see bt_ctf_trace_get_environment_field_count()). + \p trace_class (see bt_trace_get_environment_field_count()). @postrefcountsame{trace_class} @postsuccessrefcountretinc -@sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace +@sa bt_trace_get_environment_field_value_by_name(): Finds a trace class's environment entry by name. -@sa bt_ctf_trace_set_environment_field(): Sets the value of a trace +@sa bt_trace_set_environment_field(): Sets the value of a trace class's environment entry. */ extern struct bt_value * -bt_ctf_trace_get_environment_field_value_by_index(struct bt_ctf_trace *trace_class, +bt_trace_get_environment_field_value_by_index(struct bt_trace *trace_class, uint64_t index); /** @@ -431,14 +431,14 @@ bt_ctf_trace_get_environment_field_value_by_index(struct bt_ctf_trace *trace_cla @postrefcountsame{trace_class} @postsuccessrefcountretinc -@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's +@sa bt_trace_get_environment_field_value_by_index(): Finds a trace class's environment entry by index. -@sa bt_ctf_trace_set_environment_field(): Sets the value of a trace +@sa bt_trace_set_environment_field(): Sets the value of a trace class's environment entry. */ extern struct bt_value * -bt_ctf_trace_get_environment_field_value_by_name( - struct bt_ctf_trace *trace_class, const char *name); +bt_trace_get_environment_field_value_by_name( + struct bt_trace *trace_class, const char *name); /** @brief Sets the environment entry named \p name in the @@ -465,13 +465,13 @@ value is first put, and then replaced by \p value. @postrefcountsame{trace_class} @postsuccessrefcountinc{value} -@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's +@sa bt_trace_get_environment_field_value_by_index(): Finds a trace class's environment entry by index. -@sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace +@sa bt_trace_get_environment_field_value_by_name(): Finds a trace class's environment entry by name. */ -extern int bt_ctf_trace_set_environment_field( - struct bt_ctf_trace *trace_class, const char *name, +extern int bt_trace_set_environment_field( + struct bt_trace *trace_class, const char *name, struct bt_value *value); /** @@ -495,11 +495,11 @@ containing \p value. @prehot{trace_class} @postrefcountsame{trace_class} -@sa bt_ctf_trace_set_environment_field(): Sets the value of a trace +@sa bt_trace_set_environment_field(): Sets the value of a trace class's environment entry. */ -extern int bt_ctf_trace_set_environment_field_integer( - struct bt_ctf_trace *trace_class, const char *name, +extern int bt_trace_set_environment_field_integer( + struct bt_trace *trace_class, const char *name, int64_t value); /** @@ -525,11 +525,11 @@ containing \p value. @prehot{trace_class} @postrefcountsame{trace_class} -@sa bt_ctf_trace_set_environment_field(): Sets the value of a trace +@sa bt_trace_set_environment_field(): Sets the value of a trace class's environment entry. */ -extern int bt_ctf_trace_set_environment_field_string( - struct bt_ctf_trace *trace_class, const char *name, +extern int bt_trace_set_environment_field_string( + struct bt_trace *trace_class, const char *name, const char *value); /** @} */ @@ -554,11 +554,11 @@ extern int bt_ctf_trace_set_environment_field_string( @post On success, if the return value is a field type, its reference count is incremented. -@sa bt_ctf_trace_set_packet_header_type(): Sets the packet +@sa bt_trace_set_packet_header_type(): Sets the packet header field type of a given trace class. */ -extern struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_type( - struct bt_ctf_trace *trace_class); +extern struct bt_field_type *bt_trace_get_packet_header_type( + struct bt_trace *trace_class); /** @brief Sets the packet header field type of the CTF IR trace class @@ -586,11 +586,11 @@ As of Babeltrace \btversion, if \p packet_header_type is not \c NULL, @post On success, if \p packet_header_type is not \c NULL, the reference count of \p packet_header_type is incremented. -@sa bt_ctf_trace_get_packet_header_type(): Returns the packet +@sa bt_trace_get_packet_header_type(): Returns the packet header field type of a given trace class. */ -extern int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace_class, - struct bt_ctf_field_type *packet_header_type); +extern int bt_trace_set_packet_header_type(struct bt_trace *trace_class, + struct bt_field_type *packet_header_type); /** @} */ @@ -612,8 +612,8 @@ extern int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace_class, @prenotnull{trace_class} @postrefcountsame{trace_class} */ -extern int64_t bt_ctf_trace_get_clock_class_count( - struct bt_ctf_trace *trace_class); +extern int64_t bt_trace_get_clock_class_count( + struct bt_trace *trace_class); /** @brief Returns the CTF IR clock class at index \p index in the CTF @@ -629,16 +629,16 @@ extern int64_t bt_ctf_trace_get_clock_class_count( @prenotnull{trace_class} @pre \p index is lesser than the number of clock classes contained in the trace class \p trace_class (see - bt_ctf_trace_get_clock_class_count()). + bt_trace_get_clock_class_count()). @postrefcountsame{trace_class} @postsuccessrefcountretinc -@sa bt_ctf_trace_get_clock_class_by_name(): Finds a clock class by name +@sa bt_trace_get_clock_class_by_name(): Finds a clock class by name in a given trace class. -@sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class. +@sa bt_trace_add_clock_class(): Adds a clock class to a trace class. */ -extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); +extern struct bt_clock_class *bt_trace_get_clock_class_by_index( + struct bt_trace *trace_class, uint64_t index); /** @brief Returns the CTF IR clock class named \c name found in the CTF @@ -655,12 +655,12 @@ extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index( @postrefcountsame{trace_class} @postsuccessrefcountretinc -@sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained +@sa bt_trace_get_clock_class_by_index(): Returns the clock class contained in a given trace class at a given index. -@sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class. +@sa bt_trace_add_clock_class(): Adds a clock class to a trace class. */ -extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_name( - struct bt_ctf_trace *trace_class, const char *name); +extern struct bt_clock_class *bt_trace_get_clock_class_by_name( + struct bt_trace *trace_class, const char *name); /** @brief Adds the CTF IR clock class \p clock_class to the CTF IR @@ -682,13 +682,13 @@ are frozen. @post On success, if \p trace_class is frozen, \p clock_class is frozen. -@sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained +@sa bt_trace_get_clock_class_by_index(): Returns the clock class contained in a given trace class at a given index. -@sa bt_ctf_trace_get_clock_class_by_name(): Finds a clock class by name +@sa bt_trace_get_clock_class_by_name(): Finds a clock class by name in a given trace class. */ -extern int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace_class, - struct bt_ctf_clock_class *clock_class); +extern int bt_trace_add_clock_class(struct bt_trace *trace_class, + struct bt_clock_class *clock_class); /** @} */ @@ -710,8 +710,8 @@ extern int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace_class, @prenotnull{trace_class} @postrefcountsame{trace_class} */ -extern int64_t bt_ctf_trace_get_stream_class_count( - struct bt_ctf_trace *trace_class); +extern int64_t bt_trace_get_stream_class_count( + struct bt_trace *trace_class); /** @brief Returns the stream class at index \p index in the CTF IR trace @@ -725,14 +725,14 @@ extern int64_t bt_ctf_trace_get_stream_class_count( @prenotnull{trace_class} @pre \p index is lesser than the number of stream classes contained in the trace class \p trace_class (see - bt_ctf_trace_get_stream_class_count()). + bt_trace_get_stream_class_count()). @postrefcountsame{trace_class} -@sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID. -@sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class. +@sa bt_trace_get_stream_class_by_id(): Finds a stream class by ID. +@sa bt_trace_add_stream_class(): Adds a stream class to a trace class. */ -extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); +extern struct bt_stream_class *bt_trace_get_stream_class_by_index( + struct bt_trace *trace_class, uint64_t index); /** @brief Returns the stream class with ID \c id found in the CTF IR @@ -747,12 +747,12 @@ extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index( @postrefcountsame{trace_class} @postsuccessrefcountretinc -@sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained +@sa bt_trace_get_stream_class_by_index(): Returns the stream class contained in a given trace class at a given index. -@sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class. +@sa bt_trace_add_stream_class(): Adds a stream class to a trace class. */ -extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id( - struct bt_ctf_trace *trace_class, uint64_t id); +extern struct bt_stream_class *bt_trace_get_stream_class_by_id( + struct bt_trace *trace_class, uint64_t id); /** @brief Adds the CTF IR stream class \p stream_class to the @@ -781,12 +781,12 @@ resolving fails, then this function fails. @postsuccessrefcountinc{stream_class} @postsuccessfrozen{stream_class} -@sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained +@sa bt_trace_get_stream_class_by_index(): Returns the stream class contained in a given trace class at a given index. -@sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID. +@sa bt_trace_get_stream_class_by_id(): Finds a stream class by ID. */ -extern int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace_class, - struct bt_ctf_stream_class *stream_class); +extern int bt_trace_add_stream_class(struct bt_trace *trace_class, + struct bt_stream_class *stream_class); /** @} */ @@ -808,7 +808,7 @@ extern int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace_class, @prenotnull{trace_class} @postrefcountsame{trace_class} */ -extern int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace_class); +extern int64_t bt_trace_get_stream_count(struct bt_trace *trace_class); /** @brief Returns the stream at index \p index in the CTF IR trace @@ -822,11 +822,11 @@ extern int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace_class); @prenotnull{trace_class} @pre \p index is lesser than the number of streams contained in the trace class \p trace_class (see - bt_ctf_trace_get_stream_count()). + bt_trace_get_stream_count()). @postrefcountsame{trace_class} */ -extern struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index( - struct bt_ctf_trace *trace_class, uint64_t index); +extern struct bt_stream *bt_trace_get_stream_by_index( + struct bt_trace *trace_class, uint64_t index); /** @} */ @@ -843,15 +843,15 @@ It is guaranteed that a static trace class will never contain new streams, stream classes, or clock classes. A static class is always frozen. -This function returns #BT_TRUE if bt_ctf_trace_set_is_static() was +This function returns #BT_TRUE if bt_trace_set_is_static() was previously called on it. @param[in] trace_class Trace class to check. @returns #BT_TRUE if \p trace_class is static, -@sa bt_ctf_trace_set_is_static(): Makes a trace class static. +@sa bt_trace_set_is_static(): Makes a trace class static. */ -extern bt_bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace_class); +extern bt_bool bt_trace_is_static(struct bt_trace *trace_class); /** @brief Makes the CTF IR trace class \p trace_class static. @@ -859,14 +859,14 @@ extern bt_bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace_class); A static trace class is frozen and you cannot call any modifying function on it: -- bt_ctf_trace_add_stream_class() -- bt_ctf_trace_add_clock_class() -- bt_ctf_trace_set_environment_field() -- bt_ctf_trace_set_environment_field_integer() -- bt_ctf_trace_set_environment_field_string() -- bt_ctf_trace_add_is_static_listener() +- bt_trace_add_stream_class() +- bt_trace_add_clock_class() +- bt_trace_set_environment_field() +- bt_trace_set_environment_field_integer() +- bt_trace_set_environment_field_string() +- bt_trace_add_is_static_listener() -You cannot create a stream with bt_ctf_stream_create() with any of the +You cannot create a stream with bt_stream_create() with any of the stream classes of a static trace class. @param[in] trace_class Trace class to make static. @@ -876,34 +876,34 @@ stream classes of a static trace class. @postrefcountsame{trace_class} @postsuccessfrozen{trace_class} -@sa bt_ctf_trace_is_static(): Checks whether or not a given trace class +@sa bt_trace_is_static(): Checks whether or not a given trace class is static. -@sa bt_ctf_trace_add_is_static_listener(): Adds a listener to a trace +@sa bt_trace_add_is_static_listener(): Adds a listener to a trace class which is called when the trace class is made static. */ -extern int bt_ctf_trace_set_is_static(struct bt_ctf_trace *trace_class); +extern int bt_trace_set_is_static(struct bt_trace *trace_class); /** @brief Adds the listener \p listener to the CTF IR trace class \p trace_class which is called when the trace is made static. \p listener is called with \p data, the user data, the first time -bt_ctf_trace_set_is_static() is called on \p trace_class. +bt_trace_set_is_static() is called on \p trace_class. When the trace is destroyed, or when you remove the added listener with -bt_ctf_trace_remove_is_static_listener(), \p listener_removed is called +bt_trace_remove_is_static_listener(), \p listener_removed is called if it's not \c NULL. You can use \p listener_removed to free any dynamic data which exists only for the added listener. You cannot call any function which modifies \p trace_class during the execution of -\p listener_removed, including bt_ctf_trace_remove_is_static_listener(). +\p listener_removed, including bt_trace_remove_is_static_listener(). This function fails if \p trace_class is already static: you need to -check the condition first with bt_ctf_trace_is_static(). +check the condition first with bt_trace_is_static(). On success, this function returns a unique numeric identifier for this listener within \p trace. You can use this identifier to remove the specific listener you added with -bt_ctf_trace_remove_is_static_listener(). +bt_trace_remove_is_static_listener(). @param[in] trace_class Trace class to which to add the listener. @@ -923,17 +923,17 @@ bt_ctf_trace_remove_is_static_listener(). @pre \p trace_class is not static. @postrefcountsame{trace_class} -@sa bt_ctf_trace_remove_is_static_listener(): Removes a "trace is +@sa bt_trace_remove_is_static_listener(): Removes a "trace is static" listener from a trace class previously added with this function. -@sa bt_ctf_trace_is_static(): Checks whether or not a given trace class +@sa bt_trace_is_static(): Checks whether or not a given trace class is static. -@sa bt_ctf_trace_set_is_static(): Makes a trace class static. +@sa bt_trace_set_is_static(): Makes a trace class static. */ -extern int bt_ctf_trace_add_is_static_listener( - struct bt_ctf_trace *trace_class, - bt_ctf_trace_is_static_listener listener, - bt_ctf_trace_listener_removed listener_removed, void *data); +extern int bt_trace_add_is_static_listener( + struct bt_trace *trace_class, + bt_trace_is_static_listener listener, + bt_trace_listener_removed listener_removed, void *data); /** @brief Removes the "trace is static" listener identified by @@ -948,15 +948,15 @@ extern int bt_ctf_trace_add_is_static_listener( @prenotnull{trace_class} @pre \p listener_id is the identifier of a listener that you previously - added with bt_ctf_trace_add_is_static_listener() and did not + added with bt_trace_add_is_static_listener() and did not already remove with this function. @postrefcountsame{trace_class} -@sa bt_ctf_trace_add_is_static_listener(): Adds a listener to a trace +@sa bt_trace_add_is_static_listener(): Adds a listener to a trace class which is called when the trace class is made static. */ -extern int bt_ctf_trace_remove_is_static_listener( - struct bt_ctf_trace *trace_class, int listener_id); +extern int bt_trace_remove_is_static_listener( + struct bt_trace *trace_class, int listener_id); /** @brief Accepts the visitor \p visitor to visit the hierarchy of the @@ -976,13 +976,16 @@ class, the stream class itself, and all its children event classes. @prenotnull{trace_class} @prenotnull{visitor} */ -extern int bt_ctf_trace_visit(struct bt_ctf_trace *trace_class, - bt_ctf_visitor visitor, void *data); +extern int bt_trace_visit(struct bt_trace *trace_class, + bt_visitor visitor, void *data); /** @} */ /** @} */ +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_trace bt_trace + #ifdef __cplusplus } #endif diff --git a/include/babeltrace/ctf-ir/utils.h b/include/babeltrace/ctf-ir/utils.h index a209c5f5..91207302 100644 --- a/include/babeltrace/ctf-ir/utils.h +++ b/include/babeltrace/ctf-ir/utils.h @@ -67,7 +67,7 @@ or if it does not meet any other imposed requirement. @prenotnull{identifier} */ -extern bt_bool bt_ctf_identifier_is_valid(const char *identifier); +extern bt_bool bt_identifier_is_valid(const char *identifier); /** @} */ diff --git a/include/babeltrace/ctf-ir/validation-internal.h b/include/babeltrace/ctf-ir/validation-internal.h index e5636377..cf05a23b 100644 --- a/include/babeltrace/ctf-ir/validation-internal.h +++ b/include/babeltrace/ctf-ir/validation-internal.h @@ -32,10 +32,10 @@ #include #include -enum bt_ctf_validation_flag { - BT_CTF_VALIDATION_FLAG_TRACE = 1, - BT_CTF_VALIDATION_FLAG_STREAM = 2, - BT_CTF_VALIDATION_FLAG_EVENT = 4, +enum bt_validation_flag { + BT_VALIDATION_FLAG_TRACE = 1, + BT_VALIDATION_FLAG_STREAM = 2, + BT_VALIDATION_FLAG_EVENT = 4, }; /* @@ -47,14 +47,14 @@ enum bt_ctf_validation_flag { * * `valid_flags` contains the results of the validation. */ -struct bt_ctf_validation_output { - struct bt_ctf_field_type *packet_header_type; - struct bt_ctf_field_type *packet_context_type; - struct bt_ctf_field_type *event_header_type; - struct bt_ctf_field_type *stream_event_ctx_type; - struct bt_ctf_field_type *event_context_type; - struct bt_ctf_field_type *event_payload_type; - enum bt_ctf_validation_flag valid_flags; +struct bt_validation_output { + struct bt_field_type *packet_header_type; + struct bt_field_type *packet_context_type; + struct bt_field_type *event_header_type; + struct bt_field_type *stream_event_ctx_type; + struct bt_field_type *event_context_type; + struct bt_field_type *event_payload_type; + enum bt_validation_flag valid_flags; }; /* @@ -64,7 +64,7 @@ struct bt_ctf_validation_output { * validation structure, which also contains the results of the * validation. Copies can replace the original field types of a trace, * a stream class, and an event class using - * bt_ctf_validation_replace_types(). + * bt_validation_replace_types(). * * The current known validity of the field types of the trace, * stream class, and event class must be indicated with the @@ -78,16 +78,16 @@ struct bt_ctf_validation_output { * All parameters are owned by the caller. */ BT_HIDDEN -int bt_ctf_validate_class_types(struct bt_value *environment, - struct bt_ctf_field_type *packet_header_type, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type, - struct bt_ctf_field_type *stream_event_ctx_type, - struct bt_ctf_field_type *event_context_type, - struct bt_ctf_field_type *event_payload_type, +int bt_validate_class_types(struct bt_value *environment, + struct bt_field_type *packet_header_type, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type, + struct bt_field_type *stream_event_ctx_type, + struct bt_field_type *event_context_type, + struct bt_field_type *event_payload_type, int trace_valid, int stream_class_valid, int event_class_valid, - struct bt_ctf_validation_output *output, - enum bt_ctf_validation_flag validate_flags); + struct bt_validation_output *output, + enum bt_validation_flag validate_flags); /* * This function replaces the actual field types of a trace, a stream @@ -99,17 +99,17 @@ int bt_ctf_validate_class_types(struct bt_value *environment, * * Note that the field types that are not used in the validation output * structure are still owned by it at the end of this call. - * bt_ctf_validation_output_put_types() should be called to clean the + * bt_validation_output_put_types() should be called to clean the * structure. * * All parameters are owned by the caller. */ BT_HIDDEN -void bt_ctf_validation_replace_types(struct bt_ctf_trace *trace, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_event_class *event_class, - struct bt_ctf_validation_output *output, - enum bt_ctf_validation_flag replace_flags); +void bt_validation_replace_types(struct bt_trace *trace, + struct bt_stream_class *stream_class, + struct bt_event_class *event_class, + struct bt_validation_output *output, + enum bt_validation_flag replace_flags); /* * This function puts all the field types contained in a given @@ -118,7 +118,7 @@ void bt_ctf_validation_replace_types(struct bt_ctf_trace *trace, * `output` is owned by the caller and is not freed here. */ BT_HIDDEN -void bt_ctf_validation_output_put_types( - struct bt_ctf_validation_output *output); +void bt_validation_output_put_types( + struct bt_validation_output *output); #endif /* BABELTRACE_CTF_IR_VALIDATION_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/visitor-internal.h b/include/babeltrace/ctf-ir/visitor-internal.h index 7e5e634b..3f8d8092 100644 --- a/include/babeltrace/ctf-ir/visitor-internal.h +++ b/include/babeltrace/ctf-ir/visitor-internal.h @@ -32,20 +32,20 @@ typedef void *(*bt_child_accessor)(void *object, int index); typedef int64_t (*bt_child_count_accessor)(void *object); -typedef int (*bt_child_visitor)(void *object, bt_ctf_visitor visitor, +typedef int (*bt_child_visitor)(void *object, bt_visitor visitor, void *data); -struct bt_ctf_object { - enum bt_ctf_object_type type; +struct bt_visitor_object { + enum bt_visitor_object_type type; void *object; }; BT_HIDDEN -int visitor_helper(struct bt_ctf_object *root, +int visitor_helper(struct bt_visitor_object *root, bt_child_count_accessor child_counter, bt_child_accessor child_accessor, bt_child_visitor child_visitor, - bt_ctf_visitor visitor, + bt_visitor visitor, void *data); #endif /* BABELTRACE_CTF_IR_VISITOR_INTERNAL_H */ diff --git a/include/babeltrace/ctf-ir/visitor.h b/include/babeltrace/ctf-ir/visitor.h index 014333a6..06da7ac5 100644 --- a/include/babeltrace/ctf-ir/visitor.h +++ b/include/babeltrace/ctf-ir/visitor.h @@ -46,9 +46,9 @@ extern "C" { A CTF IR visitor is a function that you can use to visit the hierarchy of a \link ctfirtraceclass CTF IR trace class\endlink with -bt_ctf_trace_visit() or of a +bt_trace_visit() or of a \link ctfirstreamclass CTF IR stream class\endlink with -bt_ctf_stream_class_visit(). +bt_stream_class_visit(). The traversal of the object's hierarchy is always done in a pre-order fashion. @@ -65,14 +65,14 @@ pre-order fashion. */ /** -@struct bt_ctf_object +@struct bt_object @brief A CTF IR object wrapper. This structure wraps both a CTF IR object and its type -(see #bt_ctf_object_type). It is used in the visiting function. +(see #bt_object_type). It is used in the visiting function. -You can use the bt_ctf_object_get_type() and -bt_ctf_object_get_object() accessors to get the type and wrapped +You can use the bt_object_get_type() and +bt_object_get_object() accessors to get the type and wrapped CTF IR object of a CTF IR object wrapper. A CTF IR object wrapper has no reference count: do \em @@ -80,39 +80,39 @@ not use bt_put() or bt_get() on it. @sa ctfirvisitor */ -struct bt_ctf_object; +struct bt_visitor_object; /** @brief CTF IR object wrapper type. */ -enum bt_ctf_object_type { +enum bt_visitor_object_type { /// Unknown (used for errors). - BT_CTF_OBJECT_TYPE_UNKNOWN = -1, + BT_VISITOR_OBJECT_TYPE_UNKNOWN = -1, /// \ref ctfirtraceclass. - BT_CTF_OBJECT_TYPE_TRACE = 0, + BT_VISITOR_OBJECT_TYPE_TRACE = 0, /// \ref ctfirstreamclass. - BT_CTF_OBJECT_TYPE_STREAM_CLASS = 1, + BT_VISITOR_OBJECT_TYPE_STREAM_CLASS = 1, /// \ref ctfirstream. - BT_CTF_OBJECT_TYPE_STREAM = 2, + BT_VISITOR_OBJECT_TYPE_STREAM = 2, /// \ref ctfireventclass. - BT_CTF_OBJECT_TYPE_EVENT_CLASS = 3, + BT_VISITOR_OBJECT_TYPE_EVENT_CLASS = 3, /// \ref ctfirevent. - BT_CTF_OBJECT_TYPE_EVENT = 4, + BT_VISITOR_OBJECT_TYPE_EVENT = 4, /// Number of entries in this enumeration. - BT_CTF_OBJECT_TYPE_NR, + BT_VISITOR_OBJECT_TYPE_NR, }; /** @brief Visting function type. -A function of this type is called by bt_ctf_trace_visit() or -bt_ctf_stream_class_visit() when visiting the CTF IR object wrapper +A function of this type is called by bt_trace_visit() or +bt_stream_class_visit() when visiting the CTF IR object wrapper \p object. \p object has no reference count: do \em not use @@ -124,11 +124,11 @@ bt_put() or bt_get() on it. @prenotnull{object} -@sa bt_ctf_trace_visit(): Accepts a visitor to visit a trace class. -@sa bt_ctf_stream_class_visit(): Accepts a visitor to visit a stream +@sa bt_trace_visit(): Accepts a visitor to visit a trace class. +@sa bt_stream_class_visit(): Accepts a visitor to visit a stream class. */ -typedef int (*bt_ctf_visitor)(struct bt_ctf_object *object, +typedef int (*bt_visitor)(struct bt_visitor_object *object, void *data); /** @@ -140,10 +140,11 @@ typedef int (*bt_ctf_visitor)(struct bt_ctf_object *object, @prenotnull{object} -@sa bt_ctf_object_get_object(): Returns the object wrapped by a given +@sa bt_visitor_object_get_object(): Returns the object wrapped by a given CTF IR object wrapper. */ -enum bt_ctf_object_type bt_ctf_object_get_type(struct bt_ctf_object *object); +enum bt_visitor_object_type bt_visitor_object_get_type( + struct bt_visitor_object *object); /** @brief Returns the CTF IR object wrapped by the CTF IR object @@ -160,10 +161,10 @@ have your own reference. @prenotnull{object} @post The reference count of the returned object is not modified. -@sa bt_ctf_object_get_type(): Returns the type of a given +@sa bt_visitor_object_get_type(): Returns the type of a given CTF IR object wrapper. */ -void *bt_ctf_object_get_object(struct bt_ctf_object *object); +void *bt_visitor_object_get_object(struct bt_visitor_object *object); /** @} */ diff --git a/include/babeltrace/ctf-writer/clock-internal.h b/include/babeltrace/ctf-writer/clock-internal.h index b9e524a9..031cf8de 100644 --- a/include/babeltrace/ctf-writer/clock-internal.h +++ b/include/babeltrace/ctf-writer/clock-internal.h @@ -35,7 +35,7 @@ struct bt_ctf_clock { struct bt_object base; - struct bt_ctf_clock_class *clock_class; + struct bt_clock_class *clock_class; uint64_t value; /* Current clock value */ }; diff --git a/include/babeltrace/ctf-writer/event-fields.h b/include/babeltrace/ctf-writer/event-fields.h index ce13907a..f4b8216d 100644 --- a/include/babeltrace/ctf-writer/event-fields.h +++ b/include/babeltrace/ctf-writer/event-fields.h @@ -40,7 +40,7 @@ extern "C" { * bt_ctf_field_get and bt_ctf_field_put: increment and decrement the * field's reference count. * - * You may also use bt_ctf_get() and bt_ctf_put() with field objects. + * You may also use bt_get() and bt_put() with field objects. * * These functions ensure that the field won't be destroyed when it * is in use. The same number of get and put (plus one extra put to @@ -52,8 +52,8 @@ extern "C" { * * @param field Field instance. */ -extern void bt_ctf_field_get(struct bt_ctf_field *field); -extern void bt_ctf_field_put(struct bt_ctf_field *field); +extern void bt_ctf_field_get(struct bt_field *field); +extern void bt_ctf_field_put(struct bt_field *field); #ifdef __cplusplus } diff --git a/include/babeltrace/ctf-writer/event-types.h b/include/babeltrace/ctf-writer/event-types.h index e19c9cde..fa5cf8ca 100644 --- a/include/babeltrace/ctf-writer/event-types.h +++ b/include/babeltrace/ctf-writer/event-types.h @@ -40,7 +40,7 @@ extern "C" { * bt_ctf_field_type_get and bt_ctf_field_type_put: increment and decrement * the field type's reference count. * - * You may also use bt_ctf_get() and bt_ctf_put() with field type objects. + * You may also use bt_get() and bt_put() with field type objects. * * These functions ensure that the field type won't be destroyed while it * is in use. The same number of get and put (plus one extra put to @@ -52,8 +52,8 @@ extern "C" { * * @param type Field type. */ -extern void bt_ctf_field_type_get(struct bt_ctf_field_type *type); -extern void bt_ctf_field_type_put(struct bt_ctf_field_type *type); +extern void bt_ctf_field_type_get(struct bt_field_type *type); +extern void bt_ctf_field_type_put(struct bt_field_type *type); #ifdef __cplusplus } diff --git a/include/babeltrace/ctf-writer/event.h b/include/babeltrace/ctf-writer/event.h index 0928e083..804ad7a6 100644 --- a/include/babeltrace/ctf-writer/event.h +++ b/include/babeltrace/ctf-writer/event.h @@ -41,7 +41,7 @@ extern "C" { * bt_ctf_event_get and bt_ctf_event_put: increment and decrement * the event's reference count. * - * You may also use bt_ctf_get() and bt_ctf_put() with event objects. + * You may also use bt_get() and bt_put() with event objects. * * These functions ensure that the event won't be destroyed while it * is in use. The same number of get and put (plus one extra put to @@ -53,14 +53,14 @@ extern "C" { * * @param event Event instance. */ -extern void bt_ctf_event_get(struct bt_ctf_event *event); -extern void bt_ctf_event_put(struct bt_ctf_event *event); +extern void bt_ctf_event_get(struct bt_event *event); +extern void bt_ctf_event_put(struct bt_event *event); /* * bt_ctf_event_class_get and bt_ctf_event_class_put: increment and decrement * the event class' reference count. * - * You may also use bt_ctf_get() and bt_ctf_put() with event class objects. + * You may also use bt_get() and bt_put() with event class objects. * * These functions ensure that the event class won't be destroyed while it * is in use. The same number of get and put (plus one extra put to @@ -72,8 +72,8 @@ extern void bt_ctf_event_put(struct bt_ctf_event *event); * * @param event_class Event class. */ -extern void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class); -extern void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class); +extern void bt_ctf_event_class_get(struct bt_event_class *event_class); +extern void bt_ctf_event_class_put(struct bt_event_class *event_class); #ifdef __cplusplus } diff --git a/include/babeltrace/ctf-writer/serialize-internal.h b/include/babeltrace/ctf-writer/serialize-internal.h index 781a3dd7..93708277 100644 --- a/include/babeltrace/ctf-writer/serialize-internal.h +++ b/include/babeltrace/ctf-writer/serialize-internal.h @@ -43,7 +43,7 @@ #define PACKET_LEN_INCREMENT (bt_common_get_page_size() * 8 * CHAR_BIT) -struct bt_ctf_stream_pos { +struct bt_stream_pos { int fd; int prot; /* mmap protection */ int flags; /* mmap flags */ @@ -57,17 +57,17 @@ struct bt_ctf_stream_pos { }; BT_HIDDEN -int bt_ctf_field_integer_write(struct bt_ctf_field_integer *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order); +int bt_field_integer_write(struct bt_field_integer *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order); BT_HIDDEN -int bt_ctf_field_floating_point_write(struct bt_ctf_field_floating_point *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order); +int bt_field_floating_point_write(struct bt_field_floating_point *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order); static inline -int bt_ctf_stream_pos_access_ok(struct bt_ctf_stream_pos *pos, uint64_t bit_len) +int bt_stream_pos_access_ok(struct bt_stream_pos *pos, uint64_t bit_len) { uint64_t max_len; @@ -93,11 +93,11 @@ int bt_ctf_stream_pos_access_ok(struct bt_ctf_stream_pos *pos, uint64_t bit_len) } static inline -int bt_ctf_stream_pos_move(struct bt_ctf_stream_pos *pos, uint64_t bit_offset) +int bt_stream_pos_move(struct bt_stream_pos *pos, uint64_t bit_offset) { int ret = 0; - ret = bt_ctf_stream_pos_access_ok(pos, bit_offset); + ret = bt_stream_pos_access_ok(pos, bit_offset); if (!ret) { goto end; } @@ -107,14 +107,14 @@ end: } static inline -int bt_ctf_stream_pos_align(struct bt_ctf_stream_pos *pos, uint64_t bit_offset) +int bt_stream_pos_align(struct bt_stream_pos *pos, uint64_t bit_offset) { - return bt_ctf_stream_pos_move(pos, + return bt_stream_pos_move(pos, offset_align(pos->offset, bit_offset)); } static inline -char *bt_ctf_stream_pos_get_addr(struct bt_ctf_stream_pos *pos) +char *bt_stream_pos_get_addr(struct bt_stream_pos *pos) { /* Only makes sense to get the address after aligning on CHAR_BIT */ assert(!(pos->offset % CHAR_BIT)); @@ -123,7 +123,7 @@ char *bt_ctf_stream_pos_get_addr(struct bt_ctf_stream_pos *pos) } static inline -int bt_ctf_stream_pos_init(struct bt_ctf_stream_pos *pos, +int bt_stream_pos_init(struct bt_stream_pos *pos, int fd, int open_flags) { pos->fd = fd; @@ -145,7 +145,7 @@ int bt_ctf_stream_pos_init(struct bt_ctf_stream_pos *pos, } static inline -int bt_ctf_stream_pos_fini(struct bt_ctf_stream_pos *pos) +int bt_stream_pos_fini(struct bt_stream_pos *pos) { if (pos->base_mma) { int ret; @@ -161,7 +161,7 @@ int bt_ctf_stream_pos_fini(struct bt_ctf_stream_pos *pos) } BT_HIDDEN -void bt_ctf_stream_pos_packet_seek(struct bt_ctf_stream_pos *pos, size_t index, +void bt_stream_pos_packet_seek(struct bt_stream_pos *pos, size_t index, int whence); #endif /* BABELTRACE_CTF_WRITER_SERIALIZE_INTERNAL_H */ diff --git a/include/babeltrace/ctf-writer/stream-class.h b/include/babeltrace/ctf-writer/stream-class.h index 09973906..a1d0ba92 100644 --- a/include/babeltrace/ctf-writer/stream-class.h +++ b/include/babeltrace/ctf-writer/stream-class.h @@ -37,7 +37,7 @@ extern "C" { #endif /* - * bt_ctf_stream_class_set_clock: assign a clock to a stream class. + * bt_stream_class_set_clock: assign a clock to a stream class. * * Assign a clock to a stream class. This clock will be sampled each time an * event is appended to an instance of this stream class. @@ -47,29 +47,16 @@ extern "C" { * * Returns 0 on success, a negative value on error. */ -extern int bt_ctf_stream_class_set_clock( - struct bt_ctf_stream_class *stream_class, +extern int bt_stream_class_set_clock( + struct bt_stream_class *stream_class, struct bt_ctf_clock *clock); -extern struct bt_ctf_clock *bt_ctf_stream_class_get_clock( - struct bt_ctf_stream_class *stream_class); +extern struct bt_ctf_clock *bt_stream_class_get_clock( + struct bt_stream_class *stream_class); + +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_stream_class_set_clock bt_stream_class_set_clock -/* - * bt_ctf_stream_class_get and bt_ctf_stream_class_put: increment and - * decrement the stream class' reference count. - * - * You may also use bt_ctf_get() and bt_ctf_put() with stream class objects. - * - * These functions ensure that the stream class won't be destroyed while it - * is in use. The same number of get and put (plus one extra put to - * release the initial reference done at creation) have to be done to - * destroy a stream class. - * - * When the stream class' reference count is decremented to 0 by a - * bt_ctf_stream_class_put, the stream class is freed. - * - * @param stream_class Stream class. - */ extern void bt_ctf_stream_class_get(struct bt_ctf_stream_class *stream_class); extern void bt_ctf_stream_class_put(struct bt_ctf_stream_class *stream_class); diff --git a/include/babeltrace/ctf-writer/stream.h b/include/babeltrace/ctf-writer/stream.h index 56b6bff8..6d36e543 100644 --- a/include/babeltrace/ctf-writer/stream.h +++ b/include/babeltrace/ctf-writer/stream.h @@ -30,6 +30,7 @@ * http://www.efficios.com/ctf */ +#include #include #include @@ -38,7 +39,7 @@ extern "C" { #endif /* - * bt_ctf_stream_get_discarded_events_count: get the number of discarded + * bt_stream_get_discarded_events_count: get the number of discarded * events associated with this stream. * * Note that discarded events are not stored if the stream's packet @@ -49,11 +50,11 @@ extern "C" { * * Returns the number of discarded events, a negative value on error. */ -extern int bt_ctf_stream_get_discarded_events_count( - struct bt_ctf_stream *stream, uint64_t *count); +extern int bt_stream_get_discarded_events_count( + struct bt_stream *stream, uint64_t *count); /* - * bt_ctf_stream_append_discarded_events: increment discarded events count. + * bt_stream_append_discarded_events: increment discarded events count. * * Increase the current packet's discarded event count. Has no effect if the * stream class' packet context has no "events_discarded" field. @@ -62,17 +63,17 @@ extern int bt_ctf_stream_get_discarded_events_count( * @param event_count Number of discarded events to add to the stream's current * packet. */ -extern void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, +extern void bt_stream_append_discarded_events(struct bt_stream *stream, uint64_t event_count); /* - * bt_ctf_stream_append_event: append an event to the stream. + * bt_stream_append_event: append an event to the stream. * * Append "event" to the stream's current packet. The stream's associated clock * will be sampled during this call. The event shall not be modified after * being appended to a stream. The stream will share the event's ownership by * incrementing its reference count. The current packet is not flushed to disk - * until the next call to bt_ctf_stream_flush. + * until the next call to bt_stream_flush. * * The stream event context will be sampled for every appended event if * a stream event context was defined. @@ -82,21 +83,21 @@ extern void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, * * Returns 0 on success, a negative value on error. */ -extern int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, - struct bt_ctf_event *event); +extern int bt_stream_append_event(struct bt_stream *stream, + struct bt_event *event); /* - * bt_ctf_stream_get_packet_header: get a stream's packet header. + * bt_stream_get_packet_header: get a stream's packet header. * * @param stream Stream instance. * * Returns a field instance on success, NULL on error. */ -extern struct bt_ctf_field *bt_ctf_stream_get_packet_header( - struct bt_ctf_stream *stream); +extern struct bt_field *bt_stream_get_packet_header( + struct bt_stream *stream); /* - * bt_ctf_stream_set_packet_header: set a stream's packet header. + * bt_stream_set_packet_header: set a stream's packet header. * * The packet header's type must match the trace's packet header * type. @@ -106,22 +107,22 @@ extern struct bt_ctf_field *bt_ctf_stream_get_packet_header( * * Returns a field instance on success, NULL on error. */ -extern int bt_ctf_stream_set_packet_header( - struct bt_ctf_stream *stream, - struct bt_ctf_field *packet_header); +extern int bt_stream_set_packet_header( + struct bt_stream *stream, + struct bt_field *packet_header); /* - * bt_ctf_stream_get_packet_context: get a stream's packet context. + * bt_stream_get_packet_context: get a stream's packet context. * * @param stream Stream instance. * * Returns a field instance on success, NULL on error. */ -extern struct bt_ctf_field *bt_ctf_stream_get_packet_context( - struct bt_ctf_stream *stream); +extern struct bt_field *bt_stream_get_packet_context( + struct bt_stream *stream); /* - * bt_ctf_stream_set_packet_context: set a stream's packet context. + * bt_stream_set_packet_context: set a stream's packet context. * * The packet context's type must match the stream class' packet * context type. @@ -131,12 +132,12 @@ extern struct bt_ctf_field *bt_ctf_stream_get_packet_context( * * Returns a field instance on success, NULL on error. */ -extern int bt_ctf_stream_set_packet_context( - struct bt_ctf_stream *stream, - struct bt_ctf_field *packet_context); +extern int bt_stream_set_packet_context( + struct bt_stream *stream, + struct bt_field *packet_context); /* - * bt_ctf_stream_flush: flush a stream. + * bt_stream_flush: flush a stream. * * The stream's current packet's events will be flushed, thus closing the * current packet. Events subsequently appended to the stream will be @@ -150,28 +151,19 @@ extern int bt_ctf_stream_set_packet_context( * * Returns 0 on success, a negative value on error. */ -extern int bt_ctf_stream_flush(struct bt_ctf_stream *stream); +extern int bt_stream_flush(struct bt_stream *stream); -extern int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream); +extern int bt_stream_is_writer(struct bt_stream *stream); -/* - * bt_ctf_stream_get and bt_ctf_stream_put: increment and decrement the - * stream's reference count. - * - * You may also use bt_ctf_get() and bt_ctf_put() with stream objects. - * - * These functions ensure that the stream won't be destroyed while it - * is in use. The same number of get and put (plus one extra put to - * release the initial reference done at creation) have to be done to - * destroy a stream. - * - * When the stream's reference count is decremented to 0 by a - * bt_ctf_stream_put, the stream is freed. - * - * @param stream Stream instance. - */ -extern void bt_ctf_stream_get(struct bt_ctf_stream *stream); -extern void bt_ctf_stream_put(struct bt_ctf_stream *stream); +/* Pre-2.0 CTF writer compatibility */ +#define bt_ctf_stream_get_discarded_events_count bt_stream_get_discarded_events_count +#define bt_ctf_stream_append_discarded_events bt_stream_append_discarded_events +#define bt_ctf_stream_append_event bt_stream_append_event +#define bt_ctf_stream_get_packet_context bt_stream_get_packet_context +#define bt_ctf_stream_flush bt_stream_flush + +extern void bt_ctf_stream_get(struct bt_stream *stream); +extern void bt_ctf_stream_put(struct bt_stream *stream); #ifdef __cplusplus } diff --git a/include/babeltrace/ctf-writer/writer-internal.h b/include/babeltrace/ctf-writer/writer-internal.h index 17d4af7d..ced679ec 100644 --- a/include/babeltrace/ctf-writer/writer-internal.h +++ b/include/babeltrace/ctf-writer/writer-internal.h @@ -38,7 +38,7 @@ struct bt_ctf_writer { struct bt_object base; int frozen; /* Protects attributes that can't be changed mid-trace */ - struct bt_ctf_trace *trace; + struct bt_trace *trace; GString *path; int metadata_fd; }; diff --git a/include/babeltrace/ctf-writer/writer.h b/include/babeltrace/ctf-writer/writer.h index 140bc5fd..e1f28bc0 100644 --- a/include/babeltrace/ctf-writer/writer.h +++ b/include/babeltrace/ctf-writer/writer.h @@ -31,6 +31,8 @@ */ #include +#include +#include #include #ifdef __cplusplus diff --git a/include/babeltrace/endian-internal.h b/include/babeltrace/endian-internal.h index fc48c3c5..fdc4f27f 100644 --- a/include/babeltrace/endian-internal.h +++ b/include/babeltrace/endian-internal.h @@ -240,9 +240,9 @@ #endif /* FLOAT_WORD_ORDER */ #if (BYTE_ORDER == BIG_ENDIAN) -# define BT_CTF_MY_BYTE_ORDER BT_CTF_BYTE_ORDER_BIG_ENDIAN +# define BT_MY_BYTE_ORDER BT_BYTE_ORDER_BIG_ENDIAN #else -# define BT_CTF_MY_BYTE_ORDER BT_CTF_BYTE_ORDER_LITTLE_ENDIAN +# define BT_MY_BYTE_ORDER BT_BYTE_ORDER_LITTLE_ENDIAN #endif #endif /* _BABELTRACE_ENDIAN_H */ diff --git a/include/babeltrace/graph/clock-class-priority-map-internal.h b/include/babeltrace/graph/clock-class-priority-map-internal.h index 89ba1c9d..cb73a2c6 100644 --- a/include/babeltrace/graph/clock-class-priority-map-internal.h +++ b/include/babeltrace/graph/clock-class-priority-map-internal.h @@ -37,14 +37,14 @@ struct bt_clock_class_priority_map { struct bt_object base; - /* Array of struct bt_ctf_clock_class *, owned by this */ + /* Array of struct bt_clock_class *, owned by this */ GPtrArray *entries; - /* struct bt_ctf_clock_class * (weak) to priority (uint64_t *) */ + /* struct bt_clock_class * (weak) to priority (uint64_t *) */ GHashTable *prios; /* Clock class (weak) with the currently highest priority */ - struct bt_ctf_clock_class *highest_prio_cc; + struct bt_clock_class *highest_prio_cc; bt_bool frozen; }; diff --git a/include/babeltrace/graph/clock-class-priority-map.h b/include/babeltrace/graph/clock-class-priority-map.h index 949f49de..cc471889 100644 --- a/include/babeltrace/graph/clock-class-priority-map.h +++ b/include/babeltrace/graph/clock-class-priority-map.h @@ -33,7 +33,7 @@ extern "C" { #endif -struct bt_ctf_clock_class; +struct bt_clock_class; /** @defgroup graphclockclassprioritymap Clock class priority map @@ -139,7 +139,7 @@ extern int64_t bt_clock_class_priority_map_get_clock_class_count( @sa bt_clock_class_priority_map_add_clock_class(): Adds a clock class to a clock class priority map. */ -extern struct bt_ctf_clock_class * +extern struct bt_clock_class * bt_clock_class_priority_map_get_clock_class_by_index( struct bt_clock_class_priority_map *clock_class_priority_map, uint64_t index); @@ -171,7 +171,7 @@ bt_clock_class_priority_map_get_clock_class_by_index( @sa bt_clock_class_priority_map_add_clock_class(): Adds a clock class to a clock class priority map. */ -extern struct bt_ctf_clock_class * +extern struct bt_clock_class * bt_clock_class_priority_map_get_clock_class_by_name( struct bt_clock_class_priority_map *clock_class_priority_map, const char *name); @@ -207,7 +207,7 @@ this function returns. @sa bt_clock_class_priority_map_add_clock_class(): Adds a clock class to a clock class priority map. */ -extern struct bt_ctf_clock_class * +extern struct bt_clock_class * bt_clock_class_priority_map_get_highest_priority_clock_class( struct bt_clock_class_priority_map *clock_class_priority_map); @@ -241,7 +241,7 @@ bt_clock_class_priority_map_get_highest_priority_clock_class( */ extern int bt_clock_class_priority_map_get_clock_class_priority( struct bt_clock_class_priority_map *clock_class_priority_map, - struct bt_ctf_clock_class *clock_class, uint64_t *priority); + struct bt_clock_class *clock_class, uint64_t *priority); /** @brief Adds the CTF IR clock class \p clock_class to the clock class @@ -279,7 +279,7 @@ map. */ extern int bt_clock_class_priority_map_add_clock_class( struct bt_clock_class_priority_map *clock_class_priority_map, - struct bt_ctf_clock_class *clock_class, uint64_t priority); + struct bt_clock_class *clock_class, uint64_t priority); /** @brief Creates a copy of the clock class priority map diff --git a/include/babeltrace/graph/notification-discarded-elements-internal.h b/include/babeltrace/graph/notification-discarded-elements-internal.h index 1a339ab0..131050d1 100644 --- a/include/babeltrace/graph/notification-discarded-elements-internal.h +++ b/include/babeltrace/graph/notification-discarded-elements-internal.h @@ -30,37 +30,37 @@ #include struct bt_clock_class_priority_map; -struct bt_ctf_stream; +struct bt_stream; struct bt_notification_discarded_elements { struct bt_notification parent; - struct bt_ctf_stream *stream; - struct bt_ctf_clock_value *begin_clock_value; - struct bt_ctf_clock_value *end_clock_value; + struct bt_stream *stream; + struct bt_clock_value *begin_clock_value; + struct bt_clock_value *end_clock_value; int64_t count; }; BT_HIDDEN struct bt_notification *bt_notification_discarded_elements_create( enum bt_notification_type type, - struct bt_ctf_stream *stream, - struct bt_ctf_clock_value *begin_clock_value, - struct bt_ctf_clock_value *end_clock_value, + struct bt_stream *stream, + struct bt_clock_value *begin_clock_value, + struct bt_clock_value *end_clock_value, uint64_t count); BT_HIDDEN -struct bt_ctf_stream *bt_notification_discarded_elements_get_stream( +struct bt_stream *bt_notification_discarded_elements_get_stream( enum bt_notification_type type, struct bt_notification *notification); BT_HIDDEN -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_elements_get_begin_clock_value( enum bt_notification_type type, struct bt_notification *notification); BT_HIDDEN -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_elements_get_end_clock_value( enum bt_notification_type type, struct bt_notification *notification); @@ -71,7 +71,7 @@ int64_t bt_notification_discarded_elements_get_count( struct bt_notification *notification); static inline -struct bt_ctf_stream *bt_notification_discarded_elements_borrow_stream( +struct bt_stream *bt_notification_discarded_elements_borrow_stream( struct bt_notification *notification) { struct bt_notification_discarded_elements *discarded_elems_notif; diff --git a/include/babeltrace/graph/notification-discarded-events.h b/include/babeltrace/graph/notification-discarded-events.h index d76b6df6..6a760f86 100644 --- a/include/babeltrace/graph/notification-discarded-events.h +++ b/include/babeltrace/graph/notification-discarded-events.h @@ -31,21 +31,21 @@ extern "C" { struct bt_notification; struct bt_clock_class_priority_map; -struct bt_ctf_clock_class; -struct bt_ctf_stream; +struct bt_clock_class; +struct bt_stream; -extern struct bt_ctf_clock_value * +extern struct bt_clock_value * bt_notification_discarded_events_get_begin_clock_value( struct bt_notification *notification); -extern struct bt_ctf_clock_value * +extern struct bt_clock_value * bt_notification_discarded_events_get_end_clock_value( struct bt_notification *notification); extern int64_t bt_notification_discarded_events_get_count( struct bt_notification *notification); -extern struct bt_ctf_stream *bt_notification_discarded_events_get_stream( +extern struct bt_stream *bt_notification_discarded_events_get_stream( struct bt_notification *notification); #ifdef __cplusplus diff --git a/include/babeltrace/graph/notification-discarded-packets.h b/include/babeltrace/graph/notification-discarded-packets.h index 1e7bd51e..4fc6a4b4 100644 --- a/include/babeltrace/graph/notification-discarded-packets.h +++ b/include/babeltrace/graph/notification-discarded-packets.h @@ -31,21 +31,21 @@ extern "C" { struct bt_notification; struct bt_clock_class_priority_map; -struct bt_ctf_clock_class; -struct bt_ctf_stream; +struct bt_clock_class; +struct bt_stream; -extern struct bt_ctf_clock_value * +extern struct bt_clock_value * bt_notification_discarded_packets_get_begin_clock_value( struct bt_notification *notification); -extern struct bt_ctf_clock_value * +extern struct bt_clock_value * bt_notification_discarded_packets_get_end_clock_value( struct bt_notification *notification); extern int64_t bt_notification_discarded_packets_get_count( struct bt_notification *notification); -extern struct bt_ctf_stream *bt_notification_discarded_packets_get_stream( +extern struct bt_stream *bt_notification_discarded_packets_get_stream( struct bt_notification *notification); #ifdef __cplusplus diff --git a/include/babeltrace/graph/notification-event-internal.h b/include/babeltrace/graph/notification-event-internal.h index de4a6a12..bfc20929 100644 --- a/include/babeltrace/graph/notification-event-internal.h +++ b/include/babeltrace/graph/notification-event-internal.h @@ -38,12 +38,12 @@ extern "C" { struct bt_notification_event { struct bt_notification parent; - struct bt_ctf_event *event; + struct bt_event *event; struct bt_clock_class_priority_map *cc_prio_map; }; static inline -struct bt_ctf_event *bt_notification_event_borrow_event( +struct bt_event *bt_notification_event_borrow_event( struct bt_notification *notif) { struct bt_notification_event *notif_event = container_of(notif, diff --git a/include/babeltrace/graph/notification-event.h b/include/babeltrace/graph/notification-event.h index 1dd62662..af2666b8 100644 --- a/include/babeltrace/graph/notification-event.h +++ b/include/babeltrace/graph/notification-event.h @@ -32,7 +32,7 @@ extern "C" { #endif struct bt_notification; -struct bt_ctf_event; +struct bt_event; struct bt_clock_class_priority_map; /***BT_NOTIFICATION_TYPE_EVENT ***/ @@ -45,7 +45,7 @@ struct bt_clock_class_priority_map; * @see #bt_notification_type */ extern struct bt_notification *bt_notification_event_create( - struct bt_ctf_event *event, + struct bt_event *event, struct bt_clock_class_priority_map *clock_class_priority_map); /** @@ -54,9 +54,9 @@ extern struct bt_notification *bt_notification_event_create( * @param notification Event notification instance * @returns An event instance * - * @see #bt_ctf_event + * @see #bt_event */ -extern struct bt_ctf_event *bt_notification_event_get_event( +extern struct bt_event *bt_notification_event_get_event( struct bt_notification *notification); extern struct bt_clock_class_priority_map * diff --git a/include/babeltrace/graph/notification-inactivity.h b/include/babeltrace/graph/notification-inactivity.h index 9ddf51da..44dade89 100644 --- a/include/babeltrace/graph/notification-inactivity.h +++ b/include/babeltrace/graph/notification-inactivity.h @@ -29,7 +29,7 @@ extern "C" { struct bt_notification; struct bt_clock_class_priority_map; -struct bt_ctf_clock_class; +struct bt_clock_class; extern struct bt_notification *bt_notification_inactivity_create( struct bt_clock_class_priority_map *clock_class_priority_map); @@ -38,13 +38,13 @@ extern struct bt_clock_class_priority_map * bt_notification_inactivity_get_clock_class_priority_map( struct bt_notification *notification); -extern struct bt_ctf_clock_value *bt_notification_inactivity_get_clock_value( +extern struct bt_clock_value *bt_notification_inactivity_get_clock_value( struct bt_notification *notification, - struct bt_ctf_clock_class *clock_class); + struct bt_clock_class *clock_class); extern int bt_notification_inactivity_set_clock_value( struct bt_notification *notification, - struct bt_ctf_clock_value *clock_value); + struct bt_clock_value *clock_value); #ifdef __cplusplus } diff --git a/include/babeltrace/graph/notification-internal.h b/include/babeltrace/graph/notification-internal.h index 4ffef1c5..631d0adf 100644 --- a/include/babeltrace/graph/notification-internal.h +++ b/include/babeltrace/graph/notification-internal.h @@ -34,7 +34,7 @@ #include #include -typedef struct bt_ctf_stream *(*get_stream_func)( +typedef struct bt_stream *(*get_stream_func)( struct bt_notification *notification); struct bt_notification { diff --git a/include/babeltrace/graph/notification-iterator-internal.h b/include/babeltrace/graph/notification-iterator-internal.h index bf795a3a..ab545008 100644 --- a/include/babeltrace/graph/notification-iterator-internal.h +++ b/include/babeltrace/graph/notification-iterator-internal.h @@ -111,7 +111,7 @@ struct bt_notification_iterator_private_connection { * other notifications which refer to this stream can be * delivered by this iterator. * - * The key (struct bt_ctf_stream *) is not owned by this. The + * The key (struct bt_stream *) is not owned by this. The * value is an allocated state structure. */ GHashTable *stream_states; diff --git a/include/babeltrace/graph/notification-packet-internal.h b/include/babeltrace/graph/notification-packet-internal.h index 4d519544..7164d55b 100644 --- a/include/babeltrace/graph/notification-packet-internal.h +++ b/include/babeltrace/graph/notification-packet-internal.h @@ -33,16 +33,16 @@ struct bt_notification_packet_begin { struct bt_notification parent; - struct bt_ctf_packet *packet; + struct bt_packet *packet; }; struct bt_notification_packet_end { struct bt_notification parent; - struct bt_ctf_packet *packet; + struct bt_packet *packet; }; static inline -struct bt_ctf_packet *bt_notification_packet_begin_borrow_packet( +struct bt_packet *bt_notification_packet_begin_borrow_packet( struct bt_notification *notif) { struct bt_notification_packet_begin *notif_packet_begin = @@ -54,7 +54,7 @@ struct bt_ctf_packet *bt_notification_packet_begin_borrow_packet( } static inline -struct bt_ctf_packet *bt_notification_packet_end_borrow_packet( +struct bt_packet *bt_notification_packet_end_borrow_packet( struct bt_notification *notif) { struct bt_notification_packet_end *notif_packet_end = diff --git a/include/babeltrace/graph/notification-packet.h b/include/babeltrace/graph/notification-packet.h index 3a980910..38c4f6e6 100644 --- a/include/babeltrace/graph/notification-packet.h +++ b/include/babeltrace/graph/notification-packet.h @@ -32,20 +32,20 @@ extern "C" { #endif struct bt_notification; -struct bt_ctf_packet; +struct bt_packet; extern struct bt_notification *bt_notification_packet_begin_create( - struct bt_ctf_packet *packet); + struct bt_packet *packet); extern struct bt_notification *bt_notification_packet_end_create( - struct bt_ctf_packet *packet); + struct bt_packet *packet); /*** BT_NOTIFICATION_TYPE_PACKET_BEGIN ***/ -extern struct bt_ctf_packet *bt_notification_packet_begin_get_packet( +extern struct bt_packet *bt_notification_packet_begin_get_packet( struct bt_notification *notification); /*** BT_NOTIFICATION_TYPE_PACKET_END ***/ -extern struct bt_ctf_packet *bt_notification_packet_end_get_packet( +extern struct bt_packet *bt_notification_packet_end_get_packet( struct bt_notification *notification); #ifdef __cplusplus diff --git a/include/babeltrace/graph/notification-stream-internal.h b/include/babeltrace/graph/notification-stream-internal.h index b170e4e6..df1b3dcb 100644 --- a/include/babeltrace/graph/notification-stream-internal.h +++ b/include/babeltrace/graph/notification-stream-internal.h @@ -33,16 +33,16 @@ struct bt_notification_stream_begin { struct bt_notification parent; - struct bt_ctf_stream *stream; + struct bt_stream *stream; }; struct bt_notification_stream_end { struct bt_notification parent; - struct bt_ctf_stream *stream; + struct bt_stream *stream; }; static inline -struct bt_ctf_stream *bt_notification_stream_begin_borrow_stream( +struct bt_stream *bt_notification_stream_begin_borrow_stream( struct bt_notification *notif) { struct bt_notification_stream_begin *notif_stream_begin = @@ -54,7 +54,7 @@ struct bt_ctf_stream *bt_notification_stream_begin_borrow_stream( } static inline -struct bt_ctf_stream *bt_notification_stream_end_borrow_stream( +struct bt_stream *bt_notification_stream_end_borrow_stream( struct bt_notification *notif) { struct bt_notification_stream_end *notif_stream_end = diff --git a/include/babeltrace/graph/notification-stream.h b/include/babeltrace/graph/notification-stream.h index c022343b..bb4c5d60 100644 --- a/include/babeltrace/graph/notification-stream.h +++ b/include/babeltrace/graph/notification-stream.h @@ -31,19 +31,19 @@ extern "C" { #endif -struct bt_ctf_notification; -struct bt_ctf_stream; +struct bt_notification; +struct bt_stream; extern struct bt_notification *bt_notification_stream_begin_create( - struct bt_ctf_stream *stream); + struct bt_stream *stream); extern struct bt_notification *bt_notification_stream_end_create( - struct bt_ctf_stream *stream); + struct bt_stream *stream); -extern struct bt_ctf_stream *bt_notification_stream_begin_get_stream( +extern struct bt_stream *bt_notification_stream_begin_get_stream( struct bt_notification *notification); -extern struct bt_ctf_stream *bt_notification_stream_end_get_stream( +extern struct bt_stream *bt_notification_stream_end_get_stream( struct bt_notification *notification); #ifdef __cplusplus diff --git a/lib/ctf-ir/attributes.c b/lib/ctf-ir/attributes.c index 44e0e230..f3d6ba10 100644 --- a/lib/ctf-ir/attributes.c +++ b/lib/ctf-ir/attributes.c @@ -35,11 +35,11 @@ #include #include -#define BT_CTF_ATTR_NAME_INDEX 0 -#define BT_CTF_ATTR_VALUE_INDEX 1 +#define BT_ATTR_NAME_INDEX 0 +#define BT_ATTR_VALUE_INDEX 1 BT_HIDDEN -struct bt_value *bt_ctf_attributes_create(void) +struct bt_value *bt_attributes_create(void) { struct bt_value *attr_obj; @@ -70,20 +70,20 @@ struct bt_value *bt_ctf_attributes_create(void) } BT_HIDDEN -void bt_ctf_attributes_destroy(struct bt_value *attr_obj) +void bt_attributes_destroy(struct bt_value *attr_obj) { BT_LOGD("Destroying attributes object: addr=%p", attr_obj); bt_put(attr_obj); } BT_HIDDEN -int64_t bt_ctf_attributes_get_count(struct bt_value *attr_obj) +int64_t bt_attributes_get_count(struct bt_value *attr_obj) { return bt_value_array_size(attr_obj); } BT_HIDDEN -const char *bt_ctf_attributes_get_field_name(struct bt_value *attr_obj, +const char *bt_attributes_get_field_name(struct bt_value *attr_obj, uint64_t index) { int rc; @@ -104,11 +104,11 @@ const char *bt_ctf_attributes_get_field_name(struct bt_value *attr_obj, } attr_field_name_obj = bt_value_array_get(attr_field_obj, - BT_CTF_ATTR_NAME_INDEX); + BT_ATTR_NAME_INDEX); if (!attr_field_name_obj) { BT_LOGE("Cannot get attribute array value's element by index: " "value-addr=%p, index=%" PRIu64, attr_field_obj, - (uint64_t) BT_CTF_ATTR_NAME_INDEX); + (uint64_t) BT_ATTR_NAME_INDEX); goto end; } @@ -126,7 +126,7 @@ end: } BT_HIDDEN -struct bt_value *bt_ctf_attributes_get_field_value(struct bt_value *attr_obj, +struct bt_value *bt_attributes_get_field_value(struct bt_value *attr_obj, uint64_t index) { struct bt_value *value_obj = NULL; @@ -145,11 +145,11 @@ struct bt_value *bt_ctf_attributes_get_field_value(struct bt_value *attr_obj, } value_obj = bt_value_array_get(attr_field_obj, - BT_CTF_ATTR_VALUE_INDEX); + BT_ATTR_VALUE_INDEX); if (!value_obj) { BT_LOGE("Cannot get attribute array value's element by index: " "value-addr=%p, index=%" PRIu64, attr_field_obj, - (uint64_t) BT_CTF_ATTR_VALUE_INDEX); + (uint64_t) BT_ATTR_VALUE_INDEX); } end: @@ -158,7 +158,7 @@ end: } static -struct bt_value *bt_ctf_attributes_get_field_by_name( +struct bt_value *bt_attributes_get_field_by_name( struct bt_value *attr_obj, const char *name) { uint64_t i; @@ -218,7 +218,7 @@ error: } BT_HIDDEN -int bt_ctf_attributes_set_field_value(struct bt_value *attr_obj, +int bt_attributes_set_field_value(struct bt_value *attr_obj, const char *name, struct bt_value *value_obj) { int ret = 0; @@ -232,10 +232,10 @@ int bt_ctf_attributes_set_field_value(struct bt_value *attr_obj, goto end; } - attr_field_obj = bt_ctf_attributes_get_field_by_name(attr_obj, name); + attr_field_obj = bt_attributes_get_field_by_name(attr_obj, name); if (attr_field_obj) { ret = bt_value_array_set(attr_field_obj, - BT_CTF_ATTR_VALUE_INDEX, value_obj); + BT_ATTR_VALUE_INDEX, value_obj); goto end; } @@ -268,7 +268,7 @@ end: } BT_HIDDEN -struct bt_value *bt_ctf_attributes_get_field_value_by_name( +struct bt_value *bt_attributes_get_field_value_by_name( struct bt_value *attr_obj, const char *name) { struct bt_value *value_obj = NULL; @@ -280,7 +280,7 @@ struct bt_value *bt_ctf_attributes_get_field_value_by_name( goto end; } - attr_field_obj = bt_ctf_attributes_get_field_by_name(attr_obj, name); + attr_field_obj = bt_attributes_get_field_by_name(attr_obj, name); if (!attr_field_obj) { BT_LOGD("Cannot find attributes object's field by name: " "value-addr=%p, name=\"%s\"", attr_obj, name); @@ -288,11 +288,11 @@ struct bt_value *bt_ctf_attributes_get_field_value_by_name( } value_obj = bt_value_array_get(attr_field_obj, - BT_CTF_ATTR_VALUE_INDEX); + BT_ATTR_VALUE_INDEX); if (!value_obj) { BT_LOGE("Cannot get attribute array value's element by index: " "value-addr=%p, index=%" PRIu64, attr_field_obj, - (uint64_t) BT_CTF_ATTR_VALUE_INDEX); + (uint64_t) BT_ATTR_VALUE_INDEX); } end: @@ -302,7 +302,7 @@ end: } BT_HIDDEN -int bt_ctf_attributes_freeze(struct bt_value *attr_obj) +int bt_attributes_freeze(struct bt_value *attr_obj) { uint64_t i; int64_t count; @@ -326,7 +326,7 @@ int bt_ctf_attributes_freeze(struct bt_value *attr_obj) for (i = 0; i < count; ++i) { struct bt_value *obj = NULL; - obj = bt_ctf_attributes_get_field_value(attr_obj, i); + obj = bt_attributes_get_field_value(attr_obj, i); if (!obj) { BT_LOGE("Cannot get attributes object's field value by index: " "value-addr=%p, index=%" PRIu64, diff --git a/lib/ctf-ir/clock-class.c b/lib/ctf-ir/clock-class.c index 2dd6536a..5d623c47 100644 --- a/lib/ctf-ir/clock-class.c +++ b/lib/ctf-ir/clock-class.c @@ -41,15 +41,15 @@ #include static -void bt_ctf_clock_class_destroy(struct bt_object *obj); +void bt_clock_class_destroy(struct bt_object *obj); BT_HIDDEN -bt_bool bt_ctf_clock_class_is_valid(struct bt_ctf_clock_class *clock_class) +bt_bool bt_clock_class_is_valid(struct bt_clock_class *clock_class) { return clock_class && clock_class->name; } -int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_name(struct bt_clock_class *clock_class, const char *name) { int ret = 0; @@ -62,12 +62,12 @@ int bt_ctf_clock_class_set_name(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } - if (bt_ctf_validate_identifier(name)) { + if (bt_identifier_is_valid(name)) { BT_LOGE("Clock class's name is not a valid CTF identifier: " "addr=%p, name=\"%s\"", clock_class, name); @@ -94,7 +94,7 @@ end: } static -bool validate_freq(struct bt_ctf_clock_class *clock_class, +bool validate_freq(struct bt_clock_class *clock_class, const char *name, uint64_t freq) { bool is_valid = true; @@ -111,11 +111,11 @@ end: return is_valid; } -struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, +struct bt_clock_class *bt_clock_class_create(const char *name, uint64_t freq) { int ret; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; BT_LOGD("Creating default clock class object: name=\"%s\"", name); @@ -125,7 +125,7 @@ struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, goto error; } - clock_class = g_new0(struct bt_ctf_clock_class, 1); + clock_class = g_new0(struct bt_clock_class, 1); if (!clock_class) { BT_LOGE_STR("Failed to allocate one clock class."); goto error; @@ -133,10 +133,10 @@ struct bt_ctf_clock_class *bt_ctf_clock_class_create(const char *name, clock_class->precision = 1; clock_class->frequency = freq; - bt_object_init(clock_class, bt_ctf_clock_class_destroy); + bt_object_init(clock_class, bt_clock_class_destroy); if (name) { - ret = bt_ctf_clock_class_set_name(clock_class, name); + ret = bt_clock_class_set_name(clock_class, name); if (ret) { BT_LOGE("Cannot set clock class's name: " "addr=%p, name=\"%s\"", @@ -153,7 +153,7 @@ error: return clock_class; } -const char *bt_ctf_clock_class_get_name(struct bt_ctf_clock_class *clock_class) +const char *bt_clock_class_get_name(struct bt_clock_class *clock_class) { const char *ret = NULL; @@ -170,8 +170,8 @@ end: return ret; } -const char *bt_ctf_clock_class_get_description( - struct bt_ctf_clock_class *clock_class) +const char *bt_clock_class_get_description( + struct bt_clock_class *clock_class) { const char *ret = NULL; @@ -187,7 +187,7 @@ end: return ret; } -int bt_ctf_clock_class_set_description(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_description(struct bt_clock_class *clock_class, const char *desc) { int ret = 0; @@ -195,7 +195,7 @@ int bt_ctf_clock_class_set_description(struct bt_ctf_clock_class *clock_class, if (!clock_class || !desc) { BT_LOGW("Invalid parameter: clock class or description is NULL: " "clock-class-addr=%p, name=\"%s\", desc-addr=%p", - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), desc); ret = -1; goto end; @@ -203,7 +203,7 @@ int bt_ctf_clock_class_set_description(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } @@ -212,13 +212,13 @@ int bt_ctf_clock_class_set_description(struct bt_ctf_clock_class *clock_class, ret = clock_class->description ? 0 : -1; BT_LOGV("Set clock class's description: addr=%p, " "name=\"%s\", desc=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class), desc); + clock_class, bt_clock_class_get_name(clock_class), desc); end: return ret; } -uint64_t bt_ctf_clock_class_get_frequency( - struct bt_ctf_clock_class *clock_class) +uint64_t bt_clock_class_get_frequency( + struct bt_clock_class *clock_class) { uint64_t ret = -1ULL; @@ -232,7 +232,7 @@ end: return ret; } -int bt_ctf_clock_class_set_frequency(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_frequency(struct bt_clock_class *clock_class, uint64_t freq) { int ret = 0; @@ -240,12 +240,12 @@ int bt_ctf_clock_class_set_frequency(struct bt_ctf_clock_class *clock_class, if (!clock_class) { BT_LOGW("Invalid parameter: clock class is NULL or frequency is invalid: " "addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } - if (!validate_freq(clock_class, bt_ctf_clock_class_get_name(clock_class), + if (!validate_freq(clock_class, bt_clock_class_get_name(clock_class), freq)) { /* validate_freq() logs errors */ goto end; @@ -253,19 +253,19 @@ int bt_ctf_clock_class_set_frequency(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } clock_class->frequency = freq; BT_LOGV("Set clock class's frequency: addr=%p, name=\"%s\", freq=%" PRIu64, - clock_class, bt_ctf_clock_class_get_name(clock_class), freq); + clock_class, bt_clock_class_get_name(clock_class), freq); end: return ret; } -uint64_t bt_ctf_clock_class_get_precision(struct bt_ctf_clock_class *clock_class) +uint64_t bt_clock_class_get_precision(struct bt_clock_class *clock_class) { uint64_t ret = -1ULL; @@ -279,7 +279,7 @@ end: return ret; } -int bt_ctf_clock_class_set_precision(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_precision(struct bt_clock_class *clock_class, uint64_t precision) { int ret = 0; @@ -287,7 +287,7 @@ int bt_ctf_clock_class_set_precision(struct bt_ctf_clock_class *clock_class, if (!clock_class || precision == -1ULL) { BT_LOGW("Invalid parameter: clock class is NULL or precision is invalid: " "addr=%p, name=\"%s\", precision=%" PRIu64, - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), precision); ret = -1; goto end; @@ -295,20 +295,20 @@ int bt_ctf_clock_class_set_precision(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } clock_class->precision = precision; BT_LOGV("Set clock class's precision: addr=%p, name=\"%s\", precision=%" PRIu64, - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), precision); end: return ret; } -int bt_ctf_clock_class_get_offset_s(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_get_offset_s(struct bt_clock_class *clock_class, int64_t *offset_s) { int ret = 0; @@ -316,7 +316,7 @@ int bt_ctf_clock_class_get_offset_s(struct bt_ctf_clock_class *clock_class, if (!clock_class || !offset_s) { BT_LOGW("Invalid parameter: clock class or offset pointer is NULL: " "clock-class-addr=%p, name=\"%s\", offset-addr=%p", - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), offset_s); ret = -1; goto end; @@ -327,7 +327,7 @@ end: return ret; } -int bt_ctf_clock_class_set_offset_s(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_offset_s(struct bt_clock_class *clock_class, int64_t offset_s) { int ret = 0; @@ -340,7 +340,7 @@ int bt_ctf_clock_class_set_offset_s(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } @@ -348,13 +348,13 @@ int bt_ctf_clock_class_set_offset_s(struct bt_ctf_clock_class *clock_class, clock_class->offset_s = offset_s; BT_LOGV("Set clock class's offset (seconds): " "addr=%p, name=\"%s\", offset-s=%" PRId64, - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), offset_s); end: return ret; } -int bt_ctf_clock_class_get_offset_cycles(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_get_offset_cycles(struct bt_clock_class *clock_class, int64_t *offset) { int ret = 0; @@ -362,7 +362,7 @@ int bt_ctf_clock_class_get_offset_cycles(struct bt_ctf_clock_class *clock_class, if (!clock_class || !offset) { BT_LOGW("Invalid parameter: clock class or offset pointer is NULL: " "clock-class-addr=%p, name=\"%s\", offset-addr=%p", - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), offset); ret = -1; goto end; @@ -373,7 +373,7 @@ end: return ret; } -int bt_ctf_clock_class_set_offset_cycles(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_offset_cycles(struct bt_clock_class *clock_class, int64_t offset) { int ret = 0; @@ -386,19 +386,19 @@ int bt_ctf_clock_class_set_offset_cycles(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } clock_class->offset = offset; BT_LOGV("Set clock class's offset (cycles): addr=%p, name=\"%s\", offset-cycles=%" PRId64, - clock_class, bt_ctf_clock_class_get_name(clock_class), offset); + clock_class, bt_clock_class_get_name(clock_class), offset); end: return ret; } -bt_bool bt_ctf_clock_class_is_absolute(struct bt_ctf_clock_class *clock_class) +bt_bool bt_clock_class_is_absolute(struct bt_clock_class *clock_class) { int ret = -1; @@ -412,7 +412,7 @@ end: return ret; } -int bt_ctf_clock_class_set_is_absolute(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_is_absolute(struct bt_clock_class *clock_class, bt_bool is_absolute) { int ret = 0; @@ -425,21 +425,21 @@ int bt_ctf_clock_class_set_is_absolute(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } clock_class->absolute = !!is_absolute; BT_LOGV("Set clock class's absolute flag: addr=%p, name=\"%s\", is-absolute=%d", - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), is_absolute); end: return ret; } -const unsigned char *bt_ctf_clock_class_get_uuid( - struct bt_ctf_clock_class *clock_class) +const unsigned char *bt_clock_class_get_uuid( + struct bt_clock_class *clock_class) { const unsigned char *ret; @@ -451,7 +451,7 @@ const unsigned char *bt_ctf_clock_class_get_uuid( if (!clock_class->uuid_set) { BT_LOGV("Clock class's UUID is not set: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = NULL; goto end; } @@ -461,7 +461,7 @@ end: return ret; } -int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, +int bt_clock_class_set_uuid(struct bt_clock_class *clock_class, const unsigned char *uuid) { int ret = 0; @@ -469,7 +469,7 @@ int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, if (!clock_class || !uuid) { BT_LOGW("Invalid parameter: clock class or UUID is NULL: " "clock-class-addr=%p, name=\"%s\", uuid-addr=%p", - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), uuid); ret = -1; goto end; @@ -477,7 +477,7 @@ int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, if (clock_class->frozen) { BT_LOGW("Invalid parameter: clock class is frozen: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } @@ -486,7 +486,7 @@ int bt_ctf_clock_class_set_uuid(struct bt_ctf_clock_class *clock_class, clock_class->uuid_set = 1; BT_LOGV("Set clock class's UUID: addr=%p, name=\"%s\", " "uuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"", - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), (unsigned int) uuid[0], (unsigned int) uuid[1], (unsigned int) uuid[2], @@ -528,7 +528,7 @@ static uint64_t ns_from_value(uint64_t frequency, uint64_t value) } BT_HIDDEN -void bt_ctf_clock_class_freeze(struct bt_ctf_clock_class *clock_class) +void bt_clock_class_freeze(struct bt_clock_class *clock_class) { if (!clock_class) { BT_LOGW_STR("Invalid parameter: clock class is NULL."); @@ -537,25 +537,25 @@ void bt_ctf_clock_class_freeze(struct bt_ctf_clock_class *clock_class) if (!clock_class->frozen) { BT_LOGD("Freezing clock class: addr=%p, name=\"%s\"", - clock_class, bt_ctf_clock_class_get_name(clock_class)); + clock_class, bt_clock_class_get_name(clock_class)); clock_class->frozen = 1; } } BT_HIDDEN -void bt_ctf_clock_class_serialize(struct bt_ctf_clock_class *clock_class, +void bt_clock_class_serialize(struct bt_clock_class *clock_class, struct metadata_context *context) { unsigned char *uuid; BT_LOGD("Serializing clock class's metadata: clock-class-addr=%p, " "name=\"%s\", metadata-context-addr=%p", clock_class, - bt_ctf_clock_class_get_name(clock_class), context); + bt_clock_class_get_name(clock_class), context); if (!clock_class || !context) { BT_LOGW("Invalid parameter: clock class or metadata context is NULL: " "clock-class-addr=%p, name=\"%s\", metadata-context-addr=%p", - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), context); return; } @@ -593,13 +593,13 @@ void bt_ctf_clock_class_serialize(struct bt_ctf_clock_class *clock_class, } static -void bt_ctf_clock_class_destroy(struct bt_object *obj) +void bt_clock_class_destroy(struct bt_object *obj) { - struct bt_ctf_clock_class *clock_class; + struct bt_clock_class *clock_class; - clock_class = container_of(obj, struct bt_ctf_clock_class, base); + clock_class = container_of(obj, struct bt_clock_class, base); BT_LOGD("Destroying clock class: addr=%p, name=\"%s\"", - obj, bt_ctf_clock_class_get_name(clock_class)); + obj, bt_clock_class_get_name(clock_class)); if (clock_class->name) { g_string_free(clock_class->name, TRUE); } @@ -611,26 +611,26 @@ void bt_ctf_clock_class_destroy(struct bt_object *obj) } static -void bt_ctf_clock_value_destroy(struct bt_object *obj) +void bt_clock_value_destroy(struct bt_object *obj) { - struct bt_ctf_clock_value *value; + struct bt_clock_value *value; if (!obj) { return; } - value = container_of(obj, struct bt_ctf_clock_value, base); + value = container_of(obj, struct bt_clock_value, base); BT_LOGD("Destroying clock value: addr=%p, clock-class-addr=%p, " "clock-class-name=\"%s\"", obj, value->clock_class, - bt_ctf_clock_class_get_name(value->clock_class)); + bt_clock_class_get_name(value->clock_class)); bt_put(value->clock_class); g_free(value); } static -void set_ns_from_epoch(struct bt_ctf_clock_value *clock_value) +void set_ns_from_epoch(struct bt_clock_value *clock_value) { - struct bt_ctf_clock_class *clock_class = clock_value->clock_class; + struct bt_clock_class *clock_class = clock_value->clock_class; int64_t diff; int64_t s_ns; uint64_t u_ns; @@ -759,43 +759,43 @@ end: } } -struct bt_ctf_clock_value *bt_ctf_clock_value_create( - struct bt_ctf_clock_class *clock_class, uint64_t value) +struct bt_clock_value *bt_clock_value_create( + struct bt_clock_class *clock_class, uint64_t value) { - struct bt_ctf_clock_value *ret = NULL; + struct bt_clock_value *ret = NULL; BT_LOGD("Creating clock value object: clock-class-addr=%p, " "clock-class-name=\"%s\", value=%" PRIu64, clock_class, - bt_ctf_clock_class_get_name(clock_class), value); + bt_clock_class_get_name(clock_class), value); if (!clock_class) { BT_LOGW_STR("Invalid parameter: clock class is NULL."); goto end; } - ret = g_new0(struct bt_ctf_clock_value, 1); + ret = g_new0(struct bt_clock_value, 1); if (!ret) { BT_LOGE_STR("Failed to allocate one clock value."); goto end; } - bt_object_init(ret, bt_ctf_clock_value_destroy); + bt_object_init(ret, bt_clock_value_destroy); ret->clock_class = bt_get(clock_class); ret->value = value; set_ns_from_epoch(ret); - bt_ctf_clock_class_freeze(clock_class); + bt_clock_class_freeze(clock_class); BT_LOGD("Created clock value object: clock-value-addr=%p, " "clock-class-addr=%p, clock-class-name=\"%s\", " "ns-from-epoch=%" PRId64 ", ns-from-epoch-overflows=%d", - ret, clock_class, bt_ctf_clock_class_get_name(clock_class), + ret, clock_class, bt_clock_class_get_name(clock_class), ret->ns_from_epoch, ret->ns_from_epoch_overflows); end: return ret; } -int bt_ctf_clock_value_get_value( - struct bt_ctf_clock_value *clock_value, uint64_t *raw_value) +int bt_clock_value_get_value( + struct bt_clock_value *clock_value, uint64_t *raw_value) { int ret = 0; @@ -812,7 +812,7 @@ end: return ret; } -int bt_ctf_clock_value_get_value_ns_from_epoch(struct bt_ctf_clock_value *value, +int bt_clock_value_get_value_ns_from_epoch(struct bt_clock_value *value, int64_t *ret_value_ns) { int ret = 0; @@ -844,10 +844,10 @@ end: return ret; } -struct bt_ctf_clock_class *bt_ctf_clock_value_get_class( - struct bt_ctf_clock_value *clock_value) +struct bt_clock_class *bt_clock_value_get_class( + struct bt_clock_value *clock_value) { - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; if (!clock_value) { BT_LOGW_STR("Invalid parameter: clock value is NULL."); diff --git a/lib/ctf-ir/event-class.c b/lib/ctf-ir/event-class.c index b8bd96ec..4c969978 100644 --- a/lib/ctf-ir/event-class.c +++ b/lib/ctf-ir/event-class.c @@ -48,12 +48,12 @@ #include static -void bt_ctf_event_class_destroy(struct bt_object *obj); +void bt_event_class_destroy(struct bt_object *obj); -struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name) +struct bt_event_class *bt_event_class_create(const char *name) { struct bt_value *obj = NULL; - struct bt_ctf_event_class *event_class = NULL; + struct bt_event_class *event_class = NULL; BT_LOGD("Creating event class object: name=\"%s\"", name); @@ -63,14 +63,14 @@ struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name) goto error; } - event_class = g_new0(struct bt_ctf_event_class, 1); + event_class = g_new0(struct bt_event_class, 1); if (!event_class) { BT_LOGE_STR("Failed to allocate one event class."); goto error; } - bt_object_init(event_class, bt_ctf_event_class_destroy); - event_class->fields = bt_ctf_field_type_structure_create(); + bt_object_init(event_class, bt_event_class_destroy); + event_class->fields = bt_field_type_structure_create(); if (!event_class->fields) { BT_LOGE_STR("Cannot create event class's initial payload field type object."); goto error; @@ -89,10 +89,10 @@ struct bt_ctf_event_class *bt_ctf_event_class_create(const char *name) goto error; } - event_class->log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED; + event_class->log_level = BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED; BT_PUT(obj); BT_LOGD("Created event class object: addr=%p, name=\"%s\"", - event_class, bt_ctf_event_class_get_name(event_class)); + event_class, bt_event_class_get_name(event_class)); return event_class; error: @@ -101,7 +101,7 @@ error: return event_class; } -const char *bt_ctf_event_class_get_name(struct bt_ctf_event_class *event_class) +const char *bt_event_class_get_name(struct bt_event_class *event_class) { const char *name = NULL; @@ -116,7 +116,7 @@ end: return name; } -int64_t bt_ctf_event_class_get_id(struct bt_ctf_event_class *event_class) +int64_t bt_event_class_get_id(struct bt_event_class *event_class) { int64_t ret = 0; @@ -132,7 +132,7 @@ end: return ret; } -int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class, +int bt_event_class_set_id(struct bt_event_class *event_class, uint64_t id_param) { int ret = 0; @@ -147,8 +147,8 @@ int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class, if (event_class->frozen) { BT_LOGW("Invalid parameter: event class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); ret = -1; goto end; } @@ -156,7 +156,7 @@ int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class, if (id < 0) { BT_LOGW("Invalid parameter: invalid event class's ID: " "addr=%p, name=\"%s\", id=%" PRIu64, - event_class, bt_ctf_event_class_get_name(event_class), + event_class, bt_event_class_get_name(event_class), id_param); ret = -1; goto end; @@ -165,20 +165,20 @@ int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class, event_class->id = id; BT_LOGV("Set event class's ID: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), id); + event_class, bt_event_class_get_name(event_class), id); end: return ret; } -enum bt_ctf_event_class_log_level bt_ctf_event_class_get_log_level( - struct bt_ctf_event_class *event_class) +enum bt_event_class_log_level bt_event_class_get_log_level( + struct bt_event_class *event_class) { - enum bt_ctf_event_class_log_level log_level; + enum bt_event_class_log_level log_level; if (!event_class) { BT_LOGW_STR("Invalid parameter: event class is NULL."); - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN; + log_level = BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN; goto end; } @@ -188,8 +188,8 @@ end: return log_level; } -int bt_ctf_event_class_set_log_level(struct bt_ctf_event_class *event_class, - enum bt_ctf_event_class_log_level log_level) +int bt_event_class_set_log_level(struct bt_event_class *event_class, + enum bt_event_class_log_level log_level) { int ret = 0; @@ -202,35 +202,35 @@ int bt_ctf_event_class_set_log_level(struct bt_ctf_event_class *event_class, if (event_class->frozen) { BT_LOGW("Invalid parameter: event class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); ret = -1; goto end; } switch (log_level) { - case BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE: - case BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG: + case BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED: + case BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY: + case BT_EVENT_CLASS_LOG_LEVEL_ALERT: + case BT_EVENT_CLASS_LOG_LEVEL_CRITICAL: + case BT_EVENT_CLASS_LOG_LEVEL_ERROR: + case BT_EVENT_CLASS_LOG_LEVEL_WARNING: + case BT_EVENT_CLASS_LOG_LEVEL_NOTICE: + case BT_EVENT_CLASS_LOG_LEVEL_INFO: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE: + case BT_EVENT_CLASS_LOG_LEVEL_DEBUG: break; default: BT_LOGW("Invalid parameter: unknown event class log level: " "addr=%p, name=\"%s\", id=%" PRId64 ", log-level=%d", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), log_level); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), log_level); ret = -1; goto end; } @@ -238,16 +238,16 @@ int bt_ctf_event_class_set_log_level(struct bt_ctf_event_class *event_class, event_class->log_level = log_level; BT_LOGV("Set event class's log level: " "addr=%p, name=\"%s\", id=%" PRId64 ", log-level=%s", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), - bt_ctf_event_class_log_level_string(log_level)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), + bt_event_class_log_level_string(log_level)); end: return ret; } -const char *bt_ctf_event_class_get_emf_uri( - struct bt_ctf_event_class *event_class) +const char *bt_event_class_get_emf_uri( + struct bt_event_class *event_class) { const char *emf_uri = NULL; @@ -264,7 +264,7 @@ end: return emf_uri; } -int bt_ctf_event_class_set_emf_uri(struct bt_ctf_event_class *event_class, +int bt_event_class_set_emf_uri(struct bt_event_class *event_class, const char *emf_uri) { int ret = 0; @@ -284,8 +284,8 @@ int bt_ctf_event_class_set_emf_uri(struct bt_ctf_event_class *event_class, if (event_class->frozen) { BT_LOGW("Invalid parameter: event class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); ret = -1; goto end; } @@ -294,32 +294,32 @@ int bt_ctf_event_class_set_emf_uri(struct bt_ctf_event_class *event_class, g_string_assign(event_class->emf_uri, emf_uri); BT_LOGV("Set event class's EMF URI: " "addr=%p, name=\"%s\", id=%" PRId64 ", emf-uri=\"%s\"", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), emf_uri); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), emf_uri); } else { g_string_assign(event_class->emf_uri, ""); BT_LOGV("Reset event class's EMF URI: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); } end: return ret; } -struct bt_ctf_stream_class *bt_ctf_event_class_get_stream_class( - struct bt_ctf_event_class *event_class) +struct bt_stream_class *bt_event_class_get_stream_class( + struct bt_event_class *event_class) { return event_class ? - bt_get(bt_ctf_event_class_borrow_stream_class(event_class)) : + bt_get(bt_event_class_borrow_stream_class(event_class)) : NULL; } -struct bt_ctf_field_type *bt_ctf_event_class_get_payload_type( - struct bt_ctf_event_class *event_class) +struct bt_field_type *bt_event_class_get_payload_type( + struct bt_event_class *event_class) { - struct bt_ctf_field_type *payload = NULL; + struct bt_field_type *payload = NULL; if (!event_class) { BT_LOGW_STR("Invalid parameter: event class is NULL."); @@ -332,8 +332,8 @@ end: return payload; } -int bt_ctf_event_class_set_payload_type(struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *payload) +int bt_event_class_set_payload_type(struct bt_event_class *event_class, + struct bt_field_type *payload) { int ret = 0; @@ -343,15 +343,15 @@ int bt_ctf_event_class_set_payload_type(struct bt_ctf_event_class *event_class, goto end; } - if (payload && bt_ctf_field_type_get_type_id(payload) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (payload && bt_field_type_get_type_id(payload) != + BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: event class's payload field type must be a structure: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "payload-ft-addr=%p, payload-ft-id=%s", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), payload, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(payload))); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), payload, + bt_field_type_id_string( + bt_field_type_get_type_id(payload))); ret = -1; goto end; } @@ -361,14 +361,14 @@ int bt_ctf_event_class_set_payload_type(struct bt_ctf_event_class *event_class, BT_LOGV("Set event class's payload field type: " "event-class-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", payload-ft-addr=%p", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), payload); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), payload); end: return ret; } -int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *type, +int bt_event_class_add_field(struct bt_event_class *event_class, + struct bt_field_type *type, const char *name) { int ret = 0; @@ -381,11 +381,11 @@ int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, goto end; } - if (bt_ctf_validate_identifier(name)) { + if (bt_identifier_is_valid(name)) { BT_LOGW("Invalid parameter: event class's payload field type's field name is not a valid CTF identifier: " "addr=%p, name=\"%s\", id=%" PRId64 ", field-name=\"%s\"", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), name); ret = -1; goto end; @@ -394,8 +394,8 @@ int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, if (event_class->frozen) { BT_LOGW("Invalid parameter: event class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); ret = -1; goto end; } @@ -403,27 +403,27 @@ int bt_ctf_event_class_add_field(struct bt_ctf_event_class *event_class, if (!event_class->fields) { BT_LOGW("Event class has no payload field type: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); ret = -1; goto end; } - assert(bt_ctf_field_type_get_type_id(event_class->fields) == - BT_CTF_FIELD_TYPE_ID_STRUCT); - ret = bt_ctf_field_type_structure_add_field(event_class->fields, + assert(bt_field_type_get_type_id(event_class->fields) == + BT_FIELD_TYPE_ID_STRUCT); + ret = bt_field_type_structure_add_field(event_class->fields, type, name); BT_LOGV("Added field to event class's payload field type: " "event-class-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", field-name=\"%s\", ft-addr=%p", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), name, type); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), name, type); end: return ret; } -int64_t bt_ctf_event_class_get_payload_type_field_count( - struct bt_ctf_event_class *event_class) +int64_t bt_event_class_get_payload_type_field_count( + struct bt_event_class *event_class) { int64_t ret; @@ -436,22 +436,22 @@ int64_t bt_ctf_event_class_get_payload_type_field_count( if (!event_class->fields) { BT_LOGV("Event class has no payload field type: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); ret = (int64_t) -1; goto end; } - assert(bt_ctf_field_type_get_type_id(event_class->fields) == - BT_CTF_FIELD_TYPE_ID_STRUCT); - ret = bt_ctf_field_type_structure_get_field_count(event_class->fields); + assert(bt_field_type_get_type_id(event_class->fields) == + BT_FIELD_TYPE_ID_STRUCT); + ret = bt_field_type_structure_get_field_count(event_class->fields); end: return ret; } -int bt_ctf_event_class_get_payload_type_field_by_index( - struct bt_ctf_event_class *event_class, - const char **field_name, struct bt_ctf_field_type **field_type, +int bt_event_class_get_payload_type_field_by_index( + struct bt_event_class *event_class, + const char **field_name, struct bt_field_type **field_type, uint64_t index) { int ret; @@ -465,26 +465,26 @@ int bt_ctf_event_class_get_payload_type_field_by_index( if (!event_class->fields) { BT_LOGV("Event class has no payload field type: " "addr=%p, name=\"%s\", id=%" PRId64 ", index=%" PRIu64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), index); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), index); ret = -1; goto end; } - assert(bt_ctf_field_type_get_type_id(event_class->fields) == - BT_CTF_FIELD_TYPE_ID_STRUCT); - ret = bt_ctf_field_type_structure_get_field(event_class->fields, + assert(bt_field_type_get_type_id(event_class->fields) == + BT_FIELD_TYPE_ID_STRUCT); + ret = bt_field_type_structure_get_field_by_index(event_class->fields, field_name, field_type, index); end: return ret; } -struct bt_ctf_field_type * -bt_ctf_event_class_get_payload_type_field_type_by_name( - struct bt_ctf_event_class *event_class, const char *name) +struct bt_field_type * +bt_event_class_get_payload_type_field_type_by_name( + struct bt_event_class *event_class, const char *name) { GQuark name_quark; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; if (!event_class || !name) { BT_LOGW("Invalid parameter: event class or name is NULL: " @@ -496,13 +496,13 @@ bt_ctf_event_class_get_payload_type_field_type_by_name( if (!event_class->fields) { BT_LOGV("Event class has no payload field type: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); goto end; } - assert(bt_ctf_field_type_get_type_id(event_class->fields) == - BT_CTF_FIELD_TYPE_ID_STRUCT); + assert(bt_field_type_get_type_id(event_class->fields) == + BT_FIELD_TYPE_ID_STRUCT); name_quark = g_quark_try_string(name); if (!name_quark) { BT_LOGE("Cannot get GQuark: string=\"%s\"", name); @@ -513,16 +513,16 @@ bt_ctf_event_class_get_payload_type_field_type_by_name( * No need to increment field_type's reference count since getting it * from the structure already does. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( event_class->fields, name); end: return field_type; } -struct bt_ctf_field_type *bt_ctf_event_class_get_context_type( - struct bt_ctf_event_class *event_class) +struct bt_field_type *bt_event_class_get_context_type( + struct bt_event_class *event_class) { - struct bt_ctf_field_type *context_type = NULL; + struct bt_field_type *context_type = NULL; if (!event_class) { BT_LOGW_STR("Invalid parameter: event class is NULL."); @@ -532,8 +532,8 @@ struct bt_ctf_field_type *bt_ctf_event_class_get_context_type( if (!event_class->context) { BT_LOGV("Event class has no context field type: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); goto end; } @@ -543,9 +543,9 @@ end: return context_type; } -int bt_ctf_event_class_set_context_type( - struct bt_ctf_event_class *event_class, - struct bt_ctf_field_type *context) +int bt_event_class_set_context_type( + struct bt_event_class *event_class, + struct bt_field_type *context) { int ret = 0; @@ -558,21 +558,21 @@ int bt_ctf_event_class_set_context_type( if (event_class->frozen) { BT_LOGW("Invalid parameter: event class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); ret = -1; goto end; } - if (context && bt_ctf_field_type_get_type_id(context) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (context && bt_field_type_get_type_id(context) != + BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: event class's context field type must be a structure: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "context-ft-id=%s", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(context))); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), + bt_field_type_id_string( + bt_field_type_get_type_id(context))); ret = -1; goto end; } @@ -582,34 +582,34 @@ int bt_ctf_event_class_set_context_type( BT_LOGV("Set event class's context field type: " "event-class-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", context-ft-addr=%p", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), context); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), context); end: return ret; } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_event_class_get(struct bt_ctf_event_class *event_class) +void bt_ctf_event_class_get(struct bt_event_class *event_class) { bt_get(event_class); } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class) +void bt_ctf_event_class_put(struct bt_event_class *event_class) { bt_put(event_class); } static -void bt_ctf_event_class_destroy(struct bt_object *obj) +void bt_event_class_destroy(struct bt_object *obj) { - struct bt_ctf_event_class *event_class; + struct bt_event_class *event_class; - event_class = container_of(obj, struct bt_ctf_event_class, base); + event_class = container_of(obj, struct bt_event_class, base); BT_LOGD("Destroying event class: addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); g_string_free(event_class->name, TRUE); g_string_free(event_class->emf_uri, TRUE); BT_LOGD_STR("Putting context field type."); @@ -620,7 +620,7 @@ void bt_ctf_event_class_destroy(struct bt_object *obj) } BT_HIDDEN -void bt_ctf_event_class_freeze(struct bt_ctf_event_class *event_class) +void bt_event_class_freeze(struct bt_event_class *event_class) { assert(event_class); @@ -629,17 +629,17 @@ void bt_ctf_event_class_freeze(struct bt_ctf_event_class *event_class) } BT_LOGD("Freezing event class: addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); event_class->frozen = 1; BT_LOGD_STR("Freezing event class's context field type."); - bt_ctf_field_type_freeze(event_class->context); + bt_field_type_freeze(event_class->context); BT_LOGD_STR("Freezing event class's payload field type."); - bt_ctf_field_type_freeze(event_class->fields); + bt_field_type_freeze(event_class->fields); } BT_HIDDEN -int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, +int bt_event_class_serialize(struct bt_event_class *event_class, struct metadata_context *context) { int ret = 0; @@ -650,8 +650,8 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, BT_LOGD("Serializing event class's metadata: " "event-class-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", metadata-context-addr=%p", - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), context); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), context); context->current_indentation_level = 1; g_string_assign(context->field_name, ""); g_string_append(context->string, "event {\n"); @@ -663,10 +663,10 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, g_string_append_printf(context->string, "\tid = %" PRId64 ";\n", event_class->id); g_string_append_printf(context->string, "\tstream_id = %" PRId64 ";\n", - bt_ctf_stream_class_get_id( - bt_ctf_event_class_borrow_stream_class(event_class))); + bt_stream_class_get_id( + bt_event_class_borrow_stream_class(event_class))); - if (event_class->log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) { + if (event_class->log_level != BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) { g_string_append_printf(context->string, "\tloglevel = %d;\n", (int) event_class->log_level); } @@ -680,7 +680,7 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, if (event_class->context) { g_string_append(context->string, "\tcontext := "); BT_LOGD_STR("Serializing event class's context field type metadata."); - ret = bt_ctf_field_type_serialize(event_class->context, + ret = bt_field_type_serialize(event_class->context, context); if (ret) { BT_LOGW("Cannot serialize event class's context field type's metadata: " @@ -694,7 +694,7 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class, if (event_class->fields) { g_string_append(context->string, "\tfields := "); BT_LOGD_STR("Serializing event class's payload field type metadata."); - ret = bt_ctf_field_type_serialize(event_class->fields, context); + ret = bt_field_type_serialize(event_class->fields, context); if (ret) { BT_LOGW("Cannot serialize event class's payload field type's metadata: " "ret=%d", ret); diff --git a/lib/ctf-ir/event.c b/lib/ctf-ir/event.c index 62fc4328..6dc7ad07 100644 --- a/lib/ctf-ir/event.c +++ b/lib/ctf-ir/event.c @@ -54,42 +54,42 @@ #include static -void bt_ctf_event_destroy(struct bt_object *obj); +void bt_event_destroy(struct bt_object *obj); -struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) +struct bt_event *bt_event_create(struct bt_event_class *event_class) { int ret; - enum bt_ctf_validation_flag validation_flags = - BT_CTF_VALIDATION_FLAG_STREAM | - BT_CTF_VALIDATION_FLAG_EVENT; - struct bt_ctf_event *event = NULL; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_field_type *packet_header_type = NULL; - struct bt_ctf_field_type *packet_context_type = NULL; - struct bt_ctf_field_type *event_header_type = NULL; - struct bt_ctf_field_type *stream_event_ctx_type = NULL; - struct bt_ctf_field_type *event_context_type = NULL; - struct bt_ctf_field_type *event_payload_type = NULL; - struct bt_ctf_field *event_header = NULL; - struct bt_ctf_field *stream_event_context = NULL; - struct bt_ctf_field *event_context = NULL; - struct bt_ctf_field *event_payload = NULL; + enum bt_validation_flag validation_flags = + BT_VALIDATION_FLAG_STREAM | + BT_VALIDATION_FLAG_EVENT; + struct bt_event *event = NULL; + struct bt_trace *trace = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_field_type *packet_header_type = NULL; + struct bt_field_type *packet_context_type = NULL; + struct bt_field_type *event_header_type = NULL; + struct bt_field_type *stream_event_ctx_type = NULL; + struct bt_field_type *event_context_type = NULL; + struct bt_field_type *event_payload_type = NULL; + struct bt_field *event_header = NULL; + struct bt_field *stream_event_context = NULL; + struct bt_field *event_context = NULL; + struct bt_field *event_payload = NULL; struct bt_value *environment = NULL; - struct bt_ctf_validation_output validation_output = { 0 }; + struct bt_validation_output validation_output = { 0 }; int trace_valid = 0; BT_LOGD("Creating event object: event-class-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); if (!event_class) { BT_LOGW_STR("Invalid parameter: event class is NULL."); goto error; } - stream_class = bt_ctf_event_class_get_stream_class(event_class); + stream_class = bt_event_class_get_stream_class(event_class); /* * We disallow the creation of an event if its event class has not been @@ -104,24 +104,24 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) assert(event_class->frozen); /* Validate the trace (if any), the stream class, and the event class */ - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); if (trace) { BT_LOGD_STR("Event's class is part of a trace."); - packet_header_type = bt_ctf_trace_get_packet_header_type(trace); + packet_header_type = bt_trace_get_packet_header_type(trace); trace_valid = trace->valid; assert(trace_valid); environment = trace->environment; } - packet_context_type = bt_ctf_stream_class_get_packet_context_type( + packet_context_type = bt_stream_class_get_packet_context_type( stream_class); - event_header_type = bt_ctf_stream_class_get_event_header_type( + event_header_type = bt_stream_class_get_event_header_type( stream_class); - stream_event_ctx_type = bt_ctf_stream_class_get_event_context_type( + stream_event_ctx_type = bt_stream_class_get_event_context_type( stream_class); - event_context_type = bt_ctf_event_class_get_context_type(event_class); - event_payload_type = bt_ctf_event_class_get_payload_type(event_class); - ret = bt_ctf_validate_class_types(environment, packet_header_type, + event_context_type = bt_event_class_get_context_type(event_class); + event_payload_type = bt_event_class_get_payload_type(event_class); + ret = bt_validate_class_types(environment, packet_header_type, packet_context_type, event_header_type, stream_event_ctx_type, event_context_type, event_payload_type, trace_valid, stream_class->valid, event_class->valid, @@ -155,13 +155,13 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) * current types, are valid. We may proceed with creating * the event. */ - event = g_new0(struct bt_ctf_event, 1); + event = g_new0(struct bt_event, 1); if (!event) { BT_LOGE_STR("Failed to allocate one event."); goto error; } - bt_object_init(event, bt_ctf_event_destroy); + bt_object_init(event, bt_event_destroy); /* * event does not share a common ancestor with the event class; it has @@ -178,7 +178,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) BT_LOGD("Creating initial event header field: ft-addr=%p", validation_output.event_header_type); event_header = - bt_ctf_field_create(validation_output.event_header_type); + bt_field_create(validation_output.event_header_type); if (!event_header) { BT_LOGE_STR("Cannot create initial event header field object."); goto error; @@ -188,7 +188,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) if (validation_output.stream_event_ctx_type) { BT_LOGD("Creating initial stream event context field: ft-addr=%p", validation_output.stream_event_ctx_type); - stream_event_context = bt_ctf_field_create( + stream_event_context = bt_field_create( validation_output.stream_event_ctx_type); if (!stream_event_context) { BT_LOGE_STR("Cannot create initial stream event context field object."); @@ -199,7 +199,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) if (validation_output.event_context_type) { BT_LOGD("Creating initial event context field: ft-addr=%p", validation_output.event_context_type); - event_context = bt_ctf_field_create( + event_context = bt_field_create( validation_output.event_context_type); if (!event_context) { BT_LOGE_STR("Cannot create initial event context field object."); @@ -210,7 +210,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) if (validation_output.event_payload_type) { BT_LOGD("Creating initial event payload field: ft-addr=%p", validation_output.event_payload_type); - event_payload = bt_ctf_field_create( + event_payload = bt_field_create( validation_output.event_payload_type); if (!event_payload) { BT_LOGE_STR("Cannot create initial event payload field object."); @@ -224,7 +224,7 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) * fields can be replaced in the trace, stream class, * event class, and created event. */ - bt_ctf_validation_replace_types(trace, stream_class, + bt_validation_replace_types(trace, stream_class, event_class, &validation_output, validation_flags); BT_MOVE(event->event_header, event_header); BT_MOVE(event->stream_event_context, stream_event_context); @@ -232,15 +232,15 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) BT_MOVE(event->fields_payload, event_payload); /* - * Put what was not moved in bt_ctf_validation_replace_types(). + * Put what was not moved in bt_validation_replace_types(). */ - bt_ctf_validation_output_put_types(&validation_output); + bt_validation_output_put_types(&validation_output); /* * Freeze the stream class since the event header must not be changed * anymore. */ - bt_ctf_stream_class_freeze(stream_class); + bt_stream_class_freeze(stream_class); /* * Mark stream class, and event class as valid since @@ -254,12 +254,12 @@ struct bt_ctf_event *bt_ctf_event_create(struct bt_ctf_event_class *event_class) BT_PUT(trace); BT_LOGD("Created event object: addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event_class)); return event; error: - bt_ctf_validation_output_put_types(&validation_output); + bt_validation_output_put_types(&validation_output); BT_PUT(event); BT_PUT(stream_class); BT_PUT(trace); @@ -277,23 +277,23 @@ error: return event; } -struct bt_ctf_event_class *bt_ctf_event_get_class(struct bt_ctf_event *event) +struct bt_event_class *bt_event_get_class(struct bt_event *event) { - struct bt_ctf_event_class *event_class = NULL; + struct bt_event_class *event_class = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); goto end; } - event_class = bt_get(bt_ctf_event_borrow_event_class(event)); + event_class = bt_get(bt_event_borrow_event_class(event)); end: return event_class; } -struct bt_ctf_stream *bt_ctf_event_get_stream(struct bt_ctf_event *event) +struct bt_stream *bt_event_get_stream(struct bt_event *event) { - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -306,7 +306,7 @@ struct bt_ctf_stream *bt_ctf_event_get_stream(struct bt_ctf_event *event) * is its (non-writer) stream. */ if (event->base.parent) { - stream = (struct bt_ctf_stream *) bt_object_get_parent(event); + stream = (struct bt_stream *) bt_object_get_parent(event); } else { if (event->packet) { stream = bt_get(event->packet->stream); @@ -317,9 +317,9 @@ end: return stream; } -int bt_ctf_event_set_payload(struct bt_ctf_event *event, +int bt_event_set_payload(struct bt_event *event, const char *name, - struct bt_ctf_field *payload) + struct bt_field *payload) { int ret = 0; @@ -334,21 +334,21 @@ int bt_ctf_event_set_payload(struct bt_ctf_event *event, if (event->frozen) { BT_LOGW("Invalid parameter: event is frozen: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } if (name) { - ret = bt_ctf_field_structure_set_field_by_name( + ret = bt_field_structure_set_field_by_name( event->fields_payload, name, payload); } else { - struct bt_ctf_field_type *payload_type; + struct bt_field_type *payload_type; - payload_type = bt_ctf_field_get_type(payload); + payload_type = bt_field_get_type(payload); - if (bt_ctf_field_type_compare(payload_type, + if (bt_field_type_compare(payload_type, event->event_class->fields) == 0) { bt_put(event->fields_payload); bt_get(payload); @@ -358,8 +358,8 @@ int bt_ctf_event_set_payload(struct bt_ctf_event *event, "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; } @@ -370,15 +370,15 @@ int bt_ctf_event_set_payload(struct bt_ctf_event *event, BT_LOGW("Failed to set event's payload field: event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "payload-field-name=\"%s\", payload-field-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), name, payload); } else { BT_LOGV("Set event's payload field: event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "payload-field-name=\"%s\", payload-field-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), name, payload); } @@ -386,9 +386,9 @@ end: return ret; } -struct bt_ctf_field *bt_ctf_event_get_event_payload(struct bt_ctf_event *event) +struct bt_field *bt_event_get_event_payload(struct bt_event *event) { - struct bt_ctf_field *payload = NULL; + struct bt_field *payload = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -398,8 +398,8 @@ struct bt_ctf_field *bt_ctf_event_get_event_payload(struct bt_ctf_event *event) if (!event->fields_payload) { BT_LOGV("Event has no current payload field: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } @@ -409,16 +409,16 @@ end: return payload; } -int bt_ctf_event_set_event_payload(struct bt_ctf_event *event, - struct bt_ctf_field *payload) +int bt_event_set_event_payload(struct bt_event *event, + struct bt_field *payload) { - return bt_ctf_event_set_payload(event, NULL, payload); + return bt_event_set_payload(event, NULL, payload); } -struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event, +struct bt_field *bt_event_get_payload(struct bt_event *event, const char *name) { - struct bt_ctf_field *field = NULL; + struct bt_field *field = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -426,8 +426,8 @@ struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event, } if (name) { - field = bt_ctf_field_structure_get_field(event->fields_payload, - name); + field = bt_field_structure_get_field_by_name( + event->fields_payload, name); } else { field = event->fields_payload; bt_get(field); @@ -436,26 +436,26 @@ end: return field; } -struct bt_ctf_field *bt_ctf_event_get_payload_by_index( - struct bt_ctf_event *event, uint64_t index) +struct bt_field *bt_event_get_payload_by_index( + struct bt_event *event, uint64_t index) { - struct bt_ctf_field *field = NULL; + struct bt_field *field = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); goto end; } - field = bt_ctf_field_structure_get_field_by_index(event->fields_payload, + field = bt_field_structure_get_field_by_index(event->fields_payload, index); end: return field; } -struct bt_ctf_field *bt_ctf_event_get_header( - struct bt_ctf_event *event) +struct bt_field *bt_event_get_header( + struct bt_event *event) { - struct bt_ctf_field *header = NULL; + struct bt_field *header = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -465,8 +465,8 @@ struct bt_ctf_field *bt_ctf_event_get_header( if (!event->event_header) { BT_LOGV("Event has no current header field: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } @@ -476,12 +476,12 @@ end: return header; } -int bt_ctf_event_set_header(struct bt_ctf_event *event, - struct bt_ctf_field *header) +int bt_event_set_header(struct bt_event *event, + struct bt_field *header) { int ret = 0; - struct bt_ctf_field_type *field_type = NULL; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_field_type *field_type = NULL; + struct bt_stream_class *stream_class = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -492,28 +492,28 @@ int bt_ctf_event_set_header(struct bt_ctf_event *event, if (event->frozen) { BT_LOGW("Invalid parameter: event is frozen: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } - stream_class = (struct bt_ctf_stream_class *) bt_object_get_parent( + stream_class = (struct bt_stream_class *) bt_object_get_parent( event->event_class); /* * Ensure the provided header's type matches the one registered to the * stream class. */ if (header) { - field_type = bt_ctf_field_get_type(header); - if (bt_ctf_field_type_compare(field_type, + field_type = bt_field_get_type(header); + if (bt_field_type_compare(field_type, stream_class->event_header_type)) { BT_LOGW("Invalid parameter: header field type is different from the expected field type: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } @@ -524,8 +524,8 @@ int bt_ctf_event_set_header(struct bt_ctf_event *event, "event-class-id=%" PRId64 ", " "event-header-ft-addr=%p", event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), stream_class->event_header_type); ret = -1; goto end; @@ -537,18 +537,18 @@ int bt_ctf_event_set_header(struct bt_ctf_event *event, BT_LOGV("Set event's header field: event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "header-field-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), header); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), header); end: bt_put(stream_class); bt_put(field_type); return ret; } -struct bt_ctf_field *bt_ctf_event_get_event_context( - struct bt_ctf_event *event) +struct bt_field *bt_event_get_event_context( + struct bt_event *event) { - struct bt_ctf_field *context = NULL; + struct bt_field *context = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -558,8 +558,8 @@ struct bt_ctf_field *bt_ctf_event_get_event_context( if (!event->context_payload) { BT_LOGV("Event has no current context field: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } @@ -569,11 +569,11 @@ end: return context; } -int bt_ctf_event_set_event_context(struct bt_ctf_event *event, - struct bt_ctf_field *context) +int bt_event_set_event_context(struct bt_event *event, + struct bt_field *context) { int ret = 0; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -584,23 +584,23 @@ int bt_ctf_event_set_event_context(struct bt_ctf_event *event, if (event->frozen) { BT_LOGW("Invalid parameter: event is frozen: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } if (context) { - field_type = bt_ctf_field_get_type(context); + field_type = bt_field_get_type(context); - if (bt_ctf_field_type_compare(field_type, + if (bt_field_type_compare(field_type, event->event_class->context)) { BT_LOGW("Invalid parameter: context field type is different from the expected field type: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } @@ -611,8 +611,8 @@ int bt_ctf_event_set_event_context(struct bt_ctf_event *event, "event-class-id=%" PRId64 ", " "event-context-ft-addr=%p", event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), event->event_class->context); ret = -1; goto end; @@ -624,17 +624,17 @@ int bt_ctf_event_set_event_context(struct bt_ctf_event *event, BT_LOGV("Set event's context field: event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "context-field-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), context); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), context); end: bt_put(field_type); return ret; } -struct bt_ctf_field *bt_ctf_event_get_stream_event_context( - struct bt_ctf_event *event) +struct bt_field *bt_event_get_stream_event_context( + struct bt_event *event) { - struct bt_ctf_field *stream_event_context = NULL; + struct bt_field *stream_event_context = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -644,8 +644,8 @@ struct bt_ctf_field *bt_ctf_event_get_stream_event_context( if (!event->stream_event_context) { BT_LOGV("Event has no current stream event context field: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } @@ -654,12 +654,12 @@ end: return bt_get(stream_event_context); } -int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, - struct bt_ctf_field *stream_event_context) +int bt_event_set_stream_event_context(struct bt_event *event, + struct bt_field *stream_event_context) { int ret = 0; - struct bt_ctf_field_type *field_type = NULL; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_field_type *field_type = NULL; + struct bt_stream_class *stream_class = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -670,13 +670,13 @@ int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, if (event->frozen) { BT_LOGW("Invalid parameter: event is frozen: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } - stream_class = bt_ctf_event_class_get_stream_class(event->event_class); + stream_class = bt_event_class_get_stream_class(event->event_class); /* * We should not have been able to create the event without associating * the event class to a stream class. @@ -684,15 +684,15 @@ int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, assert(stream_class); if (stream_event_context) { - field_type = bt_ctf_field_get_type(stream_event_context); - if (bt_ctf_field_type_compare(field_type, + field_type = bt_field_get_type(stream_event_context); + if (bt_field_type_compare(field_type, stream_class->event_context_type)) { BT_LOGW("Invalid parameter: stream event context field type is different from the expected field type: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } @@ -703,8 +703,8 @@ int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, "event-class-id=%" PRId64 ", " "stream-event-context-ft-addr=%p", event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), stream_class->event_context_type); ret = -1; goto end; @@ -716,8 +716,8 @@ int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event, BT_LOGV("Set event's stream event context field: event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "stream-event-context-field-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), stream_event_context); end: BT_PUT(stream_class); @@ -726,26 +726,26 @@ end: } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_event_get(struct bt_ctf_event *event) +void bt_ctf_event_get(struct bt_event *event) { bt_get(event); } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_event_put(struct bt_ctf_event *event) +void bt_ctf_event_put(struct bt_event *event) { bt_put(event); } -void bt_ctf_event_destroy(struct bt_object *obj) +void bt_event_destroy(struct bt_object *obj) { - struct bt_ctf_event *event; + struct bt_event *event; - event = container_of(obj, struct bt_ctf_event, base); + event = container_of(obj, struct bt_event, base); BT_LOGD("Destroying event: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); if (!event->base.parent) { /* @@ -769,10 +769,10 @@ void bt_ctf_event_destroy(struct bt_object *obj) g_free(event); } -struct bt_ctf_clock_value *bt_ctf_event_get_clock_value( - struct bt_ctf_event *event, struct bt_ctf_clock_class *clock_class) +struct bt_clock_value *bt_event_get_clock_value( + struct bt_event *event, struct bt_clock_class *clock_class) { - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_value *clock_value = NULL; if (!event || !clock_class) { BT_LOGW("Invalid parameter: event or clock class is NULL: " @@ -787,9 +787,9 @@ struct bt_ctf_clock_value *bt_ctf_event_get_clock_value( "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", clock-class-addr=%p, " "clock-class-name=\"%s\"", event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), - clock_class, bt_ctf_clock_class_get_name(clock_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), + clock_class, bt_clock_class_get_name(clock_class)); goto end; } @@ -798,14 +798,14 @@ end: return clock_value; } -int bt_ctf_event_set_clock_value(struct bt_ctf_event *event, - struct bt_ctf_clock_value *value) +int bt_event_set_clock_value(struct bt_event *event, + struct bt_clock_value *value) { int ret = 0; - struct bt_ctf_trace *trace; - struct bt_ctf_stream_class *stream_class; - struct bt_ctf_event_class *event_class; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_trace *trace; + struct bt_stream_class *stream_class; + struct bt_event_class *event_class; + struct bt_clock_class *clock_class = NULL; if (!event || !value) { BT_LOGW("Invalid parameter: event or clock value is NULL: " @@ -818,28 +818,28 @@ int bt_ctf_event_set_clock_value(struct bt_ctf_event *event, if (event->frozen) { BT_LOGW("Invalid parameter: event is frozen: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } - clock_class = bt_ctf_clock_value_get_class(value); - event_class = bt_ctf_event_borrow_event_class(event); + clock_class = bt_clock_value_get_class(value); + event_class = bt_event_borrow_event_class(event); assert(event_class); - stream_class = bt_ctf_event_class_borrow_stream_class(event_class); + stream_class = bt_event_class_borrow_stream_class(event_class); assert(stream_class); - trace = bt_ctf_stream_class_borrow_trace(stream_class); + trace = bt_stream_class_borrow_trace(stream_class); assert(trace); - if (!bt_ctf_trace_has_clock_class(trace, clock_class)) { + if (!bt_trace_has_clock_class(trace, clock_class)) { BT_LOGW("Invalid parameter: clock class is not part of event's trace: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", clock-class-addr=%p, " "clock-class-name=\"%s\"", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), - clock_class, bt_ctf_clock_class_get_name(clock_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } @@ -850,9 +850,9 @@ int bt_ctf_event_set_clock_value(struct bt_ctf_event *event, "event-class-id=%" PRId64 ", clock-class-addr=%p, " "clock-class-name=\"%s\", clock-value-addr=%p, " "clock-value-cycles=%" PRIu64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), - clock_class, bt_ctf_clock_class_get_name(clock_class), + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), + clock_class, bt_clock_class_get_name(clock_class), value, value->value); clock_class = NULL; @@ -862,52 +862,52 @@ end: } BT_HIDDEN -int bt_ctf_event_validate(struct bt_ctf_event *event) +int bt_event_validate(struct bt_event *event) { /* Make sure each field's payload has been set */ int ret; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; assert(event); if (event->event_header) { - ret = bt_ctf_field_validate(event->event_header); + ret = bt_field_validate(event->event_header); if (ret) { BT_LOGD("Invalid event's header field: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } } - stream_class = bt_ctf_event_class_get_stream_class(event->event_class); + stream_class = bt_event_class_get_stream_class(event->event_class); /* * We should not have been able to create the event without associating * the event class to a stream class. */ assert(stream_class); if (stream_class->event_context_type) { - ret = bt_ctf_field_validate(event->stream_event_context); + ret = bt_field_validate(event->stream_event_context); if (ret) { BT_LOGD("Invalid event's stream event context field: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } } - ret = bt_ctf_field_validate(event->fields_payload); + ret = bt_field_validate(event->fields_payload); if (ret) { BT_LOGD("Invalid event's payload field: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } @@ -916,9 +916,9 @@ int bt_ctf_event_validate(struct bt_ctf_event *event) "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); - ret = bt_ctf_field_validate(event->context_payload); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); + ret = bt_field_validate(event->context_payload); } end: bt_put(stream_class); @@ -926,9 +926,9 @@ end: } BT_HIDDEN -int bt_ctf_event_serialize(struct bt_ctf_event *event, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_event_serialize(struct bt_event *event, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int ret = 0; @@ -937,30 +937,30 @@ int bt_ctf_event_serialize(struct bt_ctf_event *event, BT_LOGV_STR("Serializing event's context field."); if (event->context_payload) { - ret = bt_ctf_field_serialize(event->context_payload, pos, + ret = bt_field_serialize(event->context_payload, pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize event's context field: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } } BT_LOGV_STR("Serializing event's payload field."); if (event->fields_payload) { - ret = bt_ctf_field_serialize(event->fields_payload, pos, + ret = bt_field_serialize(event->fields_payload, pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize event's payload field: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event, - bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } } @@ -968,9 +968,9 @@ end: return ret; } -struct bt_ctf_packet *bt_ctf_event_get_packet(struct bt_ctf_event *event) +struct bt_packet *bt_event_get_packet(struct bt_event *event) { - struct bt_ctf_packet *packet = NULL; + struct bt_packet *packet = NULL; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -980,8 +980,8 @@ struct bt_ctf_packet *bt_ctf_event_get_packet(struct bt_ctf_event *event) if (!event->packet) { BT_LOGV("Event has no current packet: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); goto end; } @@ -990,12 +990,12 @@ end: return packet; } -int bt_ctf_event_set_packet(struct bt_ctf_event *event, - struct bt_ctf_packet *packet) +int bt_event_set_packet(struct bt_event *event, + struct bt_packet *packet) { - struct bt_ctf_stream_class *event_stream_class = NULL; - struct bt_ctf_stream_class *packet_stream_class = NULL; - struct bt_ctf_stream *stream = NULL; + struct bt_stream_class *event_stream_class = NULL; + struct bt_stream_class *packet_stream_class = NULL; + struct bt_stream *stream = NULL; int ret = 0; if (!event || !packet) { @@ -1009,8 +1009,8 @@ int bt_ctf_event_set_packet(struct bt_ctf_event *event, if (event->frozen) { BT_LOGW("Invalid parameter: event is frozen: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); ret = -1; goto end; } @@ -1019,24 +1019,24 @@ int bt_ctf_event_set_packet(struct bt_ctf_event *event, * Make sure the new packet was created by this event's * stream, if it is set. */ - stream = bt_ctf_event_get_stream(event); + stream = bt_event_get_stream(event); if (stream) { if (packet->stream != stream) { BT_LOGW("Invalid parameter: packet's stream and event's stream differ: " "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", packet-stream-addr=%p, " "event-stream-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), packet->stream, stream); ret = -1; goto end; } } else { event_stream_class = - bt_ctf_event_class_get_stream_class(event->event_class); + bt_event_class_get_stream_class(event->event_class); packet_stream_class = - bt_ctf_stream_get_class(packet->stream); + bt_stream_get_class(packet->stream); assert(event_stream_class); assert(packet_stream_class); @@ -1046,8 +1046,8 @@ int bt_ctf_event_set_packet(struct bt_ctf_event *event, "event-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64 ", packet-stream-class-addr=%p, " "event-stream-class-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), packet_stream_class, event_stream_class); ret = -1; goto end; @@ -1059,8 +1059,8 @@ int bt_ctf_event_set_packet(struct bt_ctf_event *event, BT_LOGV("Set event's packet: event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "packet-addr=%p", - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class), packet); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class), packet); end: BT_PUT(stream); @@ -1071,7 +1071,7 @@ end: } BT_HIDDEN -void bt_ctf_event_freeze(struct bt_ctf_event *event) +void bt_event_freeze(struct bt_event *event) { assert(event); @@ -1081,16 +1081,16 @@ void bt_ctf_event_freeze(struct bt_ctf_event *event) BT_LOGD("Freezing event: addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - event, bt_ctf_event_class_get_name(event->event_class), - bt_ctf_event_class_get_id(event->event_class)); - bt_ctf_packet_freeze(event->packet); + event, bt_event_class_get_name(event->event_class), + bt_event_class_get_id(event->event_class)); + bt_packet_freeze(event->packet); BT_LOGD_STR("Freezing event's header field."); - bt_ctf_field_freeze(event->event_header); + bt_field_freeze(event->event_header); BT_LOGD_STR("Freezing event's stream event context field."); - bt_ctf_field_freeze(event->stream_event_context); + bt_field_freeze(event->stream_event_context); BT_LOGD_STR("Freezing event's context field."); - bt_ctf_field_freeze(event->context_payload); + bt_field_freeze(event->context_payload); BT_LOGD_STR("Freezing event's payload field."); - bt_ctf_field_freeze(event->fields_payload); + bt_field_freeze(event->fields_payload); event->frozen = 1; } diff --git a/lib/ctf-ir/field-path.c b/lib/ctf-ir/field-path.c index 97ce554e..32ba02ae 100644 --- a/lib/ctf-ir/field-path.c +++ b/lib/ctf-ir/field-path.c @@ -40,7 +40,7 @@ static void field_path_destroy(struct bt_object *obj) { - struct bt_ctf_field_path *field_path = (struct bt_ctf_field_path *) obj; + struct bt_field_path *field_path = (struct bt_field_path *) obj; BT_LOGD("Destroying field path: addr=%p", obj); @@ -55,20 +55,20 @@ void field_path_destroy(struct bt_object *obj) } BT_HIDDEN -struct bt_ctf_field_path *bt_ctf_field_path_create(void) +struct bt_field_path *bt_field_path_create(void) { - struct bt_ctf_field_path *field_path = NULL; + struct bt_field_path *field_path = NULL; BT_LOGD_STR("Creating empty field path object."); - field_path = g_new0(struct bt_ctf_field_path, 1); + field_path = g_new0(struct bt_field_path, 1); if (!field_path) { BT_LOGE_STR("Failed to allocate one field path."); goto error; } bt_object_init(field_path, field_path_destroy); - field_path->root = BT_CTF_SCOPE_UNKNOWN; + field_path->root = BT_SCOPE_UNKNOWN; field_path->indexes = g_array_new(TRUE, FALSE, sizeof(int)); if (!field_path->indexes) { BT_LOGE_STR("Failed to allocate a GArray."); @@ -84,7 +84,7 @@ error: } BT_HIDDEN -void bt_ctf_field_path_clear(struct bt_ctf_field_path *field_path) +void bt_field_path_clear(struct bt_field_path *field_path) { if (field_path->indexes->len > 0) { g_array_remove_range(field_path->indexes, 0, @@ -93,15 +93,15 @@ void bt_ctf_field_path_clear(struct bt_ctf_field_path *field_path) } BT_HIDDEN -struct bt_ctf_field_path *bt_ctf_field_path_copy( - struct bt_ctf_field_path *path) +struct bt_field_path *bt_field_path_copy( + struct bt_field_path *path) { - struct bt_ctf_field_path *new_path; + struct bt_field_path *new_path; assert(path); BT_LOGD("Copying field path: addr=%p, index-count=%u", path, path->indexes->len); - new_path = bt_ctf_field_path_create(); + new_path = bt_field_path_create(); if (!new_path) { BT_LOGE_STR("Cannot create empty field path."); goto end; @@ -116,10 +116,10 @@ end: return new_path; } -enum bt_ctf_scope bt_ctf_field_path_get_root_scope( - const struct bt_ctf_field_path *field_path) +enum bt_scope bt_field_path_get_root_scope( + const struct bt_field_path *field_path) { - enum bt_ctf_scope scope = BT_CTF_SCOPE_UNKNOWN; + enum bt_scope scope = BT_SCOPE_UNKNOWN; if (!field_path) { BT_LOGW_STR("Invalid parameter: field path is NULL."); @@ -132,8 +132,8 @@ end: return scope; } -int64_t bt_ctf_field_path_get_index_count( - const struct bt_ctf_field_path *field_path) +int64_t bt_field_path_get_index_count( + const struct bt_field_path *field_path) { int64_t count = (int64_t) -1; @@ -148,7 +148,7 @@ end: return count; } -int bt_ctf_field_path_get_index(const struct bt_ctf_field_path *field_path, +int bt_field_path_get_index(const struct bt_field_path *field_path, uint64_t index) { int ret = INT_MIN; diff --git a/lib/ctf-ir/field-types.c b/lib/ctf-ir/field-types.c index abd16586..7371e5bf 100644 --- a/lib/ctf-ir/field-types.c +++ b/lib/ctf-ir/field-types.c @@ -59,242 +59,242 @@ struct range_overlap_query { }; static -void bt_ctf_field_type_destroy(struct bt_object *); +void bt_field_type_destroy(struct bt_object *); static -void bt_ctf_field_type_integer_destroy(struct bt_ctf_field_type *); +void bt_field_type_integer_destroy(struct bt_field_type *); static -void bt_ctf_field_type_enumeration_destroy(struct bt_ctf_field_type *); +void bt_field_type_enumeration_destroy(struct bt_field_type *); static -void bt_ctf_field_type_floating_point_destroy(struct bt_ctf_field_type *); +void bt_field_type_floating_point_destroy(struct bt_field_type *); static -void bt_ctf_field_type_structure_destroy(struct bt_ctf_field_type *); +void bt_field_type_structure_destroy(struct bt_field_type *); static -void bt_ctf_field_type_variant_destroy(struct bt_ctf_field_type *); +void bt_field_type_variant_destroy(struct bt_field_type *); static -void bt_ctf_field_type_array_destroy(struct bt_ctf_field_type *); +void bt_field_type_array_destroy(struct bt_field_type *); static -void bt_ctf_field_type_sequence_destroy(struct bt_ctf_field_type *); +void bt_field_type_sequence_destroy(struct bt_field_type *); static -void bt_ctf_field_type_string_destroy(struct bt_ctf_field_type *); +void bt_field_type_string_destroy(struct bt_field_type *); static -void (* const type_destroy_funcs[])(struct bt_ctf_field_type *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_destroy, - [BT_CTF_FIELD_TYPE_ID_ENUM] = - bt_ctf_field_type_enumeration_destroy, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = - bt_ctf_field_type_floating_point_destroy, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_destroy, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_destroy, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_destroy, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_destroy, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_destroy, +void (* const type_destroy_funcs[])(struct bt_field_type *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_type_integer_destroy, + [BT_FIELD_TYPE_ID_ENUM] = + bt_field_type_enumeration_destroy, + [BT_FIELD_TYPE_ID_FLOAT] = + bt_field_type_floating_point_destroy, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_type_structure_destroy, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_type_variant_destroy, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_type_array_destroy, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_type_sequence_destroy, + [BT_FIELD_TYPE_ID_STRING] = bt_field_type_string_destroy, }; static -void generic_field_type_freeze(struct bt_ctf_field_type *); +void generic_field_type_freeze(struct bt_field_type *); static -void bt_ctf_field_type_integer_freeze(struct bt_ctf_field_type *); +void bt_field_type_integer_freeze(struct bt_field_type *); static -void bt_ctf_field_type_enumeration_freeze(struct bt_ctf_field_type *); +void bt_field_type_enumeration_freeze(struct bt_field_type *); static -void bt_ctf_field_type_structure_freeze(struct bt_ctf_field_type *); +void bt_field_type_structure_freeze(struct bt_field_type *); static -void bt_ctf_field_type_variant_freeze(struct bt_ctf_field_type *); +void bt_field_type_variant_freeze(struct bt_field_type *); static -void bt_ctf_field_type_array_freeze(struct bt_ctf_field_type *); +void bt_field_type_array_freeze(struct bt_field_type *); static -void bt_ctf_field_type_sequence_freeze(struct bt_ctf_field_type *); +void bt_field_type_sequence_freeze(struct bt_field_type *); static type_freeze_func const type_freeze_funcs[] = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_freeze, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_freeze, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = generic_field_type_freeze, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_freeze, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_freeze, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_freeze, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_freeze, - [BT_CTF_FIELD_TYPE_ID_STRING] = generic_field_type_freeze, + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_type_integer_freeze, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_type_enumeration_freeze, + [BT_FIELD_TYPE_ID_FLOAT] = generic_field_type_freeze, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_type_structure_freeze, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_type_variant_freeze, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_type_array_freeze, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_type_sequence_freeze, + [BT_FIELD_TYPE_ID_STRING] = generic_field_type_freeze, }; static -int bt_ctf_field_type_integer_serialize(struct bt_ctf_field_type *, +int bt_field_type_integer_serialize(struct bt_field_type *, struct metadata_context *); static -int bt_ctf_field_type_enumeration_serialize(struct bt_ctf_field_type *, +int bt_field_type_enumeration_serialize(struct bt_field_type *, struct metadata_context *); static -int bt_ctf_field_type_floating_point_serialize( - struct bt_ctf_field_type *, struct metadata_context *); +int bt_field_type_floating_point_serialize( + struct bt_field_type *, struct metadata_context *); static -int bt_ctf_field_type_structure_serialize(struct bt_ctf_field_type *, +int bt_field_type_structure_serialize(struct bt_field_type *, struct metadata_context *); static -int bt_ctf_field_type_variant_serialize(struct bt_ctf_field_type *, +int bt_field_type_variant_serialize(struct bt_field_type *, struct metadata_context *); static -int bt_ctf_field_type_array_serialize(struct bt_ctf_field_type *, +int bt_field_type_array_serialize(struct bt_field_type *, struct metadata_context *); static -int bt_ctf_field_type_sequence_serialize(struct bt_ctf_field_type *, +int bt_field_type_sequence_serialize(struct bt_field_type *, struct metadata_context *); static -int bt_ctf_field_type_string_serialize(struct bt_ctf_field_type *, +int bt_field_type_string_serialize(struct bt_field_type *, struct metadata_context *); static type_serialize_func const type_serialize_funcs[] = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_serialize, - [BT_CTF_FIELD_TYPE_ID_ENUM] = - bt_ctf_field_type_enumeration_serialize, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = - bt_ctf_field_type_floating_point_serialize, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = - bt_ctf_field_type_structure_serialize, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_serialize, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_serialize, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_serialize, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_serialize, + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_type_integer_serialize, + [BT_FIELD_TYPE_ID_ENUM] = + bt_field_type_enumeration_serialize, + [BT_FIELD_TYPE_ID_FLOAT] = + bt_field_type_floating_point_serialize, + [BT_FIELD_TYPE_ID_STRUCT] = + bt_field_type_structure_serialize, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_type_variant_serialize, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_type_array_serialize, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_type_sequence_serialize, + [BT_FIELD_TYPE_ID_STRING] = bt_field_type_string_serialize, }; static -void bt_ctf_field_type_integer_set_byte_order(struct bt_ctf_field_type *, - enum bt_ctf_byte_order byte_order); +void bt_field_type_integer_set_byte_order(struct bt_field_type *, + enum bt_byte_order byte_order); static -void bt_ctf_field_type_enumeration_set_byte_order(struct bt_ctf_field_type *, - enum bt_ctf_byte_order byte_order); +void bt_field_type_enumeration_set_byte_order(struct bt_field_type *, + enum bt_byte_order byte_order); static -void bt_ctf_field_type_floating_point_set_byte_order( - struct bt_ctf_field_type *, enum bt_ctf_byte_order byte_order); +void bt_field_type_floating_point_set_byte_order( + struct bt_field_type *, enum bt_byte_order byte_order); static -void bt_ctf_field_type_structure_set_byte_order(struct bt_ctf_field_type *, - enum bt_ctf_byte_order byte_order); +void bt_field_type_structure_set_byte_order(struct bt_field_type *, + enum bt_byte_order byte_order); static -void bt_ctf_field_type_variant_set_byte_order(struct bt_ctf_field_type *, - enum bt_ctf_byte_order byte_order); +void bt_field_type_variant_set_byte_order(struct bt_field_type *, + enum bt_byte_order byte_order); static -void bt_ctf_field_type_array_set_byte_order(struct bt_ctf_field_type *, - enum bt_ctf_byte_order byte_order); +void bt_field_type_array_set_byte_order(struct bt_field_type *, + enum bt_byte_order byte_order); static -void bt_ctf_field_type_sequence_set_byte_order(struct bt_ctf_field_type *, - enum bt_ctf_byte_order byte_order); +void bt_field_type_sequence_set_byte_order(struct bt_field_type *, + enum bt_byte_order byte_order); static -void (* const set_byte_order_funcs[])(struct bt_ctf_field_type *, - enum bt_ctf_byte_order) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_set_byte_order, - [BT_CTF_FIELD_TYPE_ID_ENUM] = - bt_ctf_field_type_enumeration_set_byte_order, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = - bt_ctf_field_type_floating_point_set_byte_order, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = - bt_ctf_field_type_structure_set_byte_order, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_set_byte_order, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_set_byte_order, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order, - [BT_CTF_FIELD_TYPE_ID_STRING] = NULL, +void (* const set_byte_order_funcs[])(struct bt_field_type *, + enum bt_byte_order) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_type_integer_set_byte_order, + [BT_FIELD_TYPE_ID_ENUM] = + bt_field_type_enumeration_set_byte_order, + [BT_FIELD_TYPE_ID_FLOAT] = + bt_field_type_floating_point_set_byte_order, + [BT_FIELD_TYPE_ID_STRUCT] = + bt_field_type_structure_set_byte_order, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_type_variant_set_byte_order, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_type_array_set_byte_order, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_type_sequence_set_byte_order, + [BT_FIELD_TYPE_ID_STRING] = NULL, }; static -struct bt_ctf_field_type *bt_ctf_field_type_integer_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_integer_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *bt_ctf_field_type_enumeration_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_enumeration_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *bt_ctf_field_type_floating_point_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_floating_point_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *bt_ctf_field_type_structure_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_structure_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *bt_ctf_field_type_variant_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_variant_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *bt_ctf_field_type_array_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_array_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *bt_ctf_field_type_sequence_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_sequence_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *bt_ctf_field_type_string_copy( - struct bt_ctf_field_type *); +struct bt_field_type *bt_field_type_string_copy( + struct bt_field_type *); static -struct bt_ctf_field_type *(* const type_copy_funcs[])( - struct bt_ctf_field_type *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_copy, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_copy, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_copy, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_copy, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_copy, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_copy, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_copy, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_copy, +struct bt_field_type *(* const type_copy_funcs[])( + struct bt_field_type *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_type_integer_copy, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_type_enumeration_copy, + [BT_FIELD_TYPE_ID_FLOAT] = bt_field_type_floating_point_copy, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_type_structure_copy, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_type_variant_copy, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_type_array_copy, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_type_sequence_copy, + [BT_FIELD_TYPE_ID_STRING] = bt_field_type_string_copy, }; static -int bt_ctf_field_type_integer_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_integer_compare(struct bt_field_type *, + struct bt_field_type *); static -int bt_ctf_field_type_floating_point_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_floating_point_compare(struct bt_field_type *, + struct bt_field_type *); static -int bt_ctf_field_type_enumeration_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_enumeration_compare(struct bt_field_type *, + struct bt_field_type *); static -int bt_ctf_field_type_string_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_string_compare(struct bt_field_type *, + struct bt_field_type *); static -int bt_ctf_field_type_structure_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_structure_compare(struct bt_field_type *, + struct bt_field_type *); static -int bt_ctf_field_type_variant_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_variant_compare(struct bt_field_type *, + struct bt_field_type *); static -int bt_ctf_field_type_array_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_array_compare(struct bt_field_type *, + struct bt_field_type *); static -int bt_ctf_field_type_sequence_compare(struct bt_ctf_field_type *, - struct bt_ctf_field_type *); +int bt_field_type_sequence_compare(struct bt_field_type *, + struct bt_field_type *); static -int (* const type_compare_funcs[])(struct bt_ctf_field_type *, - struct bt_ctf_field_type *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_compare, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_compare, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_compare, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_compare, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_compare, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_compare, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_compare, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_type_string_compare, +int (* const type_compare_funcs[])(struct bt_field_type *, + struct bt_field_type *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_type_integer_compare, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_type_enumeration_compare, + [BT_FIELD_TYPE_ID_FLOAT] = bt_field_type_floating_point_compare, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_type_structure_compare, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_type_variant_compare, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_type_array_compare, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_type_sequence_compare, + [BT_FIELD_TYPE_ID_STRING] = bt_field_type_string_compare, }; static -int bt_ctf_field_type_integer_validate(struct bt_ctf_field_type *); +int bt_field_type_integer_validate(struct bt_field_type *); static -int bt_ctf_field_type_enumeration_validate(struct bt_ctf_field_type *); +int bt_field_type_enumeration_validate(struct bt_field_type *); static -int bt_ctf_field_type_structure_validate(struct bt_ctf_field_type *); +int bt_field_type_structure_validate(struct bt_field_type *); static -int bt_ctf_field_type_variant_validate(struct bt_ctf_field_type *); +int bt_field_type_variant_validate(struct bt_field_type *); static -int bt_ctf_field_type_array_validate(struct bt_ctf_field_type *); +int bt_field_type_array_validate(struct bt_field_type *); static -int bt_ctf_field_type_sequence_validate(struct bt_ctf_field_type *); +int bt_field_type_sequence_validate(struct bt_field_type *); static -int (* const type_validate_funcs[])(struct bt_ctf_field_type *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_validate, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = NULL, - [BT_CTF_FIELD_TYPE_ID_STRING] = NULL, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_validate, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_validate, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_validate, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_type_array_validate, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_validate, +int (* const type_validate_funcs[])(struct bt_field_type *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_type_integer_validate, + [BT_FIELD_TYPE_ID_FLOAT] = NULL, + [BT_FIELD_TYPE_ID_STRING] = NULL, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_type_enumeration_validate, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_type_structure_validate, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_type_variant_validate, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_type_array_validate, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_type_sequence_validate, }; static @@ -395,22 +395,22 @@ gint compare_enumeration_mappings_unsigned(struct enumeration_mapping **a, } static -void bt_ctf_field_type_init(struct bt_ctf_field_type *type, bt_bool init_bo) +void bt_field_type_init(struct bt_field_type *type, bt_bool init_bo) { - assert(type && (type->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN) && - (type->id < BT_CTF_NR_TYPE_IDS)); + assert(type && (type->id > BT_FIELD_TYPE_ID_UNKNOWN) && + (type->id < BT_FIELD_TYPE_ID_NR)); - bt_object_init(type, bt_ctf_field_type_destroy); + bt_object_init(type, bt_field_type_destroy); type->freeze = type_freeze_funcs[type->id]; type->serialize = type_serialize_funcs[type->id]; if (init_bo) { int ret; - const enum bt_ctf_byte_order bo = BT_CTF_BYTE_ORDER_NATIVE; + const enum bt_byte_order bo = BT_BYTE_ORDER_NATIVE; BT_LOGD("Setting initial field type's byte order: bo=%s", - bt_ctf_byte_order_string(bo)); - ret = bt_ctf_field_type_set_byte_order(type, bo); + bt_byte_order_string(bo)); + ret = bt_field_type_set_byte_order(type, bo); assert(ret == 0); } @@ -420,7 +420,7 @@ void bt_ctf_field_type_init(struct bt_ctf_field_type *type, bt_bool init_bo) static int add_structure_field(GPtrArray *fields, GHashTable *field_name_to_index, - struct bt_ctf_field_type *field_type, + struct bt_field_type *field_type, const char *field_name) { int ret = 0; @@ -481,32 +481,32 @@ end: } static -void bt_ctf_field_type_destroy(struct bt_object *obj) +void bt_field_type_destroy(struct bt_object *obj) { - struct bt_ctf_field_type *type; - enum bt_ctf_field_type_id type_id; + struct bt_field_type *type; + enum bt_field_type_id type_id; - type = container_of(obj, struct bt_ctf_field_type, base); + type = container_of(obj, struct bt_field_type, base); type_id = type->id; - assert(type_id > BT_CTF_FIELD_TYPE_ID_UNKNOWN && - type_id < BT_CTF_NR_TYPE_IDS); + assert(type_id > BT_FIELD_TYPE_ID_UNKNOWN && + type_id < BT_FIELD_TYPE_ID_NR); type_destroy_funcs[type_id](type); } static -int bt_ctf_field_type_integer_validate(struct bt_ctf_field_type *type) +int bt_field_type_integer_validate(struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type_integer *integer = - container_of(type, struct bt_ctf_field_type_integer, + struct bt_field_type_integer *integer = + container_of(type, struct bt_field_type_integer, parent); if (integer->mapped_clock && integer->is_signed) { BT_LOGW("Invalid integer field type: cannot be signed and have a mapped clock class: " "ft-addr=%p, clock-class-addr=%p, clock-class-name=\"%s\"", type, integer->mapped_clock, - bt_ctf_clock_class_get_name(integer->mapped_clock)); + bt_clock_class_get_name(integer->mapped_clock)); ret = -1; goto end; } @@ -517,12 +517,12 @@ end: static struct enumeration_mapping *get_enumeration_mapping( - struct bt_ctf_field_type *type, uint64_t index) + struct bt_field_type *type, uint64_t index) { struct enumeration_mapping *mapping = NULL; - struct bt_ctf_field_type_enumeration *enumeration; + struct bt_field_type_enumeration *enumeration; - enumeration = container_of(type, struct bt_ctf_field_type_enumeration, + enumeration = container_of(type, struct bt_field_type_enumeration, parent); if (index >= enumeration->entries->len) { BT_LOGW("Invalid parameter: index is out of bounds: " @@ -542,21 +542,21 @@ end: */ static void set_enumeration_range_overlap( - struct bt_ctf_field_type *type) + struct bt_field_type *type) { int64_t i, j, len; - struct bt_ctf_field_type *container_type; - struct bt_ctf_field_type_enumeration *enumeration_type; + struct bt_field_type *container_type; + struct bt_field_type_enumeration *enumeration_type; int is_signed; BT_LOGV("Setting enumeration field type's overlap flag: addr=%p", type); enumeration_type = container_of(type, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration, parent); len = enumeration_type->entries->len; container_type = enumeration_type->container; - is_signed = bt_ctf_field_type_integer_get_signed(container_type); + is_signed = bt_field_type_integer_is_signed(container_type); for (i = 0; i < len; i++) { for (j = i + 1; j < len; j++) { @@ -593,18 +593,18 @@ end: } static -int bt_ctf_field_type_enumeration_validate(struct bt_ctf_field_type *type) +int bt_field_type_enumeration_validate(struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type_enumeration *enumeration = - container_of(type, struct bt_ctf_field_type_enumeration, + struct bt_field_type_enumeration *enumeration = + container_of(type, struct bt_field_type_enumeration, parent); - struct bt_ctf_field_type *container_type = - bt_ctf_field_type_enumeration_get_container_type(type); + struct bt_field_type *container_type = + bt_field_type_enumeration_get_container_type(type); assert(container_type); - ret = bt_ctf_field_type_validate(container_type); + ret = bt_field_type_validate(container_type); if (ret) { BT_LOGW("Invalid enumeration field type: container type is invalid: " "enum-ft-addr=%p, int-ft-addr=%p", @@ -626,12 +626,12 @@ end: } static -int bt_ctf_field_type_sequence_validate(struct bt_ctf_field_type *type) +int bt_field_type_sequence_validate(struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type *element_type = NULL; - struct bt_ctf_field_type_sequence *sequence = - container_of(type, struct bt_ctf_field_type_sequence, + struct bt_field_type *element_type = NULL; + struct bt_field_type_sequence *sequence = + container_of(type, struct bt_field_type_sequence, parent); /* Length field name should be set at this point */ @@ -642,9 +642,9 @@ int bt_ctf_field_type_sequence_validate(struct bt_ctf_field_type *type) goto end; } - element_type = bt_ctf_field_type_sequence_get_element_type(type); + element_type = bt_field_type_sequence_get_element_type(type); assert(element_type); - ret = bt_ctf_field_type_validate(element_type); + ret = bt_field_type_validate(element_type); if (ret) { BT_LOGW("Invalid sequence field type: invalid element field type: " "seq-ft-addr=%p, element-ft-add=%p", @@ -658,14 +658,14 @@ end: } static -int bt_ctf_field_type_array_validate(struct bt_ctf_field_type *type) +int bt_field_type_array_validate(struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type *element_type = NULL; + struct bt_field_type *element_type = NULL; - element_type = bt_ctf_field_type_array_get_element_type(type); + element_type = bt_field_type_array_get_element_type(type); assert(element_type); - ret = bt_ctf_field_type_validate(element_type); + ret = bt_field_type_validate(element_type); if (ret) { BT_LOGW("Invalid array field type: invalid element field type: " "array-ft-addr=%p, element-ft-add=%p", @@ -677,11 +677,11 @@ int bt_ctf_field_type_array_validate(struct bt_ctf_field_type *type) } static -int bt_ctf_field_type_structure_validate(struct bt_ctf_field_type *type) +int bt_field_type_structure_validate(struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type *child_type = NULL; - int64_t field_count = bt_ctf_field_type_structure_get_field_count(type); + struct bt_field_type *child_type = NULL; + int64_t field_count = bt_field_type_structure_get_field_count(type); int64_t i; assert(field_count >= 0); @@ -689,10 +689,10 @@ int bt_ctf_field_type_structure_validate(struct bt_ctf_field_type *type) for (i = 0; i < field_count; ++i) { const char *field_name; - ret = bt_ctf_field_type_structure_get_field_by_index(type, + ret = bt_field_type_structure_get_field_by_index(type, &field_name, &child_type, i); assert(ret == 0); - ret = bt_ctf_field_type_validate(child_type); + ret = bt_field_type_validate(child_type); if (ret) { BT_LOGW("Invalid structure field type: " "a contained field type is invalid: " @@ -712,8 +712,8 @@ end: } static -bt_bool bt_ctf_field_type_enumeration_has_overlapping_ranges( - struct bt_ctf_field_type_enumeration *enumeration_type) +bt_bool bt_field_type_enumeration_has_overlapping_ranges( + struct bt_field_type_enumeration *enumeration_type) { if (!enumeration_type->parent.frozen) { set_enumeration_range_overlap(&enumeration_type->parent); @@ -722,13 +722,13 @@ bt_bool bt_ctf_field_type_enumeration_has_overlapping_ranges( } static -int bt_ctf_field_type_variant_validate(struct bt_ctf_field_type *type) +int bt_field_type_variant_validate(struct bt_field_type *type) { int ret = 0; int64_t field_count; - struct bt_ctf_field_type *child_type = NULL; - struct bt_ctf_field_type_variant *variant = - container_of(type, struct bt_ctf_field_type_variant, + struct bt_field_type *child_type = NULL; + struct bt_field_type_variant *variant = + container_of(type, struct bt_field_type_variant, parent); int64_t i; @@ -747,7 +747,7 @@ int bt_ctf_field_type_variant_validate(struct bt_ctf_field_type *type) goto end; } - if (bt_ctf_field_type_enumeration_has_overlapping_ranges( + if (bt_field_type_enumeration_has_overlapping_ranges( variant->tag)) { BT_LOGW("Invalid variant field type: enumeration tag field type has overlapping ranges: " "variant-ft-addr=%p, tag-field-name=\"%s\", " @@ -771,7 +771,7 @@ int bt_ctf_field_type_variant_validate(struct bt_ctf_field_type *type) * enumeration while reading a variant field, an error will be * generated at that point (while reading the stream). */ - field_count = bt_ctf_field_type_variant_get_field_count(type); + field_count = bt_field_type_variant_get_field_count(type); if (field_count < 0) { BT_LOGW("Invalid variant field type: no fields: " "addr=%p, tag-field-name=\"%s\"", @@ -783,10 +783,10 @@ int bt_ctf_field_type_variant_validate(struct bt_ctf_field_type *type) for (i = 0; i < field_count; ++i) { const char *field_name; - ret = bt_ctf_field_type_variant_get_field_by_index(type, + ret = bt_field_type_variant_get_field_by_index(type, &field_name, &child_type, i); assert(ret == 0); - ret = bt_ctf_field_type_validate(child_type); + ret = bt_field_type_validate(child_type); if (ret) { BT_LOGW("Invalid variant field type: " "a contained field type is invalid: " @@ -814,10 +814,10 @@ end: * applicable. */ BT_HIDDEN -int bt_ctf_field_type_validate(struct bt_ctf_field_type *type) +int bt_field_type_validate(struct bt_field_type *type) { int ret = 0; - enum bt_ctf_field_type_id id = bt_ctf_field_type_get_type_id(type); + enum bt_field_type_id id = bt_field_type_get_type_id(type); assert(type); @@ -840,10 +840,10 @@ end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_integer_create(unsigned int size) +struct bt_field_type *bt_field_type_integer_create(unsigned int size) { - struct bt_ctf_field_type_integer *integer = - g_new0(struct bt_ctf_field_type_integer, 1); + struct bt_field_type_integer *integer = + g_new0(struct bt_field_type_integer, 1); BT_LOGD("Creating integer field type object: size=%u", size); @@ -858,20 +858,20 @@ struct bt_ctf_field_type *bt_ctf_field_type_integer_create(unsigned int size) return NULL; } - integer->parent.id = BT_CTF_FIELD_TYPE_ID_INTEGER; + integer->parent.id = BT_FIELD_TYPE_ID_INTEGER; integer->size = size; - integer->base = BT_CTF_INTEGER_BASE_DECIMAL; - integer->encoding = BT_CTF_STRING_ENCODING_NONE; - bt_ctf_field_type_init(&integer->parent, TRUE); + integer->base = BT_INTEGER_BASE_DECIMAL; + integer->encoding = BT_STRING_ENCODING_NONE; + bt_field_type_init(&integer->parent, TRUE); BT_LOGD("Created integer field type object: addr=%p, size=%u", &integer->parent, size); return &integer->parent; } -int bt_ctf_field_type_integer_get_size(struct bt_ctf_field_type *type) +int bt_field_type_integer_get_size(struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type_integer *integer; + struct bt_field_type_integer *integer; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -879,24 +879,24 @@ int bt_ctf_field_type_integer_get_size(struct bt_ctf_field_type *type) goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); ret = (int) integer->size; end: return ret; } -int bt_ctf_field_type_integer_get_signed(struct bt_ctf_field_type *type) +int bt_ctf_field_type_integer_get_signed(struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type_integer *integer; + struct bt_field_type_integer *integer; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -904,32 +904,32 @@ int bt_ctf_field_type_integer_get_signed(struct bt_ctf_field_type *type) goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); ret = integer->is_signed; end: return ret; } -bt_bool bt_ctf_field_type_integer_is_signed( - struct bt_ctf_field_type *int_field_type) +bt_bool bt_field_type_integer_is_signed( + struct bt_field_type *int_field_type) { return bt_ctf_field_type_integer_get_signed(int_field_type) ? BT_TRUE : BT_FALSE; } -int bt_ctf_field_type_integer_set_signed(struct bt_ctf_field_type *type, +int bt_field_type_integer_set_is_signed(struct bt_field_type *type, bt_bool is_signed) { int ret = 0; - struct bt_ctf_field_type_integer *integer; + struct bt_field_type_integer *integer; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -944,15 +944,15 @@ int bt_ctf_field_type_integer_set_signed(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); integer->is_signed = !!is_signed; BT_LOGV("Set integer field type's signedness: addr=%p, is-signed=%d", type, is_signed); @@ -960,11 +960,11 @@ end: return ret; } -int bt_ctf_field_type_integer_set_size(struct bt_ctf_field_type *type, +int bt_field_type_integer_set_size(struct bt_field_type *type, unsigned int size) { int ret = 0; - struct bt_ctf_field_type_integer *integer; + struct bt_field_type_integer *integer; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -979,10 +979,10 @@ int bt_ctf_field_type_integer_set_size(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -994,7 +994,7 @@ int bt_ctf_field_type_integer_set_size(struct bt_ctf_field_type *type, goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); integer->size = size; BT_LOGV("Set integer field type's size: addr=%p, size=%u", type, size); @@ -1002,32 +1002,32 @@ end: return ret; } -enum bt_ctf_integer_base bt_ctf_field_type_integer_get_base( - struct bt_ctf_field_type *type) +enum bt_integer_base bt_field_type_integer_get_base( + struct bt_field_type *type) { - enum bt_ctf_integer_base ret = BT_CTF_INTEGER_BASE_UNKNOWN; - struct bt_ctf_field_type_integer *integer; + enum bt_integer_base ret = BT_INTEGER_BASE_UNKNOWN; + struct bt_field_type_integer *integer; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); ret = integer->base; end: return ret; } -int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *type, - enum bt_ctf_integer_base base) +int bt_field_type_integer_set_base(struct bt_field_type *type, + enum bt_integer_base base) { int ret = 0; @@ -1044,23 +1044,23 @@ int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } switch (base) { - case BT_CTF_INTEGER_BASE_UNSPECIFIED: - case BT_CTF_INTEGER_BASE_BINARY: - case BT_CTF_INTEGER_BASE_OCTAL: - case BT_CTF_INTEGER_BASE_DECIMAL: - case BT_CTF_INTEGER_BASE_HEXADECIMAL: + case BT_INTEGER_BASE_UNSPECIFIED: + case BT_INTEGER_BASE_BINARY: + case BT_INTEGER_BASE_OCTAL: + case BT_INTEGER_BASE_DECIMAL: + case BT_INTEGER_BASE_HEXADECIMAL: { - struct bt_ctf_field_type_integer *integer = container_of(type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer *integer = container_of(type, + struct bt_field_type_integer, parent); integer->base = base; break; } @@ -1071,41 +1071,41 @@ int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *type, } BT_LOGV("Set integer field type's base: addr=%p, base=%s", - type, bt_ctf_integer_base_string(base)); + type, bt_integer_base_string(base)); end: return ret; } -enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding( - struct bt_ctf_field_type *type) +enum bt_string_encoding bt_field_type_integer_get_encoding( + struct bt_field_type *type) { - enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN; - struct bt_ctf_field_type_integer *integer; + enum bt_string_encoding ret = BT_STRING_ENCODING_UNKNOWN; + struct bt_field_type_integer *integer; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); ret = integer->encoding; end: return ret; } -int bt_ctf_field_type_integer_set_encoding(struct bt_ctf_field_type *type, - enum bt_ctf_string_encoding encoding) +int bt_field_type_integer_set_encoding(struct bt_field_type *type, + enum bt_string_encoding encoding) { int ret = 0; - struct bt_ctf_field_type_integer *integer; + struct bt_field_type_integer *integer; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -1120,42 +1120,43 @@ int bt_ctf_field_type_integer_set_encoding(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - if (encoding < BT_CTF_STRING_ENCODING_NONE || - encoding >= BT_CTF_STRING_ENCODING_UNKNOWN) { + if (encoding != BT_STRING_ENCODING_UTF8 && + encoding != BT_STRING_ENCODING_ASCII && + encoding != BT_STRING_ENCODING_NONE) { BT_LOGW("Invalid parameter: unknown string encoding: " "addr=%p, encoding=%d", type, encoding); ret = -1; goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); integer->encoding = encoding; BT_LOGV("Set integer field type's encoding: addr=%p, encoding=%s", - type, bt_ctf_string_encoding_string(encoding)); + type, bt_string_encoding_string(encoding)); end: return ret; } -struct bt_ctf_clock_class *bt_ctf_field_type_integer_get_mapped_clock_class( - struct bt_ctf_field_type *type) +struct bt_clock_class *bt_field_type_integer_get_mapped_clock_class( + struct bt_field_type *type) { - struct bt_ctf_field_type_integer *integer; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_field_type_integer *integer; + struct bt_clock_class *clock_class = NULL; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); clock_class = integer->mapped_clock; bt_get(clock_class); end: @@ -1163,11 +1164,11 @@ end: } BT_HIDDEN -int bt_ctf_field_type_integer_set_mapped_clock_class_no_check( - struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *clock_class) +int bt_field_type_integer_set_mapped_clock_class_no_check( + struct bt_field_type *type, + struct bt_clock_class *clock_class) { - struct bt_ctf_field_type_integer *integer; + struct bt_field_type_integer *integer; int ret = 0; if (!type) { @@ -1182,35 +1183,35 @@ int bt_ctf_field_type_integer_set_mapped_clock_class_no_check( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field type is not an integer field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - if (!bt_ctf_clock_class_is_valid(clock_class)) { + if (!bt_clock_class_is_valid(clock_class)) { BT_LOGW("Invalid parameter: clock class is invalid: ft-addr=%p" "clock-class-addr=%p, clock-class-name=\"%s\"", type, clock_class, - bt_ctf_clock_class_get_name(clock_class)); + bt_clock_class_get_name(clock_class)); ret = -1; goto end; } - integer = container_of(type, struct bt_ctf_field_type_integer, parent); + integer = container_of(type, struct bt_field_type_integer, parent); bt_put(integer->mapped_clock); integer->mapped_clock = bt_get(clock_class); BT_LOGV("Set integer field type's mapped clock class: ft-addr=%p, " "clock-class-addr=%p, clock-class-name=\"%s\"", - type, clock_class, bt_ctf_clock_class_get_name(clock_class)); + type, clock_class, bt_clock_class_get_name(clock_class)); end: return ret; } -int bt_ctf_field_type_integer_set_mapped_clock_class( - struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *clock_class) +int bt_field_type_integer_set_mapped_clock_class( + struct bt_field_type *type, + struct bt_clock_class *clock_class) { int ret = 0; @@ -1227,7 +1228,7 @@ int bt_ctf_field_type_integer_set_mapped_clock_class( goto end; } - ret = bt_ctf_field_type_integer_set_mapped_clock_class_no_check( + ret = bt_field_type_integer_set_mapped_clock_class_no_check( type, clock_class); end: @@ -1235,11 +1236,11 @@ end: } static -void bt_ctf_field_type_enum_iter_destroy(struct bt_object *obj) +void bt_field_type_enum_iter_destroy(struct bt_object *obj) { - struct bt_ctf_field_type_enumeration_mapping_iterator *iter = + struct bt_field_type_enumeration_mapping_iterator *iter = container_of(obj, - struct bt_ctf_field_type_enumeration_mapping_iterator, + struct bt_field_type_enumeration_mapping_iterator, base); BT_LOGD("Destroying enumeration field type mapping iterator: addr=%p", @@ -1250,35 +1251,35 @@ void bt_ctf_field_type_enum_iter_destroy(struct bt_object *obj) } static -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_type( - struct bt_ctf_field_type *type, - enum bt_ctf_field_type_enumeration_mapping_iterator_type iterator_type) +struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_type( + struct bt_field_type *type, + enum bt_field_type_enumeration_mapping_iterator_type iterator_type) { - struct bt_ctf_field_type_enumeration *enumeration_type; - struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; + struct bt_field_type_enumeration *enumeration_type; + struct bt_field_type_enumeration_mapping_iterator *iter = NULL; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) { + if (type->id != BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: field type is not an enumeration field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } enumeration_type = container_of(type, - struct bt_ctf_field_type_enumeration, parent); - iter = g_new0(struct bt_ctf_field_type_enumeration_mapping_iterator, 1); + struct bt_field_type_enumeration, parent); + iter = g_new0(struct bt_field_type_enumeration_mapping_iterator, 1); if (!iter) { BT_LOGE_STR("Failed to allocate one enumeration field type mapping."); goto end; } - bt_object_init(&iter->base, bt_ctf_field_type_enum_iter_destroy); + bt_object_init(&iter->base, bt_field_type_enum_iter_destroy); bt_get(type); iter->enumeration_type = enumeration_type; iter->index = -1; @@ -1287,13 +1288,13 @@ end: return iter; } -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_name( - struct bt_ctf_field_type *type, const char *name) +struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_name( + struct bt_field_type *type, const char *name) { - struct bt_ctf_field_type_enumeration_mapping_iterator *iter; + struct bt_field_type_enumeration_mapping_iterator *iter; - iter = bt_ctf_field_type_enumeration_find_mappings_type( + iter = bt_field_type_enumeration_find_mappings_type( type, ITERATOR_BY_NAME); if (!iter) { BT_LOGE("Cannot create enumeration field type mapping iterator: " @@ -1315,11 +1316,11 @@ error: return NULL; } -int bt_ctf_field_type_enumeration_mapping_iterator_next( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter) +int bt_field_type_enumeration_mapping_iterator_next( + struct bt_field_type_enumeration_mapping_iterator *iter) { - struct bt_ctf_field_type_enumeration *enumeration; - struct bt_ctf_field_type *type; + struct bt_field_type_enumeration *enumeration; + struct bt_field_type *type; int i, ret = 0, len; if (!iter) { @@ -1376,13 +1377,13 @@ end: return ret; } -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_signed_value( - struct bt_ctf_field_type *type, int64_t value) +struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_signed_value( + struct bt_field_type *type, int64_t value) { - struct bt_ctf_field_type_enumeration_mapping_iterator *iter; + struct bt_field_type_enumeration_mapping_iterator *iter; - iter = bt_ctf_field_type_enumeration_find_mappings_type( + iter = bt_field_type_enumeration_find_mappings_type( type, ITERATOR_BY_SIGNED_VALUE); if (!iter) { BT_LOGE("Cannot create enumeration field type mapping iterator: " @@ -1405,13 +1406,13 @@ error: return NULL; } -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value( - struct bt_ctf_field_type *type, uint64_t value) +struct bt_field_type_enumeration_mapping_iterator * +bt_field_type_enumeration_find_mappings_by_unsigned_value( + struct bt_field_type *type, uint64_t value) { - struct bt_ctf_field_type_enumeration_mapping_iterator *iter; + struct bt_field_type_enumeration_mapping_iterator *iter; - iter = bt_ctf_field_type_enumeration_find_mappings_type( + iter = bt_field_type_enumeration_find_mappings_type( type, ITERATOR_BY_UNSIGNED_VALUE); if (!iter) { BT_LOGE("Cannot create enumeration field type mapping iterator: " @@ -1433,8 +1434,8 @@ error: return NULL; } -int bt_ctf_field_type_enumeration_mapping_iterator_get_signed( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter, +int bt_field_type_enumeration_mapping_iterator_get_signed( + struct bt_field_type_enumeration_mapping_iterator *iter, const char **mapping_name, int64_t *range_begin, int64_t *range_end) { @@ -1452,15 +1453,15 @@ int bt_ctf_field_type_enumeration_mapping_iterator_get_signed( goto end; } - ret = bt_ctf_field_type_enumeration_get_mapping_signed( + ret = bt_field_type_enumeration_get_mapping_signed( &iter->enumeration_type->parent, iter->index, mapping_name, range_begin, range_end); end: return ret; } -int bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned( - struct bt_ctf_field_type_enumeration_mapping_iterator *iter, +int bt_field_type_enumeration_mapping_iterator_get_unsigned( + struct bt_field_type_enumeration_mapping_iterator *iter, const char **mapping_name, uint64_t *range_begin, uint64_t *range_end) { @@ -1478,15 +1479,15 @@ int bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned( goto end; } - ret = bt_ctf_field_type_enumeration_get_mapping_unsigned( + ret = bt_field_type_enumeration_get_mapping_unsigned( &iter->enumeration_type->parent, iter->index, mapping_name, range_begin, range_end); end: return ret; } -int bt_ctf_field_type_enumeration_get_mapping_signed( - struct bt_ctf_field_type *enum_field_type, +int bt_field_type_enumeration_get_mapping_signed( + struct bt_field_type *enum_field_type, uint64_t index, const char **mapping_name, int64_t *range_begin, int64_t *range_end) { @@ -1522,8 +1523,8 @@ end: return ret; } -int bt_ctf_field_type_enumeration_get_mapping_unsigned( - struct bt_ctf_field_type *enum_field_type, +int bt_field_type_enumeration_get_mapping_unsigned( + struct bt_field_type *enum_field_type, uint64_t index, const char **mapping_name, uint64_t *range_begin, uint64_t *range_end) @@ -1560,10 +1561,10 @@ end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( - struct bt_ctf_field_type *integer_container_type) +struct bt_field_type *bt_field_type_enumeration_create( + struct bt_field_type *integer_container_type) { - struct bt_ctf_field_type_enumeration *enumeration = NULL; + struct bt_field_type_enumeration *enumeration = NULL; BT_LOGD("Creating enumeration field type object: int-ft-addr=%p", integer_container_type); @@ -1573,70 +1574,70 @@ struct bt_ctf_field_type *bt_ctf_field_type_enumeration_create( goto error; } - if (integer_container_type->id != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (integer_container_type->id != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: container field type is not an integer field type: " "container-ft-addr=%p, container-ft-id=%s", integer_container_type, - bt_ctf_field_type_id_string(integer_container_type->id)); + bt_field_type_id_string(integer_container_type->id)); goto error; } - enumeration = g_new0(struct bt_ctf_field_type_enumeration, 1); + enumeration = g_new0(struct bt_field_type_enumeration, 1); if (!enumeration) { BT_LOGE_STR("Failed to allocate one enumeration field type."); goto error; } - enumeration->parent.id = BT_CTF_FIELD_TYPE_ID_ENUM; + enumeration->parent.id = BT_FIELD_TYPE_ID_ENUM; bt_get(integer_container_type); enumeration->container = integer_container_type; enumeration->entries = g_ptr_array_new_with_free_func( (GDestroyNotify)destroy_enumeration_mapping); - bt_ctf_field_type_init(&enumeration->parent, FALSE); + bt_field_type_init(&enumeration->parent, FALSE); BT_LOGD("Created enumeration field type object: addr=%p, " "int-ft-addr=%p, int-ft-size=%u", &enumeration->parent, integer_container_type, - bt_ctf_field_type_integer_get_size(integer_container_type)); + bt_field_type_integer_get_size(integer_container_type)); return &enumeration->parent; error: g_free(enumeration); return NULL; } -struct bt_ctf_field_type *bt_ctf_field_type_enumeration_get_container_type( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_enumeration_get_container_type( + struct bt_field_type *type) { - struct bt_ctf_field_type *container_type = NULL; - struct bt_ctf_field_type_enumeration *enumeration_type; + struct bt_field_type *container_type = NULL; + struct bt_field_type_enumeration *enumeration_type; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) { + if (type->id != BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: field type is not an enumeration field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } enumeration_type = container_of(type, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration, parent); container_type = enumeration_type->container; bt_get(container_type); end: return container_type; } -int bt_ctf_field_type_enumeration_add_mapping_signed( - struct bt_ctf_field_type *type, const char *string, +int bt_field_type_enumeration_add_mapping_signed( + struct bt_field_type *type, const char *string, int64_t range_start, int64_t range_end) { int ret = 0; GQuark mapping_name; struct enumeration_mapping *mapping; - struct bt_ctf_field_type_enumeration *enumeration; + struct bt_field_type_enumeration *enumeration; char *escaped_string; if (!type) { @@ -1658,10 +1659,10 @@ int bt_ctf_field_type_enumeration_add_mapping_signed( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) { + if (type->id != BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: field type is not an enumeration field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -1703,7 +1704,7 @@ int bt_ctf_field_type_enumeration_add_mapping_signed( .range_end._signed = range_end, .string = mapping_name, }; - enumeration = container_of(type, struct bt_ctf_field_type_enumeration, + enumeration = container_of(type, struct bt_field_type_enumeration, parent); g_ptr_array_add(enumeration->entries, mapping); g_ptr_array_sort(enumeration->entries, @@ -1718,14 +1719,14 @@ end: return ret; } -int bt_ctf_field_type_enumeration_add_mapping_unsigned( - struct bt_ctf_field_type *type, const char *string, +int bt_field_type_enumeration_add_mapping_unsigned( + struct bt_field_type *type, const char *string, uint64_t range_start, uint64_t range_end) { int ret = 0; GQuark mapping_name; struct enumeration_mapping *mapping; - struct bt_ctf_field_type_enumeration *enumeration; + struct bt_field_type_enumeration *enumeration; char *escaped_string; if (!type) { @@ -1747,10 +1748,10 @@ int bt_ctf_field_type_enumeration_add_mapping_unsigned( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) { + if (type->id != BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: field type is not an enumeration field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -1792,7 +1793,7 @@ int bt_ctf_field_type_enumeration_add_mapping_unsigned( .range_end._unsigned = range_end, .string = mapping_name, }; - enumeration = container_of(type, struct bt_ctf_field_type_enumeration, + enumeration = container_of(type, struct bt_field_type_enumeration, parent); g_ptr_array_add(enumeration->entries, mapping); g_ptr_array_sort(enumeration->entries, @@ -1807,11 +1808,11 @@ end: return ret; } -int64_t bt_ctf_field_type_enumeration_get_mapping_count( - struct bt_ctf_field_type *type) +int64_t bt_field_type_enumeration_get_mapping_count( + struct bt_field_type *type) { int64_t ret = 0; - struct bt_ctf_field_type_enumeration *enumeration; + struct bt_field_type_enumeration *enumeration; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -1819,25 +1820,25 @@ int64_t bt_ctf_field_type_enumeration_get_mapping_count( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ENUM) { + if (type->id != BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: field type is not an enumeration field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = (int64_t) -1; goto end; } - enumeration = container_of(type, struct bt_ctf_field_type_enumeration, + enumeration = container_of(type, struct bt_field_type_enumeration, parent); ret = (int64_t) enumeration->entries->len; end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void) +struct bt_field_type *bt_field_type_floating_point_create(void) { - struct bt_ctf_field_type_floating_point *floating_point = - g_new0(struct bt_ctf_field_type_floating_point, 1); + struct bt_field_type_floating_point *floating_point = + g_new0(struct bt_field_type_floating_point, 1); BT_LOGD_STR("Creating floating point number field type object."); @@ -1846,10 +1847,10 @@ struct bt_ctf_field_type *bt_ctf_field_type_floating_point_create(void) goto end; } - floating_point->parent.id = BT_CTF_FIELD_TYPE_ID_FLOAT; + floating_point->parent.id = BT_FIELD_TYPE_ID_FLOAT; floating_point->exp_dig = sizeof(float) * CHAR_BIT - FLT_MANT_DIG; floating_point->mant_dig = FLT_MANT_DIG; - bt_ctf_field_type_init(&floating_point->parent, TRUE); + bt_field_type_init(&floating_point->parent, TRUE); BT_LOGD("Created floating point number field type object: addr=%p, " "exp-size=%u, mant-size=%u", &floating_point->parent, floating_point->exp_dig, floating_point->mant_dig); @@ -1857,11 +1858,11 @@ end: return floating_point ? &floating_point->parent : NULL; } -int bt_ctf_field_type_floating_point_get_exponent_digits( - struct bt_ctf_field_type *type) +int bt_field_type_floating_point_get_exponent_digits( + struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type_floating_point *floating_point; + struct bt_field_type_floating_point *floating_point; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -1869,27 +1870,27 @@ int bt_ctf_field_type_floating_point_get_exponent_digits( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT) { + if (type->id != BT_FIELD_TYPE_ID_FLOAT) { BT_LOGW("Invalid parameter: field type is not a floating point number field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } floating_point = container_of(type, - struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point, parent); ret = (int) floating_point->exp_dig; end: return ret; } -int bt_ctf_field_type_floating_point_set_exponent_digits( - struct bt_ctf_field_type *type, +int bt_field_type_floating_point_set_exponent_digits( + struct bt_field_type *type, unsigned int exponent_digits) { int ret = 0; - struct bt_ctf_field_type_floating_point *floating_point; + struct bt_field_type_floating_point *floating_point; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -1904,16 +1905,16 @@ int bt_ctf_field_type_floating_point_set_exponent_digits( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT) { + if (type->id != BT_FIELD_TYPE_ID_FLOAT) { BT_LOGW("Invalid parameter: field type is not a floating point number field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } floating_point = container_of(type, - struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point, parent); if ((exponent_digits != sizeof(float) * CHAR_BIT - FLT_MANT_DIG) && (exponent_digits != sizeof(double) * CHAR_BIT - DBL_MANT_DIG) && (exponent_digits != @@ -1931,11 +1932,11 @@ end: return ret; } -int bt_ctf_field_type_floating_point_get_mantissa_digits( - struct bt_ctf_field_type *type) +int bt_field_type_floating_point_get_mantissa_digits( + struct bt_field_type *type) { int ret = 0; - struct bt_ctf_field_type_floating_point *floating_point; + struct bt_field_type_floating_point *floating_point; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -1943,27 +1944,27 @@ int bt_ctf_field_type_floating_point_get_mantissa_digits( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT) { + if (type->id != BT_FIELD_TYPE_ID_FLOAT) { BT_LOGW("Invalid parameter: field type is not a floating point number field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } floating_point = container_of(type, - struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point, parent); ret = (int) floating_point->mant_dig; end: return ret; } -int bt_ctf_field_type_floating_point_set_mantissa_digits( - struct bt_ctf_field_type *type, +int bt_field_type_floating_point_set_mantissa_digits( + struct bt_field_type *type, unsigned int mantissa_digits) { int ret = 0; - struct bt_ctf_field_type_floating_point *floating_point; + struct bt_field_type_floating_point *floating_point; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -1978,16 +1979,16 @@ int bt_ctf_field_type_floating_point_set_mantissa_digits( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_FLOAT) { + if (type->id != BT_FIELD_TYPE_ID_FLOAT) { BT_LOGW("Invalid parameter: field type is not a floating point number field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } floating_point = container_of(type, - struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point, parent); if ((mantissa_digits != FLT_MANT_DIG) && (mantissa_digits != DBL_MANT_DIG) && @@ -2005,10 +2006,10 @@ end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void) +struct bt_field_type *bt_field_type_structure_create(void) { - struct bt_ctf_field_type_structure *structure = - g_new0(struct bt_ctf_field_type_structure, 1); + struct bt_field_type_structure *structure = + g_new0(struct bt_field_type_structure, 1); BT_LOGD_STR("Creating structure field type object."); @@ -2017,11 +2018,11 @@ struct bt_ctf_field_type *bt_ctf_field_type_structure_create(void) goto error; } - structure->parent.id = BT_CTF_FIELD_TYPE_ID_STRUCT; + structure->parent.id = BT_FIELD_TYPE_ID_STRUCT; structure->fields = g_ptr_array_new_with_free_func( (GDestroyNotify)destroy_structure_field); structure->field_name_to_index = g_hash_table_new(NULL, NULL); - bt_ctf_field_type_init(&structure->parent, TRUE); + bt_field_type_init(&structure->parent, TRUE); BT_LOGD("Created structure field type object: addr=%p", &structure->parent); return &structure->parent; @@ -2029,12 +2030,12 @@ error: return NULL; } -int bt_ctf_field_type_structure_add_field(struct bt_ctf_field_type *type, - struct bt_ctf_field_type *field_type, +int bt_field_type_structure_add_field(struct bt_field_type *type, + struct bt_field_type *field_type, const char *field_name) { int ret = 0; - struct bt_ctf_field_type_structure *structure; + struct bt_field_type_structure *structure; /* * TODO: check that `field_type` does not contain `type`, @@ -2059,10 +2060,10 @@ int bt_ctf_field_type_structure_add_field(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (type->id != BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: field type is not a structure field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -2075,7 +2076,7 @@ int bt_ctf_field_type_structure_add_field(struct bt_ctf_field_type *type, } structure = container_of(type, - struct bt_ctf_field_type_structure, parent); + struct bt_field_type_structure, parent); if (add_structure_field(structure->fields, structure->field_name_to_index, field_type, field_name)) { BT_LOGW("Cannot add field to structure field type: " @@ -2092,11 +2093,11 @@ end: return ret; } -int64_t bt_ctf_field_type_structure_get_field_count( - struct bt_ctf_field_type *type) +int64_t bt_field_type_structure_get_field_count( + struct bt_field_type *type) { int64_t ret = 0; - struct bt_ctf_field_type_structure *structure; + struct bt_field_type_structure *structure; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2104,27 +2105,27 @@ int64_t bt_ctf_field_type_structure_get_field_count( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (type->id != BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: field type is not a structure field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = (int64_t) -1; goto end; } - structure = container_of(type, struct bt_ctf_field_type_structure, + structure = container_of(type, struct bt_field_type_structure, parent); ret = (int64_t) structure->fields->len; end: return ret; } -int bt_ctf_field_type_structure_get_field_by_index( - struct bt_ctf_field_type *type, - const char **field_name, struct bt_ctf_field_type **field_type, +int bt_field_type_structure_get_field_by_index( + struct bt_field_type *type, + const char **field_name, struct bt_field_type **field_type, uint64_t index) { - struct bt_ctf_field_type_structure *structure; + struct bt_field_type_structure *structure; struct structure_field *field; int ret = 0; @@ -2134,15 +2135,15 @@ int bt_ctf_field_type_structure_get_field_by_index( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (type->id != BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: field type is not a structure field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - structure = container_of(type, struct bt_ctf_field_type_structure, + structure = container_of(type, struct bt_field_type_structure, parent); if (index >= structure->fields->len) { BT_LOGW("Invalid parameter: index is out of bounds: " @@ -2165,15 +2166,15 @@ end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name( - struct bt_ctf_field_type *type, +struct bt_field_type *bt_field_type_structure_get_field_type_by_name( + struct bt_field_type *type, const char *name) { size_t index; GQuark name_quark; struct structure_field *field; - struct bt_ctf_field_type_structure *structure; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type_structure *structure; + struct bt_field_type *field_type = NULL; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2193,7 +2194,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_structure_get_field_type_by_name( goto end; } - structure = container_of(type, struct bt_ctf_field_type_structure, + structure = container_of(type, struct bt_field_type_structure, parent); if (!g_hash_table_lookup_extended(structure->field_name_to_index, GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { @@ -2210,29 +2211,29 @@ end: return field_type; } -struct bt_ctf_field_type *bt_ctf_field_type_variant_create( - struct bt_ctf_field_type *enum_tag, const char *tag_name) +struct bt_field_type *bt_field_type_variant_create( + struct bt_field_type *enum_tag, const char *tag_name) { - struct bt_ctf_field_type_variant *variant = NULL; + struct bt_field_type_variant *variant = NULL; BT_LOGD("Creating variant field type object: " "tag-ft-addr=%p, tag-field-name=\"%s\"", enum_tag, tag_name); - if (tag_name && bt_ctf_validate_identifier(tag_name)) { + if (tag_name && bt_identifier_is_valid(tag_name)) { BT_LOGW("Invalid parameter: tag field name is not a valid CTF identifier: " "tag-ft-addr=%p, tag-field-name=\"%s\"", enum_tag, tag_name); goto error; } - variant = g_new0(struct bt_ctf_field_type_variant, 1); + variant = g_new0(struct bt_field_type_variant, 1); if (!variant) { BT_LOGE_STR("Failed to allocate one variant field type."); goto error; } - variant->parent.id = BT_CTF_FIELD_TYPE_ID_VARIANT; + variant->parent.id = BT_FIELD_TYPE_ID_VARIANT; variant->tag_name = g_string_new(tag_name); variant->field_name_to_index = g_hash_table_new(NULL, NULL); variant->fields = g_ptr_array_new_with_free_func( @@ -2240,10 +2241,10 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_create( if (enum_tag) { bt_get(enum_tag); variant->tag = container_of(enum_tag, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration, parent); } - bt_ctf_field_type_init(&variant->parent, TRUE); + bt_field_type_init(&variant->parent, TRUE); /* A variant's alignment is undefined */ variant->parent.alignment = 0; BT_LOGD("Created variant field type object: addr=%p, " @@ -2254,25 +2255,25 @@ error: return NULL; } -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_tag_type( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_variant_get_tag_type( + struct bt_field_type *type) { - struct bt_ctf_field_type_variant *variant; - struct bt_ctf_field_type *tag_type = NULL; + struct bt_field_type_variant *variant; + struct bt_field_type *tag_type = NULL; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (type->id != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, parent); + variant = container_of(type, struct bt_field_type_variant, parent); if (!variant->tag) { BT_LOGV("Variant field type has no tag field type: " "addr=%p", type); @@ -2285,10 +2286,10 @@ end: return tag_type; } -const char *bt_ctf_field_type_variant_get_tag_name( - struct bt_ctf_field_type *type) +const char *bt_field_type_variant_get_tag_name( + struct bt_field_type *type) { - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; const char *tag_name = NULL; if (!type) { @@ -2296,14 +2297,14 @@ const char *bt_ctf_field_type_variant_get_tag_name( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (type->id != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, parent); + variant = container_of(type, struct bt_field_type_variant, parent); if (variant->tag_name->len == 0) { BT_LOGV("Variant field type has no tag field name: " "addr=%p", type); @@ -2315,11 +2316,11 @@ end: return tag_name; } -int bt_ctf_field_type_variant_set_tag_name( - struct bt_ctf_field_type *type, const char *name) +int bt_field_type_variant_set_tag_name( + struct bt_field_type *type, const char *name) { int ret = 0; - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2334,15 +2335,15 @@ int bt_ctf_field_type_variant_set_tag_name( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (type->id != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - if (bt_ctf_validate_identifier(name)) { + if (bt_identifier_is_valid(name)) { BT_LOGW("Invalid parameter: tag field name is not a valid CTF identifier: " "variant-ft-addr=%p, tag-field-name=\"%s\"", type, name); @@ -2350,7 +2351,7 @@ int bt_ctf_field_type_variant_set_tag_name( goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, parent); + variant = container_of(type, struct bt_field_type_variant, parent); g_string_assign(variant->tag_name, name); BT_LOGV("Set variant field type's tag field name: addr=%p, " "tag-field-name=\"%s\"", type, name); @@ -2358,13 +2359,13 @@ end: return ret; } -int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type, - struct bt_ctf_field_type *field_type, +int bt_field_type_variant_add_field(struct bt_field_type *type, + struct bt_field_type *field_type, const char *field_name) { size_t i; int ret = 0; - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; GQuark field_name_quark = g_quark_from_string(field_name); /* @@ -2384,10 +2385,10 @@ int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (type->id != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -2399,7 +2400,7 @@ int bt_ctf_field_type_variant_add_field(struct bt_ctf_field_type *type, goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, parent); + variant = container_of(type, struct bt_field_type_variant, parent); /* The user has explicitly provided a tag; validate against it. */ if (variant->tag) { @@ -2446,15 +2447,15 @@ end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name( - struct bt_ctf_field_type *type, +struct bt_field_type *bt_field_type_variant_get_field_type_by_name( + struct bt_field_type *type, const char *field_name) { size_t index; GQuark name_quark; struct structure_field *field; - struct bt_ctf_field_type_variant *variant; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type_variant *variant; + struct bt_field_type *field_type = NULL; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2474,7 +2475,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_by_name( goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, parent); + variant = container_of(type, struct bt_field_type_variant, parent); if (!g_hash_table_lookup_extended(variant->field_name_to_index, GUINT_TO_POINTER(name_quark), NULL, (gpointer *)&index)) { BT_LOGV("No such variant field type field name: " @@ -2490,14 +2491,14 @@ end: return field_type; } -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( - struct bt_ctf_field_type *type, - struct bt_ctf_field *tag) +struct bt_field_type *bt_field_type_variant_get_field_type_from_tag( + struct bt_field_type *type, + struct bt_field *tag) { int ret; const char *enum_value; - struct bt_ctf_field_type *field_type = NULL; - struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; + struct bt_field_type *field_type = NULL; + struct bt_field_type_enumeration_mapping_iterator *iter = NULL; if (!type) { BT_LOGW_STR("Invalid parameter: variant field type is NULL."); @@ -2509,22 +2510,22 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (type->id != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - iter = bt_ctf_field_enumeration_get_mappings(tag); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); + iter = bt_field_enumeration_get_mappings(tag); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); if (!iter || ret) { BT_LOGE("Cannot get enumeration field type mapping iterator from enumeration field: " "enum-field-addr=%p", tag); goto end; } - ret = bt_ctf_field_type_enumeration_mapping_iterator_get_signed(iter, + ret = bt_field_type_enumeration_mapping_iterator_get_signed(iter, &enum_value, NULL, NULL); if (ret) { BT_LOGW("Cannot get enumeration field type mapping iterator's current mapping: " @@ -2532,17 +2533,17 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_from_tag( goto end; } - field_type = bt_ctf_field_type_variant_get_field_type_by_name( + field_type = bt_field_type_variant_get_field_type_by_name( type, enum_value); end: bt_put(iter); return field_type; } -int64_t bt_ctf_field_type_variant_get_field_count(struct bt_ctf_field_type *type) +int64_t bt_field_type_variant_get_field_count(struct bt_field_type *type) { int64_t ret = 0; - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2550,15 +2551,15 @@ int64_t bt_ctf_field_type_variant_get_field_count(struct bt_ctf_field_type *type goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (type->id != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = (int64_t) -1; goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, + variant = container_of(type, struct bt_field_type_variant, parent); ret = (int64_t) variant->fields->len; end: @@ -2566,11 +2567,11 @@ end: } -int bt_ctf_field_type_variant_get_field_by_index(struct bt_ctf_field_type *type, - const char **field_name, struct bt_ctf_field_type **field_type, +int bt_field_type_variant_get_field_by_index(struct bt_field_type *type, + const char **field_name, struct bt_field_type **field_type, uint64_t index) { - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; struct structure_field *field; int ret = 0; @@ -2580,15 +2581,15 @@ int bt_ctf_field_type_variant_get_field_by_index(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (type->id != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, + variant = container_of(type, struct bt_field_type_variant, parent); if (index >= variant->fields->len) { BT_LOGW("Invalid parameter: index is out of bounds: " @@ -2611,11 +2612,11 @@ end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_array_create( - struct bt_ctf_field_type *element_type, +struct bt_field_type *bt_field_type_array_create( + struct bt_field_type *element_type, unsigned int length) { - struct bt_ctf_field_type_array *array = NULL; + struct bt_field_type_array *array = NULL; BT_LOGD("Creating array field type object: element-ft-addr=%p, " "length=%u", element_type, length); @@ -2630,17 +2631,17 @@ struct bt_ctf_field_type *bt_ctf_field_type_array_create( goto error; } - array = g_new0(struct bt_ctf_field_type_array, 1); + array = g_new0(struct bt_field_type_array, 1); if (!array) { BT_LOGE_STR("Failed to allocate one array field type."); goto error; } - array->parent.id = BT_CTF_FIELD_TYPE_ID_ARRAY; + array->parent.id = BT_FIELD_TYPE_ID_ARRAY; bt_get(element_type); array->element_type = element_type; array->length = length; - bt_ctf_field_type_init(&array->parent, FALSE); + bt_field_type_init(&array->parent, FALSE); BT_LOGD("Created array field type object: addr=%p, " "element-ft-addr=%p, length=%u", &array->parent, element_type, length); @@ -2649,25 +2650,25 @@ error: return NULL; } -struct bt_ctf_field_type *bt_ctf_field_type_array_get_element_type( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_array_get_element_type( + struct bt_field_type *type) { - struct bt_ctf_field_type *ret = NULL; - struct bt_ctf_field_type_array *array; + struct bt_field_type *ret = NULL; + struct bt_field_type_array *array; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY) { + if (type->id != BT_FIELD_TYPE_ID_ARRAY) { BT_LOGW("Invalid parameter: field type is not an array field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - array = container_of(type, struct bt_ctf_field_type_array, parent); + array = container_of(type, struct bt_field_type_array, parent); ret = array->element_type; bt_get(ret); end: @@ -2675,11 +2676,11 @@ end: } BT_HIDDEN -int bt_ctf_field_type_array_set_element_type(struct bt_ctf_field_type *type, - struct bt_ctf_field_type *element_type) +int bt_field_type_array_set_element_type(struct bt_field_type *type, + struct bt_field_type *element_type) { int ret = 0; - struct bt_ctf_field_type_array *array; + struct bt_field_type_array *array; if (!type) { BT_LOGW_STR("Invalid parameter: array field type is NULL."); @@ -2693,15 +2694,15 @@ int bt_ctf_field_type_array_set_element_type(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY) { + if (type->id != BT_FIELD_TYPE_ID_ARRAY) { BT_LOGW("Invalid parameter: field type is not an array field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - array = container_of(type, struct bt_ctf_field_type_array, parent); + array = container_of(type, struct bt_field_type_array, parent); if (array->element_type) { BT_PUT(array->element_type); @@ -2716,10 +2717,10 @@ end: return ret; } -int64_t bt_ctf_field_type_array_get_length(struct bt_ctf_field_type *type) +int64_t bt_field_type_array_get_length(struct bt_field_type *type) { int64_t ret; - struct bt_ctf_field_type_array *array; + struct bt_field_type_array *array; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2727,25 +2728,25 @@ int64_t bt_ctf_field_type_array_get_length(struct bt_ctf_field_type *type) goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY) { + if (type->id != BT_FIELD_TYPE_ID_ARRAY) { BT_LOGW("Invalid parameter: field type is not an array field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = (int64_t) -1; goto end; } - array = container_of(type, struct bt_ctf_field_type_array, parent); + array = container_of(type, struct bt_field_type_array, parent); ret = (int64_t) array->length; end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_sequence_create( - struct bt_ctf_field_type *element_type, +struct bt_field_type *bt_field_type_sequence_create( + struct bt_field_type *element_type, const char *length_field_name) { - struct bt_ctf_field_type_sequence *sequence = NULL; + struct bt_field_type_sequence *sequence = NULL; BT_LOGD("Creating sequence field type object: element-ft-addr=%p, " "length-field-name=\"%s\"", element_type, length_field_name); @@ -2755,23 +2756,23 @@ struct bt_ctf_field_type *bt_ctf_field_type_sequence_create( goto error; } - if (bt_ctf_validate_identifier(length_field_name)) { + if (bt_identifier_is_valid(length_field_name)) { BT_LOGW("Invalid parameter: length field name is not a valid CTF identifier: " "length-field-name=\"%s\"", length_field_name); goto error; } - sequence = g_new0(struct bt_ctf_field_type_sequence, 1); + sequence = g_new0(struct bt_field_type_sequence, 1); if (!sequence) { BT_LOGE_STR("Failed to allocate one sequence field type."); goto error; } - sequence->parent.id = BT_CTF_FIELD_TYPE_ID_SEQUENCE; + sequence->parent.id = BT_FIELD_TYPE_ID_SEQUENCE; bt_get(element_type); sequence->element_type = element_type; sequence->length_field_name = g_string_new(length_field_name); - bt_ctf_field_type_init(&sequence->parent, FALSE); + bt_field_type_init(&sequence->parent, FALSE); BT_LOGD("Created sequence field type object: addr=%p, " "element-ft-addr=%p, length-field-name=\"%s\"", &sequence->parent, element_type, length_field_name); @@ -2780,25 +2781,25 @@ error: return NULL; } -struct bt_ctf_field_type *bt_ctf_field_type_sequence_get_element_type( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_sequence_get_element_type( + struct bt_field_type *type) { - struct bt_ctf_field_type *ret = NULL; - struct bt_ctf_field_type_sequence *sequence; + struct bt_field_type *ret = NULL; + struct bt_field_type_sequence *sequence; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (type->id != BT_FIELD_TYPE_ID_SEQUENCE) { BT_LOGW("Invalid parameter: field type is not a sequence field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - sequence = container_of(type, struct bt_ctf_field_type_sequence, + sequence = container_of(type, struct bt_field_type_sequence, parent); ret = sequence->element_type; bt_get(ret); @@ -2807,11 +2808,11 @@ end: } BT_HIDDEN -int bt_ctf_field_type_sequence_set_element_type(struct bt_ctf_field_type *type, - struct bt_ctf_field_type *element_type) +int bt_field_type_sequence_set_element_type(struct bt_field_type *type, + struct bt_field_type *element_type) { int ret = 0; - struct bt_ctf_field_type_sequence *sequence; + struct bt_field_type_sequence *sequence; if (!type) { BT_LOGW_STR("Invalid parameter: sequence field type is NULL."); @@ -2825,15 +2826,15 @@ int bt_ctf_field_type_sequence_set_element_type(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (type->id != BT_FIELD_TYPE_ID_SEQUENCE) { BT_LOGW("Invalid parameter: field type is not a sequence field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - sequence = container_of(type, struct bt_ctf_field_type_sequence, parent); + sequence = container_of(type, struct bt_field_type_sequence, parent); if (sequence->element_type) { BT_PUT(sequence->element_type); } @@ -2847,35 +2848,35 @@ end: return ret; } -const char *bt_ctf_field_type_sequence_get_length_field_name( - struct bt_ctf_field_type *type) +const char *bt_field_type_sequence_get_length_field_name( + struct bt_field_type *type) { const char *ret = NULL; - struct bt_ctf_field_type_sequence *sequence; + struct bt_field_type_sequence *sequence; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (type->id != BT_FIELD_TYPE_ID_SEQUENCE) { BT_LOGW("Invalid parameter: field type is not a sequence field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - sequence = container_of(type, struct bt_ctf_field_type_sequence, + sequence = container_of(type, struct bt_field_type_sequence, parent); ret = sequence->length_field_name->str; end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_string_create(void) +struct bt_field_type *bt_field_type_string_create(void) { - struct bt_ctf_field_type_string *string = - g_new0(struct bt_ctf_field_type_string, 1); + struct bt_field_type_string *string = + g_new0(struct bt_field_type_string, 1); BT_LOGD_STR("Creating string field type object."); @@ -2884,44 +2885,44 @@ struct bt_ctf_field_type *bt_ctf_field_type_string_create(void) return NULL; } - string->parent.id = BT_CTF_FIELD_TYPE_ID_STRING; - bt_ctf_field_type_init(&string->parent, TRUE); - string->encoding = BT_CTF_STRING_ENCODING_UTF8; + string->parent.id = BT_FIELD_TYPE_ID_STRING; + bt_field_type_init(&string->parent, TRUE); + string->encoding = BT_STRING_ENCODING_UTF8; string->parent.alignment = CHAR_BIT; BT_LOGD("Created string field type object: addr=%p", &string->parent); return &string->parent; } -enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding( - struct bt_ctf_field_type *type) +enum bt_string_encoding bt_field_type_string_get_encoding( + struct bt_field_type *type) { - struct bt_ctf_field_type_string *string; - enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN; + struct bt_field_type_string *string; + enum bt_string_encoding ret = BT_STRING_ENCODING_UNKNOWN; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_STRING) { + if (type->id != BT_FIELD_TYPE_ID_STRING) { BT_LOGW("Invalid parameter: field type is not a string field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - string = container_of(type, struct bt_ctf_field_type_string, + string = container_of(type, struct bt_field_type_string, parent); ret = string->encoding; end: return ret; } -int bt_ctf_field_type_string_set_encoding(struct bt_ctf_field_type *type, - enum bt_ctf_string_encoding encoding) +int bt_field_type_string_set_encoding(struct bt_field_type *type, + enum bt_string_encoding encoding) { int ret = 0; - struct bt_ctf_field_type_string *string; + struct bt_field_type_string *string; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2929,34 +2930,34 @@ int bt_ctf_field_type_string_set_encoding(struct bt_ctf_field_type *type, goto end; } - if (type->id != BT_CTF_FIELD_TYPE_ID_STRING) { + if (type->id != BT_FIELD_TYPE_ID_STRING) { BT_LOGW("Invalid parameter: field type is not a string field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - if ((encoding != BT_CTF_STRING_ENCODING_UTF8 && - encoding != BT_CTF_STRING_ENCODING_ASCII)) { + if (encoding != BT_STRING_ENCODING_UTF8 && + encoding != BT_STRING_ENCODING_ASCII) { BT_LOGW("Invalid parameter: unknown string encoding: " "addr=%p, encoding=%d", type, encoding); ret = -1; goto end; } - string = container_of(type, struct bt_ctf_field_type_string, parent); + string = container_of(type, struct bt_field_type_string, parent); string->encoding = encoding; BT_LOGV("Set string field type's encoding: addr=%p, encoding=%s", - type, bt_ctf_string_encoding_string(encoding)); + type, bt_string_encoding_string(encoding)); end: return ret; } -int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) +int bt_field_type_get_alignment(struct bt_field_type *type) { int ret; - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -2969,45 +2970,45 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) goto end; } - type_id = bt_ctf_field_type_get_type_id(type); + type_id = bt_field_type_get_type_id(type); switch (type_id) { - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_SEQUENCE: { - struct bt_ctf_field_type *element = - bt_ctf_field_type_sequence_get_element_type(type); + struct bt_field_type *element = + bt_field_type_sequence_get_element_type(type); assert(element); - ret = bt_ctf_field_type_get_alignment(element); + ret = bt_field_type_get_alignment(element); bt_put(element); break; } - case BT_CTF_FIELD_TYPE_ID_ARRAY: + case BT_FIELD_TYPE_ID_ARRAY: { - struct bt_ctf_field_type *element = - bt_ctf_field_type_array_get_element_type(type); + struct bt_field_type *element = + bt_field_type_array_get_element_type(type); assert(element); - ret = bt_ctf_field_type_get_alignment(element); + ret = bt_field_type_get_alignment(element); bt_put(element); break; } - case BT_CTF_FIELD_TYPE_ID_STRUCT: + case BT_FIELD_TYPE_ID_STRUCT: { int64_t i, element_count; - element_count = bt_ctf_field_type_structure_get_field_count( + element_count = bt_field_type_structure_get_field_count( type); assert(element_count >= 0); for (i = 0; i < element_count; i++) { - struct bt_ctf_field_type *field; + struct bt_field_type *field; int field_alignment; - ret = bt_ctf_field_type_structure_get_field_by_index( + ret = bt_field_type_structure_get_field_by_index( type, NULL, &field, i); assert(ret == 0); assert(field); - field_alignment = bt_ctf_field_type_get_alignment( + field_alignment = bt_field_type_get_alignment( field); bt_put(field); if (field_alignment < 0) { @@ -3020,7 +3021,7 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type) ret = (int) type->alignment; break; } - case BT_CTF_FIELD_TYPE_ID_UNKNOWN: + case BT_FIELD_TYPE_ID_UNKNOWN: BT_LOGW("Invalid parameter: unknown field type ID: " "addr=%p, ft-id=%d", type, type_id); ret = -1; @@ -3039,11 +3040,11 @@ int is_power_of_two(unsigned int value) return ((value & (value - 1)) == 0) && value > 0; } -int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *type, +int bt_field_type_set_alignment(struct bt_field_type *type, unsigned int alignment) { int ret = 0; - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; /* Alignment must be a power of two */ if (!type) { @@ -3066,15 +3067,15 @@ int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *type, goto end; } - type_id = bt_ctf_field_type_get_type_id(type); - if (type_id == BT_CTF_FIELD_TYPE_ID_UNKNOWN) { + type_id = bt_field_type_get_type_id(type); + if (type_id == BT_FIELD_TYPE_ID_UNKNOWN) { BT_LOGW("Invalid parameter: unknown field type ID: " "addr=%p, ft-id=%d", type, type_id); ret = -1; goto end; } - if (type->id == BT_CTF_FIELD_TYPE_ID_STRING && + if (type->id == BT_FIELD_TYPE_ID_STRING && alignment != CHAR_BIT) { BT_LOGW("Invalid parameter: alignment must be %u for a string field type: " "addr=%p, align=%u", CHAR_BIT, type, alignment); @@ -3082,13 +3083,13 @@ int bt_ctf_field_type_set_alignment(struct bt_ctf_field_type *type, goto end; } - if (type_id == BT_CTF_FIELD_TYPE_ID_VARIANT || - type_id == BT_CTF_FIELD_TYPE_ID_SEQUENCE || - type_id == BT_CTF_FIELD_TYPE_ID_ARRAY) { + if (type_id == BT_FIELD_TYPE_ID_VARIANT || + type_id == BT_FIELD_TYPE_ID_SEQUENCE || + type_id == BT_FIELD_TYPE_ID_ARRAY) { /* Setting an alignment on these types makes no sense */ BT_LOGW("Invalid parameter: cannot set the alignment of this field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -3101,10 +3102,10 @@ end: return ret; } -enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order( - struct bt_ctf_field_type *type) +enum bt_byte_order bt_field_type_get_byte_order( + struct bt_field_type *type) { - enum bt_ctf_byte_order ret = BT_CTF_BYTE_ORDER_UNKNOWN; + enum bt_byte_order ret = BT_BYTE_ORDER_UNKNOWN; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -3112,25 +3113,25 @@ enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order( } switch (type->id) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: + case BT_FIELD_TYPE_ID_INTEGER: { - struct bt_ctf_field_type_integer *integer = container_of( - type, struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer *integer = container_of( + type, struct bt_field_type_integer, parent); ret = integer->user_byte_order; break; } - case BT_CTF_FIELD_TYPE_ID_ENUM: + case BT_FIELD_TYPE_ID_ENUM: { - struct bt_ctf_field_type_enumeration *enum_ft = container_of( - type, struct bt_ctf_field_type_enumeration, parent); - ret = bt_ctf_field_type_get_byte_order(enum_ft->container); + struct bt_field_type_enumeration *enum_ft = container_of( + type, struct bt_field_type_enumeration, parent); + ret = bt_field_type_get_byte_order(enum_ft->container); break; } - case BT_CTF_FIELD_TYPE_ID_FLOAT: + case BT_FIELD_TYPE_ID_FLOAT: { - struct bt_ctf_field_type_floating_point *floating_point = + struct bt_field_type_floating_point *floating_point = container_of(type, - struct bt_ctf_field_type_floating_point, + struct bt_field_type_floating_point, parent); ret = floating_point->user_byte_order; break; @@ -3138,21 +3139,21 @@ enum bt_ctf_byte_order bt_ctf_field_type_get_byte_order( default: BT_LOGW("Invalid parameter: cannot get the byte order of this field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - assert(ret == BT_CTF_BYTE_ORDER_NATIVE || - ret == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN || - ret == BT_CTF_BYTE_ORDER_BIG_ENDIAN || - ret == BT_CTF_BYTE_ORDER_NETWORK); + assert(ret == BT_BYTE_ORDER_NATIVE || + ret == BT_BYTE_ORDER_LITTLE_ENDIAN || + ret == BT_BYTE_ORDER_BIG_ENDIAN || + ret == BT_BYTE_ORDER_NETWORK); end: return ret; } -int bt_ctf_field_type_set_byte_order(struct bt_ctf_field_type *type, - enum bt_ctf_byte_order byte_order) +int bt_field_type_set_byte_order(struct bt_field_type *type, + enum bt_byte_order byte_order) { int ret = 0; @@ -3169,13 +3170,13 @@ int bt_ctf_field_type_set_byte_order(struct bt_ctf_field_type *type, goto end; } - if (byte_order != BT_CTF_BYTE_ORDER_NATIVE && - byte_order != BT_CTF_BYTE_ORDER_LITTLE_ENDIAN && - byte_order != BT_CTF_BYTE_ORDER_BIG_ENDIAN && - byte_order != BT_CTF_BYTE_ORDER_NETWORK) { + if (byte_order != BT_BYTE_ORDER_NATIVE && + byte_order != BT_BYTE_ORDER_LITTLE_ENDIAN && + byte_order != BT_BYTE_ORDER_BIG_ENDIAN && + byte_order != BT_BYTE_ORDER_NETWORK) { BT_LOGW("Invalid parameter: invalid byte order: " "addr=%p, bo=%s", type, - bt_ctf_byte_order_string(byte_order)); + bt_byte_order_string(byte_order)); ret = -1; goto end; } @@ -3185,77 +3186,77 @@ int bt_ctf_field_type_set_byte_order(struct bt_ctf_field_type *type, } BT_LOGV("Set field type's byte order: addr=%p, bo=%s", - type, bt_ctf_byte_order_string(byte_order)); + type, bt_byte_order_string(byte_order)); end: return ret; } -enum bt_ctf_field_type_id bt_ctf_field_type_get_type_id( - struct bt_ctf_field_type *type) +enum bt_field_type_id bt_field_type_get_type_id( + struct bt_field_type *type) { if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); - return BT_CTF_FIELD_TYPE_ID_UNKNOWN; + return BT_FIELD_TYPE_ID_UNKNOWN; } return type->id; } -int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *type) +int bt_field_type_is_integer(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_INTEGER; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_INTEGER; } -int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *type) +int bt_field_type_is_floating_point(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_FLOAT; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_FLOAT; } -int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *type) +int bt_field_type_is_enumeration(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_ENUM; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_ENUM; } -int bt_ctf_field_type_is_string(struct bt_ctf_field_type *type) +int bt_field_type_is_string(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_STRING; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_STRING; } -int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *type) +int bt_field_type_is_structure(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_STRUCT; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_STRUCT; } -int bt_ctf_field_type_is_array(struct bt_ctf_field_type *type) +int bt_field_type_is_array(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_ARRAY; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_ARRAY; } -int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *type) +int bt_field_type_is_sequence(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_SEQUENCE; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_SEQUENCE; } -int bt_ctf_field_type_is_variant(struct bt_ctf_field_type *type) +int bt_field_type_is_variant(struct bt_field_type *type) { - return bt_ctf_field_type_get_type_id(type) == BT_CTF_FIELD_TYPE_ID_VARIANT; + return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_VARIANT; } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_field_type_get(struct bt_ctf_field_type *type) +void bt_ctf_field_type_get(struct bt_field_type *type) { bt_get(type); } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_field_type_put(struct bt_ctf_field_type *type) +void bt_ctf_field_type_put(struct bt_field_type *type) { bt_put(type); } BT_HIDDEN -void bt_ctf_field_type_freeze(struct bt_ctf_field_type *type) +void bt_field_type_freeze(struct bt_field_type *type) { if (!type || type->frozen) { return; @@ -3265,11 +3266,11 @@ void bt_ctf_field_type_freeze(struct bt_ctf_field_type *type) } BT_HIDDEN -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_signed( - struct bt_ctf_field_type_variant *variant, +struct bt_field_type *bt_field_type_variant_get_field_type_signed( + struct bt_field_type_variant *variant, int64_t tag_value) { - struct bt_ctf_field_type *type = NULL; + struct bt_field_type *type = NULL; GQuark field_name_quark; gpointer index; struct structure_field *field_entry; @@ -3299,11 +3300,11 @@ end: } BT_HIDDEN -struct bt_ctf_field_type *bt_ctf_field_type_variant_get_field_type_unsigned( - struct bt_ctf_field_type_variant *variant, +struct bt_field_type *bt_field_type_variant_get_field_type_unsigned( + struct bt_field_type_variant *variant, uint64_t tag_value) { - struct bt_ctf_field_type *type = NULL; + struct bt_field_type *type = NULL; GQuark field_name_quark; gpointer index; struct structure_field *field_entry; @@ -3334,7 +3335,7 @@ end: } BT_HIDDEN -int bt_ctf_field_type_serialize(struct bt_ctf_field_type *type, +int bt_field_type_serialize(struct bt_field_type *type, struct metadata_context *context) { int ret; @@ -3343,7 +3344,7 @@ int bt_ctf_field_type_serialize(struct bt_ctf_field_type *type, assert(context); /* Make sure field type is valid before serializing it */ - ret = bt_ctf_field_type_validate(type); + ret = bt_field_type_validate(type); if (ret) { BT_LOGW("Cannot serialize field type's metadata: field type is invalid: " "addr=%p", type); @@ -3355,9 +3356,9 @@ end: return ret; } -struct bt_ctf_field_type *bt_ctf_field_type_copy(struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_copy(struct bt_field_type *type) { - struct bt_ctf_field_type *copy = NULL; + struct bt_field_type *copy = NULL; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -3376,13 +3377,13 @@ end: } BT_HIDDEN -int bt_ctf_field_type_structure_get_field_name_index( - struct bt_ctf_field_type *type, const char *name) +int bt_field_type_structure_get_field_name_index( + struct bt_field_type *type, const char *name) { int ret; size_t index; GQuark name_quark; - struct bt_ctf_field_type_structure *structure; + struct bt_field_type_structure *structure; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -3396,10 +3397,10 @@ int bt_ctf_field_type_structure_get_field_name_index( goto end; } - if (bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (bt_field_type_get_type_id(type) != BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: field type is not a structure field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -3413,7 +3414,7 @@ int bt_ctf_field_type_structure_get_field_name_index( goto end; } - structure = container_of(type, struct bt_ctf_field_type_structure, + structure = container_of(type, struct bt_field_type_structure, parent); if (!g_hash_table_lookup_extended(structure->field_name_to_index, GUINT_TO_POINTER(name_quark), @@ -3430,13 +3431,13 @@ end: } BT_HIDDEN -int bt_ctf_field_type_variant_get_field_name_index( - struct bt_ctf_field_type *type, const char *name) +int bt_field_type_variant_get_field_name_index( + struct bt_field_type *type, const char *name) { int ret; size_t index; GQuark name_quark; - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; if (!type) { BT_LOGW_STR("Invalid parameter: variant field type is NULL."); @@ -3450,10 +3451,10 @@ int bt_ctf_field_type_variant_get_field_name_index( goto end; } - if (bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (bt_field_type_get_type_id(type) != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } @@ -3467,7 +3468,7 @@ int bt_ctf_field_type_variant_get_field_name_index( goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, + variant = container_of(type, struct bt_field_type_variant, parent); if (!g_hash_table_lookup_extended(variant->field_name_to_index, GUINT_TO_POINTER(name_quark), @@ -3484,12 +3485,12 @@ end: } BT_HIDDEN -int bt_ctf_field_type_sequence_set_length_field_path( - struct bt_ctf_field_type *type, - struct bt_ctf_field_path *path) +int bt_field_type_sequence_set_length_field_path( + struct bt_field_type *type, + struct bt_field_path *path) { int ret = 0; - struct bt_ctf_field_type_sequence *sequence; + struct bt_field_type_sequence *sequence; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -3497,15 +3498,15 @@ int bt_ctf_field_type_sequence_set_length_field_path( goto end; } - if (bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (bt_field_type_get_type_id(type) != BT_FIELD_TYPE_ID_SEQUENCE) { BT_LOGW("Invalid parameter: field type is not a sequence field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - sequence = container_of(type, struct bt_ctf_field_type_sequence, + sequence = container_of(type, struct bt_field_type_sequence, parent); bt_get(path); BT_MOVE(sequence->length_field_path, path); @@ -3516,11 +3517,11 @@ end: } BT_HIDDEN -int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type, - struct bt_ctf_field_path *path) +int bt_field_type_variant_set_tag_field_path(struct bt_field_type *type, + struct bt_field_path *path) { int ret = 0; - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); @@ -3528,15 +3529,15 @@ int bt_ctf_field_type_variant_set_tag_field_path(struct bt_ctf_field_type *type, goto end; } - if (bt_ctf_field_type_get_type_id(type) != BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (bt_field_type_get_type_id(type) != BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, + variant = container_of(type, struct bt_field_type_variant, parent); bt_get(path); BT_MOVE(variant->tag_field_path, path); @@ -3547,11 +3548,11 @@ end: } BT_HIDDEN -int bt_ctf_field_type_variant_set_tag_field_type(struct bt_ctf_field_type *type, - struct bt_ctf_field_type *tag) +int bt_field_type_variant_set_tag_field_type(struct bt_field_type *type, + struct bt_field_type *tag) { int ret = 0; - struct bt_ctf_field_type_variant *variant; + struct bt_field_type_variant *variant; if (!type) { BT_LOGW_STR("Invalid parameter: variant field type is NULL."); @@ -3565,21 +3566,21 @@ int bt_ctf_field_type_variant_set_tag_field_type(struct bt_ctf_field_type *type, goto end; } - if (bt_ctf_field_type_get_type_id(tag) != BT_CTF_FIELD_TYPE_ID_ENUM) { + if (bt_field_type_get_type_id(tag) != BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: field type is not an enumeration field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); ret = -1; goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, + variant = container_of(type, struct bt_field_type_variant, parent); bt_get(tag); if (variant->tag) { bt_put(&variant->tag->parent); } - variant->tag = container_of(tag, struct bt_ctf_field_type_enumeration, + variant->tag = container_of(tag, struct bt_field_type_enumeration, parent); BT_LOGV("Set variant field type's tag field type: variant-ft-addr=%p, " "tag-ft-addr=%p", type, tag); @@ -3588,10 +3589,10 @@ end: } static -void bt_ctf_field_type_integer_destroy(struct bt_ctf_field_type *type) +void bt_field_type_integer_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_integer *integer = - (struct bt_ctf_field_type_integer *) type; + struct bt_field_type_integer *integer = + (struct bt_field_type_integer *) type; if (!type) { return; @@ -3604,10 +3605,10 @@ void bt_ctf_field_type_integer_destroy(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_enumeration_destroy(struct bt_ctf_field_type *type) +void bt_field_type_enumeration_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_enumeration *enumeration = - (struct bt_ctf_field_type_enumeration *) type; + struct bt_field_type_enumeration *enumeration = + (struct bt_field_type_enumeration *) type; if (!type) { return; @@ -3621,10 +3622,10 @@ void bt_ctf_field_type_enumeration_destroy(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_floating_point_destroy(struct bt_ctf_field_type *type) +void bt_field_type_floating_point_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_floating_point *floating_point = - (struct bt_ctf_field_type_floating_point *) type; + struct bt_field_type_floating_point *floating_point = + (struct bt_field_type_floating_point *) type; if (!type) { return; @@ -3635,10 +3636,10 @@ void bt_ctf_field_type_floating_point_destroy(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_structure_destroy(struct bt_ctf_field_type *type) +void bt_field_type_structure_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_structure *structure = - (struct bt_ctf_field_type_structure *) type; + struct bt_field_type_structure *structure = + (struct bt_field_type_structure *) type; if (!type) { return; @@ -3651,10 +3652,10 @@ void bt_ctf_field_type_structure_destroy(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_variant_destroy(struct bt_ctf_field_type *type) +void bt_field_type_variant_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_variant *variant = - (struct bt_ctf_field_type_variant *) type; + struct bt_field_type_variant *variant = + (struct bt_field_type_variant *) type; if (!type) { return; @@ -3671,10 +3672,10 @@ void bt_ctf_field_type_variant_destroy(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_array_destroy(struct bt_ctf_field_type *type) +void bt_field_type_array_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_array *array = - (struct bt_ctf_field_type_array *) type; + struct bt_field_type_array *array = + (struct bt_field_type_array *) type; if (!type) { return; @@ -3687,10 +3688,10 @@ void bt_ctf_field_type_array_destroy(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_sequence_destroy(struct bt_ctf_field_type *type) +void bt_field_type_sequence_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_sequence *sequence = - (struct bt_ctf_field_type_sequence *) type; + struct bt_field_type_sequence *sequence = + (struct bt_field_type_sequence *) type; if (!type) { return; @@ -3706,10 +3707,10 @@ void bt_ctf_field_type_sequence_destroy(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_string_destroy(struct bt_ctf_field_type *type) +void bt_field_type_string_destroy(struct bt_field_type *type) { - struct bt_ctf_field_type_string *string = - (struct bt_ctf_field_type_string *) type; + struct bt_field_type_string *string = + (struct bt_field_type_string *) type; if (!type) { return; @@ -3720,39 +3721,39 @@ void bt_ctf_field_type_string_destroy(struct bt_ctf_field_type *type) } static -void generic_field_type_freeze(struct bt_ctf_field_type *type) +void generic_field_type_freeze(struct bt_field_type *type) { type->frozen = 1; } static -void bt_ctf_field_type_integer_freeze(struct bt_ctf_field_type *type) +void bt_field_type_integer_freeze(struct bt_field_type *type) { - struct bt_ctf_field_type_integer *integer_type = container_of( - type, struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer *integer_type = container_of( + type, struct bt_field_type_integer, parent); BT_LOGD("Freezing integer field type object: addr=%p", type); if (integer_type->mapped_clock) { BT_LOGD_STR("Freezing integer field type's mapped clock class."); - bt_ctf_clock_class_freeze(integer_type->mapped_clock); + bt_clock_class_freeze(integer_type->mapped_clock); } generic_field_type_freeze(type); } static -void bt_ctf_field_type_enumeration_freeze(struct bt_ctf_field_type *type) +void bt_field_type_enumeration_freeze(struct bt_field_type *type) { - struct bt_ctf_field_type_enumeration *enumeration_type = container_of( - type, struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration *enumeration_type = container_of( + type, struct bt_field_type_enumeration, parent); BT_LOGD("Freezing enumeration field type object: addr=%p", type); set_enumeration_range_overlap(type); generic_field_type_freeze(type); BT_LOGD("Freezing enumeration field type object's container field type: int-ft-addr=%p", enumeration_type->container); - bt_ctf_field_type_freeze(enumeration_type->container); + bt_field_type_freeze(enumeration_type->container); } static @@ -3761,28 +3762,28 @@ void freeze_structure_field(struct structure_field *field) BT_LOGD("Freezing structure/variant field type field: field-addr=%p, " "field-ft-addr=%p, field-name=\"%s\"", field, field->type, g_quark_to_string(field->name)); - bt_ctf_field_type_freeze(field->type); + bt_field_type_freeze(field->type); } static -void bt_ctf_field_type_structure_freeze(struct bt_ctf_field_type *type) +void bt_field_type_structure_freeze(struct bt_field_type *type) { - struct bt_ctf_field_type_structure *structure_type = container_of( - type, struct bt_ctf_field_type_structure, parent); + struct bt_field_type_structure *structure_type = container_of( + type, struct bt_field_type_structure, parent); /* Cache the alignment */ BT_LOGD("Freezing structure field type object: addr=%p", type); - type->alignment = bt_ctf_field_type_get_alignment(type); + type->alignment = bt_field_type_get_alignment(type); generic_field_type_freeze(type); g_ptr_array_foreach(structure_type->fields, (GFunc) freeze_structure_field, NULL); } static -void bt_ctf_field_type_variant_freeze(struct bt_ctf_field_type *type) +void bt_field_type_variant_freeze(struct bt_field_type *type) { - struct bt_ctf_field_type_variant *variant_type = container_of( - type, struct bt_ctf_field_type_variant, parent); + struct bt_field_type_variant *variant_type = container_of( + type, struct bt_field_type_variant, parent); BT_LOGD("Freezing variant field type object: addr=%p", type); generic_field_type_freeze(type); @@ -3791,48 +3792,48 @@ void bt_ctf_field_type_variant_freeze(struct bt_ctf_field_type *type) } static -void bt_ctf_field_type_array_freeze(struct bt_ctf_field_type *type) +void bt_field_type_array_freeze(struct bt_field_type *type) { - struct bt_ctf_field_type_array *array_type = container_of( - type, struct bt_ctf_field_type_array, parent); + struct bt_field_type_array *array_type = container_of( + type, struct bt_field_type_array, parent); /* Cache the alignment */ BT_LOGD("Freezing array field type object: addr=%p", type); - type->alignment = bt_ctf_field_type_get_alignment(type); + type->alignment = bt_field_type_get_alignment(type); generic_field_type_freeze(type); BT_LOGD("Freezing array field type object's element field type: element-ft-addr=%p", array_type->element_type); - bt_ctf_field_type_freeze(array_type->element_type); + bt_field_type_freeze(array_type->element_type); } static -void bt_ctf_field_type_sequence_freeze(struct bt_ctf_field_type *type) +void bt_field_type_sequence_freeze(struct bt_field_type *type) { - struct bt_ctf_field_type_sequence *sequence_type = container_of( - type, struct bt_ctf_field_type_sequence, parent); + struct bt_field_type_sequence *sequence_type = container_of( + type, struct bt_field_type_sequence, parent); /* Cache the alignment */ BT_LOGD("Freezing sequence field type object: addr=%p", type); - type->alignment = bt_ctf_field_type_get_alignment(type); + type->alignment = bt_field_type_get_alignment(type); generic_field_type_freeze(type); BT_LOGD("Freezing sequence field type object's element field type: element-ft-addr=%p", sequence_type->element_type); - bt_ctf_field_type_freeze(sequence_type->element_type); + bt_field_type_freeze(sequence_type->element_type); } static -const char *get_encoding_string(enum bt_ctf_string_encoding encoding) +const char *get_encoding_string(enum bt_string_encoding encoding) { const char *encoding_string; switch (encoding) { - case BT_CTF_STRING_ENCODING_NONE: + case BT_STRING_ENCODING_NONE: encoding_string = "none"; break; - case BT_CTF_STRING_ENCODING_ASCII: + case BT_STRING_ENCODING_ASCII: encoding_string = "ASCII"; break; - case BT_CTF_STRING_ENCODING_UTF8: + case BT_STRING_ENCODING_UTF8: encoding_string = "UTF8"; break; default: @@ -3844,22 +3845,22 @@ const char *get_encoding_string(enum bt_ctf_string_encoding encoding) } static -const char *get_integer_base_string(enum bt_ctf_integer_base base) +const char *get_integer_base_string(enum bt_integer_base base) { const char *base_string; switch (base) { - case BT_CTF_INTEGER_BASE_DECIMAL: - case BT_CTF_INTEGER_BASE_UNSPECIFIED: + case BT_INTEGER_BASE_DECIMAL: + case BT_INTEGER_BASE_UNSPECIFIED: base_string = "decimal"; break; - case BT_CTF_INTEGER_BASE_HEXADECIMAL: + case BT_INTEGER_BASE_HEXADECIMAL: base_string = "hexadecimal"; break; - case BT_CTF_INTEGER_BASE_OCTAL: + case BT_INTEGER_BASE_OCTAL: base_string = "octal"; break; - case BT_CTF_INTEGER_BASE_BINARY: + case BT_INTEGER_BASE_BINARY: base_string = "binary"; break; default: @@ -3876,7 +3877,7 @@ void append_field_name(struct metadata_context *context, { g_string_append_c(context->string, ' '); - if (bt_ctf_validate_identifier(name) || *name == '_') { + if (bt_identifier_is_valid(name) || *name == '_') { g_string_append_c(context->string, '_'); } @@ -3884,11 +3885,11 @@ void append_field_name(struct metadata_context *context, } static -int bt_ctf_field_type_integer_serialize(struct bt_ctf_field_type *type, +int bt_field_type_integer_serialize(struct bt_field_type *type, struct metadata_context *context) { - struct bt_ctf_field_type_integer *integer = container_of(type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer *integer = container_of(type, + struct bt_field_type_integer, parent); int ret = 0; BT_LOGD("Serializing integer field type's metadata: " @@ -3901,7 +3902,7 @@ int bt_ctf_field_type_integer_serialize(struct bt_ctf_field_type *type, get_integer_base_string(integer->base), get_byte_order_string(integer->user_byte_order)); if (integer->mapped_clock) { - const char *clock_name = bt_ctf_clock_class_get_name( + const char *clock_name = bt_clock_class_get_name( integer->mapped_clock); assert(clock_name); @@ -3914,25 +3915,25 @@ int bt_ctf_field_type_integer_serialize(struct bt_ctf_field_type *type, } static -int bt_ctf_field_type_enumeration_serialize(struct bt_ctf_field_type *type, +int bt_field_type_enumeration_serialize(struct bt_field_type *type, struct metadata_context *context) { size_t entry; int ret; - struct bt_ctf_field_type_enumeration *enumeration = container_of(type, - struct bt_ctf_field_type_enumeration, parent); - struct bt_ctf_field_type *container_type; + struct bt_field_type_enumeration *enumeration = container_of(type, + struct bt_field_type_enumeration, parent); + struct bt_field_type *container_type; int container_signed; BT_LOGD("Serializing enumeration field type's metadata: " "ft-addr=%p, metadata-context-addr=%p", type, context); - container_type = bt_ctf_field_type_enumeration_get_container_type(type); + container_type = bt_field_type_enumeration_get_container_type(type); assert(container_type); container_signed = bt_ctf_field_type_integer_get_signed(container_type); assert(container_signed >= 0); g_string_append(context->string, "enum : "); BT_LOGD_STR("Serializing enumeration field type's container field type's metadata."); - ret = bt_ctf_field_type_serialize(enumeration->container, context); + ret = bt_field_type_serialize(enumeration->container, context); if (ret) { BT_LOGW("Cannot serialize enumeration field type's container field type's metadata: " "container-ft-addr=%p", enumeration->container); @@ -3990,11 +3991,11 @@ end: } static -int bt_ctf_field_type_floating_point_serialize(struct bt_ctf_field_type *type, +int bt_field_type_floating_point_serialize(struct bt_field_type *type, struct metadata_context *context) { - struct bt_ctf_field_type_floating_point *floating_point = container_of( - type, struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point *floating_point = container_of( + type, struct bt_field_type_floating_point, parent); BT_LOGD("Serializing floating point number field type's metadata: " "ft-addr=%p, metadata-context-addr=%p", type, context); @@ -4008,14 +4009,14 @@ int bt_ctf_field_type_floating_point_serialize(struct bt_ctf_field_type *type, } static -int bt_ctf_field_type_structure_serialize(struct bt_ctf_field_type *type, +int bt_field_type_structure_serialize(struct bt_field_type *type, struct metadata_context *context) { size_t i; unsigned int indent; int ret = 0; - struct bt_ctf_field_type_structure *structure = container_of(type, - struct bt_ctf_field_type_structure, parent); + struct bt_field_type_structure *structure = container_of(type, + struct bt_field_type_structure, parent); GString *structure_field_name = context->field_name; BT_LOGD("Serializing structure field type's metadata: " @@ -4040,7 +4041,7 @@ int bt_ctf_field_type_structure_serialize(struct bt_ctf_field_type *type, g_string_assign(context->field_name, g_quark_to_string(field->name)); - ret = bt_ctf_field_type_serialize(field->type, context); + ret = bt_field_type_serialize(field->type, context); if (ret) { BT_LOGW("Cannot serialize structure field type's field's metadata: " "index=%zu, " @@ -4072,14 +4073,14 @@ end: } static -int bt_ctf_field_type_variant_serialize(struct bt_ctf_field_type *type, +int bt_field_type_variant_serialize(struct bt_field_type *type, struct metadata_context *context) { size_t i; unsigned int indent; int ret = 0; - struct bt_ctf_field_type_variant *variant = container_of( - type, struct bt_ctf_field_type_variant, parent); + struct bt_field_type_variant *variant = container_of( + type, struct bt_field_type_variant, parent); GString *variant_field_name = context->field_name; BT_LOGD("Serializing variant field type's metadata: " @@ -4111,7 +4112,7 @@ int bt_ctf_field_type_variant_serialize(struct bt_ctf_field_type *type, g_string_assign(context->field_name, g_quark_to_string(field->name)); - ret = bt_ctf_field_type_serialize(field->type, context); + ret = bt_field_type_serialize(field->type, context); if (ret) { BT_LOGW("Cannot serialize variant field type's field's metadata: " "index=%zu, " @@ -4144,17 +4145,17 @@ end: } static -int bt_ctf_field_type_array_serialize(struct bt_ctf_field_type *type, +int bt_field_type_array_serialize(struct bt_field_type *type, struct metadata_context *context) { int ret = 0; - struct bt_ctf_field_type_array *array = container_of(type, - struct bt_ctf_field_type_array, parent); + struct bt_field_type_array *array = container_of(type, + struct bt_field_type_array, parent); BT_LOGD("Serializing array field type's metadata: " "ft-addr=%p, metadata-context-addr=%p", type, context); BT_LOGD_STR("Serializing array field type's element field type's metadata."); - ret = bt_ctf_field_type_serialize(array->element_type, context); + ret = bt_field_type_serialize(array->element_type, context); if (ret) { BT_LOGW("Cannot serialize array field type's element field type's metadata: " "element-ft-addr=%p", array->element_type); @@ -4175,17 +4176,17 @@ end: } static -int bt_ctf_field_type_sequence_serialize(struct bt_ctf_field_type *type, +int bt_field_type_sequence_serialize(struct bt_field_type *type, struct metadata_context *context) { int ret = 0; - struct bt_ctf_field_type_sequence *sequence = container_of( - type, struct bt_ctf_field_type_sequence, parent); + struct bt_field_type_sequence *sequence = container_of( + type, struct bt_field_type_sequence, parent); BT_LOGD("Serializing sequence field type's metadata: " "ft-addr=%p, metadata-context-addr=%p", type, context); BT_LOGD_STR("Serializing sequence field type's element field type's metadata."); - ret = bt_ctf_field_type_serialize(sequence->element_type, context); + ret = bt_field_type_serialize(sequence->element_type, context); if (ret) { BT_LOGW("Cannot serialize sequence field type's element field type's metadata: " "element-ft-addr=%p", sequence->element_type); @@ -4204,11 +4205,11 @@ end: } static -int bt_ctf_field_type_string_serialize(struct bt_ctf_field_type *type, +int bt_field_type_string_serialize(struct bt_field_type *type, struct metadata_context *context) { - struct bt_ctf_field_type_string *string = container_of( - type, struct bt_ctf_field_type_string, parent); + struct bt_field_type_string *string = container_of( + type, struct bt_field_type_string, parent); BT_LOGD("Serializing string field type's metadata: " "ft-addr=%p, metadata-context-addr=%p", type, context); @@ -4219,51 +4220,51 @@ int bt_ctf_field_type_string_serialize(struct bt_ctf_field_type *type, } static -void bt_ctf_field_type_integer_set_byte_order(struct bt_ctf_field_type *type, - enum bt_ctf_byte_order byte_order) +void bt_field_type_integer_set_byte_order(struct bt_field_type *type, + enum bt_byte_order byte_order) { - struct bt_ctf_field_type_integer *integer_type = container_of(type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer *integer_type = container_of(type, + struct bt_field_type_integer, parent); integer_type->user_byte_order = byte_order; } static -void bt_ctf_field_type_enumeration_set_byte_order( - struct bt_ctf_field_type *type, enum bt_ctf_byte_order byte_order) +void bt_field_type_enumeration_set_byte_order( + struct bt_field_type *type, enum bt_byte_order byte_order) { - struct bt_ctf_field_type_enumeration *enum_type = container_of(type, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration *enum_type = container_of(type, + struct bt_field_type_enumeration, parent); /* Safe to assume that container is an integer */ - bt_ctf_field_type_integer_set_byte_order(enum_type->container, + bt_field_type_integer_set_byte_order(enum_type->container, byte_order); } static -void bt_ctf_field_type_floating_point_set_byte_order( - struct bt_ctf_field_type *type, enum bt_ctf_byte_order byte_order) +void bt_field_type_floating_point_set_byte_order( + struct bt_field_type *type, enum bt_byte_order byte_order) { - struct bt_ctf_field_type_floating_point *floating_point_type = - container_of(type, struct bt_ctf_field_type_floating_point, + struct bt_field_type_floating_point *floating_point_type = + container_of(type, struct bt_field_type_floating_point, parent); floating_point_type->user_byte_order = byte_order; } static -void bt_ctf_field_type_structure_set_byte_order(struct bt_ctf_field_type *type, - enum bt_ctf_byte_order byte_order) +void bt_field_type_structure_set_byte_order(struct bt_field_type *type, + enum bt_byte_order byte_order) { int i; - struct bt_ctf_field_type_structure *structure_type = - container_of(type, struct bt_ctf_field_type_structure, + struct bt_field_type_structure *structure_type = + container_of(type, struct bt_field_type_structure, parent); for (i = 0; i < structure_type->fields->len; i++) { struct structure_field *field = g_ptr_array_index( structure_type->fields, i); - struct bt_ctf_field_type *field_type = field->type; + struct bt_field_type *field_type = field->type; if (set_byte_order_funcs[field_type->id]) { set_byte_order_funcs[field_type->id]( @@ -4273,18 +4274,18 @@ void bt_ctf_field_type_structure_set_byte_order(struct bt_ctf_field_type *type, } static -void bt_ctf_field_type_variant_set_byte_order(struct bt_ctf_field_type *type, - enum bt_ctf_byte_order byte_order) +void bt_field_type_variant_set_byte_order(struct bt_field_type *type, + enum bt_byte_order byte_order) { int i; - struct bt_ctf_field_type_variant *variant_type = - container_of(type, struct bt_ctf_field_type_variant, + struct bt_field_type_variant *variant_type = + container_of(type, struct bt_field_type_variant, parent); for (i = 0; i < variant_type->fields->len; i++) { struct structure_field *field = g_ptr_array_index( variant_type->fields, i); - struct bt_ctf_field_type *field_type = field->type; + struct bt_field_type *field_type = field->type; if (set_byte_order_funcs[field_type->id]) { set_byte_order_funcs[field_type->id]( @@ -4294,11 +4295,11 @@ void bt_ctf_field_type_variant_set_byte_order(struct bt_ctf_field_type *type, } static -void bt_ctf_field_type_array_set_byte_order(struct bt_ctf_field_type *type, - enum bt_ctf_byte_order byte_order) +void bt_field_type_array_set_byte_order(struct bt_field_type *type, + enum bt_byte_order byte_order) { - struct bt_ctf_field_type_array *array_type = - container_of(type, struct bt_ctf_field_type_array, + struct bt_field_type_array *array_type = + container_of(type, struct bt_field_type_array, parent); if (set_byte_order_funcs[array_type->element_type->id]) { @@ -4308,11 +4309,11 @@ void bt_ctf_field_type_array_set_byte_order(struct bt_ctf_field_type *type, } static -void bt_ctf_field_type_sequence_set_byte_order(struct bt_ctf_field_type *type, - enum bt_ctf_byte_order byte_order) +void bt_field_type_sequence_set_byte_order(struct bt_field_type *type, + enum bt_byte_order byte_order) { - struct bt_ctf_field_type_sequence *sequence_type = - container_of(type, struct bt_ctf_field_type_sequence, + struct bt_field_type_sequence *sequence_type = + container_of(type, struct bt_field_type_sequence, parent); if (set_byte_order_funcs[ @@ -4324,21 +4325,21 @@ void bt_ctf_field_type_sequence_set_byte_order(struct bt_ctf_field_type *type, } static -struct bt_ctf_field_type *bt_ctf_field_type_integer_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_integer_copy( + struct bt_field_type *type) { - struct bt_ctf_field_type *copy; - struct bt_ctf_field_type_integer *integer, *copy_integer; + struct bt_field_type *copy; + struct bt_field_type_integer *integer, *copy_integer; BT_LOGD("Copying integer field type's: addr=%p", type); - integer = container_of(type, struct bt_ctf_field_type_integer, parent); - copy = bt_ctf_field_type_integer_create(integer->size); + integer = container_of(type, struct bt_field_type_integer, parent); + copy = bt_field_type_integer_create(integer->size); if (!copy) { BT_LOGE_STR("Cannot create integer field type."); goto end; } - copy_integer = container_of(copy, struct bt_ctf_field_type_integer, + copy_integer = container_of(copy, struct bt_field_type_integer, parent); copy_integer->mapped_clock = bt_get(integer->mapped_clock); copy_integer->user_byte_order = integer->user_byte_order; @@ -4354,32 +4355,32 @@ end: } static -struct bt_ctf_field_type *bt_ctf_field_type_enumeration_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_enumeration_copy( + struct bt_field_type *type) { size_t i; - struct bt_ctf_field_type *copy = NULL, *copy_container; - struct bt_ctf_field_type_enumeration *enumeration, *copy_enumeration; + struct bt_field_type *copy = NULL, *copy_container; + struct bt_field_type_enumeration *enumeration, *copy_enumeration; BT_LOGD("Copying enumeration field type's: addr=%p", type); - enumeration = container_of(type, struct bt_ctf_field_type_enumeration, + enumeration = container_of(type, struct bt_field_type_enumeration, parent); /* Copy the source enumeration's container */ BT_LOGD_STR("Copying enumeration field type's container field type."); - copy_container = bt_ctf_field_type_copy(enumeration->container); + copy_container = bt_field_type_copy(enumeration->container); if (!copy_container) { BT_LOGE_STR("Cannot copy enumeration field type's container field type."); goto end; } - copy = bt_ctf_field_type_enumeration_create(copy_container); + copy = bt_field_type_enumeration_create(copy_container); if (!copy) { BT_LOGE_STR("Cannot create enumeration field type."); goto end; } copy_enumeration = container_of(copy, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration, parent); /* Copy all enumaration entries */ for (i = 0; i < enumeration->entries->len; i++) { @@ -4410,23 +4411,23 @@ error: } static -struct bt_ctf_field_type *bt_ctf_field_type_floating_point_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_floating_point_copy( + struct bt_field_type *type) { - struct bt_ctf_field_type *copy; - struct bt_ctf_field_type_floating_point *floating_point, *copy_float; + struct bt_field_type *copy; + struct bt_field_type_floating_point *floating_point, *copy_float; BT_LOGD("Copying floating point number field type's: addr=%p", type); floating_point = container_of(type, - struct bt_ctf_field_type_floating_point, parent); - copy = bt_ctf_field_type_floating_point_create(); + struct bt_field_type_floating_point, parent); + copy = bt_field_type_floating_point_create(); if (!copy) { BT_LOGE_STR("Cannot create floating point number field type."); goto end; } copy_float = container_of(copy, - struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point, parent); copy_float->user_byte_order = floating_point->user_byte_order; copy_float->exp_dig = floating_point->exp_dig; copy_float->mant_dig = floating_point->mant_dig; @@ -4437,26 +4438,26 @@ end: } static -struct bt_ctf_field_type *bt_ctf_field_type_structure_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_structure_copy( + struct bt_field_type *type) { int64_t i; GHashTableIter iter; gpointer key, value; - struct bt_ctf_field_type *copy; - struct bt_ctf_field_type_structure *structure, *copy_structure; + struct bt_field_type *copy; + struct bt_field_type_structure *structure, *copy_structure; BT_LOGD("Copying structure field type's: addr=%p", type); - structure = container_of(type, struct bt_ctf_field_type_structure, + structure = container_of(type, struct bt_field_type_structure, parent); - copy = bt_ctf_field_type_structure_create(); + copy = bt_field_type_structure_create(); if (!copy) { BT_LOGE_STR("Cannot create structure field type."); goto end; } copy_structure = container_of(copy, - struct bt_ctf_field_type_structure, parent); + struct bt_field_type_structure, parent); /* Copy field_name_to_index */ g_hash_table_iter_init(&iter, structure->field_name_to_index); @@ -4467,7 +4468,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_structure_copy( for (i = 0; i < structure->fields->len; i++) { struct structure_field *entry, *copy_entry; - struct bt_ctf_field_type *copy_field; + struct bt_field_type *copy_field; entry = g_ptr_array_index(structure->fields, i); BT_LOGD("Copying structure field type's field: " @@ -4480,7 +4481,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_structure_copy( goto error; } - copy_field = bt_ctf_field_type_copy(entry->type); + copy_field = bt_field_type_copy(entry->type); if (!copy_field) { BT_LOGE("Cannot copy structure field type's field: " "index=%" PRId64 ", " @@ -4506,35 +4507,35 @@ error: } static -struct bt_ctf_field_type *bt_ctf_field_type_variant_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_variant_copy( + struct bt_field_type *type) { int64_t i; GHashTableIter iter; gpointer key, value; - struct bt_ctf_field_type *copy = NULL, *copy_tag = NULL; - struct bt_ctf_field_type_variant *variant, *copy_variant; + struct bt_field_type *copy = NULL, *copy_tag = NULL; + struct bt_field_type_variant *variant, *copy_variant; BT_LOGD("Copying variant field type's: addr=%p", type); - variant = container_of(type, struct bt_ctf_field_type_variant, + variant = container_of(type, struct bt_field_type_variant, parent); if (variant->tag) { BT_LOGD_STR("Copying variant field type's tag field type."); - copy_tag = bt_ctf_field_type_copy(&variant->tag->parent); + copy_tag = bt_field_type_copy(&variant->tag->parent); if (!copy_tag) { BT_LOGE_STR("Cannot copy variant field type's tag field type."); goto end; } } - copy = bt_ctf_field_type_variant_create(copy_tag, + copy = bt_field_type_variant_create(copy_tag, variant->tag_name->len ? variant->tag_name->str : NULL); if (!copy) { BT_LOGE_STR("Cannot create variant field type."); goto end; } - copy_variant = container_of(copy, struct bt_ctf_field_type_variant, + copy_variant = container_of(copy, struct bt_field_type_variant, parent); /* Copy field_name_to_index */ @@ -4546,7 +4547,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_copy( for (i = 0; i < variant->fields->len; i++) { struct structure_field *entry, *copy_entry; - struct bt_ctf_field_type *copy_field; + struct bt_field_type *copy_field; entry = g_ptr_array_index(variant->fields, i); BT_LOGD("Copying variant field type's field: " @@ -4559,7 +4560,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_copy( goto error; } - copy_field = bt_ctf_field_type_copy(entry->type); + copy_field = bt_field_type_copy(entry->type); if (!copy_field) { BT_LOGE("Cannot copy variant field type's field: " "index=%" PRId64 ", " @@ -4576,7 +4577,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_variant_copy( if (variant->tag_field_path) { BT_LOGD_STR("Copying variant field type's tag field path."); - copy_variant->tag_field_path = bt_ctf_field_path_copy( + copy_variant->tag_field_path = bt_field_path_copy( variant->tag_field_path); if (!copy_variant->tag_field_path) { BT_LOGE_STR("Cannot copy variant field type's tag field path."); @@ -4597,23 +4598,23 @@ error: } static -struct bt_ctf_field_type *bt_ctf_field_type_array_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_array_copy( + struct bt_field_type *type) { - struct bt_ctf_field_type *copy = NULL, *copy_element; - struct bt_ctf_field_type_array *array; + struct bt_field_type *copy = NULL, *copy_element; + struct bt_field_type_array *array; BT_LOGD("Copying array field type's: addr=%p", type); - array = container_of(type, struct bt_ctf_field_type_array, + array = container_of(type, struct bt_field_type_array, parent); BT_LOGD_STR("Copying array field type's element field type."); - copy_element = bt_ctf_field_type_copy(array->element_type); + copy_element = bt_field_type_copy(array->element_type); if (!copy_element) { BT_LOGE_STR("Cannot copy array field type's element field type."); goto end; } - copy = bt_ctf_field_type_array_create(copy_element, array->length); + copy = bt_field_type_array_create(copy_element, array->length); if (!copy) { BT_LOGE_STR("Cannot create array field type."); goto end; @@ -4628,23 +4629,23 @@ end: } static -struct bt_ctf_field_type *bt_ctf_field_type_sequence_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_sequence_copy( + struct bt_field_type *type) { - struct bt_ctf_field_type *copy = NULL, *copy_element; - struct bt_ctf_field_type_sequence *sequence, *copy_sequence; + struct bt_field_type *copy = NULL, *copy_element; + struct bt_field_type_sequence *sequence, *copy_sequence; BT_LOGD("Copying sequence field type's: addr=%p", type); - sequence = container_of(type, struct bt_ctf_field_type_sequence, + sequence = container_of(type, struct bt_field_type_sequence, parent); BT_LOGD_STR("Copying sequence field type's element field type."); - copy_element = bt_ctf_field_type_copy(sequence->element_type); + copy_element = bt_field_type_copy(sequence->element_type); if (!copy_element) { BT_LOGE_STR("Cannot copy sequence field type's element field type."); goto end; } - copy = bt_ctf_field_type_sequence_create(copy_element, + copy = bt_field_type_sequence_create(copy_element, sequence->length_field_name->len ? sequence->length_field_name->str : NULL); if (!copy) { @@ -4652,11 +4653,11 @@ struct bt_ctf_field_type *bt_ctf_field_type_sequence_copy( goto end; } - copy_sequence = container_of(copy, struct bt_ctf_field_type_sequence, + copy_sequence = container_of(copy, struct bt_field_type_sequence, parent); if (sequence->length_field_path) { BT_LOGD_STR("Copying sequence field type's length field path."); - copy_sequence->length_field_path = bt_ctf_field_path_copy( + copy_sequence->length_field_path = bt_field_path_copy( sequence->length_field_path); if (!copy_sequence->length_field_path) { BT_LOGE_STR("Cannot copy sequence field type's length field path."); @@ -4676,13 +4677,13 @@ error: } static -struct bt_ctf_field_type *bt_ctf_field_type_string_copy( - struct bt_ctf_field_type *type) +struct bt_field_type *bt_field_type_string_copy( + struct bt_field_type *type) { - struct bt_ctf_field_type *copy; + struct bt_field_type *copy; BT_LOGD("Copying string field type's: addr=%p", type); - copy = bt_ctf_field_type_string_create(); + copy = bt_field_type_string_create(); if (!copy) { BT_LOGE_STR("Cannot create string field type."); goto end; @@ -4695,16 +4696,16 @@ end: } static -int bt_ctf_field_type_integer_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_integer_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; - struct bt_ctf_field_type_integer *int_type_a; - struct bt_ctf_field_type_integer *int_type_b; + struct bt_field_type_integer *int_type_a; + struct bt_field_type_integer *int_type_b; - int_type_a = container_of(type_a, struct bt_ctf_field_type_integer, + int_type_a = container_of(type_a, struct bt_field_type_integer, parent); - int_type_b = container_of(type_b, struct bt_ctf_field_type_integer, + int_type_b = container_of(type_b, struct bt_field_type_integer, parent); /* Length */ @@ -4719,8 +4720,8 @@ int bt_ctf_field_type_integer_compare(struct bt_ctf_field_type *type_a, if (int_type_a->user_byte_order != int_type_b->user_byte_order) { BT_LOGV("Integer field types differ: different byte orders: " "ft-a-bo=%s, ft-b-bo=%s", - bt_ctf_byte_order_string(int_type_a->user_byte_order), - bt_ctf_byte_order_string(int_type_b->user_byte_order)); + bt_byte_order_string(int_type_a->user_byte_order), + bt_byte_order_string(int_type_b->user_byte_order)); goto end; } @@ -4737,8 +4738,8 @@ int bt_ctf_field_type_integer_compare(struct bt_ctf_field_type *type_a, if (int_type_a->base != int_type_b->base) { BT_LOGV("Integer field types differ: different bases: " "ft-a-base=%s, ft-b-base=%s", - bt_ctf_integer_base_string(int_type_a->base), - bt_ctf_integer_base_string(int_type_b->base)); + bt_integer_base_string(int_type_a->base), + bt_integer_base_string(int_type_b->base)); goto end; } @@ -4746,8 +4747,8 @@ int bt_ctf_field_type_integer_compare(struct bt_ctf_field_type *type_a, if (int_type_a->encoding != int_type_b->encoding) { BT_LOGV("Integer field types differ: different encodings: " "ft-a-encoding=%s, ft-b-encoding=%s", - bt_ctf_string_encoding_string(int_type_a->encoding), - bt_ctf_string_encoding_string(int_type_b->encoding)); + bt_string_encoding_string(int_type_a->encoding), + bt_string_encoding_string(int_type_b->encoding)); goto end; } @@ -4759,8 +4760,8 @@ int bt_ctf_field_type_integer_compare(struct bt_ctf_field_type *type_a, "ft-a-mapped-clock-class-name=\"%s\", " "ft-b-mapped-clock-class-name=\"%s\"", int_type_a->mapped_clock, int_type_b->mapped_clock, - int_type_a->mapped_clock ? bt_ctf_clock_class_get_name(int_type_a->mapped_clock) : "", - int_type_b->mapped_clock ? bt_ctf_clock_class_get_name(int_type_b->mapped_clock) : ""); + int_type_a->mapped_clock ? bt_clock_class_get_name(int_type_a->mapped_clock) : "", + int_type_b->mapped_clock ? bt_clock_class_get_name(int_type_b->mapped_clock) : ""); goto end; } @@ -4772,24 +4773,24 @@ end: } static -int bt_ctf_field_type_floating_point_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_floating_point_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; - struct bt_ctf_field_type_floating_point *float_a; - struct bt_ctf_field_type_floating_point *float_b; + struct bt_field_type_floating_point *float_a; + struct bt_field_type_floating_point *float_b; float_a = container_of(type_a, - struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point, parent); float_b = container_of(type_b, - struct bt_ctf_field_type_floating_point, parent); + struct bt_field_type_floating_point, parent); /* Byte order */ if (float_a->user_byte_order != float_b->user_byte_order) { BT_LOGV("Floating point number field types differ: different byte orders: " "ft-a-bo=%s, ft-b-bo=%s", - bt_ctf_byte_order_string(float_a->user_byte_order), - bt_ctf_byte_order_string(float_b->user_byte_order)); + bt_byte_order_string(float_a->user_byte_order), + bt_byte_order_string(float_b->user_byte_order)); goto end; } @@ -4861,21 +4862,21 @@ end: } static -int bt_ctf_field_type_enumeration_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_enumeration_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; int i; - struct bt_ctf_field_type_enumeration *enum_a; - struct bt_ctf_field_type_enumeration *enum_b; + struct bt_field_type_enumeration *enum_a; + struct bt_field_type_enumeration *enum_b; enum_a = container_of(type_a, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration, parent); enum_b = container_of(type_b, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration, parent); /* Container field type */ - ret = bt_ctf_field_type_compare(enum_a->container, enum_b->container); + ret = bt_field_type_compare(enum_a->container, enum_b->container); if (ret) { BT_LOGV("Enumeration field types differ: different container field types: " "ft-a-container-ft-addr=%p, ft-b-container-ft-addr=%p", @@ -4915,24 +4916,24 @@ end: } static -int bt_ctf_field_type_string_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_string_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; - struct bt_ctf_field_type_string *string_a; - struct bt_ctf_field_type_string *string_b; + struct bt_field_type_string *string_a; + struct bt_field_type_string *string_b; string_a = container_of(type_a, - struct bt_ctf_field_type_string, parent); + struct bt_field_type_string, parent); string_b = container_of(type_b, - struct bt_ctf_field_type_string, parent); + struct bt_field_type_string, parent); /* Encoding */ if (string_a->encoding != string_b->encoding) { BT_LOGV("String field types differ: different encodings: " "ft-a-encoding=%s, ft-b-encoding=%s", - bt_ctf_string_encoding_string(string_a->encoding), - bt_ctf_string_encoding_string(string_b->encoding)); + bt_string_encoding_string(string_a->encoding), + bt_string_encoding_string(string_b->encoding)); goto end; } @@ -4959,7 +4960,7 @@ int compare_structure_fields(struct structure_field *field_a, } /* Type */ - ret = bt_ctf_field_type_compare(field_a->type, field_b->type); + ret = bt_field_type_compare(field_a->type, field_b->type); if (ret == 1) { BT_LOGV("Structure/variant field type fields differ: different field types: " "field-name=\"%s\", field-a-ft-addr=%p, field-b-ft-addr=%p", @@ -4972,26 +4973,26 @@ end: } static -int bt_ctf_field_type_structure_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_structure_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; int i; - struct bt_ctf_field_type_structure *struct_a; - struct bt_ctf_field_type_structure *struct_b; + struct bt_field_type_structure *struct_a; + struct bt_field_type_structure *struct_b; struct_a = container_of(type_a, - struct bt_ctf_field_type_structure, parent); + struct bt_field_type_structure, parent); struct_b = container_of(type_b, - struct bt_ctf_field_type_structure, parent); + struct bt_field_type_structure, parent); /* Alignment */ - if (bt_ctf_field_type_get_alignment(type_a) != - bt_ctf_field_type_get_alignment(type_b)) { + if (bt_field_type_get_alignment(type_a) != + bt_field_type_get_alignment(type_b)) { BT_LOGV("Structure field types differ: different alignments: " "ft-a-align=%u, ft-b-align=%u", - bt_ctf_field_type_get_alignment(type_a), - bt_ctf_field_type_get_alignment(type_b)); + bt_field_type_get_alignment(type_a), + bt_field_type_get_alignment(type_b)); goto end; } @@ -5025,18 +5026,18 @@ end: } static -int bt_ctf_field_type_variant_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_variant_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; int i; - struct bt_ctf_field_type_variant *variant_a; - struct bt_ctf_field_type_variant *variant_b; + struct bt_field_type_variant *variant_a; + struct bt_field_type_variant *variant_b; variant_a = container_of(type_a, - struct bt_ctf_field_type_variant, parent); + struct bt_field_type_variant, parent); variant_b = container_of(type_b, - struct bt_ctf_field_type_variant, parent); + struct bt_field_type_variant, parent); /* Tag name */ if (strcmp(variant_a->tag_name->str, variant_b->tag_name->str)) { @@ -5047,9 +5048,9 @@ int bt_ctf_field_type_variant_compare(struct bt_ctf_field_type *type_a, } /* Tag type */ - ret = bt_ctf_field_type_compare( - (struct bt_ctf_field_type *) variant_a->tag, - (struct bt_ctf_field_type *) variant_b->tag); + ret = bt_field_type_compare( + (struct bt_field_type *) variant_a->tag, + (struct bt_field_type *) variant_b->tag); if (ret) { BT_LOGV("Variant field types differ: different tag field types: " "ft-a-tag-ft-addr=%p, ft-b-tag-ft-addr=%p", @@ -5089,17 +5090,17 @@ end: } static -int bt_ctf_field_type_array_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_array_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; - struct bt_ctf_field_type_array *array_a; - struct bt_ctf_field_type_array *array_b; + struct bt_field_type_array *array_a; + struct bt_field_type_array *array_b; array_a = container_of(type_a, - struct bt_ctf_field_type_array, parent); + struct bt_field_type_array, parent); array_b = container_of(type_b, - struct bt_ctf_field_type_array, parent); + struct bt_field_type_array, parent); /* Length */ if (array_a->length != array_b->length) { @@ -5110,7 +5111,7 @@ int bt_ctf_field_type_array_compare(struct bt_ctf_field_type *type_a, } /* Element type */ - ret = bt_ctf_field_type_compare(array_a->element_type, + ret = bt_field_type_compare(array_a->element_type, array_b->element_type); if (ret == 1) { BT_LOGV("Array field types differ: different element field types: " @@ -5123,17 +5124,17 @@ end: } static -int bt_ctf_field_type_sequence_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_sequence_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = -1; - struct bt_ctf_field_type_sequence *sequence_a; - struct bt_ctf_field_type_sequence *sequence_b; + struct bt_field_type_sequence *sequence_a; + struct bt_field_type_sequence *sequence_b; sequence_a = container_of(type_a, - struct bt_ctf_field_type_sequence, parent); + struct bt_field_type_sequence, parent); sequence_b = container_of(type_b, - struct bt_ctf_field_type_sequence, parent); + struct bt_field_type_sequence, parent); /* Length name */ if (strcmp(sequence_a->length_field_name->str, @@ -5147,7 +5148,7 @@ int bt_ctf_field_type_sequence_compare(struct bt_ctf_field_type *type_a, } /* Element type */ - ret = bt_ctf_field_type_compare(sequence_a->element_type, + ret = bt_field_type_compare(sequence_a->element_type, sequence_b->element_type); if (ret == 1) { BT_LOGV("Sequence field types differ: different element field types: " @@ -5159,8 +5160,8 @@ end: return ret; } -int bt_ctf_field_type_compare(struct bt_ctf_field_type *type_a, - struct bt_ctf_field_type *type_b) +int bt_field_type_compare(struct bt_field_type *type_a, + struct bt_field_type *type_b) { int ret = 1; @@ -5188,12 +5189,12 @@ int bt_ctf_field_type_compare(struct bt_ctf_field_type *type_a, "ft-a-addr=%p, ft-b-addr=%p, " "ft-a-id=%s, ft-b-id=%s", type_a, type_b, - bt_ctf_field_type_id_string(type_a->id), - bt_ctf_field_type_id_string(type_b->id)); + bt_field_type_id_string(type_a->id), + bt_field_type_id_string(type_b->id)); goto end; } - if (type_a->id == BT_CTF_FIELD_TYPE_ID_UNKNOWN) { + if (type_a->id == BT_FIELD_TYPE_ID_UNKNOWN) { /* Both have unknown type IDs */ BT_LOGW_STR("Invalid parameter: field type IDs are unknown."); goto end; @@ -5210,19 +5211,19 @@ end: } BT_HIDDEN -int64_t bt_ctf_field_type_get_field_count(struct bt_ctf_field_type *field_type) +int64_t bt_field_type_get_field_count(struct bt_field_type *field_type) { int64_t field_count = -1; - enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(field_type); + enum bt_field_type_id type_id = bt_field_type_get_type_id(field_type); switch (type_id) { case CTF_TYPE_STRUCT: field_count = - bt_ctf_field_type_structure_get_field_count(field_type); + bt_field_type_structure_get_field_count(field_type); break; case CTF_TYPE_VARIANT: field_count = - bt_ctf_field_type_variant_get_field_count(field_type); + bt_field_type_variant_get_field_count(field_type); break; case CTF_TYPE_ARRAY: case CTF_TYPE_SEQUENCE: @@ -5240,16 +5241,16 @@ int64_t bt_ctf_field_type_get_field_count(struct bt_ctf_field_type *field_type) } BT_HIDDEN -struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( - struct bt_ctf_field_type *field_type, int index) +struct bt_field_type *bt_field_type_get_field_at_index( + struct bt_field_type *field_type, int index) { - struct bt_ctf_field_type *field = NULL; - enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(field_type); + struct bt_field_type *field = NULL; + enum bt_field_type_id type_id = bt_field_type_get_type_id(field_type); switch (type_id) { case CTF_TYPE_STRUCT: { - int ret = bt_ctf_field_type_structure_get_field_by_index( + int ret = bt_field_type_structure_get_field_by_index( field_type, NULL, &field, index); if (ret) { field = NULL; @@ -5259,7 +5260,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( } case CTF_TYPE_VARIANT: { - int ret = bt_ctf_field_type_variant_get_field_by_index( + int ret = bt_field_type_variant_get_field_by_index( field_type, NULL, &field, index); if (ret) { field = NULL; @@ -5268,10 +5269,10 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( break; } case CTF_TYPE_ARRAY: - field = bt_ctf_field_type_array_get_element_type(field_type); + field = bt_field_type_array_get_element_type(field_type); break; case CTF_TYPE_SEQUENCE: - field = bt_ctf_field_type_sequence_get_element_type(field_type); + field = bt_field_type_sequence_get_element_type(field_type); break; default: break; @@ -5281,19 +5282,19 @@ end: } BT_HIDDEN -int bt_ctf_field_type_get_field_index(struct bt_ctf_field_type *field_type, +int bt_field_type_get_field_index(struct bt_field_type *field_type, const char *name) { int field_index = -1; - enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(field_type); + enum bt_field_type_id type_id = bt_field_type_get_type_id(field_type); switch (type_id) { case CTF_TYPE_STRUCT: - field_index = bt_ctf_field_type_structure_get_field_name_index( + field_index = bt_field_type_structure_get_field_name_index( field_type, name); break; case CTF_TYPE_VARIANT: - field_index = bt_ctf_field_type_variant_get_field_name_index( + field_index = bt_field_type_variant_get_field_name_index( field_type, name); break; default: @@ -5303,50 +5304,50 @@ int bt_ctf_field_type_get_field_index(struct bt_ctf_field_type *field_type, return field_index; } -struct bt_ctf_field_path *bt_ctf_field_type_variant_get_tag_field_path( - struct bt_ctf_field_type *type) +struct bt_field_path *bt_field_type_variant_get_tag_field_path( + struct bt_field_type *type) { - struct bt_ctf_field_path *field_path = NULL; - struct bt_ctf_field_type_variant *variant; + struct bt_field_path *field_path = NULL; + struct bt_field_type_variant *variant; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (!bt_ctf_field_type_is_variant(type)) { + if (!bt_field_type_is_variant(type)) { BT_LOGW("Invalid parameter: field type is not a variant field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - variant = container_of(type, struct bt_ctf_field_type_variant, + variant = container_of(type, struct bt_field_type_variant, parent); field_path = bt_get(variant->tag_field_path); end: return field_path; } -struct bt_ctf_field_path *bt_ctf_field_type_sequence_get_length_field_path( - struct bt_ctf_field_type *type) +struct bt_field_path *bt_field_type_sequence_get_length_field_path( + struct bt_field_type *type) { - struct bt_ctf_field_path *field_path = NULL; - struct bt_ctf_field_type_sequence *sequence; + struct bt_field_path *field_path = NULL; + struct bt_field_type_sequence *sequence; if (!type) { BT_LOGW_STR("Invalid parameter: field type is NULL."); goto end; } - if (!bt_ctf_field_type_is_sequence(type)) { + if (!bt_field_type_is_sequence(type)) { BT_LOGW("Invalid parameter: field type is not a sequence field type: " "addr=%p, ft-id=%s", type, - bt_ctf_field_type_id_string(type->id)); + bt_field_type_id_string(type->id)); goto end; } - sequence = container_of(type, struct bt_ctf_field_type_sequence, + sequence = container_of(type, struct bt_field_type_sequence, parent); field_path = bt_get(sequence->length_field_path); end: diff --git a/lib/ctf-ir/fields.c b/lib/ctf-ir/fields.c index 32faa920..1525934e 100644 --- a/lib/ctf-ir/fields.c +++ b/lib/ctf-ir/fields.c @@ -40,253 +40,253 @@ #include static -struct bt_ctf_field *bt_ctf_field_integer_create(struct bt_ctf_field_type *); +struct bt_field *bt_field_integer_create(struct bt_field_type *); static -struct bt_ctf_field *bt_ctf_field_enumeration_create( - struct bt_ctf_field_type *); +struct bt_field *bt_field_enumeration_create( + struct bt_field_type *); static -struct bt_ctf_field *bt_ctf_field_floating_point_create( - struct bt_ctf_field_type *); +struct bt_field *bt_field_floating_point_create( + struct bt_field_type *); static -struct bt_ctf_field *bt_ctf_field_structure_create( - struct bt_ctf_field_type *); +struct bt_field *bt_field_structure_create( + struct bt_field_type *); static -struct bt_ctf_field *bt_ctf_field_variant_create( - struct bt_ctf_field_type *); +struct bt_field *bt_field_variant_create( + struct bt_field_type *); static -struct bt_ctf_field *bt_ctf_field_array_create( - struct bt_ctf_field_type *); +struct bt_field *bt_field_array_create( + struct bt_field_type *); static -struct bt_ctf_field *bt_ctf_field_sequence_create( - struct bt_ctf_field_type *); +struct bt_field *bt_field_sequence_create( + struct bt_field_type *); static -struct bt_ctf_field *bt_ctf_field_string_create(struct bt_ctf_field_type *); +struct bt_field *bt_field_string_create(struct bt_field_type *); static -void bt_ctf_field_destroy(struct bt_object *); +void bt_field_destroy(struct bt_object *); static -void bt_ctf_field_integer_destroy(struct bt_ctf_field *); +void bt_field_integer_destroy(struct bt_field *); static -void bt_ctf_field_enumeration_destroy(struct bt_ctf_field *); +void bt_field_enumeration_destroy(struct bt_field *); static -void bt_ctf_field_floating_point_destroy(struct bt_ctf_field *); +void bt_field_floating_point_destroy(struct bt_field *); static -void bt_ctf_field_structure_destroy(struct bt_ctf_field *); +void bt_field_structure_destroy(struct bt_field *); static -void bt_ctf_field_variant_destroy(struct bt_ctf_field *); +void bt_field_variant_destroy(struct bt_field *); static -void bt_ctf_field_array_destroy(struct bt_ctf_field *); +void bt_field_array_destroy(struct bt_field *); static -void bt_ctf_field_sequence_destroy(struct bt_ctf_field *); +void bt_field_sequence_destroy(struct bt_field *); static -void bt_ctf_field_string_destroy(struct bt_ctf_field *); +void bt_field_string_destroy(struct bt_field *); static -int bt_ctf_field_generic_validate(struct bt_ctf_field *); +int bt_field_generic_validate(struct bt_field *); static -int bt_ctf_field_structure_validate(struct bt_ctf_field *); +int bt_field_structure_validate(struct bt_field *); static -int bt_ctf_field_variant_validate(struct bt_ctf_field *); +int bt_field_variant_validate(struct bt_field *); static -int bt_ctf_field_enumeration_validate(struct bt_ctf_field *); +int bt_field_enumeration_validate(struct bt_field *); static -int bt_ctf_field_array_validate(struct bt_ctf_field *); +int bt_field_array_validate(struct bt_field *); static -int bt_ctf_field_sequence_validate(struct bt_ctf_field *); +int bt_field_sequence_validate(struct bt_field *); static -int bt_ctf_field_generic_reset(struct bt_ctf_field *); +int bt_field_generic_reset(struct bt_field *); static -int bt_ctf_field_structure_reset(struct bt_ctf_field *); +int bt_field_structure_reset(struct bt_field *); static -int bt_ctf_field_variant_reset(struct bt_ctf_field *); +int bt_field_variant_reset(struct bt_field *); static -int bt_ctf_field_enumeration_reset(struct bt_ctf_field *); +int bt_field_enumeration_reset(struct bt_field *); static -int bt_ctf_field_array_reset(struct bt_ctf_field *); +int bt_field_array_reset(struct bt_field *); static -int bt_ctf_field_sequence_reset(struct bt_ctf_field *); +int bt_field_sequence_reset(struct bt_field *); static -int bt_ctf_field_string_reset(struct bt_ctf_field *); +int bt_field_string_reset(struct bt_field *); static -int bt_ctf_field_integer_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_integer_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_enumeration_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_enumeration_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_floating_point_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_floating_point_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_structure_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_structure_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_variant_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_variant_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_array_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_array_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_sequence_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_sequence_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_string_serialize(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order); +int bt_field_string_serialize(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order); static -int bt_ctf_field_integer_copy(struct bt_ctf_field *, struct bt_ctf_field *); +int bt_field_integer_copy(struct bt_field *, struct bt_field *); static -int bt_ctf_field_enumeration_copy(struct bt_ctf_field *, struct bt_ctf_field *); +int bt_field_enumeration_copy(struct bt_field *, struct bt_field *); static -int bt_ctf_field_floating_point_copy(struct bt_ctf_field *, - struct bt_ctf_field *); +int bt_field_floating_point_copy(struct bt_field *, + struct bt_field *); static -int bt_ctf_field_structure_copy(struct bt_ctf_field *, struct bt_ctf_field *); +int bt_field_structure_copy(struct bt_field *, struct bt_field *); static -int bt_ctf_field_variant_copy(struct bt_ctf_field *, struct bt_ctf_field *); +int bt_field_variant_copy(struct bt_field *, struct bt_field *); static -int bt_ctf_field_array_copy(struct bt_ctf_field *, struct bt_ctf_field *); +int bt_field_array_copy(struct bt_field *, struct bt_field *); static -int bt_ctf_field_sequence_copy(struct bt_ctf_field *, struct bt_ctf_field *); +int bt_field_sequence_copy(struct bt_field *, struct bt_field *); static -int bt_ctf_field_string_copy(struct bt_ctf_field *, struct bt_ctf_field *); +int bt_field_string_copy(struct bt_field *, struct bt_field *); static -void generic_field_freeze(struct bt_ctf_field *); +void generic_field_freeze(struct bt_field *); static -void bt_ctf_field_enumeration_freeze(struct bt_ctf_field *); +void bt_field_enumeration_freeze(struct bt_field *); static -void bt_ctf_field_structure_freeze(struct bt_ctf_field *); +void bt_field_structure_freeze(struct bt_field *); static -void bt_ctf_field_variant_freeze(struct bt_ctf_field *); +void bt_field_variant_freeze(struct bt_field *); static -void bt_ctf_field_array_freeze(struct bt_ctf_field *); +void bt_field_array_freeze(struct bt_field *); static -void bt_ctf_field_sequence_freeze(struct bt_ctf_field *); +void bt_field_sequence_freeze(struct bt_field *); static -bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *); +bt_bool bt_field_generic_is_set(struct bt_field *); static -bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *); +bt_bool bt_field_structure_is_set(struct bt_field *); static -bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *); +bt_bool bt_field_variant_is_set(struct bt_field *); static -bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *); +bt_bool bt_field_enumeration_is_set(struct bt_field *); static -bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *); +bt_bool bt_field_array_is_set(struct bt_field *); static -bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *); +bt_bool bt_field_sequence_is_set(struct bt_field *); static -int increase_packet_size(struct bt_ctf_stream_pos *pos); +int increase_packet_size(struct bt_stream_pos *pos); static -struct bt_ctf_field *(* const field_create_funcs[])( - struct bt_ctf_field_type *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_create, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_create, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = - bt_ctf_field_floating_point_create, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_create, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_create, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_create, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_create, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_create, +struct bt_field *(* const field_create_funcs[])( + struct bt_field_type *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_integer_create, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_create, + [BT_FIELD_TYPE_ID_FLOAT] = + bt_field_floating_point_create, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_create, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_create, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_create, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_create, + [BT_FIELD_TYPE_ID_STRING] = bt_field_string_create, }; static -void (* const field_destroy_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_destroy, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_destroy, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = - bt_ctf_field_floating_point_destroy, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_destroy, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_destroy, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_destroy, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_destroy, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_destroy, +void (* const field_destroy_funcs[])(struct bt_field *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_integer_destroy, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_destroy, + [BT_FIELD_TYPE_ID_FLOAT] = + bt_field_floating_point_destroy, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_destroy, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_destroy, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_destroy, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_destroy, + [BT_FIELD_TYPE_ID_STRING] = bt_field_string_destroy, }; static -int (* const field_validate_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_validate, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_validate, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_validate, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_validate, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_validate, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_validate, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_validate, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_generic_validate, +int (* const field_validate_funcs[])(struct bt_field *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_generic_validate, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_validate, + [BT_FIELD_TYPE_ID_FLOAT] = bt_field_generic_validate, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_validate, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_validate, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_validate, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_validate, + [BT_FIELD_TYPE_ID_STRING] = bt_field_generic_validate, }; static -int (* const field_reset_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_reset, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_reset, +int (* const field_reset_funcs[])(struct bt_field *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_generic_reset, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_reset, + [BT_FIELD_TYPE_ID_FLOAT] = bt_field_generic_reset, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_reset, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_reset, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_reset, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_reset, + [BT_FIELD_TYPE_ID_STRING] = bt_field_string_reset, }; static -int (* const field_serialize_funcs[])(struct bt_ctf_field *, - struct bt_ctf_stream_pos *, enum bt_ctf_byte_order) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_serialize, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_serialize, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = - bt_ctf_field_floating_point_serialize, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_serialize, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_serialize, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_serialize, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_serialize, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_serialize, +int (* const field_serialize_funcs[])(struct bt_field *, + struct bt_stream_pos *, enum bt_byte_order) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_integer_serialize, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_serialize, + [BT_FIELD_TYPE_ID_FLOAT] = + bt_field_floating_point_serialize, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_serialize, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_serialize, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_serialize, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_serialize, + [BT_FIELD_TYPE_ID_STRING] = bt_field_string_serialize, }; static -int (* const field_copy_funcs[])(struct bt_ctf_field *, - struct bt_ctf_field *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_integer_copy, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_copy, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_copy, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_copy, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_copy, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_copy, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_copy, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_string_copy, +int (* const field_copy_funcs[])(struct bt_field *, + struct bt_field *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_integer_copy, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_copy, + [BT_FIELD_TYPE_ID_FLOAT] = bt_field_floating_point_copy, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_copy, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_copy, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_copy, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_copy, + [BT_FIELD_TYPE_ID_STRING] = bt_field_string_copy, }; static -void (* const field_freeze_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = generic_field_freeze, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = generic_field_freeze, - [BT_CTF_FIELD_TYPE_ID_STRING] = generic_field_freeze, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_freeze, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_freeze, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_freeze, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_freeze, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_freeze, +void (* const field_freeze_funcs[])(struct bt_field *) = { + [BT_FIELD_TYPE_ID_INTEGER] = generic_field_freeze, + [BT_FIELD_TYPE_ID_FLOAT] = generic_field_freeze, + [BT_FIELD_TYPE_ID_STRING] = generic_field_freeze, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_freeze, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_freeze, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_freeze, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_freeze, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_freeze, }; static -bt_bool (* const field_is_set_funcs[])(struct bt_ctf_field *) = { - [BT_CTF_FIELD_TYPE_ID_INTEGER] = bt_ctf_field_generic_is_set, - [BT_CTF_FIELD_TYPE_ID_ENUM] = bt_ctf_field_enumeration_is_set, - [BT_CTF_FIELD_TYPE_ID_FLOAT] = bt_ctf_field_generic_is_set, - [BT_CTF_FIELD_TYPE_ID_STRUCT] = bt_ctf_field_structure_is_set, - [BT_CTF_FIELD_TYPE_ID_VARIANT] = bt_ctf_field_variant_is_set, - [BT_CTF_FIELD_TYPE_ID_ARRAY] = bt_ctf_field_array_is_set, - [BT_CTF_FIELD_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_is_set, - [BT_CTF_FIELD_TYPE_ID_STRING] = bt_ctf_field_generic_is_set, +bt_bool (* const field_is_set_funcs[])(struct bt_field *) = { + [BT_FIELD_TYPE_ID_INTEGER] = bt_field_generic_is_set, + [BT_FIELD_TYPE_ID_ENUM] = bt_field_enumeration_is_set, + [BT_FIELD_TYPE_ID_FLOAT] = bt_field_generic_is_set, + [BT_FIELD_TYPE_ID_STRUCT] = bt_field_structure_is_set, + [BT_FIELD_TYPE_ID_VARIANT] = bt_field_variant_is_set, + [BT_FIELD_TYPE_ID_ARRAY] = bt_field_array_is_set, + [BT_FIELD_TYPE_ID_SEQUENCE] = bt_field_sequence_is_set, + [BT_FIELD_TYPE_ID_STRING] = bt_field_generic_is_set, }; -struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) +struct bt_field *bt_field_create(struct bt_field_type *type) { - struct bt_ctf_field *field = NULL; - enum bt_ctf_field_type_id type_id; + struct bt_field *field = NULL; + enum bt_field_type_id type_id; int ret; if (!type) { @@ -294,16 +294,16 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) goto error; } - type_id = bt_ctf_field_type_get_type_id(type); - if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || - type_id >= BT_CTF_NR_TYPE_IDS) { + type_id = bt_field_type_get_type_id(type); + if (type_id <= BT_FIELD_TYPE_ID_UNKNOWN || + type_id >= BT_FIELD_TYPE_ID_NR) { BT_LOGW("Invalid parameter: unknown field type ID: " "ft-addr=%p, ft-id=%d", type, type_id); goto error; } /* Field class MUST be valid */ - ret = bt_ctf_field_type_validate(type); + ret = bt_field_type_validate(type); if (ret) { /* Invalid */ BT_LOGW("Invalid parameter: field type is invalid: " @@ -317,29 +317,29 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type) } /* The type's declaration can't change after this point */ - bt_ctf_field_type_freeze(type); + bt_field_type_freeze(type); bt_get(type); - bt_object_init(field, bt_ctf_field_destroy); + bt_object_init(field, bt_field_destroy); field->type = type; error: return field; } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_field_get(struct bt_ctf_field *field) +void bt_ctf_field_get(struct bt_field *field) { bt_get(field); } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_field_put(struct bt_ctf_field *field) +void bt_ctf_field_put(struct bt_field *field) { bt_put(field); } -struct bt_ctf_field_type *bt_ctf_field_get_type(struct bt_ctf_field *field) +struct bt_field_type *bt_field_get_type(struct bt_field *field) { - struct bt_ctf_field_type *ret = NULL; + struct bt_field_type *ret = NULL; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -352,94 +352,94 @@ end: return ret; } -enum bt_ctf_field_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field) +enum bt_field_type_id bt_field_get_type_id(struct bt_field *field) { - enum bt_ctf_field_type_id ret = BT_CTF_FIELD_TYPE_ID_UNKNOWN; + enum bt_field_type_id ret = BT_FIELD_TYPE_ID_UNKNOWN; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - ret = bt_ctf_field_type_get_type_id(field->type); + ret = bt_field_type_get_type_id(field->type); end: return ret; } -bt_bool bt_ctf_field_is_integer(struct bt_ctf_field *field) +bt_bool bt_field_is_integer(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_INTEGER; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_INTEGER; } -bt_bool bt_ctf_field_is_floating_point(struct bt_ctf_field *field) +bt_bool bt_field_is_floating_point(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_FLOAT; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_FLOAT; } -bt_bool bt_ctf_field_is_enumeration(struct bt_ctf_field *field) +bt_bool bt_field_is_enumeration(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_ENUM; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_ENUM; } -bt_bool bt_ctf_field_is_string(struct bt_ctf_field *field) +bt_bool bt_field_is_string(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_STRING; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_STRING; } -bt_bool bt_ctf_field_is_structure(struct bt_ctf_field *field) +bt_bool bt_field_is_structure(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_STRUCT; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_STRUCT; } -bt_bool bt_ctf_field_is_array(struct bt_ctf_field *field) +bt_bool bt_field_is_array(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_ARRAY; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_ARRAY; } -bt_bool bt_ctf_field_is_sequence(struct bt_ctf_field *field) +bt_bool bt_field_is_sequence(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_SEQUENCE; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_SEQUENCE; } -bt_bool bt_ctf_field_is_variant(struct bt_ctf_field *field) +bt_bool bt_field_is_variant(struct bt_field *field) { - return bt_ctf_field_get_type_id(field) == BT_CTF_FIELD_TYPE_ID_VARIANT; + return bt_field_get_type_id(field) == BT_FIELD_TYPE_ID_VARIANT; } -struct bt_ctf_field *bt_ctf_field_sequence_get_length( - struct bt_ctf_field *field) +struct bt_field *bt_field_sequence_get_length( + struct bt_field *field) { - struct bt_ctf_field *ret = NULL; - struct bt_ctf_field_sequence *sequence; + struct bt_field *ret = NULL; + struct bt_field_sequence *sequence; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_SEQUENCE) { BT_LOGW("Invalid parameter: field's type is not a sequence field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto end; } - sequence = container_of(field, struct bt_ctf_field_sequence, parent); + sequence = container_of(field, struct bt_field_sequence, parent); ret = sequence->length; bt_get(ret); end: return ret; } -int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, - struct bt_ctf_field *length_field) +int bt_field_sequence_set_length(struct bt_field *field, + struct bt_field *length_field) { int ret = 0; - struct bt_ctf_field_type_integer *length_type; - struct bt_ctf_field_integer *length; - struct bt_ctf_field_sequence *sequence; + struct bt_field_type_integer *length_type; + struct bt_field_integer *length; + struct bt_field_sequence *sequence; uint64_t sequence_length; if (!field) { @@ -461,18 +461,18 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(length_field->type) != - BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(length_field->type) != + BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: length field's type is not an integer field type: " "field-addr=%p, length-field-addr=%p, length-ft-addr=%p, length-ft-id=%s", field, length_field, length_field->type, - bt_ctf_field_type_id_string(length_field->type->id)); + bt_field_type_id_string(length_field->type->id)); ret = -1; goto end; } length_type = container_of(length_field->type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer, parent); /* The length field must be unsigned */ if (length_type->is_signed) { BT_LOGW("Invalid parameter: length field's type is signed: " @@ -483,7 +483,7 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, goto end; } - if (!bt_ctf_field_is_set(length_field)) { + if (!bt_field_is_set(length_field)) { BT_LOGW("Invalid parameter: length field's value is not set: " "field-addr=%p, length-field-addr=%p, " "length-field-ft-addr=%p", field, length_field, @@ -492,10 +492,10 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, goto end; } - length = container_of(length_field, struct bt_ctf_field_integer, + length = container_of(length_field, struct bt_field_integer, parent); sequence_length = length->payload.unsignd; - sequence = container_of(field, struct bt_ctf_field_sequence, parent); + sequence = container_of(field, struct bt_field_sequence, parent); if (sequence->elements) { g_ptr_array_free(sequence->elements, TRUE); bt_put(sequence->length); @@ -513,17 +513,17 @@ int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field, g_ptr_array_set_size(sequence->elements, (size_t) sequence_length); bt_get(length_field); sequence->length = length_field; - bt_ctf_field_freeze(length_field); + bt_field_freeze(length_field); end: return ret; } -struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( - struct bt_ctf_field *field, const char *name) +struct bt_field *bt_field_structure_get_field_by_name( + struct bt_field *field, const char *name) { - struct bt_ctf_field *ret = NULL; + struct bt_field *ret = NULL; GQuark field_quark; - struct bt_ctf_field_structure *structure; + struct bt_field_structure *structure; size_t index; GHashTable *field_name_to_index; @@ -537,20 +537,20 @@ struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name( goto error; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: field's type is not a structure field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto error; } field_name_to_index = - container_of(field->type, struct bt_ctf_field_type_structure, + container_of(field->type, struct bt_field_type_structure, parent)->field_name_to_index; field_quark = g_quark_from_string(name); - structure = container_of(field, struct bt_ctf_field_structure, parent); + structure = container_of(field, struct bt_field_structure, parent); if (!g_hash_table_lookup_extended(field_name_to_index, GUINT_TO_POINTER(field_quark), NULL, (gpointer *)&index)) { @@ -566,27 +566,27 @@ error: return ret; } -struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index( - struct bt_ctf_field *field, uint64_t index) +struct bt_field *bt_field_structure_get_field_by_index( + struct bt_field *field, uint64_t index) { - struct bt_ctf_field_structure *structure; - struct bt_ctf_field *ret = NULL; + struct bt_field_structure *structure; + struct bt_field *ret = NULL; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: field's type is not a structure field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto end; } - structure = container_of(field, struct bt_ctf_field_structure, parent); + structure = container_of(field, struct bt_field_structure, parent); if (index >= structure->fields->len) { BT_LOGW("Invalid parameter: index is out of bounds: " "addr=%p, index=%" PRIu64 ", count=%u", @@ -599,13 +599,13 @@ end: return ret; } -int bt_ctf_field_structure_set_field_by_name(struct bt_ctf_field *field, - const char *name, struct bt_ctf_field *value) +int bt_field_structure_set_field_by_name(struct bt_field *field, + const char *name, struct bt_field *value) { int ret = 0; GQuark field_quark; - struct bt_ctf_field_structure *structure; - struct bt_ctf_field_type *expected_field_type = NULL; + struct bt_field_structure *structure; + struct bt_field_type *expected_field_type = NULL; size_t index; GHashTable *field_name_to_index; @@ -627,23 +627,23 @@ int bt_ctf_field_structure_set_field_by_name(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_STRUCT) { BT_LOGW("Invalid parameter: field's type is not a structure field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } field_quark = g_quark_from_string(name); - structure = container_of(field, struct bt_ctf_field_structure, parent); + structure = container_of(field, struct bt_field_structure, parent); expected_field_type = - bt_ctf_field_type_structure_get_field_type_by_name(field->type, + bt_field_type_structure_get_field_type_by_name(field->type, name); - if (bt_ctf_field_type_compare(expected_field_type, value->type)) { + if (bt_field_type_compare(expected_field_type, value->type)) { BT_LOGW("Invalid parameter: field type of field to set is different from the expected field type: " "struct-field-addr=%p, field-addr=%p, " "field-ft-addr=%p, expected-ft-addr=%p", @@ -653,7 +653,7 @@ int bt_ctf_field_structure_set_field_by_name(struct bt_ctf_field *field, } field_name_to_index = - container_of(field->type, struct bt_ctf_field_type_structure, + container_of(field->type, struct bt_field_type_structure, parent)->field_name_to_index; if (!g_hash_table_lookup_extended(field_name_to_index, GUINT_TO_POINTER(field_quark), NULL, @@ -674,28 +674,28 @@ end: return ret; } -struct bt_ctf_field *bt_ctf_field_array_get_field(struct bt_ctf_field *field, +struct bt_field *bt_field_array_get_field(struct bt_field *field, uint64_t index) { - struct bt_ctf_field *new_field = NULL; - struct bt_ctf_field_type *field_type = NULL; - struct bt_ctf_field_array *array; + struct bt_field *new_field = NULL; + struct bt_field_type *field_type = NULL; + struct bt_field_array *array; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_ARRAY) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_ARRAY) { BT_LOGW("Invalid parameter: field's type is not an array field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto end; } - array = container_of(field, struct bt_ctf_field_array, parent); + array = container_of(field, struct bt_field_array, parent); if (index >= array->elements->len) { BT_LOGW("Invalid parameter: index is out of bounds: " "addr=%p, index=%" PRIu64 ", count=%u", @@ -703,7 +703,7 @@ struct bt_ctf_field *bt_ctf_field_array_get_field(struct bt_ctf_field *field, goto end; } - field_type = bt_ctf_field_type_array_get_element_type(field->type); + field_type = bt_field_type_array_get_element_type(field->type); if (array->elements->pdata[(size_t)index]) { new_field = array->elements->pdata[(size_t)index]; goto end; @@ -722,7 +722,7 @@ struct bt_ctf_field *bt_ctf_field_array_get_field(struct bt_ctf_field *field, goto end; } - new_field = bt_ctf_field_create(field_type); + new_field = bt_field_create(field_type); array->elements->pdata[(size_t)index] = new_field; end: if (field_type) { @@ -734,28 +734,28 @@ end: return new_field; } -struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field, +struct bt_field *bt_field_sequence_get_field(struct bt_field *field, uint64_t index) { - struct bt_ctf_field *new_field = NULL; - struct bt_ctf_field_type *field_type = NULL; - struct bt_ctf_field_sequence *sequence; + struct bt_field *new_field = NULL; + struct bt_field_type *field_type = NULL; + struct bt_field_sequence *sequence; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_SEQUENCE) { BT_LOGW("Invalid parameter: field's type is not a sequence field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto end; } - sequence = container_of(field, struct bt_ctf_field_sequence, parent); + sequence = container_of(field, struct bt_field_sequence, parent); if (!sequence->elements) { BT_LOGV("Sequence field's elements do not exist: addr=%p", field); @@ -769,7 +769,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field, goto end; } - field_type = bt_ctf_field_type_sequence_get_element_type(field->type); + field_type = bt_field_type_sequence_get_element_type(field->type); if (sequence->elements->pdata[(size_t) index]) { new_field = sequence->elements->pdata[(size_t) index]; goto end; @@ -788,7 +788,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field, goto end; } - new_field = bt_ctf_field_create(field_type); + new_field = bt_field_create(field_type); sequence->elements->pdata[(size_t) index] = new_field; end: if (field_type) { @@ -800,15 +800,15 @@ end: return new_field; } -struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, - struct bt_ctf_field *tag_field) +struct bt_field *bt_field_variant_get_field(struct bt_field *field, + struct bt_field *tag_field) { - struct bt_ctf_field *new_field = NULL; - struct bt_ctf_field_variant *variant; - struct bt_ctf_field_type_variant *variant_type; - struct bt_ctf_field_type *field_type; - struct bt_ctf_field *tag_enum = NULL; - struct bt_ctf_field_integer *tag_enum_integer; + struct bt_field *new_field = NULL; + struct bt_field_variant *variant; + struct bt_field_type_variant *variant_type; + struct bt_field_type *field_type; + struct bt_field *tag_enum = NULL; + struct bt_field_integer *tag_enum_integer; int64_t tag_enum_value; if (!field) { @@ -821,36 +821,36 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field's type is not a variant field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto end; } - if (bt_ctf_field_type_get_type_id(tag_field->type) != - BT_CTF_FIELD_TYPE_ID_ENUM) { + if (bt_field_type_get_type_id(tag_field->type) != + BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: tag field's type is not an enumeration field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", tag_field, tag_field->type, - bt_ctf_field_type_id_string(tag_field->type->id)); + bt_field_type_id_string(tag_field->type->id)); goto end; } - variant = container_of(field, struct bt_ctf_field_variant, parent); + variant = container_of(field, struct bt_field_variant, parent); variant_type = container_of(field->type, - struct bt_ctf_field_type_variant, parent); - tag_enum = bt_ctf_field_enumeration_get_container(tag_field); + struct bt_field_type_variant, parent); + tag_enum = bt_field_enumeration_get_container(tag_field); if (!tag_enum) { goto end; } - tag_enum_integer = container_of(tag_enum, struct bt_ctf_field_integer, + tag_enum_integer = container_of(tag_enum, struct bt_field_integer, parent); - if (bt_ctf_field_validate(tag_field) < 0) { + if (bt_field_validate(tag_field) < 0) { BT_LOGW("Invalid parameter: tag field is invalid: " "variant-field-addr=%p, tag-field-addr=%p", field, tag_field); @@ -865,15 +865,15 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, * the current payload instead of creating a fresh one. */ if (variant->tag && variant->payload) { - struct bt_ctf_field *cur_tag_container = NULL; - struct bt_ctf_field_integer *cur_tag_enum_integer; + struct bt_field *cur_tag_container = NULL; + struct bt_field_integer *cur_tag_enum_integer; int64_t cur_tag_value; cur_tag_container = - bt_ctf_field_enumeration_get_container(variant->tag); + bt_field_enumeration_get_container(variant->tag); assert(cur_tag_container); cur_tag_enum_integer = container_of(cur_tag_container, - struct bt_ctf_field_integer, parent); + struct bt_field_integer, parent); bt_put(cur_tag_container); cur_tag_value = cur_tag_enum_integer->payload.signd; @@ -898,7 +898,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, goto end; } - field_type = bt_ctf_field_type_variant_get_field_type_signed( + field_type = bt_field_type_variant_get_field_type_signed( variant_type, tag_enum_value); if (!field_type) { BT_LOGW("Cannot get variant field type's field: " @@ -908,7 +908,7 @@ struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field, goto end; } - new_field = bt_ctf_field_create(field_type); + new_field = bt_field_create(field_type); if (!new_field) { BT_LOGW("Cannot create field: " "variant-field-addr=%p, variant-ft-addr=%p, " @@ -927,27 +927,27 @@ end: return new_field; } -struct bt_ctf_field *bt_ctf_field_variant_get_current_field( - struct bt_ctf_field *variant_field) +struct bt_field *bt_field_variant_get_current_field( + struct bt_field *variant_field) { - struct bt_ctf_field *current_field = NULL; - struct bt_ctf_field_variant *variant; + struct bt_field *current_field = NULL; + struct bt_field_variant *variant; if (!variant_field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - if (bt_ctf_field_type_get_type_id(variant_field->type) != - BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (bt_field_type_get_type_id(variant_field->type) != + BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field's type is not a variant field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", variant_field, variant_field->type, - bt_ctf_field_type_id_string(variant_field->type->id)); + bt_field_type_id_string(variant_field->type->id)); goto end; } - variant = container_of(variant_field, struct bt_ctf_field_variant, + variant = container_of(variant_field, struct bt_field_variant, parent); if (variant->payload) { @@ -960,27 +960,27 @@ end: return current_field; } -struct bt_ctf_field *bt_ctf_field_variant_get_tag( - struct bt_ctf_field *variant_field) +struct bt_field *bt_field_variant_get_tag( + struct bt_field *variant_field) { - struct bt_ctf_field *tag = NULL; - struct bt_ctf_field_variant *variant; + struct bt_field *tag = NULL; + struct bt_field_variant *variant; if (!variant_field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - if (bt_ctf_field_type_get_type_id(variant_field->type) != - BT_CTF_FIELD_TYPE_ID_VARIANT) { + if (bt_field_type_get_type_id(variant_field->type) != + BT_FIELD_TYPE_ID_VARIANT) { BT_LOGW("Invalid parameter: field's type is not a variant field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", variant_field, variant_field->type, - bt_ctf_field_type_id_string(variant_field->type->id)); + bt_field_type_id_string(variant_field->type->id)); goto end; } - variant = container_of(variant_field, struct bt_ctf_field_variant, + variant = container_of(variant_field, struct bt_field_variant, parent); if (variant->tag) { tag = bt_get(variant->tag); @@ -989,27 +989,27 @@ end: return tag; } -struct bt_ctf_field *bt_ctf_field_enumeration_get_container( - struct bt_ctf_field *field) +struct bt_field *bt_field_enumeration_get_container( + struct bt_field *field) { - struct bt_ctf_field *container = NULL; - struct bt_ctf_field_enumeration *enumeration; + struct bt_field *container = NULL; + struct bt_field_enumeration *enumeration; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_ENUM) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Invalid parameter: field's type is not an enumeration field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto end; } - enumeration = container_of(field, struct bt_ctf_field_enumeration, + enumeration = container_of(field, struct bt_field_enumeration, parent); if (!enumeration->payload) { /* We don't want to modify this field if it's frozen */ @@ -1026,11 +1026,11 @@ struct bt_ctf_field *bt_ctf_field_enumeration_get_container( goto end; } - struct bt_ctf_field_type_enumeration *enumeration_type = + struct bt_field_type_enumeration *enumeration_type = container_of(field->type, - struct bt_ctf_field_type_enumeration, parent); + struct bt_field_type_enumeration, parent); enumeration->payload = - bt_ctf_field_create(enumeration_type->container); + bt_field_create(enumeration_type->container); } container = enumeration->payload; @@ -1039,31 +1039,31 @@ end: return container; } -struct bt_ctf_field_type_enumeration_mapping_iterator * -bt_ctf_field_enumeration_get_mappings(struct bt_ctf_field *field) +struct bt_field_type_enumeration_mapping_iterator * +bt_field_enumeration_get_mappings(struct bt_field *field) { int ret; - struct bt_ctf_field *container = NULL; - struct bt_ctf_field_type *container_type = NULL; - struct bt_ctf_field_type_integer *integer_type = NULL; - struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; + struct bt_field *container = NULL; + struct bt_field_type *container_type = NULL; + struct bt_field_type_integer *integer_type = NULL; + struct bt_field_type_enumeration_mapping_iterator *iter = NULL; - container = bt_ctf_field_enumeration_get_container(field); + container = bt_field_enumeration_get_container(field); if (!container) { BT_LOGW("Invalid parameter: enumeration field has no container field: " "addr=%p", field); goto end; } - container_type = bt_ctf_field_get_type(container); + container_type = bt_field_get_type(container); assert(container_type); integer_type = container_of(container_type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer, parent); if (!integer_type->is_signed) { uint64_t value; - ret = bt_ctf_field_unsigned_integer_get_value(container, + ret = bt_field_unsigned_integer_get_value(container, &value); if (ret) { BT_LOGW("Cannot get value from signed enumeration field's payload field: " @@ -1071,12 +1071,12 @@ bt_ctf_field_enumeration_get_mappings(struct bt_ctf_field *field) field, container); goto error_put_container_type; } - iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value( + iter = bt_field_type_enumeration_find_mappings_by_unsigned_value( field->type, value); } else { int64_t value; - ret = bt_ctf_field_signed_integer_get_value(container, + ret = bt_field_signed_integer_get_value(container, &value); if (ret) { BT_LOGW("Cannot get value from unsigned enumeration field's payload field: " @@ -1084,7 +1084,7 @@ bt_ctf_field_enumeration_get_mappings(struct bt_ctf_field *field) field, container); goto error_put_container_type; } - iter = bt_ctf_field_type_enumeration_find_mappings_by_signed_value( + iter = bt_field_type_enumeration_find_mappings_by_signed_value( field->type, value); } @@ -1095,12 +1095,12 @@ end: return iter; } -int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *field, +int bt_field_signed_integer_get_value(struct bt_field *field, int64_t *value) { int ret = 0; - struct bt_ctf_field_integer *integer; - struct bt_ctf_field_type_integer *integer_type; + struct bt_field_integer *integer; + struct bt_field_type_integer *integer_type; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1120,18 +1120,18 @@ int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field's type is not an integer field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } integer_type = container_of(field->type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer, parent); if (!integer_type->is_signed) { BT_LOGW("Invalid parameter: integer field's type is not signed: " "field-addr=%p, ft-addr=%p", field, field->type); @@ -1140,18 +1140,18 @@ int bt_ctf_field_signed_integer_get_value(struct bt_ctf_field *field, } integer = container_of(field, - struct bt_ctf_field_integer, parent); + struct bt_field_integer, parent); *value = integer->payload.signd; end: return ret; } -int bt_ctf_field_signed_integer_set_value(struct bt_ctf_field *field, +int bt_field_signed_integer_set_value(struct bt_field *field, int64_t value) { int ret = 0; - struct bt_ctf_field_integer *integer; - struct bt_ctf_field_type_integer *integer_type; + struct bt_field_integer *integer; + struct bt_field_type_integer *integer_type; unsigned int size; int64_t min_value, max_value; @@ -1168,19 +1168,19 @@ int bt_ctf_field_signed_integer_set_value(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field's type is not an integer field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } - integer = container_of(field, struct bt_ctf_field_integer, parent); + integer = container_of(field, struct bt_field_integer, parent); integer_type = container_of(field->type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer, parent); if (!integer_type->is_signed) { BT_LOGW("Invalid parameter: integer field's type is not signed: " "field-addr=%p, ft-addr=%p", field, field->type); @@ -1206,12 +1206,12 @@ end: return ret; } -int bt_ctf_field_unsigned_integer_get_value(struct bt_ctf_field *field, +int bt_field_unsigned_integer_get_value(struct bt_field *field, uint64_t *value) { int ret = 0; - struct bt_ctf_field_integer *integer; - struct bt_ctf_field_type_integer *integer_type; + struct bt_field_integer *integer; + struct bt_field_type_integer *integer_type; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1231,18 +1231,18 @@ int bt_ctf_field_unsigned_integer_get_value(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field's type is not an integer field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } integer_type = container_of(field->type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer, parent); if (integer_type->is_signed) { BT_LOGW("Invalid parameter: integer field's type is signed: " "field-addr=%p, ft-addr=%p", field, field->type); @@ -1251,18 +1251,18 @@ int bt_ctf_field_unsigned_integer_get_value(struct bt_ctf_field *field, } integer = container_of(field, - struct bt_ctf_field_integer, parent); + struct bt_field_integer, parent); *value = integer->payload.unsignd; end: return ret; } -int bt_ctf_field_unsigned_integer_set_value(struct bt_ctf_field *field, +int bt_field_unsigned_integer_set_value(struct bt_field *field, uint64_t value) { int ret = 0; - struct bt_ctf_field_integer *integer; - struct bt_ctf_field_type_integer *integer_type; + struct bt_field_integer *integer; + struct bt_field_type_integer *integer_type; unsigned int size; uint64_t max_value; @@ -1279,19 +1279,19 @@ int bt_ctf_field_unsigned_integer_set_value(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_INTEGER) { BT_LOGW("Invalid parameter: field's type is not an integer field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } - integer = container_of(field, struct bt_ctf_field_integer, parent); + integer = container_of(field, struct bt_field_integer, parent); integer_type = container_of(field->type, - struct bt_ctf_field_type_integer, parent); + struct bt_field_type_integer, parent); if (integer_type->is_signed) { BT_LOGW("Invalid parameter: integer field's type is signed: " "field-addr=%p, ft-addr=%p", field, field->type); @@ -1316,11 +1316,11 @@ end: return ret; } -int bt_ctf_field_floating_point_get_value(struct bt_ctf_field *field, +int bt_field_floating_point_get_value(struct bt_field *field, double *value) { int ret = 0; - struct bt_ctf_field_floating_point *floating_point; + struct bt_field_floating_point *floating_point; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1340,28 +1340,28 @@ int bt_ctf_field_floating_point_get_value(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_FLOAT) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_FLOAT) { BT_LOGW("Invalid parameter: field's type is not a floating point number field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } floating_point = container_of(field, - struct bt_ctf_field_floating_point, parent); + struct bt_field_floating_point, parent); *value = floating_point->payload; end: return ret; } -int bt_ctf_field_floating_point_set_value(struct bt_ctf_field *field, +int bt_field_floating_point_set_value(struct bt_field *field, double value) { int ret = 0; - struct bt_ctf_field_floating_point *floating_point; + struct bt_field_floating_point *floating_point; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1376,17 +1376,17 @@ int bt_ctf_field_floating_point_set_value(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_FLOAT) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_FLOAT) { BT_LOGW("Invalid parameter: field's type is not a floating point number field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } - floating_point = container_of(field, struct bt_ctf_field_floating_point, + floating_point = container_of(field, struct bt_field_floating_point, parent); floating_point->payload = value; floating_point->parent.payload_set = true; @@ -1394,10 +1394,10 @@ end: return ret; } -const char *bt_ctf_field_string_get_value(struct bt_ctf_field *field) +const char *bt_field_string_get_value(struct bt_field *field) { const char *ret = NULL; - struct bt_ctf_field_string *string; + struct bt_field_string *string; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1409,27 +1409,27 @@ const char *bt_ctf_field_string_get_value(struct bt_ctf_field *field) goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_STRING) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_STRING) { BT_LOGW("Invalid parameter: field's type is not a string field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); goto end; } string = container_of(field, - struct bt_ctf_field_string, parent); + struct bt_field_string, parent); ret = string->payload->str; end: return ret; } -int bt_ctf_field_string_set_value(struct bt_ctf_field *field, +int bt_field_string_set_value(struct bt_field *field, const char *value) { int ret = 0; - struct bt_ctf_field_string *string; + struct bt_field_string *string; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1450,17 +1450,17 @@ int bt_ctf_field_string_set_value(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_STRING) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_STRING) { BT_LOGW("Invalid parameter: field's type is not a string field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } - string = container_of(field, struct bt_ctf_field_string, parent); + string = container_of(field, struct bt_field_string, parent); if (string->payload) { g_string_assign(string->payload, value); } else { @@ -1472,11 +1472,11 @@ end: return ret; } -int bt_ctf_field_string_append(struct bt_ctf_field *field, +int bt_field_string_append(struct bt_field *field, const char *value) { int ret = 0; - struct bt_ctf_field_string *string_field; + struct bt_field_string *string_field; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1497,17 +1497,17 @@ int bt_ctf_field_string_append(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_STRING) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_STRING) { BT_LOGW("Invalid parameter: field's type is not a string field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } - string_field = container_of(field, struct bt_ctf_field_string, parent); + string_field = container_of(field, struct bt_field_string, parent); if (string_field->payload) { g_string_append(string_field->payload, value); @@ -1521,13 +1521,13 @@ end: return ret; } -int bt_ctf_field_string_append_len(struct bt_ctf_field *field, +int bt_field_string_append_len(struct bt_field *field, const char *value, unsigned int length) { int i; int ret = 0; unsigned int effective_length = length; - struct bt_ctf_field_string *string_field; + struct bt_field_string *string_field; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -1548,17 +1548,17 @@ int bt_ctf_field_string_append_len(struct bt_ctf_field *field, goto end; } - if (bt_ctf_field_type_get_type_id(field->type) != - BT_CTF_FIELD_TYPE_ID_STRING) { + if (bt_field_type_get_type_id(field->type) != + BT_FIELD_TYPE_ID_STRING) { BT_LOGW("Invalid parameter: field's type is not a string field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field->type, - bt_ctf_field_type_id_string(field->type->id)); + bt_field_type_id_string(field->type->id)); ret = -1; goto end; } - string_field = container_of(field, struct bt_ctf_field_string, parent); + string_field = container_of(field, struct bt_field_string, parent); /* make sure no null bytes are appended */ for (i = 0; i < length; ++i) { @@ -1583,10 +1583,10 @@ end: } BT_HIDDEN -int bt_ctf_field_validate(struct bt_ctf_field *field) +int bt_field_validate(struct bt_field *field) { int ret = 0; - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -1594,8 +1594,8 @@ int bt_ctf_field_validate(struct bt_ctf_field *field) goto end; } - type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + type_id = bt_field_type_get_type_id(field->type); + if (type_id <= BT_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_FIELD_TYPE_ID_NR) { BT_LOGW("Invalid parameter: unknown field type ID: " "addr=%p, ft-addr=%p, ft-id=%d", field, field->type, type_id); @@ -1608,10 +1608,10 @@ end: return ret; } -int bt_ctf_field_reset(struct bt_ctf_field *field) +int bt_field_reset(struct bt_field *field) { int ret = 0; - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -1626,8 +1626,8 @@ int bt_ctf_field_reset(struct bt_ctf_field *field) goto end; } - type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + type_id = bt_field_type_get_type_id(field->type); + if (type_id <= BT_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_FIELD_TYPE_ID_NR) { BT_LOGW("Invalid parameter: unknown field type ID: " "addr=%p, ft-addr=%p, ft-id=%d", field, field->type, type_id); @@ -1641,12 +1641,12 @@ end: } BT_HIDDEN -int bt_ctf_field_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int ret = 0; - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; assert(pos); @@ -1656,8 +1656,8 @@ int bt_ctf_field_serialize(struct bt_ctf_field *field, goto end; } - type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + type_id = bt_field_type_get_type_id(field->type); + if (type_id <= BT_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_FIELD_TYPE_ID_NR) { BT_LOGW("Invalid parameter: unknown field type ID: " "addr=%p, ft-addr=%p, ft-id=%d", field, field->type, type_id); @@ -1670,17 +1670,17 @@ end: return ret; } -bt_bool bt_ctf_field_is_set(struct bt_ctf_field *field) +bt_bool bt_field_is_set(struct bt_field *field) { bt_bool is_set = BT_FALSE; - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; if (!field) { goto end; } - type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + type_id = bt_field_type_get_type_id(field->type); + if (type_id <= BT_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_FIELD_TYPE_ID_NR) { BT_LOGW("Invalid parameter: unknown field type ID: " "field-addr=%p, ft-addr=%p, ft-id=%d", field, field->type, type_id); @@ -1692,26 +1692,26 @@ end: return is_set; } -struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field) +struct bt_field *bt_field_copy(struct bt_field *field) { int ret; - struct bt_ctf_field *copy = NULL; - enum bt_ctf_field_type_id type_id; + struct bt_field *copy = NULL; + enum bt_field_type_id type_id; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); goto end; } - type_id = bt_ctf_field_type_get_type_id(field->type); - if (type_id <= BT_CTF_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) { + type_id = bt_field_type_get_type_id(field->type); + if (type_id <= BT_FIELD_TYPE_ID_UNKNOWN || type_id >= BT_FIELD_TYPE_ID_NR) { BT_LOGW("Invalid parameter: unknown field type ID: " "field-addr=%p, ft-addr=%p, ft-id=%d", field, field->type, type_id); goto end; } - copy = bt_ctf_field_create(field->type); + copy = bt_field_create(field->type); if (!copy) { BT_LOGW("Cannot create field: ft-addr=%p", field->type); goto end; @@ -1728,10 +1728,10 @@ end: } static -struct bt_ctf_field *bt_ctf_field_integer_create(struct bt_ctf_field_type *type) +struct bt_field *bt_field_integer_create(struct bt_field_type *type) { - struct bt_ctf_field_integer *integer = g_new0( - struct bt_ctf_field_integer, 1); + struct bt_field_integer *integer = g_new0( + struct bt_field_integer, 1); BT_LOGD("Creating integer field object: ft-addr=%p", type); @@ -1746,11 +1746,11 @@ struct bt_ctf_field *bt_ctf_field_integer_create(struct bt_ctf_field_type *type) } static -struct bt_ctf_field *bt_ctf_field_enumeration_create( - struct bt_ctf_field_type *type) +struct bt_field *bt_field_enumeration_create( + struct bt_field_type *type) { - struct bt_ctf_field_enumeration *enumeration = g_new0( - struct bt_ctf_field_enumeration, 1); + struct bt_field_enumeration *enumeration = g_new0( + struct bt_field_enumeration, 1); BT_LOGD("Creating enumeration field object: ft-addr=%p", type); @@ -1765,13 +1765,13 @@ struct bt_ctf_field *bt_ctf_field_enumeration_create( } static -struct bt_ctf_field *bt_ctf_field_floating_point_create( - struct bt_ctf_field_type *type) +struct bt_field *bt_field_floating_point_create( + struct bt_field_type *type) { - struct bt_ctf_field_floating_point *floating_point; + struct bt_field_floating_point *floating_point; BT_LOGD("Creating floating point number field object: ft-addr=%p", type); - floating_point = g_new0(struct bt_ctf_field_floating_point, 1); + floating_point = g_new0(struct bt_field_floating_point, 1); if (floating_point) { BT_LOGD("Created floating point number field object: addr=%p, ft-addr=%p", @@ -1784,14 +1784,14 @@ struct bt_ctf_field *bt_ctf_field_floating_point_create( } static -struct bt_ctf_field *bt_ctf_field_structure_create( - struct bt_ctf_field_type *type) +struct bt_field *bt_field_structure_create( + struct bt_field_type *type) { - struct bt_ctf_field_type_structure *structure_type = container_of(type, - struct bt_ctf_field_type_structure, parent); - struct bt_ctf_field_structure *structure = g_new0( - struct bt_ctf_field_structure, 1); - struct bt_ctf_field *ret = NULL; + struct bt_field_type_structure *structure_type = container_of(type, + struct bt_field_type_structure, parent); + struct bt_field_structure *structure = g_new0( + struct bt_field_structure, 1); + struct bt_field *ret = NULL; size_t i; BT_LOGD("Creating structure field object: ft-addr=%p", type); @@ -1802,21 +1802,21 @@ struct bt_ctf_field *bt_ctf_field_structure_create( } structure->fields = g_ptr_array_new_with_free_func( - (GDestroyNotify) bt_ctf_field_put); + (GDestroyNotify) bt_put); g_ptr_array_set_size(structure->fields, structure_type->fields->len); /* Create all fields contained by the structure field. */ for (i = 0; i < structure_type->fields->len; i++) { - struct bt_ctf_field *field; + struct bt_field *field; struct structure_field *field_type = g_ptr_array_index(structure_type->fields, i); - field = bt_ctf_field_create(field_type->type); + field = bt_field_create(field_type->type); if (!field) { BT_LOGE("Failed to create structure field's member: name=\"%s\", index=%zu", g_quark_to_string(field_type->name), i); - bt_ctf_field_structure_destroy(&structure->parent); + bt_field_structure_destroy(&structure->parent); goto end; } @@ -1831,10 +1831,10 @@ end: } static -struct bt_ctf_field *bt_ctf_field_variant_create(struct bt_ctf_field_type *type) +struct bt_field *bt_field_variant_create(struct bt_field_type *type) { - struct bt_ctf_field_variant *variant = g_new0( - struct bt_ctf_field_variant, 1); + struct bt_field_variant *variant = g_new0( + struct bt_field_variant, 1); BT_LOGD("Creating variant field object: ft-addr=%p", type); @@ -1849,10 +1849,10 @@ struct bt_ctf_field *bt_ctf_field_variant_create(struct bt_ctf_field_type *type) } static -struct bt_ctf_field *bt_ctf_field_array_create(struct bt_ctf_field_type *type) +struct bt_field *bt_field_array_create(struct bt_field_type *type) { - struct bt_ctf_field_array *array = g_new0(struct bt_ctf_field_array, 1); - struct bt_ctf_field_type_array *array_type; + struct bt_field_array *array = g_new0(struct bt_field_array, 1); + struct bt_field_type_array *array_type; unsigned int array_length; BT_LOGD("Creating array field object: ft-addr=%p", type); @@ -1863,7 +1863,7 @@ struct bt_ctf_field *bt_ctf_field_array_create(struct bt_ctf_field_type *type) goto error; } - array_type = container_of(type, struct bt_ctf_field_type_array, parent); + array_type = container_of(type, struct bt_field_type_array, parent); array_length = array_type->length; array->elements = g_ptr_array_sized_new(array_length); if (!array->elements) { @@ -1871,7 +1871,7 @@ struct bt_ctf_field *bt_ctf_field_array_create(struct bt_ctf_field_type *type) } g_ptr_array_set_free_func(array->elements, - (GDestroyNotify)bt_ctf_field_put); + (GDestroyNotify) bt_put); g_ptr_array_set_size(array->elements, array_length); BT_LOGD("Created array field object: addr=%p, ft-addr=%p", &array->parent, type); @@ -1882,11 +1882,11 @@ error: } static -struct bt_ctf_field *bt_ctf_field_sequence_create( - struct bt_ctf_field_type *type) +struct bt_field *bt_field_sequence_create( + struct bt_field_type *type) { - struct bt_ctf_field_sequence *sequence = g_new0( - struct bt_ctf_field_sequence, 1); + struct bt_field_sequence *sequence = g_new0( + struct bt_field_sequence, 1); BT_LOGD("Creating sequence field object: ft-addr=%p", type); @@ -1901,10 +1901,10 @@ struct bt_ctf_field *bt_ctf_field_sequence_create( } static -struct bt_ctf_field *bt_ctf_field_string_create(struct bt_ctf_field_type *type) +struct bt_field *bt_field_string_create(struct bt_field_type *type) { - struct bt_ctf_field_string *string = g_new0( - struct bt_ctf_field_string, 1); + struct bt_field_string *string = g_new0( + struct bt_field_string, 1); BT_LOGD("Creating string field object: ft-addr=%p", type); @@ -1919,47 +1919,47 @@ struct bt_ctf_field *bt_ctf_field_string_create(struct bt_ctf_field_type *type) } static -void bt_ctf_field_destroy(struct bt_object *obj) +void bt_field_destroy(struct bt_object *obj) { - struct bt_ctf_field *field; - struct bt_ctf_field_type *type; - enum bt_ctf_field_type_id type_id; + struct bt_field *field; + struct bt_field_type *type; + enum bt_field_type_id type_id; - field = container_of(obj, struct bt_ctf_field, base); + field = container_of(obj, struct bt_field, base); type = field->type; - type_id = bt_ctf_field_type_get_type_id(type); - assert(type_id > BT_CTF_FIELD_TYPE_ID_UNKNOWN && - type_id < BT_CTF_NR_TYPE_IDS); + type_id = bt_field_type_get_type_id(type); + assert(type_id > BT_FIELD_TYPE_ID_UNKNOWN && + type_id < BT_FIELD_TYPE_ID_NR); field_destroy_funcs[type_id](field); BT_LOGD_STR("Putting field's type."); bt_put(type); } static -void bt_ctf_field_integer_destroy(struct bt_ctf_field *field) +void bt_field_integer_destroy(struct bt_field *field) { - struct bt_ctf_field_integer *integer; + struct bt_field_integer *integer; if (!field) { return; } BT_LOGD("Destroying integer field object: addr=%p", field); - integer = container_of(field, struct bt_ctf_field_integer, parent); + integer = container_of(field, struct bt_field_integer, parent); g_free(integer); } static -void bt_ctf_field_enumeration_destroy(struct bt_ctf_field *field) +void bt_field_enumeration_destroy(struct bt_field *field) { - struct bt_ctf_field_enumeration *enumeration; + struct bt_field_enumeration *enumeration; if (!field) { return; } BT_LOGD("Destroying enumeration field object: addr=%p", field); - enumeration = container_of(field, struct bt_ctf_field_enumeration, + enumeration = container_of(field, struct bt_field_enumeration, parent); BT_LOGD_STR("Putting payload field."); bt_put(enumeration->payload); @@ -1967,46 +1967,46 @@ void bt_ctf_field_enumeration_destroy(struct bt_ctf_field *field) } static -void bt_ctf_field_floating_point_destroy(struct bt_ctf_field *field) +void bt_field_floating_point_destroy(struct bt_field *field) { - struct bt_ctf_field_floating_point *floating_point; + struct bt_field_floating_point *floating_point; if (!field) { return; } BT_LOGD("Destroying floating point number field object: addr=%p", field); - floating_point = container_of(field, struct bt_ctf_field_floating_point, + floating_point = container_of(field, struct bt_field_floating_point, parent); g_free(floating_point); } static -void bt_ctf_field_structure_destroy(struct bt_ctf_field *field) +void bt_field_structure_destroy(struct bt_field *field) { - struct bt_ctf_field_structure *structure; + struct bt_field_structure *structure; if (!field) { return; } BT_LOGD("Destroying structure field object: addr=%p", field); - structure = container_of(field, struct bt_ctf_field_structure, parent); + structure = container_of(field, struct bt_field_structure, parent); g_ptr_array_free(structure->fields, TRUE); g_free(structure); } static -void bt_ctf_field_variant_destroy(struct bt_ctf_field *field) +void bt_field_variant_destroy(struct bt_field *field) { - struct bt_ctf_field_variant *variant; + struct bt_field_variant *variant; if (!field) { return; } BT_LOGD("Destroying variant field object: addr=%p", field); - variant = container_of(field, struct bt_ctf_field_variant, parent); + variant = container_of(field, struct bt_field_variant, parent); BT_LOGD_STR("Putting tag field."); bt_put(variant->tag); BT_LOGD_STR("Putting payload field."); @@ -2015,31 +2015,31 @@ void bt_ctf_field_variant_destroy(struct bt_ctf_field *field) } static -void bt_ctf_field_array_destroy(struct bt_ctf_field *field) +void bt_field_array_destroy(struct bt_field *field) { - struct bt_ctf_field_array *array; + struct bt_field_array *array; if (!field) { return; } BT_LOGD("Destroying array field object: addr=%p", field); - array = container_of(field, struct bt_ctf_field_array, parent); + array = container_of(field, struct bt_field_array, parent); g_ptr_array_free(array->elements, TRUE); g_free(array); } static -void bt_ctf_field_sequence_destroy(struct bt_ctf_field *field) +void bt_field_sequence_destroy(struct bt_field *field) { - struct bt_ctf_field_sequence *sequence; + struct bt_field_sequence *sequence; if (!field) { return; } BT_LOGD("Destroying sequence field object: addr=%p", field); - sequence = container_of(field, struct bt_ctf_field_sequence, parent); + sequence = container_of(field, struct bt_field_sequence, parent); if (sequence->elements) { g_ptr_array_free(sequence->elements, TRUE); } @@ -2049,16 +2049,16 @@ void bt_ctf_field_sequence_destroy(struct bt_ctf_field *field) } static -void bt_ctf_field_string_destroy(struct bt_ctf_field *field) +void bt_field_string_destroy(struct bt_field *field) { - struct bt_ctf_field_string *string; + struct bt_field_string *string; if (!field) { return; } BT_LOGD("Destroying string field object: addr=%p", field); - string = container_of(field, struct bt_ctf_field_string, parent); + string = container_of(field, struct bt_field_string, parent); if (string->payload) { g_string_free(string->payload, TRUE); } @@ -2066,16 +2066,16 @@ void bt_ctf_field_string_destroy(struct bt_ctf_field *field) } static -int bt_ctf_field_generic_validate(struct bt_ctf_field *field) +int bt_field_generic_validate(struct bt_field *field) { return (field && field->payload_set) ? 0 : -1; } static -int bt_ctf_field_enumeration_validate(struct bt_ctf_field *field) +int bt_field_enumeration_validate(struct bt_field *field) { int ret; - struct bt_ctf_field_enumeration *enumeration; + struct bt_field_enumeration *enumeration; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2083,7 +2083,7 @@ int bt_ctf_field_enumeration_validate(struct bt_ctf_field *field) goto end; } - enumeration = container_of(field, struct bt_ctf_field_enumeration, + enumeration = container_of(field, struct bt_field_enumeration, parent); if (!enumeration->payload) { BT_LOGW("Invalid enumeration field: payload is not set: " @@ -2092,17 +2092,17 @@ int bt_ctf_field_enumeration_validate(struct bt_ctf_field *field) goto end; } - ret = bt_ctf_field_validate(enumeration->payload); + ret = bt_field_validate(enumeration->payload); end: return ret; } static -int bt_ctf_field_structure_validate(struct bt_ctf_field *field) +int bt_field_structure_validate(struct bt_field *field) { int64_t i; int ret = 0; - struct bt_ctf_field_structure *structure; + struct bt_field_structure *structure; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2110,18 +2110,18 @@ int bt_ctf_field_structure_validate(struct bt_ctf_field *field) goto end; } - structure = container_of(field, struct bt_ctf_field_structure, parent); + structure = container_of(field, struct bt_field_structure, parent); for (i = 0; i < structure->fields->len; i++) { - struct bt_ctf_field *entry_field = structure->fields->pdata[i]; - ret = bt_ctf_field_validate(entry_field); + struct bt_field *entry_field = structure->fields->pdata[i]; + ret = bt_field_validate(entry_field); if (ret) { int this_ret; const char *name; - struct bt_ctf_field_type *field_type = - bt_ctf_field_get_type(field); + struct bt_field_type *field_type = + bt_field_get_type(field); - this_ret = bt_ctf_field_type_structure_get_field( + this_ret = bt_field_type_structure_get_field_by_index( field_type, &name, NULL, i); assert(this_ret == 0); BT_LOGW("Invalid structure field's field: " @@ -2137,10 +2137,10 @@ end: } static -int bt_ctf_field_variant_validate(struct bt_ctf_field *field) +int bt_field_variant_validate(struct bt_field *field) { int ret = 0; - struct bt_ctf_field_variant *variant; + struct bt_field_variant *variant; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2148,8 +2148,8 @@ int bt_ctf_field_variant_validate(struct bt_ctf_field *field) goto end; } - variant = container_of(field, struct bt_ctf_field_variant, parent); - ret = bt_ctf_field_validate(variant->payload); + variant = container_of(field, struct bt_field_variant, parent); + ret = bt_field_validate(variant->payload); if (ret) { BT_LOGW("Invalid variant field's payload field: " "variant-field-addr=%p, variant-payload-field-addr=%p", @@ -2160,11 +2160,11 @@ end: } static -int bt_ctf_field_array_validate(struct bt_ctf_field *field) +int bt_field_array_validate(struct bt_field *field) { int64_t i; int ret = 0; - struct bt_ctf_field_array *array; + struct bt_field_array *array; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2172,11 +2172,11 @@ int bt_ctf_field_array_validate(struct bt_ctf_field *field) goto end; } - array = container_of(field, struct bt_ctf_field_array, parent); + array = container_of(field, struct bt_field_array, parent); for (i = 0; i < array->elements->len; i++) { - struct bt_ctf_field *elem_field = array->elements->pdata[i]; + struct bt_field *elem_field = array->elements->pdata[i]; - ret = bt_ctf_field_validate(elem_field); + ret = bt_field_validate(elem_field); if (ret) { BT_LOGW("Invalid array field's element field: " "array-field-addr=%p, field-addr=%p, " @@ -2189,11 +2189,11 @@ end: } static -int bt_ctf_field_sequence_validate(struct bt_ctf_field *field) +int bt_field_sequence_validate(struct bt_field *field) { size_t i; int ret = 0; - struct bt_ctf_field_sequence *sequence; + struct bt_field_sequence *sequence; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2201,11 +2201,11 @@ int bt_ctf_field_sequence_validate(struct bt_ctf_field *field) goto end; } - sequence = container_of(field, struct bt_ctf_field_sequence, parent); + sequence = container_of(field, struct bt_field_sequence, parent); for (i = 0; i < sequence->elements->len; i++) { - struct bt_ctf_field *elem_field = sequence->elements->pdata[i]; + struct bt_field *elem_field = sequence->elements->pdata[i]; - ret = bt_ctf_field_validate(elem_field); + ret = bt_field_validate(elem_field); if (ret) { BT_LOGW("Invalid sequence field's element field: " "sequence-field-addr=%p, field-addr=%p, " @@ -2218,7 +2218,7 @@ end: } static -int bt_ctf_field_generic_reset(struct bt_ctf_field *field) +int bt_field_generic_reset(struct bt_field *field) { int ret = 0; @@ -2234,10 +2234,10 @@ end: } static -int bt_ctf_field_enumeration_reset(struct bt_ctf_field *field) +int bt_field_enumeration_reset(struct bt_field *field) { int ret = 0; - struct bt_ctf_field_enumeration *enumeration; + struct bt_field_enumeration *enumeration; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2245,23 +2245,23 @@ int bt_ctf_field_enumeration_reset(struct bt_ctf_field *field) goto end; } - enumeration = container_of(field, struct bt_ctf_field_enumeration, + enumeration = container_of(field, struct bt_field_enumeration, parent); if (!enumeration->payload) { goto end; } - ret = bt_ctf_field_reset(enumeration->payload); + ret = bt_field_reset(enumeration->payload); end: return ret; } static -int bt_ctf_field_structure_reset(struct bt_ctf_field *field) +int bt_field_structure_reset(struct bt_field *field) { int64_t i; int ret = 0; - struct bt_ctf_field_structure *structure; + struct bt_field_structure *structure; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2269,9 +2269,9 @@ int bt_ctf_field_structure_reset(struct bt_ctf_field *field) goto end; } - structure = container_of(field, struct bt_ctf_field_structure, parent); + structure = container_of(field, struct bt_field_structure, parent); for (i = 0; i < structure->fields->len; i++) { - struct bt_ctf_field *member = structure->fields->pdata[i]; + struct bt_field *member = structure->fields->pdata[i]; if (!member) { /* @@ -2281,7 +2281,7 @@ int bt_ctf_field_structure_reset(struct bt_ctf_field *field) continue; } - ret = bt_ctf_field_reset(member); + ret = bt_field_reset(member); if (ret) { BT_LOGE("Failed to reset structure field's field: " "struct-field-addr=%p, field-addr=%p, " @@ -2294,10 +2294,10 @@ end: } static -int bt_ctf_field_variant_reset(struct bt_ctf_field *field) +int bt_field_variant_reset(struct bt_field *field) { int ret = 0; - struct bt_ctf_field_variant *variant; + struct bt_field_variant *variant; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2305,7 +2305,7 @@ int bt_ctf_field_variant_reset(struct bt_ctf_field *field) goto end; } - variant = container_of(field, struct bt_ctf_field_variant, parent); + variant = container_of(field, struct bt_field_variant, parent); BT_PUT(variant->tag); BT_PUT(variant->payload); end: @@ -2313,11 +2313,11 @@ end: } static -int bt_ctf_field_array_reset(struct bt_ctf_field *field) +int bt_field_array_reset(struct bt_field *field) { size_t i; int ret = 0; - struct bt_ctf_field_array *array; + struct bt_field_array *array; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2325,9 +2325,9 @@ int bt_ctf_field_array_reset(struct bt_ctf_field *field) goto end; } - array = container_of(field, struct bt_ctf_field_array, parent); + array = container_of(field, struct bt_field_array, parent); for (i = 0; i < array->elements->len; i++) { - struct bt_ctf_field *member = array->elements->pdata[i]; + struct bt_field *member = array->elements->pdata[i]; if (!member) { /* @@ -2337,7 +2337,7 @@ int bt_ctf_field_array_reset(struct bt_ctf_field *field) continue; } - ret = bt_ctf_field_reset(member); + ret = bt_field_reset(member); if (ret) { BT_LOGE("Failed to reset array field's field: " "array-field-addr=%p, field-addr=%p, " @@ -2350,10 +2350,10 @@ end: } static -int bt_ctf_field_sequence_reset(struct bt_ctf_field *field) +int bt_field_sequence_reset(struct bt_field *field) { int ret = 0; - struct bt_ctf_field_sequence *sequence; + struct bt_field_sequence *sequence; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2361,7 +2361,7 @@ int bt_ctf_field_sequence_reset(struct bt_ctf_field *field) goto end; } - sequence = container_of(field, struct bt_ctf_field_sequence, parent); + sequence = container_of(field, struct bt_field_sequence, parent); if (sequence->elements) { g_ptr_array_free(sequence->elements, TRUE); sequence->elements = NULL; @@ -2372,10 +2372,10 @@ end: } static -int bt_ctf_field_string_reset(struct bt_ctf_field *field) +int bt_field_string_reset(struct bt_field *field) { int ret = 0; - struct bt_ctf_field_string *string; + struct bt_field_string *string; if (!field) { BT_LOGD_STR("Invalid parameter: field is NULL."); @@ -2383,12 +2383,12 @@ int bt_ctf_field_string_reset(struct bt_ctf_field *field) goto end; } - ret = bt_ctf_field_generic_reset(field); + ret = bt_field_generic_reset(field); if (ret) { goto end; } - string = container_of(field, struct bt_ctf_field_string, parent); + string = container_of(field, struct bt_field_string, parent); if (string->payload) { g_string_truncate(string->payload, 0); } @@ -2397,25 +2397,25 @@ end: } static -int bt_ctf_field_integer_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_integer_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int ret = 0; - struct bt_ctf_field_integer *integer = container_of(field, - struct bt_ctf_field_integer, parent); + struct bt_field_integer *integer = container_of(field, + struct bt_field_integer, parent); BT_LOGV("Serializing integer field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); - if (!bt_ctf_field_generic_is_set(field)) { + if (!bt_field_generic_is_set(field)) { BT_LOGW_STR("Field's payload is not set."); ret = -1; goto end; } retry: - ret = bt_ctf_field_integer_write(integer, pos, native_byte_order); + ret = bt_field_integer_write(integer, pos, native_byte_order); if (ret == -EFAULT) { /* * The field is too large to fit in the current packet's @@ -2433,41 +2433,41 @@ end: } static -int bt_ctf_field_enumeration_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_enumeration_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { - struct bt_ctf_field_enumeration *enumeration = container_of( - field, struct bt_ctf_field_enumeration, parent); + struct bt_field_enumeration *enumeration = container_of( + field, struct bt_field_enumeration, parent); BT_LOGV("Serializing enumeration field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); BT_LOGV_STR("Serializing enumeration field's payload field."); - return bt_ctf_field_serialize(enumeration->payload, pos, + return bt_field_serialize(enumeration->payload, pos, native_byte_order); } static -int bt_ctf_field_floating_point_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_floating_point_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int ret = 0; - struct bt_ctf_field_floating_point *floating_point = container_of(field, - struct bt_ctf_field_floating_point, parent); + struct bt_field_floating_point *floating_point = container_of(field, + struct bt_field_floating_point, parent); BT_LOGV("Serializing floating point number field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); - if (!bt_ctf_field_generic_is_set(field)) { + if (!bt_field_generic_is_set(field)) { BT_LOGW_STR("Field's payload is not set."); ret = -1; goto end; } retry: - ret = bt_ctf_field_floating_point_write(floating_point, pos, + ret = bt_field_floating_point_write(floating_point, pos, native_byte_order); if (ret == -EFAULT) { /* @@ -2486,20 +2486,20 @@ end: } static -int bt_ctf_field_structure_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_structure_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int64_t i; int ret = 0; - struct bt_ctf_field_structure *structure = container_of( - field, struct bt_ctf_field_structure, parent); + struct bt_field_structure *structure = container_of( + field, struct bt_field_structure, parent); BT_LOGV("Serializing structure field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); - while (!bt_ctf_stream_pos_access_ok(pos, + while (!bt_stream_pos_access_ok(pos, offset_align(pos->offset, field->type->alignment))) { ret = increase_packet_size(pos); if (ret) { @@ -2508,7 +2508,7 @@ int bt_ctf_field_structure_serialize(struct bt_ctf_field *field, } } - if (!bt_ctf_stream_pos_align(pos, field->type->alignment)) { + if (!bt_stream_pos_align(pos, field->type->alignment)) { BT_LOGE("Cannot align packet's position: pos-offset=%" PRId64 ", " "align=%u", pos->offset, field->type->alignment); ret = -1; @@ -2516,12 +2516,12 @@ int bt_ctf_field_structure_serialize(struct bt_ctf_field *field, } for (i = 0; i < structure->fields->len; i++) { - struct bt_ctf_field *member = g_ptr_array_index( + struct bt_field *member = g_ptr_array_index( structure->fields, i); const char *field_name = NULL; if (BT_LOG_ON_WARN) { - ret = bt_ctf_field_type_structure_get_field( + ret = bt_field_type_structure_get_field_by_index( field->type, &field_name, NULL, i); assert(ret == 0); } @@ -2539,7 +2539,7 @@ int bt_ctf_field_structure_serialize(struct bt_ctf_field *field, goto end; } - ret = bt_ctf_field_serialize(member, pos, native_byte_order); + ret = bt_field_serialize(member, pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize structure field's field: " "struct-field-addr=%p, field-addr=%p, " @@ -2553,43 +2553,43 @@ end: } static -int bt_ctf_field_variant_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_variant_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { - struct bt_ctf_field_variant *variant = container_of( - field, struct bt_ctf_field_variant, parent); + struct bt_field_variant *variant = container_of( + field, struct bt_field_variant, parent); BT_LOGV("Serializing variant field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); BT_LOGV_STR("Serializing variant field's payload field."); - return bt_ctf_field_serialize(variant->payload, pos, + return bt_field_serialize(variant->payload, pos, native_byte_order); } static -int bt_ctf_field_array_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_array_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int64_t i; int ret = 0; - struct bt_ctf_field_array *array = container_of( - field, struct bt_ctf_field_array, parent); + struct bt_field_array *array = container_of( + field, struct bt_field_array, parent); BT_LOGV("Serializing array field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); for (i = 0; i < array->elements->len; i++) { - struct bt_ctf_field *elem_field = + struct bt_field *elem_field = g_ptr_array_index(array->elements, i); BT_LOGV("Serializing array field's element field: " "pos-offset=%" PRId64 ", field-addr=%p, index=%" PRId64, pos->offset, elem_field, i); - ret = bt_ctf_field_serialize(elem_field, pos, + ret = bt_field_serialize(elem_field, pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize array field's element field: " @@ -2603,27 +2603,27 @@ end: } static -int bt_ctf_field_sequence_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_sequence_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int64_t i; int ret = 0; - struct bt_ctf_field_sequence *sequence = container_of( - field, struct bt_ctf_field_sequence, parent); + struct bt_field_sequence *sequence = container_of( + field, struct bt_field_sequence, parent); BT_LOGV("Serializing sequence field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); for (i = 0; i < sequence->elements->len; i++) { - struct bt_ctf_field *elem_field = + struct bt_field *elem_field = g_ptr_array_index(sequence->elements, i); BT_LOGV("Serializing sequence field's element field: " "pos-offset=%" PRId64 ", field-addr=%p, index=%" PRId64, pos->offset, elem_field, i); - ret = bt_ctf_field_serialize(elem_field, pos, + ret = bt_field_serialize(elem_field, pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize sequence field's element field: " @@ -2637,29 +2637,29 @@ end: } static -int bt_ctf_field_string_serialize(struct bt_ctf_field *field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_string_serialize(struct bt_field *field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { int64_t i; int ret = 0; - struct bt_ctf_field_string *string = container_of(field, - struct bt_ctf_field_string, parent); - struct bt_ctf_field_type *character_type = + struct bt_field_string *string = container_of(field, + struct bt_field_string, parent); + struct bt_field_type *character_type = get_field_type(FIELD_TYPE_ALIAS_UINT8_T); - struct bt_ctf_field *character; + struct bt_field *character; BT_LOGV("Serializing string field: addr=%p, pos-offset=%" PRId64 ", " "native-bo=%s", field, pos->offset, - bt_ctf_byte_order_string(native_byte_order)); + bt_byte_order_string(native_byte_order)); BT_LOGV_STR("Creating character field from string field's character field type."); - character = bt_ctf_field_create(character_type); + character = bt_field_create(character_type); for (i = 0; i < string->payload->len + 1; i++) { const uint64_t chr = (uint64_t) string->payload->str[i]; - ret = bt_ctf_field_unsigned_integer_set_value(character, chr); + ret = bt_field_unsigned_integer_set_value(character, chr); if (ret) { BT_LOGW("Cannot set character field's value: " "pos-offset=%" PRId64 ", field-addr=%p, " @@ -2672,7 +2672,7 @@ int bt_ctf_field_string_serialize(struct bt_ctf_field *field, "pos-offset=%" PRId64 ", field-addr=%p, " "index=%" PRId64 ", char-int=%" PRIu64, pos->offset, character, i, chr); - ret = bt_ctf_field_integer_serialize(character, pos, + ret = bt_field_integer_serialize(character, pos, native_byte_order); if (ret) { BT_LOGW_STR("Cannot serialize character field."); @@ -2686,35 +2686,35 @@ end: } static -int bt_ctf_field_integer_copy(struct bt_ctf_field *src, - struct bt_ctf_field *dst) +int bt_field_integer_copy(struct bt_field *src, + struct bt_field *dst) { - struct bt_ctf_field_integer *integer_src, *integer_dst; + struct bt_field_integer *integer_src, *integer_dst; BT_LOGD("Copying integer field: src-field-addr=%p, dst-field-addr=%p", src, dst); - integer_src = container_of(src, struct bt_ctf_field_integer, parent); - integer_dst = container_of(dst, struct bt_ctf_field_integer, parent); + integer_src = container_of(src, struct bt_field_integer, parent); + integer_dst = container_of(dst, struct bt_field_integer, parent); integer_dst->payload = integer_src->payload; BT_LOGD_STR("Copied integer field."); return 0; } static -int bt_ctf_field_enumeration_copy(struct bt_ctf_field *src, - struct bt_ctf_field *dst) +int bt_field_enumeration_copy(struct bt_field *src, + struct bt_field *dst) { int ret = 0; - struct bt_ctf_field_enumeration *enum_src, *enum_dst; + struct bt_field_enumeration *enum_src, *enum_dst; BT_LOGD("Copying enumeration field: src-field-addr=%p, dst-field-addr=%p", src, dst); - enum_src = container_of(src, struct bt_ctf_field_enumeration, parent); - enum_dst = container_of(dst, struct bt_ctf_field_enumeration, parent); + enum_src = container_of(src, struct bt_field_enumeration, parent); + enum_dst = container_of(dst, struct bt_field_enumeration, parent); if (enum_src->payload) { BT_LOGD_STR("Copying enumeration field's payload field."); - enum_dst->payload = bt_ctf_field_copy(enum_src->payload); + enum_dst->payload = bt_field_copy(enum_src->payload); if (!enum_dst->payload) { BT_LOGE_STR("Cannot copy enumeration field's payload field."); ret = -1; @@ -2728,16 +2728,16 @@ end: } static -int bt_ctf_field_floating_point_copy( - struct bt_ctf_field *src, struct bt_ctf_field *dst) +int bt_field_floating_point_copy( + struct bt_field *src, struct bt_field *dst) { - struct bt_ctf_field_floating_point *float_src, *float_dst; + struct bt_field_floating_point *float_src, *float_dst; BT_LOGD("Copying floating point number field: src-field-addr=%p, dst-field-addr=%p", src, dst); - float_src = container_of(src, struct bt_ctf_field_floating_point, + float_src = container_of(src, struct bt_field_floating_point, parent); - float_dst = container_of(dst, struct bt_ctf_field_floating_point, + float_dst = container_of(dst, struct bt_field_floating_point, parent); float_dst->payload = float_src->payload; BT_LOGD_STR("Copied floating point number field."); @@ -2745,29 +2745,29 @@ int bt_ctf_field_floating_point_copy( } static -int bt_ctf_field_structure_copy(struct bt_ctf_field *src, - struct bt_ctf_field *dst) +int bt_field_structure_copy(struct bt_field *src, + struct bt_field *dst) { int ret = 0; int64_t i; - struct bt_ctf_field_structure *struct_src, *struct_dst; + struct bt_field_structure *struct_src, *struct_dst; BT_LOGD("Copying structure field: src-field-addr=%p, dst-field-addr=%p", src, dst); - struct_src = container_of(src, struct bt_ctf_field_structure, parent); - struct_dst = container_of(dst, struct bt_ctf_field_structure, parent); + struct_src = container_of(src, struct bt_field_structure, parent); + struct_dst = container_of(dst, struct bt_field_structure, parent); g_ptr_array_set_size(struct_dst->fields, struct_src->fields->len); for (i = 0; i < struct_src->fields->len; i++) { - struct bt_ctf_field *field = + struct bt_field *field = g_ptr_array_index(struct_src->fields, i); - struct bt_ctf_field *field_copy = NULL; + struct bt_field *field_copy = NULL; if (field) { BT_LOGD("Copying structure field's field: src-field-addr=%p" "index=%" PRId64, field, i); - field_copy = bt_ctf_field_copy(field); + field_copy = bt_field_copy(field); if (!field_copy) { BT_LOGE("Cannot copy structure field's field: " "src-field-addr=%p, index=%" PRId64, @@ -2787,20 +2787,20 @@ end: } static -int bt_ctf_field_variant_copy(struct bt_ctf_field *src, - struct bt_ctf_field *dst) +int bt_field_variant_copy(struct bt_field *src, + struct bt_field *dst) { int ret = 0; - struct bt_ctf_field_variant *variant_src, *variant_dst; + struct bt_field_variant *variant_src, *variant_dst; BT_LOGD("Copying variant field: src-field-addr=%p, dst-field-addr=%p", src, dst); - variant_src = container_of(src, struct bt_ctf_field_variant, parent); - variant_dst = container_of(dst, struct bt_ctf_field_variant, parent); + variant_src = container_of(src, struct bt_field_variant, parent); + variant_dst = container_of(dst, struct bt_field_variant, parent); if (variant_src->tag) { BT_LOGD_STR("Copying variant field's tag field."); - variant_dst->tag = bt_ctf_field_copy(variant_src->tag); + variant_dst->tag = bt_field_copy(variant_src->tag); if (!variant_dst->tag) { BT_LOGE_STR("Cannot copy variant field's tag field."); ret = -1; @@ -2809,7 +2809,7 @@ int bt_ctf_field_variant_copy(struct bt_ctf_field *src, } if (variant_src->payload) { BT_LOGD_STR("Copying variant field's payload field."); - variant_dst->payload = bt_ctf_field_copy(variant_src->payload); + variant_dst->payload = bt_field_copy(variant_src->payload); if (!variant_dst->payload) { BT_LOGE_STR("Cannot copy variant field's payload field."); ret = -1; @@ -2824,28 +2824,28 @@ end: } static -int bt_ctf_field_array_copy(struct bt_ctf_field *src, - struct bt_ctf_field *dst) +int bt_field_array_copy(struct bt_field *src, + struct bt_field *dst) { int ret = 0; int64_t i; - struct bt_ctf_field_array *array_src, *array_dst; + struct bt_field_array *array_src, *array_dst; BT_LOGD("Copying array field: src-field-addr=%p, dst-field-addr=%p", src, dst); - array_src = container_of(src, struct bt_ctf_field_array, parent); - array_dst = container_of(dst, struct bt_ctf_field_array, parent); + array_src = container_of(src, struct bt_field_array, parent); + array_dst = container_of(dst, struct bt_field_array, parent); g_ptr_array_set_size(array_dst->elements, array_src->elements->len); for (i = 0; i < array_src->elements->len; i++) { - struct bt_ctf_field *field = + struct bt_field *field = g_ptr_array_index(array_src->elements, i); - struct bt_ctf_field *field_copy = NULL; + struct bt_field *field_copy = NULL; if (field) { BT_LOGD("Copying array field's element field: field-addr=%p, " "index=%" PRId64, field, i); - field_copy = bt_ctf_field_copy(field); + field_copy = bt_field_copy(field); if (!field_copy) { BT_LOGE("Cannot copy array field's element field: " "src-field-addr=%p, index=%" PRId64, @@ -2865,21 +2865,21 @@ end: } static -int bt_ctf_field_sequence_copy(struct bt_ctf_field *src, - struct bt_ctf_field *dst) +int bt_field_sequence_copy(struct bt_field *src, + struct bt_field *dst) { int ret = 0; int64_t i; - struct bt_ctf_field_sequence *sequence_src, *sequence_dst; - struct bt_ctf_field *src_length; - struct bt_ctf_field *dst_length; + struct bt_field_sequence *sequence_src, *sequence_dst; + struct bt_field *src_length; + struct bt_field *dst_length; BT_LOGD("Copying sequence field: src-field-addr=%p, dst-field-addr=%p", src, dst); - sequence_src = container_of(src, struct bt_ctf_field_sequence, parent); - sequence_dst = container_of(dst, struct bt_ctf_field_sequence, parent); + sequence_src = container_of(src, struct bt_field_sequence, parent); + sequence_dst = container_of(dst, struct bt_field_sequence, parent); - src_length = bt_ctf_field_sequence_get_length(src); + src_length = bt_field_sequence_get_length(src); if (!src_length) { /* no length set yet: keep destination sequence empty */ goto end; @@ -2887,7 +2887,7 @@ int bt_ctf_field_sequence_copy(struct bt_ctf_field *src, /* copy source length */ BT_LOGD_STR("Copying sequence field's length field."); - dst_length = bt_ctf_field_copy(src_length); + dst_length = bt_field_copy(src_length); BT_PUT(src_length); if (!dst_length) { BT_LOGE_STR("Cannot copy sequence field's length field."); @@ -2896,7 +2896,7 @@ int bt_ctf_field_sequence_copy(struct bt_ctf_field *src, } /* this will initialize the destination sequence's internal array */ - ret = bt_ctf_field_sequence_set_length(dst, dst_length); + ret = bt_field_sequence_set_length(dst, dst_length); bt_put(dst_length); if (ret) { BT_LOGE("Cannot set sequence field copy's length field: " @@ -2908,14 +2908,14 @@ int bt_ctf_field_sequence_copy(struct bt_ctf_field *src, assert(sequence_dst->elements->len == sequence_src->elements->len); for (i = 0; i < sequence_src->elements->len; i++) { - struct bt_ctf_field *field = + struct bt_field *field = g_ptr_array_index(sequence_src->elements, i); - struct bt_ctf_field *field_copy = NULL; + struct bt_field *field_copy = NULL; if (field) { BT_LOGD("Copying sequence field's element field: field-addr=%p, " "index=%" PRId64, field, i); - field_copy = bt_ctf_field_copy(field); + field_copy = bt_field_copy(field); if (!field_copy) { BT_LOGE("Cannot copy sequence field's element field: " "src-field-addr=%p, index=%" PRId64, @@ -2935,16 +2935,16 @@ end: } static -int bt_ctf_field_string_copy(struct bt_ctf_field *src, - struct bt_ctf_field *dst) +int bt_field_string_copy(struct bt_field *src, + struct bt_field *dst) { int ret = 0; - struct bt_ctf_field_string *string_src, *string_dst; + struct bt_field_string *string_src, *string_dst; BT_LOGD("Copying string field: src-field-addr=%p, dst-field-addr=%p", src, dst); - string_src = container_of(src, struct bt_ctf_field_string, parent); - string_dst = container_of(dst, struct bt_ctf_field_string, parent); + string_src = container_of(src, struct bt_field_string, parent); + string_dst = container_of(dst, struct bt_field_string, parent); if (string_src->payload) { string_dst->payload = g_string_new(string_src->payload->str); @@ -2962,7 +2962,7 @@ end: } static -int increase_packet_size(struct bt_ctf_stream_pos *pos) +int increase_packet_size(struct bt_stream_pos *pos) { int ret; @@ -3008,109 +3008,109 @@ end: } static -void generic_field_freeze(struct bt_ctf_field *field) +void generic_field_freeze(struct bt_field *field) { field->frozen = true; } static -void bt_ctf_field_enumeration_freeze(struct bt_ctf_field *field) +void bt_field_enumeration_freeze(struct bt_field *field) { - struct bt_ctf_field_enumeration *enum_field = - container_of(field, struct bt_ctf_field_enumeration, parent); + struct bt_field_enumeration *enum_field = + container_of(field, struct bt_field_enumeration, parent); BT_LOGD("Freezing enumeration field object: addr=%p", field); BT_LOGD("Freezing enumeration field object's contained payload field: payload-field-addr=%p", enum_field->payload); - bt_ctf_field_freeze(enum_field->payload); + bt_field_freeze(enum_field->payload); generic_field_freeze(field); } static -void bt_ctf_field_structure_freeze(struct bt_ctf_field *field) +void bt_field_structure_freeze(struct bt_field *field) { int64_t i; - struct bt_ctf_field_structure *structure_field = - container_of(field, struct bt_ctf_field_structure, parent); + struct bt_field_structure *structure_field = + container_of(field, struct bt_field_structure, parent); BT_LOGD("Freezing structure field object: addr=%p", field); for (i = 0; i < structure_field->fields->len; i++) { - struct bt_ctf_field *field = + struct bt_field *field = g_ptr_array_index(structure_field->fields, i); BT_LOGD("Freezing structure field's field: field-addr=%p, index=%" PRId64, field, i); - bt_ctf_field_freeze(field); + bt_field_freeze(field); } generic_field_freeze(field); } static -void bt_ctf_field_variant_freeze(struct bt_ctf_field *field) +void bt_field_variant_freeze(struct bt_field *field) { - struct bt_ctf_field_variant *variant_field = - container_of(field, struct bt_ctf_field_variant, parent); + struct bt_field_variant *variant_field = + container_of(field, struct bt_field_variant, parent); BT_LOGD("Freezing variant field object: addr=%p", field); BT_LOGD("Freezing variant field object's tag field: tag-field-addr=%p", variant_field->tag); - bt_ctf_field_freeze(variant_field->tag); + bt_field_freeze(variant_field->tag); BT_LOGD("Freezing variant field object's payload field: payload-field-addr=%p", variant_field->payload); - bt_ctf_field_freeze(variant_field->payload); + bt_field_freeze(variant_field->payload); generic_field_freeze(field); } static -void bt_ctf_field_array_freeze(struct bt_ctf_field *field) +void bt_field_array_freeze(struct bt_field *field) { int64_t i; - struct bt_ctf_field_array *array_field = - container_of(field, struct bt_ctf_field_array, parent); + struct bt_field_array *array_field = + container_of(field, struct bt_field_array, parent); BT_LOGD("Freezing array field object: addr=%p", field); for (i = 0; i < array_field->elements->len; i++) { - struct bt_ctf_field *elem_field = + struct bt_field *elem_field = g_ptr_array_index(array_field->elements, i); BT_LOGD("Freezing array field object's element field: " "element-field-addr=%p, index=%" PRId64, elem_field, i); - bt_ctf_field_freeze(elem_field); + bt_field_freeze(elem_field); } generic_field_freeze(field); } static -void bt_ctf_field_sequence_freeze(struct bt_ctf_field *field) +void bt_field_sequence_freeze(struct bt_field *field) { int64_t i; - struct bt_ctf_field_sequence *sequence_field = - container_of(field, struct bt_ctf_field_sequence, parent); + struct bt_field_sequence *sequence_field = + container_of(field, struct bt_field_sequence, parent); BT_LOGD("Freezing sequence field object: addr=%p", field); BT_LOGD("Freezing sequence field object's length field: length-field-addr=%p", sequence_field->length); - bt_ctf_field_freeze(sequence_field->length); + bt_field_freeze(sequence_field->length); for (i = 0; i < sequence_field->elements->len; i++) { - struct bt_ctf_field *elem_field = + struct bt_field *elem_field = g_ptr_array_index(sequence_field->elements, i); BT_LOGD("Freezing sequence field object's element field: " "element-field-addr=%p, index=%" PRId64, elem_field, i); - bt_ctf_field_freeze(elem_field); + bt_field_freeze(elem_field); } generic_field_freeze(field); } BT_HIDDEN -void bt_ctf_field_freeze(struct bt_ctf_field *field) +void bt_field_freeze(struct bt_field *field) { - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; if (!field) { goto end; @@ -3121,55 +3121,55 @@ void bt_ctf_field_freeze(struct bt_ctf_field *field) } BT_LOGD("Freezing field object: addr=%p", field); - type_id = bt_ctf_field_get_type_id(field); - assert(type_id > BT_CTF_FIELD_TYPE_ID_UNKNOWN && - type_id < BT_CTF_NR_TYPE_IDS); + type_id = bt_field_get_type_id(field); + assert(type_id > BT_FIELD_TYPE_ID_UNKNOWN && + type_id < BT_FIELD_TYPE_ID_NR); field_freeze_funcs[type_id](field); end: return; } static -bt_bool bt_ctf_field_generic_is_set(struct bt_ctf_field *field) +bt_bool bt_field_generic_is_set(struct bt_field *field) { return field && field->payload_set; } static -bt_bool bt_ctf_field_enumeration_is_set(struct bt_ctf_field *field) +bt_bool bt_field_enumeration_is_set(struct bt_field *field) { bt_bool is_set = BT_FALSE; - struct bt_ctf_field_enumeration *enumeration; + struct bt_field_enumeration *enumeration; if (!field) { goto end; } - enumeration = container_of(field, struct bt_ctf_field_enumeration, + enumeration = container_of(field, struct bt_field_enumeration, parent); if (!enumeration->payload) { goto end; } - is_set = bt_ctf_field_is_set(enumeration->payload); + is_set = bt_field_is_set(enumeration->payload); end: return is_set; } static -bt_bool bt_ctf_field_structure_is_set(struct bt_ctf_field *field) +bt_bool bt_field_structure_is_set(struct bt_field *field) { bt_bool is_set = BT_FALSE; size_t i; - struct bt_ctf_field_structure *structure; + struct bt_field_structure *structure; if (!field) { goto end; } - structure = container_of(field, struct bt_ctf_field_structure, parent); + structure = container_of(field, struct bt_field_structure, parent); for (i = 0; i < structure->fields->len; i++) { - is_set = bt_ctf_field_is_set( + is_set = bt_field_is_set( structure->fields->pdata[i]); if (!is_set) { goto end; @@ -3180,35 +3180,35 @@ end: } static -bt_bool bt_ctf_field_variant_is_set(struct bt_ctf_field *field) +bt_bool bt_field_variant_is_set(struct bt_field *field) { bt_bool is_set = BT_FALSE; - struct bt_ctf_field_variant *variant; + struct bt_field_variant *variant; if (!field) { goto end; } - variant = container_of(field, struct bt_ctf_field_variant, parent); - is_set = bt_ctf_field_is_set(variant->payload); + variant = container_of(field, struct bt_field_variant, parent); + is_set = bt_field_is_set(variant->payload); end: return is_set; } static -bt_bool bt_ctf_field_array_is_set(struct bt_ctf_field *field) +bt_bool bt_field_array_is_set(struct bt_field *field) { size_t i; bt_bool is_set = BT_FALSE; - struct bt_ctf_field_array *array; + struct bt_field_array *array; if (!field) { goto end; } - array = container_of(field, struct bt_ctf_field_array, parent); + array = container_of(field, struct bt_field_array, parent); for (i = 0; i < array->elements->len; i++) { - is_set = bt_ctf_field_is_set(array->elements->pdata[i]); + is_set = bt_field_is_set(array->elements->pdata[i]); if (!is_set) { goto end; } @@ -3218,23 +3218,23 @@ end: } static -bt_bool bt_ctf_field_sequence_is_set(struct bt_ctf_field *field) +bt_bool bt_field_sequence_is_set(struct bt_field *field) { size_t i; bt_bool is_set = BT_FALSE; - struct bt_ctf_field_sequence *sequence; + struct bt_field_sequence *sequence; if (!field) { goto end; } - sequence = container_of(field, struct bt_ctf_field_sequence, parent); + sequence = container_of(field, struct bt_field_sequence, parent); if (!sequence->elements) { goto end; } for (i = 0; i < sequence->elements->len; i++) { - is_set = bt_ctf_field_is_set(sequence->elements->pdata[i]); + is_set = bt_field_is_set(sequence->elements->pdata[i]); if (!is_set) { goto end; } diff --git a/lib/ctf-ir/packet.c b/lib/ctf-ir/packet.c index 9ec77dea..5bd77274 100644 --- a/lib/ctf-ir/packet.c +++ b/lib/ctf-ir/packet.c @@ -40,25 +40,25 @@ #include #include -struct bt_ctf_stream *bt_ctf_packet_get_stream(struct bt_ctf_packet *packet) +struct bt_stream *bt_packet_get_stream(struct bt_packet *packet) { return packet ? bt_get(packet->stream) : NULL; } -struct bt_ctf_field *bt_ctf_packet_get_header( - struct bt_ctf_packet *packet) +struct bt_field *bt_packet_get_header( + struct bt_packet *packet) { return packet ? bt_get(packet->header) : NULL; } -int bt_ctf_packet_set_header(struct bt_ctf_packet *packet, - struct bt_ctf_field *header) +int bt_packet_set_header(struct bt_packet *packet, + struct bt_field *header) { int ret = 0; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_field_type *header_field_type = NULL; - struct bt_ctf_field_type *expected_header_field_type = NULL; + struct bt_trace *trace = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_field_type *header_field_type = NULL; + struct bt_field_type *expected_header_field_type = NULL; if (!packet) { BT_LOGW_STR("Invalid parameter: packet is NULL."); @@ -73,11 +73,11 @@ int bt_ctf_packet_set_header(struct bt_ctf_packet *packet, goto end; } - stream_class = bt_ctf_stream_get_class(packet->stream); + stream_class = bt_stream_get_class(packet->stream); assert(stream_class); - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); - expected_header_field_type = bt_ctf_trace_get_packet_header_type(trace); + expected_header_field_type = bt_trace_get_packet_header_type(trace); if (!header) { if (expected_header_field_type) { @@ -91,10 +91,10 @@ int bt_ctf_packet_set_header(struct bt_ctf_packet *packet, goto skip_validation; } - header_field_type = bt_ctf_field_get_type(header); + header_field_type = bt_field_get_type(header); assert(header_field_type); - if (bt_ctf_field_type_compare(header_field_type, + if (bt_field_type_compare(header_field_type, expected_header_field_type)) { BT_LOGW("Invalid parameter: packet header's field type is different from the trace's packet header field type: " "packet-addr=%p, packet-header-addr=%p", @@ -118,19 +118,19 @@ end: return ret; } -struct bt_ctf_field *bt_ctf_packet_get_context( - struct bt_ctf_packet *packet) +struct bt_field *bt_packet_get_context( + struct bt_packet *packet) { return packet ? bt_get(packet->context) : NULL; } -int bt_ctf_packet_set_context(struct bt_ctf_packet *packet, - struct bt_ctf_field *context) +int bt_packet_set_context(struct bt_packet *packet, + struct bt_field *context) { int ret = 0; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_field_type *context_field_type = NULL; - struct bt_ctf_field_type *expected_context_field_type = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_field_type *context_field_type = NULL; + struct bt_field_type *expected_context_field_type = NULL; if (!packet) { BT_LOGW_STR("Invalid parameter: packet is NULL."); @@ -145,10 +145,10 @@ int bt_ctf_packet_set_context(struct bt_ctf_packet *packet, goto end; } - stream_class = bt_ctf_stream_get_class(packet->stream); + stream_class = bt_stream_get_class(packet->stream); assert(stream_class); expected_context_field_type = - bt_ctf_stream_class_get_packet_context_type(stream_class); + bt_stream_class_get_packet_context_type(stream_class); if (!context) { if (expected_context_field_type) { @@ -162,10 +162,10 @@ int bt_ctf_packet_set_context(struct bt_ctf_packet *packet, goto skip_validation; } - context_field_type = bt_ctf_field_get_type(context); + context_field_type = bt_field_get_type(context); assert(context_field_type); - if (bt_ctf_field_type_compare(context_field_type, + if (bt_field_type_compare(context_field_type, expected_context_field_type)) { BT_LOGW("Invalid parameter: packet context's field type is different from the stream class's packet context field type: " "packet-addr=%p, packet-context-addr=%p", @@ -188,7 +188,7 @@ end: } BT_HIDDEN -void bt_ctf_packet_freeze(struct bt_ctf_packet *packet) +void bt_packet_freeze(struct bt_packet *packet) { if (!packet || packet->frozen) { return; @@ -196,18 +196,18 @@ void bt_ctf_packet_freeze(struct bt_ctf_packet *packet) BT_LOGD("Freezing packet: addr=%p", packet); BT_LOGD_STR("Freezing packet's header field."); - bt_ctf_field_freeze(packet->header); + bt_field_freeze(packet->header); BT_LOGD_STR("Freezing packet's context field."); - bt_ctf_field_freeze(packet->context); + bt_field_freeze(packet->context); packet->frozen = 1; } static -void bt_ctf_packet_destroy(struct bt_object *obj) +void bt_packet_destroy(struct bt_object *obj) { - struct bt_ctf_packet *packet; + struct bt_packet *packet; - packet = container_of(obj, struct bt_ctf_packet, base); + packet = container_of(obj, struct bt_packet, base); BT_LOGD("Destroying packet: addr=%p", packet); BT_LOGD_STR("Putting packet's header field."); bt_put(packet->header); @@ -218,12 +218,12 @@ void bt_ctf_packet_destroy(struct bt_object *obj) g_free(packet); } -struct bt_ctf_packet *bt_ctf_packet_create( - struct bt_ctf_stream *stream) +struct bt_packet *bt_packet_create( + struct bt_stream *stream) { - struct bt_ctf_packet *packet = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_trace *trace = NULL; + struct bt_packet *packet = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_trace *trace = NULL; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); @@ -233,33 +233,33 @@ struct bt_ctf_packet *bt_ctf_packet_create( BT_LOGD("Creating packet object: stream-addr=%p, " "stream-name=\"%s\", stream-class-addr=%p, " "stream-class-name=\"%s\", stream-class-id=%" PRId64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), stream->stream_class, - bt_ctf_stream_class_get_name(stream->stream_class), - bt_ctf_stream_class_get_id(stream->stream_class)); + bt_stream_class_get_name(stream->stream_class), + bt_stream_class_get_id(stream->stream_class)); if (stream->pos.fd >= 0) { BT_LOGW_STR("Invalid parameter: stream is a CTF writer stream."); goto end; } - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); - packet = g_new0(struct bt_ctf_packet, 1); + packet = g_new0(struct bt_packet, 1); if (!packet) { BT_LOGE_STR("Failed to allocate one packet object."); goto end; } - bt_object_init(packet, bt_ctf_packet_destroy); + bt_object_init(packet, bt_packet_destroy); packet->stream = bt_get(stream); if (trace->packet_header_type) { BT_LOGD("Creating initial packet header field: ft-addr=%p", trace->packet_header_type); - packet->header = bt_ctf_field_create(trace->packet_header_type); + packet->header = bt_field_create(trace->packet_header_type); if (!packet->header) { BT_LOGE_STR("Cannot create initial packet header field object."); BT_PUT(packet); @@ -270,7 +270,7 @@ struct bt_ctf_packet *bt_ctf_packet_create( if (stream->stream_class->packet_context_type) { BT_LOGD("Creating initial packet context field: ft-addr=%p", stream->stream_class->packet_context_type); - packet->context = bt_ctf_field_create( + packet->context = bt_field_create( stream->stream_class->packet_context_type); if (!packet->context) { BT_LOGE_STR("Cannot create initial packet header field object."); diff --git a/lib/ctf-ir/resolve.c b/lib/ctf-ir/resolve.c index c8648254..2a6ba2b2 100644 --- a/lib/ctf-ir/resolve.c +++ b/lib/ctf-ir/resolve.c @@ -59,7 +59,7 @@ typedef GPtrArray type_stack; * `type` is owned by the stack frame. */ struct type_stack_frame { - struct bt_ctf_field_type *type; + struct bt_field_type *type; int index; }; @@ -78,34 +78,34 @@ struct type_stack_frame { */ struct resolve_context { struct bt_value *environment; - struct bt_ctf_field_type *scopes[6]; + struct bt_field_type *scopes[6]; /* Root scope being visited */ - enum bt_ctf_scope root_scope; + enum bt_scope root_scope; type_stack *type_stack; - struct bt_ctf_field_type *cur_field_type; + struct bt_field_type *cur_field_type; }; /* TSDL dynamic scope prefixes as defined in CTF Section 7.3.2 */ static const char * const absolute_path_prefixes[] = { - [BT_CTF_SCOPE_ENV] = "env.", - [BT_CTF_SCOPE_TRACE_PACKET_HEADER] = "trace.packet.header.", - [BT_CTF_SCOPE_STREAM_PACKET_CONTEXT] = "stream.packet.context.", - [BT_CTF_SCOPE_STREAM_EVENT_HEADER] = "stream.event.header.", - [BT_CTF_SCOPE_STREAM_EVENT_CONTEXT] = "stream.event.context.", - [BT_CTF_SCOPE_EVENT_CONTEXT] = "event.context.", - [BT_CTF_SCOPE_EVENT_FIELDS] = "event.fields.", + [BT_SCOPE_ENV] = "env.", + [BT_SCOPE_TRACE_PACKET_HEADER] = "trace.packet.header.", + [BT_SCOPE_STREAM_PACKET_CONTEXT] = "stream.packet.context.", + [BT_SCOPE_STREAM_EVENT_HEADER] = "stream.event.header.", + [BT_SCOPE_STREAM_EVENT_CONTEXT] = "stream.event.context.", + [BT_SCOPE_EVENT_CONTEXT] = "event.context.", + [BT_SCOPE_EVENT_FIELDS] = "event.fields.", }; /* Number of path tokens used for the absolute prefixes */ static const int absolute_path_prefix_ptoken_counts[] = { - [BT_CTF_SCOPE_ENV] = 1, - [BT_CTF_SCOPE_TRACE_PACKET_HEADER] = 3, - [BT_CTF_SCOPE_STREAM_PACKET_CONTEXT] = 3, - [BT_CTF_SCOPE_STREAM_EVENT_HEADER] = 3, - [BT_CTF_SCOPE_STREAM_EVENT_CONTEXT] = 3, - [BT_CTF_SCOPE_EVENT_CONTEXT] = 2, - [BT_CTF_SCOPE_EVENT_FIELDS] = 2, + [BT_SCOPE_ENV] = 1, + [BT_SCOPE_TRACE_PACKET_HEADER] = 3, + [BT_SCOPE_STREAM_PACKET_CONTEXT] = 3, + [BT_SCOPE_STREAM_EVENT_HEADER] = 3, + [BT_SCOPE_STREAM_EVENT_CONTEXT] = 3, + [BT_SCOPE_EVENT_CONTEXT] = 2, + [BT_SCOPE_EVENT_FIELDS] = 2, }; /* @@ -146,7 +146,7 @@ void type_stack_destroy(type_stack *stack) * `type` is owned by the caller (stack frame gets a new reference). */ static -int type_stack_push(type_stack *stack, struct bt_ctf_field_type *type) +int type_stack_push(type_stack *stack, struct bt_field_type *type) { int ret = 0; struct type_stack_frame *frame = NULL; @@ -254,13 +254,13 @@ void type_stack_pop(type_stack *stack) * Return value is owned by `ctx` on success. */ static -struct bt_ctf_field_type *get_type_from_ctx(struct resolve_context *ctx, - enum bt_ctf_scope scope) +struct bt_field_type *get_type_from_ctx(struct resolve_context *ctx, + enum bt_scope scope) { - assert(scope >= BT_CTF_SCOPE_TRACE_PACKET_HEADER && - scope <= BT_CTF_SCOPE_EVENT_FIELDS); + assert(scope >= BT_SCOPE_TRACE_PACKET_HEADER && + scope <= BT_SCOPE_EVENT_FIELDS); - return ctx->scopes[scope - BT_CTF_SCOPE_TRACE_PACKET_HEADER]; + return ctx->scopes[scope - BT_SCOPE_TRACE_PACKET_HEADER]; } /* @@ -268,14 +268,14 @@ struct bt_ctf_field_type *get_type_from_ctx(struct resolve_context *ctx, * CTF_NODE_UNKNOWN if the path is found to be relative. */ static -enum bt_ctf_scope get_root_scope_from_absolute_pathstr(const char *pathstr) +enum bt_scope get_root_scope_from_absolute_pathstr(const char *pathstr) { - enum bt_ctf_scope scope; - enum bt_ctf_scope ret = BT_CTF_SCOPE_UNKNOWN; + enum bt_scope scope; + enum bt_scope ret = BT_SCOPE_UNKNOWN; const size_t prefixes_count = sizeof(absolute_path_prefixes) / sizeof(*absolute_path_prefixes); - for (scope = BT_CTF_SCOPE_ENV; scope < BT_CTF_SCOPE_ENV + + for (scope = BT_SCOPE_ENV; scope < BT_SCOPE_ENV + prefixes_count; scope++) { /* * Chech if path string starts with a known absolute @@ -289,7 +289,7 @@ enum bt_ctf_scope get_root_scope_from_absolute_pathstr(const char *pathstr) BT_LOGV("Prefix does not match: trying the next one: " "path=\"%s\", path-prefix=\"%s\", scope=%s", pathstr, absolute_path_prefixes[scope], - bt_ctf_scope_string(scope)); + bt_scope_string(scope)); continue; } @@ -297,7 +297,7 @@ enum bt_ctf_scope get_root_scope_from_absolute_pathstr(const char *pathstr) ret = scope; BT_LOGV("Found root scope from absolute path: " "path=\"%s\", scope=%s", pathstr, - bt_ctf_scope_string(scope)); + bt_scope_string(scope)); goto end; } @@ -395,8 +395,8 @@ error: * caller. */ static -int ptokens_to_field_path(GList *ptokens, struct bt_ctf_field_path *field_path, - struct bt_ctf_field_type *type, int src_index) +int ptokens_to_field_path(GList *ptokens, struct bt_field_path *field_path, + struct bt_field_type *type, int src_index) { int ret = 0; GList *cur_ptoken = ptokens; @@ -408,19 +408,19 @@ int ptokens_to_field_path(GList *ptokens, struct bt_ctf_field_path *field_path, /* Locate target */ while (cur_ptoken) { int child_index; - struct bt_ctf_field_type *child_type; + struct bt_field_type *child_type; const char *field_name = ptoken_get_string(cur_ptoken); - enum bt_ctf_field_type_id type_id = - bt_ctf_field_type_get_type_id(type); + enum bt_field_type_id type_id = + bt_field_type_get_type_id(type); BT_LOGV("Current path token: token=\"%s\"", field_name); /* Find to which index corresponds the current path token */ - if (type_id == BT_CTF_FIELD_TYPE_ID_ARRAY || - type_id == BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (type_id == BT_FIELD_TYPE_ID_ARRAY || + type_id == BT_FIELD_TYPE_ID_SEQUENCE) { child_index = -1; } else { - child_index = bt_ctf_field_type_get_field_index(type, + child_index = bt_field_type_get_field_index(type, field_name); if (child_index < 0) { /* @@ -450,7 +450,7 @@ int ptokens_to_field_path(GList *ptokens, struct bt_ctf_field_path *field_path, g_array_append_val(field_path->indexes, child_index); /* Get child field type */ - child_type = bt_ctf_field_type_get_field_at_index(type, + child_type = bt_field_type_get_field_at_index(type, child_index); if (!child_type) { BT_LOGW("Cannot get child field type: " @@ -478,12 +478,12 @@ end: */ static int absolute_ptokens_to_field_path(GList *ptokens, - struct bt_ctf_field_path *field_path, + struct bt_field_path *field_path, struct resolve_context *ctx) { int ret = 0; GList *cur_ptoken; - struct bt_ctf_field_type *type; + struct bt_field_type *type; /* Skip absolute path tokens */ cur_ptoken = g_list_nth(ptokens, @@ -495,7 +495,7 @@ int absolute_ptokens_to_field_path(GList *ptokens, /* Error: root type is not available */ BT_LOGW("Root field type is not available: " "root-scope=%s", - bt_ctf_scope_string(field_path->root)); + bt_scope_string(field_path->root)); ret = -1; goto end; } @@ -516,12 +516,12 @@ end: */ static int relative_ptokens_to_field_path(GList *ptokens, - struct bt_ctf_field_path *field_path, + struct bt_field_path *field_path, struct resolve_context *ctx) { int ret = 0; int parent_pos_in_stack; - struct bt_ctf_field_path *tail_field_path = bt_ctf_field_path_create(); + struct bt_field_path *tail_field_path = bt_field_path_create(); if (!tail_field_path) { BT_LOGE_STR("Cannot create empty field path."); @@ -532,7 +532,7 @@ int relative_ptokens_to_field_path(GList *ptokens, parent_pos_in_stack = type_stack_size(ctx->type_stack) - 1; while (parent_pos_in_stack >= 0) { - struct bt_ctf_field_type *parent_type = + struct bt_field_type *parent_type = type_stack_at(ctx->type_stack, parent_pos_in_stack)->type; int cur_index = type_stack_at(ctx->type_stack, @@ -548,7 +548,7 @@ int relative_ptokens_to_field_path(GList *ptokens, if (ret) { /* Not found... yet */ BT_LOGV_STR("Not found at this point."); - bt_ctf_field_path_clear(tail_field_path); + bt_field_path_clear(tail_field_path); } else { /* Found: stitch tail field path to head field path */ int i = 0; @@ -556,7 +556,7 @@ int relative_ptokens_to_field_path(GList *ptokens, tail_field_path->indexes->len; while (BT_TRUE) { - struct bt_ctf_field_type *cur_type = + struct bt_field_type *cur_type = type_stack_at(ctx->type_stack, i)->type; int index = type_stack_at( ctx->type_stack, i)->index; @@ -588,12 +588,12 @@ int relative_ptokens_to_field_path(GList *ptokens, /* Not found: look in previous scopes */ field_path->root--; - while (field_path->root >= BT_CTF_SCOPE_TRACE_PACKET_HEADER) { - struct bt_ctf_field_type *root_type; - bt_ctf_field_path_clear(field_path); + while (field_path->root >= BT_SCOPE_TRACE_PACKET_HEADER) { + struct bt_field_type *root_type; + bt_field_path_clear(field_path); BT_LOGV("Looking into potential root scope: scope=%s", - bt_ctf_scope_string(field_path->root)); + bt_scope_string(field_path->root)); root_type = get_type_from_ctx(ctx, field_path->root); if (!root_type) { field_path->root--; @@ -628,16 +628,16 @@ end: * Return value is owned by the caller on success. */ static -struct bt_ctf_field_path *pathstr_to_field_path(const char *pathstr, +struct bt_field_path *pathstr_to_field_path(const char *pathstr, struct resolve_context *ctx) { int ret; - enum bt_ctf_scope root_scope; + enum bt_scope root_scope; GList *ptokens = NULL; - struct bt_ctf_field_path *field_path = NULL; + struct bt_field_path *field_path = NULL; /* Create field path */ - field_path = bt_ctf_field_path_create(); + field_path = bt_field_path_create(); if (!field_path) { BT_LOGE_STR("Cannot create empty field path."); ret = -1; @@ -656,20 +656,20 @@ struct bt_ctf_field_path *pathstr_to_field_path(const char *pathstr, /* Absolute or relative path? */ root_scope = get_root_scope_from_absolute_pathstr(pathstr); - if (root_scope == BT_CTF_SCOPE_UNKNOWN) { + if (root_scope == BT_SCOPE_UNKNOWN) { /* Relative path: start with current root scope */ field_path->root = ctx->root_scope; BT_LOGV("Detected relative path: starting with current root scope: " - "scope=%s", bt_ctf_scope_string(field_path->root)); + "scope=%s", bt_scope_string(field_path->root)); ret = relative_ptokens_to_field_path(ptokens, field_path, ctx); if (ret) { BT_LOGW("Cannot get relative field path of path string: " "path=\"%s\", start-scope=%s, end-scope=%s", - pathstr, bt_ctf_scope_string(ctx->root_scope), - bt_ctf_scope_string(field_path->root)); + pathstr, bt_scope_string(ctx->root_scope), + bt_scope_string(field_path->root)); goto end; } - } else if (root_scope == BT_CTF_SCOPE_ENV) { + } else if (root_scope == BT_SCOPE_ENV) { BT_LOGW("Sequence field types referring the trace environment are not supported as of this version: " "path=\"%s\"", pathstr); ret = -1; @@ -678,19 +678,19 @@ struct bt_ctf_field_path *pathstr_to_field_path(const char *pathstr, /* Absolute path: use found root scope */ field_path->root = root_scope; BT_LOGV("Detected absolute path: using root scope: " - "scope=%s", bt_ctf_scope_string(field_path->root)); + "scope=%s", bt_scope_string(field_path->root)); ret = absolute_ptokens_to_field_path(ptokens, field_path, ctx); if (ret) { BT_LOGW("Cannot get absolute field path of path string: " "path=\"%s\", root-scope=%s", - pathstr, bt_ctf_scope_string(root_scope)); + pathstr, bt_scope_string(root_scope)); goto end; } } if (ret == 0) { GString *field_path_pretty = - bt_ctf_field_path_string(field_path); + bt_field_path_string(field_path); const char *field_path_pretty_str = field_path_pretty ? field_path_pretty->str : NULL; @@ -718,12 +718,12 @@ end: * Return value is owned by the caller on success. */ static -struct bt_ctf_field_type *field_path_to_field_type( - struct bt_ctf_field_path *field_path, +struct bt_field_type *field_path_to_field_type( + struct bt_field_path *field_path, struct resolve_context *ctx) { int i; - struct bt_ctf_field_type *type; + struct bt_field_type *type; /* Start with root type */ type = get_type_from_ctx(ctx, field_path->root); @@ -731,18 +731,18 @@ struct bt_ctf_field_type *field_path_to_field_type( if (!type) { /* Error: root type is not available */ BT_LOGW("Root field type is not available: root-scope=%s", - bt_ctf_scope_string(field_path->root)); + bt_scope_string(field_path->root)); goto error; } /* Locate target */ for (i = 0; i < field_path->indexes->len; i++) { - struct bt_ctf_field_type *child_type; + struct bt_field_type *child_type; int child_index = g_array_index(field_path->indexes, int, i); /* Get child field type */ - child_type = bt_ctf_field_type_get_field_at_index(type, + child_type = bt_field_type_get_field_at_index(type, child_index); if (!child_type) { BT_LOGW("Cannot get field type: " @@ -767,13 +767,13 @@ error: * Return value is owned by the caller on success. */ static -struct bt_ctf_field_path *get_ctx_stack_field_path(struct resolve_context *ctx) +struct bt_field_path *get_ctx_stack_field_path(struct resolve_context *ctx) { int i; - struct bt_ctf_field_path *field_path; + struct bt_field_path *field_path; /* Create field path */ - field_path = bt_ctf_field_path_create(); + field_path = bt_field_path_create(); if (!field_path) { BT_LOGE_STR("Cannot create empty field path."); goto error; @@ -801,17 +801,17 @@ error: * * `field_path1` and `field_path2` are owned by the caller. */ -int get_field_paths_lca_index(struct bt_ctf_field_path *field_path1, - struct bt_ctf_field_path *field_path2) +int get_field_paths_lca_index(struct bt_field_path *field_path1, + struct bt_field_path *field_path2) { int lca_index = 0; int field_path1_len, field_path2_len; if (BT_LOG_ON_VERBOSE) { GString *field_path1_pretty = - bt_ctf_field_path_string(field_path1); + bt_field_path_string(field_path1); GString *field_path2_pretty = - bt_ctf_field_path_string(field_path2); + bt_field_path_string(field_path2); const char *field_path1_pretty_str = field_path1_pretty ? field_path1_pretty->str : NULL; const char *field_path2_pretty_str = @@ -878,16 +878,16 @@ int get_field_paths_lca_index(struct bt_ctf_field_path *field_path1, * `target_field_path` and `target_type` are owned by the caller. */ static -int validate_target_field_path(struct bt_ctf_field_path *target_field_path, - struct bt_ctf_field_type *target_type, +int validate_target_field_path(struct bt_field_path *target_field_path, + struct bt_field_type *target_type, struct resolve_context *ctx) { int ret = 0; - struct bt_ctf_field_path *ctx_field_path; + struct bt_field_path *ctx_field_path; int target_field_path_len = target_field_path->indexes->len; int lca_index; - enum bt_ctf_field_type_id ctx_cur_field_type_id; - enum bt_ctf_field_type_id target_type_id; + enum bt_field_type_id ctx_cur_field_type_id; + enum bt_field_type_id target_type_id; /* Get context field path */ ctx_field_path = get_ctx_stack_field_path(ctx); @@ -913,8 +913,8 @@ int validate_target_field_path(struct bt_ctf_field_path *target_field_path, if (target_field_path->root > ctx_field_path->root) { BT_LOGW("Target field type is located after source field type: " "target-root=%s, source-root=%s", - bt_ctf_scope_string(target_field_path->root), - bt_ctf_scope_string(ctx_field_path->root)); + bt_scope_string(target_field_path->root), + bt_scope_string(ctx_field_path->root)); ret = -1; goto end; } @@ -955,29 +955,28 @@ int validate_target_field_path(struct bt_ctf_field_path *target_field_path, /* * Make sure the target type has the right type and properties. */ - ctx_cur_field_type_id = bt_ctf_field_type_get_type_id( + ctx_cur_field_type_id = bt_field_type_get_type_id( ctx->cur_field_type); - target_type_id = bt_ctf_field_type_get_type_id(target_type); + target_type_id = bt_field_type_get_type_id(target_type); switch (ctx_cur_field_type_id) { - case BT_CTF_FIELD_TYPE_ID_VARIANT: - if (target_type_id != BT_CTF_FIELD_TYPE_ID_ENUM) { + case BT_FIELD_TYPE_ID_VARIANT: + if (target_type_id != BT_FIELD_TYPE_ID_ENUM) { BT_LOGW("Variant field type's tag field type is not an enumeration field type: " "tag-ft-addr=%p, tag-ft-id=%s", target_type, - bt_ctf_field_type_id_string(target_type_id)); + bt_field_type_id_string(target_type_id)); ret = -1; goto end; } break; - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: - if (target_type_id != BT_CTF_FIELD_TYPE_ID_INTEGER || - bt_ctf_field_type_integer_get_signed( - target_type)) { + case BT_FIELD_TYPE_ID_SEQUENCE: + if (target_type_id != BT_FIELD_TYPE_ID_INTEGER || + bt_field_type_integer_is_signed(target_type)) { BT_LOGW("Sequence field type's length field type is not an unsigned integer field type: " "length-ft-addr=%p, length-ft-id=%s", target_type, - bt_ctf_field_type_id_string(target_type_id)); + bt_field_type_id_string(target_type_id)); ret = -1; goto end; } @@ -997,27 +996,27 @@ end: * `type` is owned by the caller. */ static -int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type, +int resolve_sequence_or_variant_type(struct bt_field_type *type, struct resolve_context *ctx) { int ret = 0; const char *pathstr; - enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(type); - struct bt_ctf_field_path *target_field_path = NULL; - struct bt_ctf_field_type *target_type = NULL; + enum bt_field_type_id type_id = bt_field_type_get_type_id(type); + struct bt_field_path *target_field_path = NULL; + struct bt_field_type *target_type = NULL; GString *target_field_path_pretty = NULL; const char *target_field_path_pretty_str; /* Get path string */ switch (type_id) { - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_SEQUENCE: pathstr = - bt_ctf_field_type_sequence_get_length_field_name(type); + bt_field_type_sequence_get_length_field_name(type); break; - case BT_CTF_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_VARIANT: pathstr = - bt_ctf_field_type_variant_get_tag_name(type); + bt_field_type_variant_get_tag_name(type); break; default: abort(); @@ -1038,7 +1037,7 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type, goto end; } - target_field_path_pretty = bt_ctf_field_path_string(target_field_path); + target_field_path_pretty = bt_field_path_string(target_field_path); target_field_path_pretty_str = target_field_path_pretty ? target_field_path_pretty->str : NULL; @@ -1062,8 +1061,8 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type, /* Set target field path and target field type */ switch (type_id) { - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: - ret = bt_ctf_field_type_sequence_set_length_field_path( + case BT_FIELD_TYPE_ID_SEQUENCE: + ret = bt_field_type_sequence_set_length_field_path( type, target_field_path); if (ret) { BT_LOGW("Cannot set sequence field type's length field path: " @@ -1073,8 +1072,8 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type, goto end; } break; - case BT_CTF_FIELD_TYPE_ID_VARIANT: - ret = bt_ctf_field_type_variant_set_tag_field_path( + case BT_FIELD_TYPE_ID_VARIANT: + ret = bt_field_type_variant_set_tag_field_path( type, target_field_path); if (ret) { BT_LOGW("Cannot set varaint field type's tag field path: " @@ -1084,7 +1083,7 @@ int resolve_sequence_or_variant_type(struct bt_ctf_field_type *type, goto end; } - ret = bt_ctf_field_type_variant_set_tag_field_type( + ret = bt_field_type_variant_set_tag_field_type( type, target_type); if (ret) { BT_LOGW("Cannot set varaint field type's tag field type: " @@ -1114,23 +1113,23 @@ end: * `type` is owned by the caller. */ static -int resolve_type(struct bt_ctf_field_type *type, struct resolve_context *ctx) +int resolve_type(struct bt_field_type *type, struct resolve_context *ctx) { int ret = 0; - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; if (!type) { /* Type is not available; still valid */ goto end; } - type_id = bt_ctf_field_type_get_type_id(type); + type_id = bt_field_type_get_type_id(type); ctx->cur_field_type = type; /* Resolve sequence/variant field type */ switch (type_id) { - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: - case BT_CTF_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_VARIANT: ret = resolve_sequence_or_variant_type(type, ctx); if (ret) { BT_LOGW("Cannot resolve sequence field type's length or variant field type's tag: " @@ -1144,10 +1143,10 @@ int resolve_type(struct bt_ctf_field_type *type, struct resolve_context *ctx) /* Recurse into compound types */ switch (type_id) { - case BT_CTF_FIELD_TYPE_ID_STRUCT: - case BT_CTF_FIELD_TYPE_ID_VARIANT: - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: - case BT_CTF_FIELD_TYPE_ID_ARRAY: + case BT_FIELD_TYPE_ID_STRUCT: + case BT_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_ARRAY: { int64_t field_count, f_index; @@ -1158,7 +1157,7 @@ int resolve_type(struct bt_ctf_field_type *type, struct resolve_context *ctx) goto end; } - field_count = bt_ctf_field_type_get_field_count(type); + field_count = bt_field_type_get_field_count(type); if (field_count < 0) { BT_LOGW("Cannot get field type's field count: " "ret=%" PRId64 ", ft-addr=%p", @@ -1168,8 +1167,8 @@ int resolve_type(struct bt_ctf_field_type *type, struct resolve_context *ctx) } for (f_index = 0; f_index < field_count; f_index++) { - struct bt_ctf_field_type *child_type = - bt_ctf_field_type_get_field_at_index(type, + struct bt_field_type *child_type = + bt_field_type_get_field_at_index(type, f_index); if (!child_type) { @@ -1181,8 +1180,8 @@ int resolve_type(struct bt_ctf_field_type *type, struct resolve_context *ctx) goto end; } - if (type_id == BT_CTF_FIELD_TYPE_ID_ARRAY|| - type_id == BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (type_id == BT_FIELD_TYPE_ID_ARRAY|| + type_id == BT_FIELD_TYPE_ID_SEQUENCE) { type_stack_peek(ctx->type_stack)->index = -1; } else { type_stack_peek(ctx->type_stack)->index = @@ -1215,28 +1214,28 @@ end: * Resolves the root field type corresponding to the scope `root_scope`. */ static -int resolve_root_type(enum bt_ctf_scope root_scope, struct resolve_context *ctx) +int resolve_root_type(enum bt_scope root_scope, struct resolve_context *ctx) { int ret; assert(type_stack_size(ctx->type_stack) == 0); ctx->root_scope = root_scope; ret = resolve_type(get_type_from_ctx(ctx, root_scope), ctx); - ctx->root_scope = BT_CTF_SCOPE_UNKNOWN; + ctx->root_scope = BT_SCOPE_UNKNOWN; return ret; } BT_HIDDEN -int bt_ctf_resolve_types( +int bt_resolve_types( struct bt_value *environment, - struct bt_ctf_field_type *packet_header_type, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type, - struct bt_ctf_field_type *stream_event_ctx_type, - struct bt_ctf_field_type *event_context_type, - struct bt_ctf_field_type *event_payload_type, - enum bt_ctf_resolve_flag flags) + struct bt_field_type *packet_header_type, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type, + struct bt_field_type *stream_event_ctx_type, + struct bt_field_type *event_context_type, + struct bt_field_type *event_payload_type, + enum bt_resolve_flag flags) { int ret = 0; struct resolve_context ctx = { @@ -1249,7 +1248,7 @@ int bt_ctf_resolve_types( event_context_type, event_payload_type, }, - .root_scope = BT_CTF_SCOPE_UNKNOWN, + .root_scope = BT_SCOPE_UNKNOWN, }; BT_LOGV("Resolving field types: " @@ -1271,8 +1270,8 @@ int bt_ctf_resolve_types( } /* Resolve packet header type */ - if (flags & BT_CTF_RESOLVE_FLAG_PACKET_HEADER) { - ret = resolve_root_type(BT_CTF_SCOPE_TRACE_PACKET_HEADER, &ctx); + if (flags & BT_RESOLVE_FLAG_PACKET_HEADER) { + ret = resolve_root_type(BT_SCOPE_TRACE_PACKET_HEADER, &ctx); if (ret) { BT_LOGW("Cannot resolve trace packet header field type: " "ret=%d", ret); @@ -1281,8 +1280,8 @@ int bt_ctf_resolve_types( } /* Resolve packet context type */ - if (flags & BT_CTF_RESOLVE_FLAG_PACKET_CONTEXT) { - ret = resolve_root_type(BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, &ctx); + if (flags & BT_RESOLVE_FLAG_PACKET_CONTEXT) { + ret = resolve_root_type(BT_SCOPE_STREAM_PACKET_CONTEXT, &ctx); if (ret) { BT_LOGW("Cannot resolve stream packet context field type: " "ret=%d", ret); @@ -1291,8 +1290,8 @@ int bt_ctf_resolve_types( } /* Resolve event header type */ - if (flags & BT_CTF_RESOLVE_FLAG_EVENT_HEADER) { - ret = resolve_root_type(BT_CTF_SCOPE_STREAM_EVENT_HEADER, &ctx); + if (flags & BT_RESOLVE_FLAG_EVENT_HEADER) { + ret = resolve_root_type(BT_SCOPE_STREAM_EVENT_HEADER, &ctx); if (ret) { BT_LOGW("Cannot resolve stream event header field type: " "ret=%d", ret); @@ -1301,8 +1300,8 @@ int bt_ctf_resolve_types( } /* Resolve stream event context type */ - if (flags & BT_CTF_RESOLVE_FLAG_STREAM_EVENT_CTX) { - ret = resolve_root_type(BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, &ctx); + if (flags & BT_RESOLVE_FLAG_STREAM_EVENT_CTX) { + ret = resolve_root_type(BT_SCOPE_STREAM_EVENT_CONTEXT, &ctx); if (ret) { BT_LOGW("Cannot resolve stream event context field type: " "ret=%d", ret); @@ -1311,8 +1310,8 @@ int bt_ctf_resolve_types( } /* Resolve event context type */ - if (flags & BT_CTF_RESOLVE_FLAG_EVENT_CONTEXT) { - ret = resolve_root_type(BT_CTF_SCOPE_EVENT_CONTEXT, &ctx); + if (flags & BT_RESOLVE_FLAG_EVENT_CONTEXT) { + ret = resolve_root_type(BT_SCOPE_EVENT_CONTEXT, &ctx); if (ret) { BT_LOGW("Cannot resolve event context field type: " "ret=%d", ret); @@ -1321,8 +1320,8 @@ int bt_ctf_resolve_types( } /* Resolve event payload type */ - if (flags & BT_CTF_RESOLVE_FLAG_EVENT_PAYLOAD) { - ret = resolve_root_type(BT_CTF_SCOPE_EVENT_FIELDS, &ctx); + if (flags & BT_RESOLVE_FLAG_EVENT_PAYLOAD) { + ret = resolve_root_type(BT_SCOPE_EVENT_FIELDS, &ctx); if (ret) { BT_LOGW("Cannot resolve event payload field type: " "ret=%d", ret); diff --git a/lib/ctf-ir/stream-class.c b/lib/ctf-ir/stream-class.c index 6fdb8ed2..3223f505 100644 --- a/lib/ctf-ir/stream-class.c +++ b/lib/ctf-ir/stream-class.c @@ -52,19 +52,19 @@ #include static -void bt_ctf_stream_class_destroy(struct bt_object *obj); +void bt_stream_class_destroy(struct bt_object *obj); static -int init_event_header(struct bt_ctf_stream_class *stream_class); +int init_event_header(struct bt_stream_class *stream_class); static -int init_packet_context(struct bt_ctf_stream_class *stream_class); +int init_packet_context(struct bt_stream_class *stream_class); -struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name) +struct bt_stream_class *bt_stream_class_create(const char *name) { - struct bt_ctf_stream_class *stream_class; + struct bt_stream_class *stream_class; int ret; BT_LOGD("Creating default stream class object: name=\"%s\"", name); - stream_class = bt_ctf_stream_class_create_empty(name); + stream_class = bt_stream_class_create_empty(name); if (!stream_class) { BT_LOGD_STR("Cannot create empty stream class."); goto error; @@ -91,13 +91,13 @@ error: return stream_class; } -struct bt_ctf_stream_class *bt_ctf_stream_class_create_empty(const char *name) +struct bt_stream_class *bt_stream_class_create_empty(const char *name) { - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; BT_LOGD("Creating empty stream class object: name=\"%s\"", name); - stream_class = g_new0(struct bt_ctf_stream_class, 1); + stream_class = g_new0(struct bt_stream_class, 1); if (!stream_class) { BT_LOGE_STR("Failed to allocate one stream class."); goto error; @@ -118,7 +118,7 @@ struct bt_ctf_stream_class *bt_ctf_stream_class_create_empty(const char *name) goto error; } - bt_object_init(stream_class, bt_ctf_stream_class_destroy); + bt_object_init(stream_class, bt_stream_class_destroy); BT_LOGD("Created empty stream class object: addr=%p, name=\"%s\"", stream_class, name); return stream_class; @@ -128,16 +128,16 @@ error: return stream_class; } -struct bt_ctf_trace *bt_ctf_stream_class_get_trace( - struct bt_ctf_stream_class *stream_class) +struct bt_trace *bt_stream_class_get_trace( + struct bt_stream_class *stream_class) { return stream_class ? - bt_get(bt_ctf_stream_class_borrow_trace(stream_class)) : + bt_get(bt_stream_class_borrow_trace(stream_class)) : NULL; } -const char *bt_ctf_stream_class_get_name( - struct bt_ctf_stream_class *stream_class) +const char *bt_stream_class_get_name( + struct bt_stream_class *stream_class) { const char *name = NULL; @@ -151,7 +151,7 @@ end: return name; } -int bt_ctf_stream_class_set_name(struct bt_ctf_stream_class *stream_class, +int bt_stream_class_set_name(struct bt_stream_class *stream_class, const char *name) { int ret = 0; @@ -165,8 +165,8 @@ int bt_ctf_stream_class_set_name(struct bt_ctf_stream_class *stream_class, if (stream_class->frozen) { BT_LOGW("Invalid parameter: stream class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); ret = -1; goto end; } @@ -185,14 +185,14 @@ int bt_ctf_stream_class_set_name(struct bt_ctf_stream_class *stream_class, BT_LOGV("Set stream class's name: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); end: return ret; } -struct bt_ctf_clock *bt_ctf_stream_class_get_clock( - struct bt_ctf_stream_class *stream_class) +struct bt_ctf_clock *bt_stream_class_get_clock( + struct bt_stream_class *stream_class) { struct bt_ctf_clock *clock = NULL; @@ -204,8 +204,8 @@ struct bt_ctf_clock *bt_ctf_stream_class_get_clock( if (!stream_class->clock) { BT_LOGV("Stream class has no clock: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); goto end; } @@ -214,11 +214,11 @@ end: return clock; } -int bt_ctf_stream_class_set_clock(struct bt_ctf_stream_class *stream_class, +int bt_stream_class_set_clock(struct bt_stream_class *stream_class, struct bt_ctf_clock *clock) { int ret = 0; - struct bt_ctf_field_type *timestamp_field = NULL; + struct bt_field_type *timestamp_field = NULL; if (!stream_class || !clock) { BT_LOGW("Invalid parameter: stream class or clock is NULL: " @@ -231,8 +231,8 @@ int bt_ctf_stream_class_set_clock(struct bt_ctf_stream_class *stream_class, if (stream_class->frozen) { BT_LOGW("Invalid parameter: stream class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); ret = -1; goto end; } @@ -243,8 +243,8 @@ int bt_ctf_stream_class_set_clock(struct bt_ctf_stream_class *stream_class, BT_LOGV("Set stream class's clock: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "clock-addr=%p, clock-name=\"%s\"", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), stream_class->clock, bt_ctf_clock_get_name(stream_class->clock)); @@ -253,7 +253,7 @@ end: return ret; } -int64_t bt_ctf_stream_class_get_id(struct bt_ctf_stream_class *stream_class) +int64_t bt_stream_class_get_id(struct bt_stream_class *stream_class) { int64_t ret; @@ -266,7 +266,7 @@ int64_t bt_ctf_stream_class_get_id(struct bt_ctf_stream_class *stream_class) if (!stream_class->id_set) { BT_LOGV("Stream class's ID is not set: addr=%p, name=\"%s\"", stream_class, - bt_ctf_stream_class_get_name(stream_class)); + bt_stream_class_get_name(stream_class)); ret = (int64_t) -1; goto end; } @@ -277,16 +277,16 @@ end: } BT_HIDDEN -void _bt_ctf_stream_class_set_id( - struct bt_ctf_stream_class *stream_class, int64_t id) +void _bt_stream_class_set_id( + struct bt_stream_class *stream_class, int64_t id) { assert(stream_class); stream_class->id = id; stream_class->id_set = 1; BT_LOGV("Set stream class's ID (internal): " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); } struct event_class_set_stream_class_id_data { @@ -295,14 +295,14 @@ struct event_class_set_stream_class_id_data { }; BT_HIDDEN -int bt_ctf_stream_class_set_id_no_check( - struct bt_ctf_stream_class *stream_class, int64_t id) +int bt_stream_class_set_id_no_check( + struct bt_stream_class *stream_class, int64_t id) { - _bt_ctf_stream_class_set_id(stream_class, id); + _bt_stream_class_set_id(stream_class, id); return 0; } -int bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class, +int bt_stream_class_set_id(struct bt_stream_class *stream_class, uint64_t id_param) { int ret = 0; @@ -317,8 +317,8 @@ int bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class, if (stream_class->frozen) { BT_LOGW("Invalid parameter: stream class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); ret = -1; goto end; } @@ -327,19 +327,19 @@ int bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class, BT_LOGW("Invalid parameter: invalid stream class's ID: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", id=%" PRIu64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), id_param); ret = -1; goto end; } - ret = bt_ctf_stream_class_set_id_no_check(stream_class, id); + ret = bt_stream_class_set_id_no_check(stream_class, id); if (ret == 0) { BT_LOGV("Set stream class's ID: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); } end: return ret; @@ -348,9 +348,9 @@ end: static void event_class_exists(gpointer element, gpointer query) { - struct bt_ctf_event_class *event_class_a = element; + struct bt_event_class *event_class_a = element; struct search_query *search_query = query; - struct bt_ctf_event_class *event_class_b = search_query->value; + struct bt_event_class *event_class_b = search_query->value; int64_t id_a, id_b; if (search_query->value == element) { @@ -362,8 +362,8 @@ void event_class_exists(gpointer element, gpointer query) * Two event classes cannot share the same ID in a given * stream class. */ - id_a = bt_ctf_event_class_get_id(event_class_a); - id_b = bt_ctf_event_class_get_id(event_class_b); + id_a = bt_event_class_get_id(event_class_a); + id_b = bt_event_class_get_id(event_class_b); if (id_a < 0 || id_b < 0) { /* at least one ID is not set: will be automatically set later */ @@ -373,7 +373,7 @@ void event_class_exists(gpointer element, gpointer query) if (id_a == id_b) { BT_LOGW("Event class with this ID already exists in the stream class: " "id=%" PRId64 ", name=\"%s\"", - id_a, bt_ctf_event_class_get_name(event_class_a)); + id_a, bt_event_class_get_name(event_class_a)); search_query->found = 1; goto end; } @@ -382,23 +382,23 @@ end: return; } -int bt_ctf_stream_class_add_event_class( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_event_class *event_class) +int bt_stream_class_add_event_class( + struct bt_stream_class *stream_class, + struct bt_event_class *event_class) { int ret = 0; int64_t *event_id = NULL; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_stream_class *old_stream_class = NULL; - struct bt_ctf_validation_output validation_output = { 0 }; - struct bt_ctf_field_type *packet_header_type = NULL; - struct bt_ctf_field_type *packet_context_type = NULL; - struct bt_ctf_field_type *event_header_type = NULL; - struct bt_ctf_field_type *stream_event_ctx_type = NULL; - struct bt_ctf_field_type *event_context_type = NULL; - struct bt_ctf_field_type *event_payload_type = NULL; - const enum bt_ctf_validation_flag validation_flags = - BT_CTF_VALIDATION_FLAG_EVENT; + struct bt_trace *trace = NULL; + struct bt_stream_class *old_stream_class = NULL; + struct bt_validation_output validation_output = { 0 }; + struct bt_field_type *packet_header_type = NULL; + struct bt_field_type *packet_context_type = NULL; + struct bt_field_type *event_header_type = NULL; + struct bt_field_type *stream_event_ctx_type = NULL; + struct bt_field_type *event_context_type = NULL; + struct bt_field_type *event_payload_type = NULL; + const enum bt_validation_flag validation_flags = + BT_VALIDATION_FLAG_EVENT; if (!stream_class || !event_class) { BT_LOGW("Invalid parameter: stream class or event class is NULL: " @@ -412,13 +412,13 @@ int bt_ctf_stream_class_add_event_class( "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", event-class-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); if (trace && trace->is_static) { ret = -1; goto end; @@ -441,7 +441,7 @@ int bt_ctf_stream_class_add_event_class( goto end; } - old_stream_class = bt_ctf_event_class_get_stream_class(event_class); + old_stream_class = bt_event_class_get_stream_class(event_class); if (old_stream_class) { /* Event class is already associated to a stream class. */ BT_LOGW("Event class is already part of another stream class: " @@ -449,8 +449,8 @@ int bt_ctf_stream_class_add_event_class( "event-class-stream-class-name=\"%s\", " "event-class-stream-class-id=%" PRId64, old_stream_class, - bt_ctf_stream_class_get_name(old_stream_class), - bt_ctf_stream_class_get_id(old_stream_class)); + bt_stream_class_get_name(old_stream_class), + bt_stream_class_get_id(old_stream_class)); ret = -1; goto end; } @@ -468,20 +468,20 @@ int bt_ctf_stream_class_add_event_class( assert(trace->valid); assert(stream_class->valid); packet_header_type = - bt_ctf_trace_get_packet_header_type(trace); + bt_trace_get_packet_header_type(trace); packet_context_type = - bt_ctf_stream_class_get_packet_context_type( + bt_stream_class_get_packet_context_type( stream_class); event_header_type = - bt_ctf_stream_class_get_event_header_type(stream_class); + bt_stream_class_get_event_header_type(stream_class); stream_event_ctx_type = - bt_ctf_stream_class_get_event_context_type( + bt_stream_class_get_event_context_type( stream_class); event_context_type = - bt_ctf_event_class_get_context_type(event_class); + bt_event_class_get_context_type(event_class); event_payload_type = - bt_ctf_event_class_get_payload_type(event_class); - ret = bt_ctf_validate_class_types( + bt_event_class_get_payload_type(event_class); + ret = bt_validate_class_types( trace->environment, packet_header_type, packet_context_type, event_header_type, stream_event_ctx_type, event_context_type, @@ -517,12 +517,12 @@ int bt_ctf_stream_class_add_event_class( } /* Only set an event ID if none was explicitly set before */ - *event_id = bt_ctf_event_class_get_id(event_class); + *event_id = bt_event_class_get_id(event_class); if (*event_id < 0) { BT_LOGV("Event class has no ID: automatically setting it: " "id=%" PRId64, stream_class->next_event_id); - if (bt_ctf_event_class_set_id(event_class, + if (bt_event_class_set_id(event_class, stream_class->next_event_id)) { BT_LOGE("Cannot set event class's ID: id=%" PRId64, stream_class->next_event_id); @@ -542,15 +542,15 @@ int bt_ctf_stream_class_add_event_class( * class's field types with what's in the validation * output structure and mark this event class as valid. */ - bt_ctf_validation_replace_types(NULL, NULL, event_class, + bt_validation_replace_types(NULL, NULL, event_class, &validation_output, validation_flags); event_class->valid = 1; /* * Put what was not moved in - * bt_ctf_validation_replace_types(). + * bt_validation_replace_types(). */ - bt_ctf_validation_output_put_types(&validation_output); + bt_validation_output_put_types(&validation_output); } /* Add to the event classes of the stream class */ @@ -560,30 +560,30 @@ int bt_ctf_stream_class_add_event_class( event_id = NULL; /* Freeze the event class */ - bt_ctf_event_class_freeze(event_class); + bt_event_class_freeze(event_class); /* Notifiy listeners of the trace's schema modification. */ if (trace) { - struct bt_ctf_object obj = { .object = event_class, - .type = BT_CTF_OBJECT_TYPE_EVENT_CLASS }; + struct bt_visitor_object obj = { .object = event_class, + .type = BT_VISITOR_OBJECT_TYPE_EVENT_CLASS }; - (void) bt_ctf_trace_object_modification(&obj, trace); + (void) bt_trace_object_modification(&obj, trace); } BT_LOGD("Added event class to stream class: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", event-class-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); end: BT_PUT(trace); BT_PUT(old_stream_class); - bt_ctf_validation_output_put_types(&validation_output); + bt_validation_output_put_types(&validation_output); assert(!packet_header_type); assert(!packet_context_type); assert(!event_header_type); @@ -595,8 +595,8 @@ end: return ret; } -int64_t bt_ctf_stream_class_get_event_class_count( - struct bt_ctf_stream_class *stream_class) +int64_t bt_stream_class_get_event_class_count( + struct bt_stream_class *stream_class) { int64_t ret; @@ -611,10 +611,10 @@ end: return ret; } -struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index( - struct bt_ctf_stream_class *stream_class, uint64_t index) +struct bt_event_class *bt_stream_class_get_event_class_by_index( + struct bt_stream_class *stream_class, uint64_t index) { - struct bt_ctf_event_class *event_class = NULL; + struct bt_event_class *event_class = NULL; if (!stream_class) { BT_LOGW_STR("Invalid parameter: stream class is NULL."); @@ -625,8 +625,8 @@ struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index( BT_LOGW("Invalid parameter: index is out of bounds: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "index=%" PRIu64 ", count=%u", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), index, stream_class->event_classes->len); goto end; } @@ -637,11 +637,11 @@ end: return event_class; } -struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id( - struct bt_ctf_stream_class *stream_class, uint64_t id) +struct bt_event_class *bt_stream_class_get_event_class_by_id( + struct bt_stream_class *stream_class, uint64_t id) { int64_t id_key = (int64_t) id; - struct bt_ctf_event_class *event_class = NULL; + struct bt_event_class *event_class = NULL; if (!stream_class) { BT_LOGW_STR("Invalid parameter: stream class is NULL."); @@ -653,8 +653,8 @@ struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id( "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", event-class-id=%" PRIu64, stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), id); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), id); goto end; } @@ -665,10 +665,10 @@ end: return event_class; } -struct bt_ctf_field_type *bt_ctf_stream_class_get_packet_context_type( - struct bt_ctf_stream_class *stream_class) +struct bt_field_type *bt_stream_class_get_packet_context_type( + struct bt_stream_class *stream_class) { - struct bt_ctf_field_type *ret = NULL; + struct bt_field_type *ret = NULL; if (!stream_class) { BT_LOGW_STR("Invalid parameter: stream class is NULL."); @@ -681,9 +681,9 @@ end: return ret; } -int bt_ctf_stream_class_set_packet_context_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *packet_context_type) +int bt_stream_class_set_packet_context_type( + struct bt_stream_class *stream_class, + struct bt_field_type *packet_context_type) { int ret = 0; @@ -696,24 +696,24 @@ int bt_ctf_stream_class_set_packet_context_type( if (stream_class->frozen) { BT_LOGW("Invalid parameter: stream class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); ret = -1; goto end; } if (packet_context_type && - bt_ctf_field_type_get_type_id(packet_context_type) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + bt_field_type_get_type_id(packet_context_type) != + BT_FIELD_TYPE_ID_STRUCT) { /* A packet context must be a structure. */ BT_LOGW("Invalid parameter: stream class's packet context field type must be a structure: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "packet-context-ft-addr=%p, packet-context-ft-id=%s", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), packet_context_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(packet_context_type))); + bt_field_type_id_string( + bt_field_type_get_type_id(packet_context_type))); ret = -1; goto end; } @@ -724,18 +724,18 @@ int bt_ctf_stream_class_set_packet_context_type( BT_LOGV("Set stream class's packet context field type: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "packet-context-ft-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), packet_context_type); end: return ret; } -struct bt_ctf_field_type *bt_ctf_stream_class_get_event_header_type( - struct bt_ctf_stream_class *stream_class) +struct bt_field_type *bt_stream_class_get_event_header_type( + struct bt_stream_class *stream_class) { - struct bt_ctf_field_type *ret = NULL; + struct bt_field_type *ret = NULL; if (!stream_class) { BT_LOGW_STR("Invalid parameter: stream class is NULL."); @@ -745,8 +745,8 @@ struct bt_ctf_field_type *bt_ctf_stream_class_get_event_header_type( if (!stream_class->event_header_type) { BT_LOGV("Stream class has no event header field type: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); goto end; } @@ -756,9 +756,9 @@ end: return ret; } -int bt_ctf_stream_class_set_event_header_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *event_header_type) +int bt_stream_class_set_event_header_type( + struct bt_stream_class *stream_class, + struct bt_field_type *event_header_type) { int ret = 0; @@ -771,24 +771,24 @@ int bt_ctf_stream_class_set_event_header_type( if (stream_class->frozen) { BT_LOGW("Invalid parameter: stream class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); ret = -1; goto end; } if (event_header_type && - bt_ctf_field_type_get_type_id(event_header_type) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + bt_field_type_get_type_id(event_header_type) != + BT_FIELD_TYPE_ID_STRUCT) { /* An event header must be a structure. */ BT_LOGW("Invalid parameter: stream class's event header field type must be a structure: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "event-header-ft-addr=%p, event-header-ft-id=%s", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_header_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(event_header_type))); + bt_field_type_id_string( + bt_field_type_get_type_id(event_header_type))); ret = -1; goto end; } @@ -798,17 +798,17 @@ int bt_ctf_stream_class_set_event_header_type( BT_LOGV("Set stream class's event header field type: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "event-header-ft-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_header_type); end: return ret; } -struct bt_ctf_field_type *bt_ctf_stream_class_get_event_context_type( - struct bt_ctf_stream_class *stream_class) +struct bt_field_type *bt_stream_class_get_event_context_type( + struct bt_stream_class *stream_class) { - struct bt_ctf_field_type *ret = NULL; + struct bt_field_type *ret = NULL; if (!stream_class) { BT_LOGW_STR("Invalid parameter: stream class is NULL."); @@ -825,9 +825,9 @@ end: return ret; } -int bt_ctf_stream_class_set_event_context_type( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *event_context_type) +int bt_stream_class_set_event_context_type( + struct bt_stream_class *stream_class, + struct bt_field_type *event_context_type) { int ret = 0; @@ -840,24 +840,24 @@ int bt_ctf_stream_class_set_event_context_type( if (stream_class->frozen) { BT_LOGW("Invalid parameter: stream class is frozen: " "addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); ret = -1; goto end; } if (event_context_type && - bt_ctf_field_type_get_type_id(event_context_type) != - BT_CTF_FIELD_TYPE_ID_STRUCT) { + bt_field_type_get_type_id(event_context_type) != + BT_FIELD_TYPE_ID_STRUCT) { /* A packet context must be a structure. */ BT_LOGW("Invalid parameter: stream class's event context field type must be a structure: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "event-context-ft-addr=%p, event-context-ft-id=%s", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_context_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(event_context_type))); + bt_field_type_id_string( + bt_field_type_get_type_id(event_context_type))); ret = -1; goto end; } @@ -867,21 +867,21 @@ int bt_ctf_stream_class_set_event_context_type( BT_LOGV("Set stream class's event context field type: " "addr=%p, name=\"%s\", id=%" PRId64 ", " "event-context-ft-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_context_type); end: return ret; } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_stream_class_get(struct bt_ctf_stream_class *stream_class) +void bt_ctf_stream_class_get(struct bt_stream_class *stream_class) { bt_get(stream_class); } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_stream_class_put(struct bt_ctf_stream_class *stream_class) +void bt_ctf_stream_class_put(struct bt_stream_class *stream_class) { bt_put(stream_class); } @@ -889,34 +889,34 @@ void bt_ctf_stream_class_put(struct bt_ctf_stream_class *stream_class) static int64_t get_event_class_count(void *element) { - return bt_ctf_stream_class_get_event_class_count( - (struct bt_ctf_stream_class *) element); + return bt_stream_class_get_event_class_count( + (struct bt_stream_class *) element); } static void *get_event_class(void *element, int i) { - return bt_ctf_stream_class_get_event_class_by_index( - (struct bt_ctf_stream_class *) element, i); + return bt_stream_class_get_event_class_by_index( + (struct bt_stream_class *) element, i); } static -int visit_event_class(void *object, bt_ctf_visitor visitor,void *data) +int visit_event_class(void *object, bt_visitor visitor,void *data) { - struct bt_ctf_object obj = + struct bt_visitor_object obj = { .object = object, - .type = BT_CTF_OBJECT_TYPE_EVENT_CLASS }; + .type = BT_VISITOR_OBJECT_TYPE_EVENT_CLASS }; return visitor(&obj, data); } -int bt_ctf_stream_class_visit(struct bt_ctf_stream_class *stream_class, - bt_ctf_visitor visitor, void *data) +int bt_stream_class_visit(struct bt_stream_class *stream_class, + bt_visitor visitor, void *data) { int ret; - struct bt_ctf_object obj = + struct bt_visitor_object obj = { .object = stream_class, - .type = BT_CTF_OBJECT_TYPE_STREAM_CLASS }; + .type = BT_VISITOR_OBJECT_TYPE_STREAM_CLASS }; if (!stream_class || !visitor) { BT_LOGW("Invalid parameter: stream class or visitor is NULL: " @@ -935,39 +935,39 @@ end: } BT_HIDDEN -void bt_ctf_stream_class_freeze(struct bt_ctf_stream_class *stream_class) +void bt_stream_class_freeze(struct bt_stream_class *stream_class) { if (!stream_class || stream_class->frozen) { return; } BT_LOGD("Freezing stream class: addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); stream_class->frozen = 1; - bt_ctf_field_type_freeze(stream_class->event_header_type); - bt_ctf_field_type_freeze(stream_class->packet_context_type); - bt_ctf_field_type_freeze(stream_class->event_context_type); + bt_field_type_freeze(stream_class->event_header_type); + bt_field_type_freeze(stream_class->packet_context_type); + bt_field_type_freeze(stream_class->event_context_type); if (stream_class->clock) { - bt_ctf_clock_class_freeze(stream_class->clock->clock_class); + bt_clock_class_freeze(stream_class->clock->clock_class); } } BT_HIDDEN -int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, +int bt_stream_class_serialize(struct bt_stream_class *stream_class, struct metadata_context *context) { int ret = 0; size_t i; - struct bt_ctf_trace *trace; - struct bt_ctf_field_type *packet_header_type = NULL; + struct bt_trace *trace; + struct bt_field_type *packet_header_type = NULL; BT_LOGD("Serializing stream class's metadata: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", metadata-context-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), context); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), context); g_string_assign(context->field_name, ""); context->current_indentation_level = 1; if (!stream_class->id_set) { @@ -986,15 +986,15 @@ int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, * 1 -> 0 -> 1 -> 0 -> ..., provoking an endless loop of destruction * and serialization. */ - trace = bt_ctf_stream_class_borrow_trace(stream_class); + trace = bt_stream_class_borrow_trace(stream_class); assert(trace); - packet_header_type = bt_ctf_trace_get_packet_header_type(trace); + packet_header_type = bt_trace_get_packet_header_type(trace); trace = NULL; if (packet_header_type) { - struct bt_ctf_field_type *stream_id_type; + struct bt_field_type *stream_id_type; stream_id_type = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( packet_header_type, "stream_id"); if (stream_id_type) { /* @@ -1011,7 +1011,7 @@ int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, if (stream_class->event_header_type) { BT_LOGD_STR("Serializing stream class's event header field type's metadata."); g_string_append(context->string, "\tevent.header := "); - ret = bt_ctf_field_type_serialize(stream_class->event_header_type, + ret = bt_field_type_serialize(stream_class->event_header_type, context); if (ret) { BT_LOGW("Cannot serialize stream class's event header field type's metadata: " @@ -1025,7 +1025,7 @@ int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, if (stream_class->packet_context_type) { BT_LOGD_STR("Serializing stream class's packet context field type's metadata."); g_string_append(context->string, "\n\n\tpacket.context := "); - ret = bt_ctf_field_type_serialize(stream_class->packet_context_type, + ret = bt_field_type_serialize(stream_class->packet_context_type, context); if (ret) { BT_LOGW("Cannot serialize stream class's packet context field type's metadata: " @@ -1038,7 +1038,7 @@ int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, if (stream_class->event_context_type) { BT_LOGD_STR("Serializing stream class's event context field type's metadata."); g_string_append(context->string, "\n\n\tevent.context := "); - ret = bt_ctf_field_type_serialize( + ret = bt_field_type_serialize( stream_class->event_context_type, context); if (ret) { BT_LOGW("Cannot serialize stream class's event context field type's metadata: " @@ -1051,17 +1051,17 @@ int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class, g_string_append(context->string, "\n};\n\n"); for (i = 0; i < stream_class->event_classes->len; i++) { - struct bt_ctf_event_class *event_class = + struct bt_event_class *event_class = stream_class->event_classes->pdata[i]; - ret = bt_ctf_event_class_serialize(event_class, context); + ret = bt_event_class_serialize(event_class, context); if (ret) { BT_LOGW("Cannot serialize event class's metadata: " "event-class-addr=%p, event-class-name=\"%s\", " "event-class-id=%" PRId64, event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); goto end; } } @@ -1072,14 +1072,14 @@ end: } static -void bt_ctf_stream_class_destroy(struct bt_object *obj) +void bt_stream_class_destroy(struct bt_object *obj) { - struct bt_ctf_stream_class *stream_class; + struct bt_stream_class *stream_class; - stream_class = container_of(obj, struct bt_ctf_stream_class, base); + stream_class = container_of(obj, struct bt_stream_class, base); BT_LOGD("Destroying stream class: addr=%p, name=\"%s\", id=%" PRId64, - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); bt_put(stream_class->clock); if (stream_class->event_classes_ht) { @@ -1104,14 +1104,14 @@ void bt_ctf_stream_class_destroy(struct bt_object *obj) } static -int init_event_header(struct bt_ctf_stream_class *stream_class) +int init_event_header(struct bt_stream_class *stream_class) { int ret = 0; - struct bt_ctf_field_type *event_header_type = - bt_ctf_field_type_structure_create(); - struct bt_ctf_field_type *_uint32_t = + struct bt_field_type *event_header_type = + bt_field_type_structure_create(); + struct bt_field_type *_uint32_t = get_field_type(FIELD_TYPE_ALIAS_UINT32_T); - struct bt_ctf_field_type *_uint64_t = + struct bt_field_type *_uint64_t = get_field_type(FIELD_TYPE_ALIAS_UINT64_T); if (!event_header_type) { @@ -1120,14 +1120,14 @@ int init_event_header(struct bt_ctf_stream_class *stream_class) goto end; } - ret = bt_ctf_field_type_structure_add_field(event_header_type, + ret = bt_field_type_structure_add_field(event_header_type, _uint32_t, "id"); if (ret) { BT_LOGE_STR("Cannot add `id` field to event header field type."); goto end; } - ret = bt_ctf_field_type_structure_add_field(event_header_type, + ret = bt_field_type_structure_add_field(event_header_type, _uint64_t, "timestamp"); if (ret) { BT_LOGE_STR("Cannot add `timestamp` field to event header field type."); @@ -1146,14 +1146,14 @@ end: } static -int init_packet_context(struct bt_ctf_stream_class *stream_class) +int init_packet_context(struct bt_stream_class *stream_class) { int ret = 0; - struct bt_ctf_field_type *packet_context_type = - bt_ctf_field_type_structure_create(); - struct bt_ctf_field_type *_uint64_t = + struct bt_field_type *packet_context_type = + bt_field_type_structure_create(); + struct bt_field_type *_uint64_t = get_field_type(FIELD_TYPE_ALIAS_UINT64_T); - struct bt_ctf_field_type *ts_begin_end_uint64_t; + struct bt_field_type *ts_begin_end_uint64_t; if (!packet_context_type) { BT_LOGE_STR("Cannot create empty structure field type."); @@ -1161,7 +1161,7 @@ int init_packet_context(struct bt_ctf_stream_class *stream_class) goto end; } - ts_begin_end_uint64_t = bt_ctf_field_type_copy(_uint64_t); + ts_begin_end_uint64_t = bt_field_type_copy(_uint64_t); if (!ts_begin_end_uint64_t) { BT_LOGE_STR("Cannot copy integer field type for `timestamp_begin` and `timestamp_end` fields."); ret = -1; @@ -1172,35 +1172,35 @@ int init_packet_context(struct bt_ctf_stream_class *stream_class) * We create a stream packet context as proposed in the CTF * specification. */ - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, ts_begin_end_uint64_t, "timestamp_begin"); if (ret) { BT_LOGE_STR("Cannot add `timestamp_begin` field to event header field type."); goto end; } - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, ts_begin_end_uint64_t, "timestamp_end"); if (ret) { BT_LOGE_STR("Cannot add `timestamp_end` field to event header field type."); goto end; } - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, _uint64_t, "content_size"); if (ret) { BT_LOGE_STR("Cannot add `content_size` field to event header field type."); goto end; } - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, _uint64_t, "packet_size"); if (ret) { BT_LOGE_STR("Cannot add `packet_size` field to event header field type."); goto end; } - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, _uint64_t, "events_discarded"); if (ret) { BT_LOGE_STR("Cannot add `events_discarded` field to event header field type."); @@ -1220,10 +1220,10 @@ end: } static -int try_map_clock_class(struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *ft) +int try_map_clock_class(struct bt_stream_class *stream_class, + struct bt_field_type *ft) { - struct bt_ctf_clock_class *mapped_clock_class = NULL; + struct bt_clock_class *mapped_clock_class = NULL; int ret = 0; if (!ft) { @@ -1231,36 +1231,36 @@ int try_map_clock_class(struct bt_ctf_stream_class *stream_class, goto end; } - assert(bt_ctf_field_type_is_integer(ft)); + assert(bt_field_type_is_integer(ft)); mapped_clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class(ft); + bt_field_type_integer_get_mapped_clock_class(ft); if (!mapped_clock_class) { if (!stream_class->clock) { BT_LOGW("Cannot automatically set field's type mapped clock class: stream class's clock is not set: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", ft-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), ft); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), ft); ret = -1; goto end; } - ret = bt_ctf_field_type_integer_set_mapped_clock_class_no_check( + ret = bt_field_type_integer_set_mapped_clock_class_no_check( ft, stream_class->clock->clock_class); if (ret) { BT_LOGW("Cannot set field type's mapped clock class: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", ft-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), ft); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), ft); goto end; } BT_LOGV("Automatically mapped field type to stream class's clock class: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", ft-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), ft); + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), ft); } end: @@ -1269,18 +1269,18 @@ end: } BT_HIDDEN -int bt_ctf_stream_class_map_clock_class( - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type) +int bt_stream_class_map_clock_class( + struct bt_stream_class *stream_class, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type) { - struct bt_ctf_field_type *ft = NULL; + struct bt_field_type *ft = NULL; int ret = 0; assert(stream_class); if (packet_context_type) { - ft = bt_ctf_field_type_structure_get_field_type_by_name( + ft = bt_field_type_structure_get_field_type_by_name( packet_context_type, "timestamp_begin"); if (try_map_clock_class(stream_class, ft)) { BT_LOGE_STR("Cannot automatically set stream class's packet context field type's `timestamp_begin` field's mapped clock class."); @@ -1289,7 +1289,7 @@ int bt_ctf_stream_class_map_clock_class( } bt_put(ft); - ft = bt_ctf_field_type_structure_get_field_type_by_name( + ft = bt_field_type_structure_get_field_type_by_name( packet_context_type, "timestamp_end"); if (try_map_clock_class(stream_class, ft)) { BT_LOGE_STR("Cannot automatically set stream class's packet context field type's `timestamp_end` field's mapped clock class."); @@ -1301,7 +1301,7 @@ int bt_ctf_stream_class_map_clock_class( } if (event_header_type) { - ft = bt_ctf_field_type_structure_get_field_type_by_name( + ft = bt_field_type_structure_get_field_type_by_name( event_header_type, "timestamp"); if (try_map_clock_class(stream_class, ft)) { BT_LOGE_STR("Cannot automatically set stream class's event header field type's `timestamp` field's mapped clock class."); diff --git a/lib/ctf-ir/stream.c b/lib/ctf-ir/stream.c index 70f08d18..05c32311 100644 --- a/lib/ctf-ir/stream.c +++ b/lib/ctf-ir/stream.c @@ -51,15 +51,15 @@ #include static -void bt_ctf_stream_destroy(struct bt_object *obj); +void bt_stream_destroy(struct bt_object *obj); static -int try_set_structure_field_integer(struct bt_ctf_field *, char *, uint64_t); +int try_set_structure_field_integer(struct bt_field *, char *, uint64_t); static -int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) +int set_integer_field_value(struct bt_field* field, uint64_t value) { int ret = 0; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; if (!field) { BT_LOGW_STR("Invalid parameter: field is NULL."); @@ -67,22 +67,22 @@ int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) goto end; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != - BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field_type) != + BT_FIELD_TYPE_ID_INTEGER) { /* Not an integer and the value is unset, error. */ BT_LOGW("Invalid parameter: field's type is not an integer field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field, field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); ret = -1; goto end; } - if (bt_ctf_field_type_integer_get_signed(field_type)) { - ret = bt_ctf_field_signed_integer_set_value(field, (int64_t) value); + if (bt_field_type_integer_is_signed(field_type)) { + ret = bt_field_signed_integer_set_value(field, (int64_t) value); if (ret) { /* Value is out of range, error. */ BT_LOGW("Cannot set signed integer field's value: " @@ -91,7 +91,7 @@ int set_integer_field_value(struct bt_ctf_field* field, uint64_t value) goto end; } } else { - ret = bt_ctf_field_unsigned_integer_set_value(field, value); + ret = bt_field_unsigned_integer_set_value(field, value); if (ret) { /* Value is out of range, error. */ BT_LOGW("Cannot set unsigned integer field's value: " @@ -106,10 +106,10 @@ end: } static -int set_packet_header_magic(struct bt_ctf_stream *stream) +int set_packet_header_magic(struct bt_stream *stream) { int ret = 0; - struct bt_ctf_field *magic_field = bt_ctf_field_structure_get_field( + struct bt_field *magic_field = bt_field_structure_get_field_by_name( stream->packet_header, "magic"); const uint32_t magic_value = 0xc1fc1fc1; @@ -119,22 +119,22 @@ int set_packet_header_magic(struct bt_ctf_stream *stream) /* No magic field found. Not an error, skip. */ BT_LOGV("No field named `magic` in packet header: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(magic_field, + ret = bt_field_unsigned_integer_set_value(magic_field, (uint64_t) magic_value); if (ret) { BT_LOGW("Cannot set packet header field's `magic` integer field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), magic_field, (uint64_t) magic_value); } else { BT_LOGV("Set packet header field's `magic` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), magic_field, (uint64_t) magic_value); } end: @@ -143,12 +143,12 @@ end: } static -int set_packet_header_uuid(struct bt_ctf_stream *stream) +int set_packet_header_uuid(struct bt_stream *stream) { int ret = 0; int64_t i; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_field *uuid_field = bt_ctf_field_structure_get_field( + struct bt_trace *trace = NULL; + struct bt_field *uuid_field = bt_field_structure_get_field_by_name( stream->packet_header, "uuid"); assert(stream); @@ -157,23 +157,23 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) /* No uuid field found. Not an error, skip. */ BT_LOGV("No field named `uuid` in packet header: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } - trace = (struct bt_ctf_trace *) bt_object_get_parent(stream); + trace = (struct bt_trace *) bt_object_get_parent(stream); for (i = 0; i < 16; i++) { - struct bt_ctf_field *uuid_element = - bt_ctf_field_array_get_field(uuid_field, i); + struct bt_field *uuid_element = + bt_field_array_get_field(uuid_field, i); - ret = bt_ctf_field_unsigned_integer_set_value( + ret = bt_field_unsigned_integer_set_value( uuid_element, (uint64_t) trace->uuid[i]); bt_put(uuid_element); if (ret) { BT_LOGW("Cannot set integer field's value (for `uuid` packet header field): " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, " "value=%" PRIu64 ", index=%" PRId64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), uuid_element, (uint64_t) trace->uuid[i], i); goto end; } @@ -181,7 +181,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream) BT_LOGV("Set packet header field's `uuid` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p", - stream, bt_ctf_stream_get_name(stream), uuid_field); + stream, bt_stream_get_name(stream), uuid_field); end: bt_put(uuid_field); @@ -189,33 +189,33 @@ end: return ret; } static -int set_packet_header_stream_id(struct bt_ctf_stream *stream) +int set_packet_header_stream_id(struct bt_stream *stream) { int ret = 0; uint32_t stream_id; - struct bt_ctf_field *stream_id_field = bt_ctf_field_structure_get_field( + struct bt_field *stream_id_field = bt_field_structure_get_field_by_name( stream->packet_header, "stream_id"); if (!stream_id_field) { /* No stream_id field found. Not an error, skip. */ BT_LOGV("No field named `stream_id` in packet header: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } stream_id = stream->stream_class->id; - ret = bt_ctf_field_unsigned_integer_set_value(stream_id_field, + ret = bt_field_unsigned_integer_set_value(stream_id_field, (uint64_t) stream_id); if (ret) { BT_LOGW("Cannot set packet header field's `stream_id` integer field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), stream_id_field, (uint64_t) stream_id); } else { BT_LOGV("Set packet header field's `stream_id` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), stream_id_field, (uint64_t) stream_id); } @@ -225,7 +225,7 @@ end: } static -int auto_populate_packet_header(struct bt_ctf_stream *stream) +int auto_populate_packet_header(struct bt_stream *stream) { int ret = 0; @@ -237,7 +237,7 @@ int auto_populate_packet_header(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet header's magic number field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -245,7 +245,7 @@ int auto_populate_packet_header(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet header's UUID field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -253,23 +253,23 @@ int auto_populate_packet_header(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet header's stream class ID field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } BT_LOGV("Automatically populated stream's packet header's known fields: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); end: return ret; } static -int set_packet_context_packet_size(struct bt_ctf_stream *stream) +int set_packet_context_packet_size(struct bt_stream *stream) { int ret = 0; - struct bt_ctf_field *field = bt_ctf_field_structure_get_field( + struct bt_field *field = bt_field_structure_get_field_by_name( stream->packet_context, "packet_size"); assert(stream); @@ -278,21 +278,21 @@ int set_packet_context_packet_size(struct bt_ctf_stream *stream) /* No packet size field found. Not an error, skip. */ BT_LOGV("No field named `packet_size` in packet context: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(field, + ret = bt_field_unsigned_integer_set_value(field, stream->pos.packet_size); if (ret) { BT_LOGW("Cannot set packet context field's `packet_size` integer field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, stream->pos.packet_size); } else { BT_LOGV("Set packet context field's `packet_size` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, stream->pos.packet_size); } @@ -302,10 +302,10 @@ end: } static -int set_packet_context_content_size(struct bt_ctf_stream *stream) +int set_packet_context_content_size(struct bt_stream *stream) { int ret = 0; - struct bt_ctf_field *field = bt_ctf_field_structure_get_field( + struct bt_field *field = bt_field_structure_get_field_by_name( stream->packet_context, "content_size"); assert(stream); @@ -314,21 +314,21 @@ int set_packet_context_content_size(struct bt_ctf_stream *stream) /* No content size field found. Not an error, skip. */ BT_LOGV("No field named `content_size` in packet context: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(field, + ret = bt_field_unsigned_integer_set_value(field, stream->pos.offset); if (ret) { BT_LOGW("Cannot set packet context field's `content_size` integer field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRId64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, stream->pos.offset); } else { BT_LOGV("Set packet context field's `content_size` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRId64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, stream->pos.offset); } @@ -338,10 +338,10 @@ end: } static -int set_packet_context_events_discarded(struct bt_ctf_stream *stream) +int set_packet_context_events_discarded(struct bt_stream *stream) { int ret = 0; - struct bt_ctf_field *field = bt_ctf_field_structure_get_field( + struct bt_field *field = bt_field_structure_get_field_by_name( stream->packet_context, "events_discarded"); assert(stream); @@ -350,7 +350,7 @@ int set_packet_context_events_discarded(struct bt_ctf_stream *stream) /* No discarded events count field found. Not an error, skip. */ BT_LOGV("No field named `events_discarded` in packet context: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -360,15 +360,15 @@ int set_packet_context_events_discarded(struct bt_ctf_stream *stream) * discarded events. We do not allow wrapping here. If it's * valid, update the stream's current count. */ - if (bt_ctf_field_is_set(field)) { + if (bt_field_is_set(field)) { uint64_t user_val; - ret = bt_ctf_field_unsigned_integer_get_value(field, + ret = bt_field_unsigned_integer_get_value(field, &user_val); if (ret) { BT_LOGW("Cannot get packet context `events_discarded` field's unsigned value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p", - stream, bt_ctf_stream_get_name(stream), field); + stream, bt_stream_get_name(stream), field); goto end; } @@ -378,24 +378,24 @@ int set_packet_context_events_discarded(struct bt_ctf_stream *stream) "stream-addr=%p, stream-name=\"%s\", field-addr=%p, " "value=%" PRIu64 ", " "stream-discarded-events-count=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), field, + stream, bt_stream_get_name(stream), field, user_val, stream->discarded_events); goto end; } stream->discarded_events = user_val; } else { - ret = bt_ctf_field_unsigned_integer_set_value(field, + ret = bt_field_unsigned_integer_set_value(field, stream->discarded_events); if (ret) { BT_LOGW("Cannot set packet context field's `events_discarded` integer field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, stream->discarded_events); } else { BT_LOGV("Set packet context field's `events_discarded` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, stream->discarded_events); } } @@ -406,12 +406,12 @@ end: } static -int get_event_header_timestamp(struct bt_ctf_stream *stream, - struct bt_ctf_field *event_header, uint64_t *timestamp) +int get_event_header_timestamp(struct bt_stream *stream, + struct bt_field *event_header, uint64_t *timestamp) { int ret = 0; - struct bt_ctf_field *timestamp_field = NULL; - struct bt_ctf_clock_class *ts_field_mapped_clock_class = NULL; + struct bt_field *timestamp_field = NULL; + struct bt_clock_class *ts_field_mapped_clock_class = NULL; *timestamp = 0; @@ -420,7 +420,7 @@ int get_event_header_timestamp(struct bt_ctf_stream *stream, goto end; } - timestamp_field = bt_ctf_field_structure_get_field(event_header, + timestamp_field = bt_field_structure_get_field_by_name(event_header, "timestamp"); if (!timestamp_field) { BT_LOGV("Cannot get event header's `timestamp` field: " @@ -428,14 +428,14 @@ int get_event_header_timestamp(struct bt_ctf_stream *stream, goto end; } - if (!bt_ctf_field_type_is_integer(timestamp_field->type)) { + if (!bt_field_type_is_integer(timestamp_field->type)) { BT_LOGV("Event header's `timestamp` field's type is not an integer field type: " "event-header-field-addr=%p", event_header); goto end; } ts_field_mapped_clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class( + bt_field_type_integer_get_mapped_clock_class( timestamp_field->type); if (!ts_field_mapped_clock_class) { BT_LOGV("Event header's `timestamp` field's type is not mapped to a clock class: " @@ -450,7 +450,7 @@ int get_event_header_timestamp(struct bt_ctf_stream *stream, goto end; } - ret = bt_ctf_field_unsigned_integer_get_value(timestamp_field, + ret = bt_field_unsigned_integer_get_value(timestamp_field, timestamp); if (ret) { BT_LOGW("Cannot get unsigned integer field's value: " @@ -467,13 +467,13 @@ end: } static -int set_packet_context_timestamp_field(struct bt_ctf_stream *stream, - const char *field_name, struct bt_ctf_event *event) +int set_packet_context_timestamp_field(struct bt_stream *stream, + const char *field_name, struct bt_event *event) { int ret = 0; - struct bt_ctf_field *field = bt_ctf_field_structure_get_field( + struct bt_field *field = bt_field_structure_get_field_by_name( stream->packet_context, field_name); - struct bt_ctf_clock_class *field_mapped_clock_class = NULL; + struct bt_clock_class *field_mapped_clock_class = NULL; uint64_t ts; assert(stream); @@ -482,24 +482,24 @@ int set_packet_context_timestamp_field(struct bt_ctf_stream *stream, /* No beginning timestamp field found. Not an error, skip. */ BT_LOGV("No field named `%s` in packet context: skipping: " "stream-addr=%p, stream-name=\"%s\"", field_name, - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } if (!stream->stream_class->clock) { BT_LOGV("Stream has no clock: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } field_mapped_clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class(field->type); + bt_field_type_integer_get_mapped_clock_class(field->type); if (!field_mapped_clock_class) { BT_LOGV("Packet context's `%s` field's type is not mapped to a clock class: skipping: " "stream-addr=%p, stream-name=\"%s\", " "field-addr=%p, ft-addr=%p", field_name, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, field->type); goto end; } @@ -514,12 +514,12 @@ int set_packet_context_timestamp_field(struct bt_ctf_stream *stream, "stream-clock-class-addr=%p, " "stream-clock-class-name=\"%s\"", field_name, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, field->type, field_mapped_clock_class, - bt_ctf_clock_class_get_name(field_mapped_clock_class), + bt_clock_class_get_name(field_mapped_clock_class), stream->stream_class->clock->clock_class, - bt_ctf_clock_class_get_name( + bt_clock_class_get_name( stream->stream_class->clock->clock_class)); goto end; } @@ -532,16 +532,16 @@ int set_packet_context_timestamp_field(struct bt_ctf_stream *stream, goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(field, ts); + ret = bt_field_unsigned_integer_set_value(field, ts); if (ret) { BT_LOGW("Cannot set packet context field's `%s` integer field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - field_name, stream, bt_ctf_stream_get_name(stream), + field_name, stream, bt_stream_get_name(stream), field, stream->discarded_events); } else { BT_LOGV("Set packet context field's `%s` field's value: " "stream-addr=%p, stream-name=\"%s\", field-addr=%p, value=%" PRIu64, - field_name, stream, bt_ctf_stream_get_name(stream), + field_name, stream, bt_stream_get_name(stream), field, stream->discarded_events); } @@ -552,14 +552,14 @@ end: } static -int set_packet_context_timestamp_begin(struct bt_ctf_stream *stream) +int set_packet_context_timestamp_begin(struct bt_stream *stream) { int ret = 0; if (stream->events->len == 0) { BT_LOGV("Current packet contains no events: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -571,14 +571,14 @@ end: } static -int set_packet_context_timestamp_end(struct bt_ctf_stream *stream) +int set_packet_context_timestamp_end(struct bt_stream *stream) { int ret = 0; if (stream->events->len == 0) { BT_LOGV("Current packet contains no events: skipping: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -590,7 +590,7 @@ end: } static -int auto_populate_packet_context(struct bt_ctf_stream *stream) +int auto_populate_packet_context(struct bt_stream *stream) { int ret = 0; @@ -602,7 +602,7 @@ int auto_populate_packet_context(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet context's packet size field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -610,7 +610,7 @@ int auto_populate_packet_context(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet context's content size field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -618,7 +618,7 @@ int auto_populate_packet_context(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet context's beginning timestamp field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -626,7 +626,7 @@ int auto_populate_packet_context(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet context's end timestamp field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } @@ -634,20 +634,20 @@ int auto_populate_packet_context(struct bt_ctf_stream *stream) if (ret) { BT_LOGW("Cannot set packet context's discarded events count field: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; } BT_LOGV("Automatically populated stream's packet context's known fields: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); end: return ret; } static -void release_event(struct bt_ctf_event *event) +void release_event(struct bt_event *event) { if (bt_object_get_ref_count(event)) { /* @@ -664,7 +664,7 @@ void release_event(struct bt_ctf_event *event) static int create_stream_file(struct bt_ctf_writer *writer, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { int fd; GString *filename = g_string_new(NULL); @@ -673,7 +673,7 @@ int create_stream_file(struct bt_ctf_writer *writer, BT_LOGD("Creating stream file: writer-addr=%p, stream-addr=%p, " "stream-name=\"%s\", stream-class-addr=%p, stream-class-name=\"%s\"", - writer, stream, bt_ctf_stream_get_name(stream), + writer, stream, bt_stream_get_name(stream), stream->stream_class, stream->stream_class->name->str); if (stream->name && stream->name->len > 0) { @@ -714,7 +714,7 @@ int create_stream_file(struct bt_ctf_writer *writer, g_string_assign(filename, "stream"); append_ids: - stream_class_id = bt_ctf_stream_class_get_id(stream->stream_class); + stream_class_id = bt_stream_class_get_id(stream->stream_class); assert(stream_class_id >= 0); assert(stream->id >= 0); g_string_append_printf(filename, "-%" PRId64 "-%" PRId64, @@ -739,7 +739,7 @@ append_ids: BT_LOGD("Created stream file for writing: " "stream-addr=%p, stream-name=\"%s\", " - "filename=\"%s\", fd=%d", stream, bt_ctf_stream_get_name(stream), + "filename=\"%s\", fd=%d", stream, bt_stream_get_name(stream), filename->str, fd); end: @@ -748,16 +748,16 @@ end: } static -void set_stream_fd(struct bt_ctf_stream *stream, int fd) +void set_stream_fd(struct bt_stream *stream, int fd) { - (void) bt_ctf_stream_pos_init(&stream->pos, fd, O_RDWR); + (void) bt_stream_pos_init(&stream->pos, fd, O_RDWR); stream->pos.fd = fd; } static void component_destroy_listener(struct bt_component *component, void *data) { - struct bt_ctf_stream *stream = data; + struct bt_stream *stream = data; BT_LOGD("Component is being destroyed, stream is notified: " "comp-addr=%p, stream-addr=%p", component, stream); @@ -765,13 +765,13 @@ void component_destroy_listener(struct bt_component *component, void *data) } static -struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( - struct bt_ctf_stream_class *stream_class, +struct bt_stream *bt_stream_create_with_id_no_check( + struct bt_stream_class *stream_class, const char *name, uint64_t id) { int ret; - struct bt_ctf_stream *stream = NULL; - struct bt_ctf_trace *trace = NULL; + struct bt_stream *stream = NULL; + struct bt_trace *trace = NULL; struct bt_ctf_writer *writer = NULL; if (!stream_class) { @@ -782,19 +782,19 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( BT_LOGD("Creating stream object: stream-class-addr=%p, " "stream-class-name=\"%s\", stream-name=\"%s\", " "stream-id=%" PRIu64, - stream_class, bt_ctf_stream_class_get_name(stream_class), + stream_class, bt_stream_class_get_name(stream_class), name, id); - trace = bt_ctf_stream_class_borrow_trace(stream_class); + trace = bt_stream_class_borrow_trace(stream_class); if (!trace) { BT_LOGW("Invalid parameter: cannot create stream from a stream class which is not part of trace: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-name=\"%s\"", - stream_class, bt_ctf_stream_class_get_name(stream_class), + stream_class, bt_stream_class_get_name(stream_class), name); goto error; } - if (bt_ctf_trace_is_static(trace)) { + if (bt_trace_is_static(trace)) { /* * A static trace has the property that all its stream * classes, clock classes, and streams are definitive: @@ -803,7 +803,7 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( BT_LOGW("Invalid parameter: cannot create stream from a stream class which is part of a static trace: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-name=\"%s\", trace-addr=%p", - stream_class, bt_ctf_stream_class_get_name(stream_class), + stream_class, bt_stream_class_get_name(stream_class), name, trace); goto error; } @@ -817,7 +817,7 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( size_t i; for (i = 0; i < trace->streams->len; i++) { - struct bt_ctf_stream *trace_stream = + struct bt_stream *trace_stream = g_ptr_array_index(trace->streams, i); if (trace_stream->stream_class != stream_class) { @@ -831,13 +831,13 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( } } - stream = g_new0(struct bt_ctf_stream, 1); + stream = g_new0(struct bt_stream, 1); if (!stream) { BT_LOGE_STR("Failed to allocate one stream."); goto error; } - bt_object_init(stream, bt_ctf_stream_destroy); + bt_object_init(stream, bt_stream_destroy); /* * Acquire reference to parent since stream will become publicly * reachable; it needs its parent to remain valid. @@ -848,7 +848,7 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( stream->id = (int64_t) id; stream->destroy_listeners = g_array_new(FALSE, TRUE, - sizeof(struct bt_ctf_stream_destroy_listener)); + sizeof(struct bt_stream_destroy_listener)); if (!stream->destroy_listeners) { BT_LOGE_STR("Failed to allocate a GArray."); goto error; @@ -876,7 +876,7 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( if (stream_class->packet_context_type) { BT_LOGD("Creating stream's packet context field: " "ft-addr=%p", stream_class->packet_context_type); - stream->packet_context = bt_ctf_field_create( + stream->packet_context = bt_field_create( stream_class->packet_context_type); if (!stream->packet_context) { BT_LOGW_STR("Cannot create stream's packet context field."); @@ -905,7 +905,7 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id_no_check( BT_LOGD("Creating stream's packet header field: " "ft-addr=%p", trace->packet_header_type); stream->packet_header = - bt_ctf_field_create(trace->packet_header_type); + bt_field_create(trace->packet_header_type); if (!stream->packet_header) { BT_LOGW_STR("Cannot create stream's packet header field."); goto error; @@ -962,12 +962,12 @@ end: return stream; } -struct bt_ctf_stream *bt_ctf_stream_create_with_id( - struct bt_ctf_stream_class *stream_class, +struct bt_stream *bt_stream_create_with_id( + struct bt_stream_class *stream_class, const char *name, uint64_t id_param) { - struct bt_ctf_trace *trace; - struct bt_ctf_stream *stream = NULL; + struct bt_trace *trace; + struct bt_stream *stream = NULL; int64_t id = (int64_t) id_param; if (!stream_class) { @@ -982,44 +982,44 @@ struct bt_ctf_stream *bt_ctf_stream_create_with_id( goto end; } - trace = bt_ctf_stream_class_borrow_trace(stream_class); + trace = bt_stream_class_borrow_trace(stream_class); if (!trace) { BT_LOGW("Invalid parameter: cannot create stream from a stream class which is not part of trace: " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-name=\"%s\", stream-id=%" PRIu64, - stream_class, bt_ctf_stream_class_get_name(stream_class), + stream_class, bt_stream_class_get_name(stream_class), name, id_param); goto end; } if (trace->is_created_by_writer) { - BT_LOGW("Invalid parameter: cannot create a CTF writer stream with this function; use bt_ctf_stream_create(): " + BT_LOGW("Invalid parameter: cannot create a CTF writer stream with this function; use bt_stream_create(): " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-name=\"%s\", stream-id=%" PRIu64, - stream_class, bt_ctf_stream_class_get_name(stream_class), + stream_class, bt_stream_class_get_name(stream_class), name, id_param); goto end; } - stream = bt_ctf_stream_create_with_id_no_check(stream_class, + stream = bt_stream_create_with_id_no_check(stream_class, name, id_param); end: return stream; } -struct bt_ctf_stream *bt_ctf_stream_create( - struct bt_ctf_stream_class *stream_class, +struct bt_stream *bt_stream_create( + struct bt_stream_class *stream_class, const char *name) { - return bt_ctf_stream_create_with_id_no_check(stream_class, + return bt_stream_create_with_id_no_check(stream_class, name, -1ULL); } -struct bt_ctf_stream_class *bt_ctf_stream_get_class( - struct bt_ctf_stream *stream) +struct bt_stream_class *bt_stream_get_class( + struct bt_stream *stream) { - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); @@ -1032,8 +1032,8 @@ end: return stream_class; } -int bt_ctf_stream_get_discarded_events_count( - struct bt_ctf_stream *stream, uint64_t *count) +int bt_stream_get_discarded_events_count( + struct bt_stream *stream, uint64_t *count) { int ret = 0; @@ -1052,7 +1052,7 @@ int bt_ctf_stream_get_discarded_events_count( if (stream->pos.fd < 0) { BT_LOGW("Invalid parameter: stream is not a CTF writer stream: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); ret = -1; goto end; } @@ -1064,23 +1064,23 @@ end: } static -int set_packet_context_events_discarded_field(struct bt_ctf_stream *stream, +int set_packet_context_events_discarded_field(struct bt_stream *stream, uint64_t count) { int ret = 0; - struct bt_ctf_field *events_discarded_field = NULL; + struct bt_field *events_discarded_field = NULL; if (!stream->packet_context) { goto end; } - events_discarded_field = bt_ctf_field_structure_get_field( + events_discarded_field = bt_field_structure_get_field_by_name( stream->packet_context, "events_discarded"); if (!events_discarded_field) { goto end; } - ret = bt_ctf_field_unsigned_integer_set_value( + ret = bt_field_unsigned_integer_set_value( events_discarded_field, count); if (ret) { BT_LOGW("Cannot set packet context's `events_discarded` field: " @@ -1094,12 +1094,12 @@ end: return ret; } -void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, +void bt_stream_append_discarded_events(struct bt_stream *stream, uint64_t event_count) { int ret; uint64_t new_count; - struct bt_ctf_field *events_discarded_field = NULL; + struct bt_field *events_discarded_field = NULL; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); @@ -1108,7 +1108,7 @@ void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, BT_LOGV("Appending discarded events to stream: " "stream-addr=%p, stream-name=\"%s\", append-count=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), event_count); + stream, bt_stream_get_name(stream), event_count); if (!stream->packet_context) { BT_LOGW_STR("Invalid parameter: stream has no packet context field."); @@ -1120,7 +1120,7 @@ void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, goto end; } - events_discarded_field = bt_ctf_field_structure_get_field( + events_discarded_field = bt_field_structure_get_field_by_name( stream->packet_context, "events_discarded"); if (!events_discarded_field) { BT_LOGW_STR("No field named `events_discarded` in stream's packet context."); @@ -1144,18 +1144,18 @@ void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, stream->discarded_events = new_count; BT_LOGV("Appended discarded events to stream: " "stream-addr=%p, stream-name=\"%s\", append-count=%" PRIu64, - stream, bt_ctf_stream_get_name(stream), event_count); + stream, bt_stream_get_name(stream), event_count); end: bt_put(events_discarded_field); } -static int auto_populate_event_header(struct bt_ctf_stream *stream, - struct bt_ctf_event *event) +static int auto_populate_event_header(struct bt_stream *stream, + struct bt_event *event) { int ret = 0; - struct bt_ctf_field *id_field = NULL, *timestamp_field = NULL; - struct bt_ctf_clock_class *mapped_clock_class = NULL; + struct bt_field *id_field = NULL, *timestamp_field = NULL; + struct bt_clock_class *mapped_clock_class = NULL; int64_t event_class_id; assert(event); @@ -1172,16 +1172,16 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, BT_LOGV("Automatically populating event's header field: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p", - stream, bt_ctf_stream_get_name(stream), event); + stream, bt_stream_get_name(stream), event); - id_field = bt_ctf_field_structure_get_field(event->event_header, "id"); - event_class_id = bt_ctf_event_class_get_id(event->event_class); + id_field = bt_field_structure_get_field_by_name(event->event_header, "id"); + event_class_id = bt_event_class_get_id(event->event_class); if (event_class_id < 0) { BT_LOGE("Event class ID cannot be found"); ret = -1; goto end; } - if (id_field && bt_ctf_field_type_is_integer(id_field->type)) { + if (id_field && bt_field_type_is_integer(id_field->type)) { ret = set_integer_field_value(id_field, event_class_id); if (ret) { BT_LOGW("Cannot set event header's `id` field's value: " @@ -1197,20 +1197,20 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, * 1. The event header field "timestamp" exists and is an * integer field. * 2. This stream's class has a registered clock (set with - * bt_ctf_stream_class_set_clock()). + * bt_stream_class_set_clock()). * 3. The event header field "timestamp" has its type mapped to * a clock class which is also the clock class of this * stream's class's registered clock. */ - timestamp_field = bt_ctf_field_structure_get_field(event->event_header, + timestamp_field = bt_field_structure_get_field_by_name(event->event_header, "timestamp"); if (timestamp_field && stream->stream_class->clock && - bt_ctf_field_type_is_integer(timestamp_field->type)) { - struct bt_ctf_clock_class *stream_class_clock_class = + bt_field_type_is_integer(timestamp_field->type)) { + struct bt_clock_class *stream_class_clock_class = stream->stream_class->clock->clock_class; mapped_clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class( + bt_field_type_integer_get_mapped_clock_class( timestamp_field->type); if (mapped_clock_class == stream_class_clock_class) { uint64_t timestamp; @@ -1232,7 +1232,7 @@ static int auto_populate_event_header(struct bt_ctf_stream *stream, BT_LOGV("Automatically populated event's header field: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p", - stream, bt_ctf_stream_get_name(stream), event); + stream, bt_stream_get_name(stream), event); end: bt_put(id_field); @@ -1241,8 +1241,8 @@ end: return ret; } -int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, - struct bt_ctf_event *event) +int bt_stream_append_event(struct bt_stream *stream, + struct bt_event *event) { int ret = 0; @@ -1267,9 +1267,9 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, BT_LOGV("Appending event to stream: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - stream, bt_ctf_stream_get_name(stream), event, - bt_ctf_event_class_get_name(bt_ctf_event_borrow_event_class(event)), - bt_ctf_event_class_get_id(bt_ctf_event_borrow_event_class(event))); + stream, bt_stream_get_name(stream), event, + bt_event_class_get_name(bt_event_borrow_event_class(event)), + bt_event_class_get_id(bt_event_borrow_event_class(event))); /* * The event is not supposed to have a parent stream at this @@ -1294,14 +1294,14 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, /* Make sure the various scopes of the event are set */ BT_LOGV_STR("Validating event to append."); - ret = bt_ctf_event_validate(event); + ret = bt_event_validate(event); if (ret) { goto error; } /* Save the new event and freeze it */ BT_LOGV_STR("Freezing the event to append."); - bt_ctf_event_freeze(event); + bt_event_freeze(event); g_ptr_array_add(stream->events, event); /* @@ -1315,9 +1315,9 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, BT_LOGV("Appended event to stream: " "stream-addr=%p, stream-name=\"%s\", event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, - stream, bt_ctf_stream_get_name(stream), event, - bt_ctf_event_class_get_name(bt_ctf_event_borrow_event_class(event)), - bt_ctf_event_class_get_id(bt_ctf_event_borrow_event_class(event))); + stream, bt_stream_get_name(stream), event, + bt_event_class_get_name(bt_event_borrow_event_class(event)), + bt_event_class_get_id(bt_event_borrow_event_class(event))); end: return ret; @@ -1332,10 +1332,9 @@ error: return ret; } -struct bt_ctf_field *bt_ctf_stream_get_packet_context( - struct bt_ctf_stream *stream) +struct bt_field *bt_stream_get_packet_context(struct bt_stream *stream) { - struct bt_ctf_field *packet_context = NULL; + struct bt_field *packet_context = NULL; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); @@ -1345,7 +1344,7 @@ struct bt_ctf_field *bt_ctf_stream_get_packet_context( if (stream->pos.fd < 0) { BT_LOGW("Invalid parameter: stream is not a CTF writer stream: " "stream-addr=%p, stream-name=\"%s\"", stream, - bt_ctf_stream_get_name(stream)); + bt_stream_get_name(stream)); goto end; } @@ -1357,11 +1356,11 @@ end: return packet_context; } -int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream, - struct bt_ctf_field *field) +int bt_stream_set_packet_context(struct bt_stream *stream, + struct bt_field *field) { int ret = 0; - struct bt_ctf_field_type *field_type; + struct bt_field_type *field_type; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); @@ -1375,14 +1374,14 @@ int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream, goto end; } - field_type = bt_ctf_field_get_type(field); - if (bt_ctf_field_type_compare(field_type, + field_type = bt_field_get_type(field); + if (bt_field_type_compare(field_type, stream->stream_class->packet_context_type)) { BT_LOGW("Invalid parameter: packet context's field type is different from the stream's packet context field type: " "stream-addr=%p, stream-name=\"%s\", " "packet-context-field-addr=%p, " "packet-context-ft-addr=%p", - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, field_type); ret = -1; goto end; @@ -1394,15 +1393,14 @@ int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream, BT_LOGV("Set stream's packet context field: " "stream-addr=%p, stream-name=\"%s\", " "packet-context-field-addr=%p", - stream, bt_ctf_stream_get_name(stream), field); + stream, bt_stream_get_name(stream), field); end: return ret; } -struct bt_ctf_field *bt_ctf_stream_get_packet_header( - struct bt_ctf_stream *stream) +struct bt_field *bt_stream_get_packet_header(struct bt_stream *stream) { - struct bt_ctf_field *packet_header = NULL; + struct bt_field *packet_header = NULL; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); @@ -1412,7 +1410,7 @@ struct bt_ctf_field *bt_ctf_stream_get_packet_header( if (stream->pos.fd < 0) { BT_LOGW("Invalid parameter: stream is not a CTF writer stream: " "stream-addr=%p, stream-name=\"%s\"", stream, - bt_ctf_stream_get_name(stream)); + bt_stream_get_name(stream)); goto end; } @@ -1424,12 +1422,12 @@ end: return packet_header; } -int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, - struct bt_ctf_field *field) +int bt_stream_set_packet_header(struct bt_stream *stream, + struct bt_field *field) { int ret = 0; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_trace *trace = NULL; + struct bt_field_type *field_type = NULL; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); @@ -1443,7 +1441,7 @@ int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, goto end; } - trace = (struct bt_ctf_trace *) bt_object_get_parent(stream); + trace = (struct bt_trace *) bt_object_get_parent(stream); if (!field) { if (trace->packet_header_type) { @@ -1451,7 +1449,7 @@ int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, "stream-addr=%p, stream-name=\"%s\", " "packet-header-field-addr=%p, " "expected-ft-addr=%p", - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, trace->packet_header_type); ret = -1; goto end; @@ -1460,15 +1458,15 @@ int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, goto skip_validation; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_compare(field_type, trace->packet_header_type)) { + if (bt_field_type_compare(field_type, trace->packet_header_type)) { BT_LOGW("Invalid parameter: packet header's field type is different from the stream's packet header field type: " "stream-addr=%p, stream-name=\"%s\", " "packet-header-field-addr=%p, " "packet-header-ft-addr=%p", - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), field, field_type); ret = -1; goto end; @@ -1480,7 +1478,7 @@ skip_validation: BT_LOGV("Set stream's packet header field: " "stream-addr=%p, stream-name=\"%s\", " "packet-header-field-addr=%p", - stream, bt_ctf_stream_get_name(stream), field); + stream, bt_stream_get_name(stream), field); end: BT_PUT(trace); bt_put(field_type); @@ -1488,24 +1486,24 @@ end: } static -void reset_structure_field(struct bt_ctf_field *structure, const char *name) +void reset_structure_field(struct bt_field *structure, const char *name) { - struct bt_ctf_field *member; + struct bt_field *member; - member = bt_ctf_field_structure_get_field(structure, name); + member = bt_field_structure_get_field_by_name(structure, name); if (member) { - (void) bt_ctf_field_reset(member); + (void) bt_field_reset(member); bt_put(member); } } -int bt_ctf_stream_flush(struct bt_ctf_stream *stream) +int bt_stream_flush(struct bt_stream *stream) { int ret = 0; size_t i; - struct bt_ctf_stream_pos packet_context_pos; - struct bt_ctf_trace *trace; - enum bt_ctf_byte_order native_byte_order; + struct bt_stream_pos packet_context_pos; + struct bt_trace *trace; + enum bt_byte_order native_byte_order; bool has_packet_size = false; if (!stream) { @@ -1521,9 +1519,9 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) } if (stream->packet_context) { - struct bt_ctf_field *packet_size_field; + struct bt_field *packet_size_field; - packet_size_field = bt_ctf_field_structure_get_field( + packet_size_field = bt_field_structure_get_field_by_name( stream->packet_context, "packet_size"); has_packet_size = (packet_size_field != NULL); bt_put(packet_size_field); @@ -1545,10 +1543,10 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) BT_LOGV("Flushing stream's current packet: stream-addr=%p, " "stream-name=\"%s\", packet-index=%u", stream, - bt_ctf_stream_get_name(stream), stream->flushed_packet_count); - trace = bt_ctf_stream_class_borrow_trace(stream->stream_class); + bt_stream_get_name(stream), stream->flushed_packet_count); + trace = bt_stream_class_borrow_trace(stream->stream_class); assert(trace); - native_byte_order = bt_ctf_trace_get_native_byte_order(trace); + native_byte_order = bt_trace_get_native_byte_order(trace); ret = auto_populate_packet_header(stream); if (ret) { @@ -1567,12 +1565,12 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) /* mmap the next packet */ BT_LOGV("Seeking to the next packet: pos-offset=%" PRId64, stream->pos.offset); - bt_ctf_stream_pos_packet_seek(&stream->pos, 0, SEEK_CUR); + bt_stream_pos_packet_seek(&stream->pos, 0, SEEK_CUR); assert(stream->pos.packet_size % 8 == 0); if (stream->packet_header) { BT_LOGV_STR("Serializing packet header field."); - ret = bt_ctf_field_serialize(stream->packet_header, &stream->pos, + ret = bt_field_serialize(stream->packet_header, &stream->pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize stream's packet header field: " @@ -1586,7 +1584,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) memcpy(&packet_context_pos, &stream->pos, sizeof(packet_context_pos)); BT_LOGV_STR("Serializing packet context field."); - ret = bt_ctf_field_serialize(stream->packet_context, + ret = bt_field_serialize(stream->packet_context, &stream->pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize stream's packet context field: " @@ -1598,22 +1596,22 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) BT_LOGV("Serializing events: count=%u", stream->events->len); for (i = 0; i < stream->events->len; i++) { - struct bt_ctf_event *event = g_ptr_array_index( + struct bt_event *event = g_ptr_array_index( stream->events, i); - struct bt_ctf_event_class *event_class = - bt_ctf_event_borrow_event_class(event); + struct bt_event_class *event_class = + bt_event_borrow_event_class(event); BT_LOGV("Serializing event: index=%zu, event-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "pos-offset=%" PRId64 ", packet-size=%" PRIu64, - i, event, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), + i, event, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), stream->pos.offset, stream->pos.packet_size); /* Write event header */ if (event->event_header) { BT_LOGV_STR("Serializing event's header field."); - ret = bt_ctf_field_serialize(event->event_header, + ret = bt_field_serialize(event->event_header, &stream->pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize event's header field: " @@ -1625,7 +1623,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) /* Write stream event context */ if (event->stream_event_context) { BT_LOGV_STR("Serializing event's stream event context field."); - ret = bt_ctf_field_serialize( + ret = bt_field_serialize( event->stream_event_context, &stream->pos, native_byte_order); if (ret) { @@ -1636,10 +1634,10 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) } /* Write event content */ - ret = bt_ctf_event_serialize(event, &stream->pos, + ret = bt_event_serialize(event, &stream->pos, native_byte_order); if (ret) { - /* bt_ctf_event_serialize() logs errors */ + /* bt_event_serialize() logs errors */ goto end; } } @@ -1668,7 +1666,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) * if `packet_size` is missing, the current content size is * equal to the current packet size. */ - struct bt_ctf_field *field = bt_ctf_field_structure_get_field( + struct bt_field *field = bt_field_structure_get_field_by_name( stream->packet_context, "content_size"); bt_put(field); @@ -1702,7 +1700,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) } BT_LOGV("Rewriting (serializing) packet context field."); - ret = bt_ctf_field_serialize(stream->packet_context, + ret = bt_field_serialize(stream->packet_context, &packet_context_pos, native_byte_order); if (ret) { BT_LOGW("Cannot serialize stream's packet context field: " @@ -1744,39 +1742,39 @@ end_no_stream: } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_stream_get(struct bt_ctf_stream *stream) +void bt_ctf_stream_get(struct bt_stream *stream) { bt_get(stream); } /* Pre-2.0 CTF writer backward compatibility */ -void bt_ctf_stream_put(struct bt_ctf_stream *stream) +void bt_ctf_stream_put(struct bt_stream *stream) { bt_put(stream); } static -void bt_ctf_stream_destroy(struct bt_object *obj) +void bt_stream_destroy(struct bt_object *obj) { - struct bt_ctf_stream *stream; + struct bt_stream *stream; int i; - stream = container_of(obj, struct bt_ctf_stream, base); + stream = container_of(obj, struct bt_stream, base); BT_LOGD("Destroying stream object: addr=%p, name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); /* Call destroy listeners in reverse registration order */ for (i = stream->destroy_listeners->len - 1; i >= 0; i--) { - struct bt_ctf_stream_destroy_listener *listener = + struct bt_stream_destroy_listener *listener = &g_array_index(stream->destroy_listeners, - struct bt_ctf_stream_destroy_listener, i); + struct bt_stream_destroy_listener, i); BT_LOGD("Calling destroy listener: func=%p, data=%p, index=%d", listener->func, listener->data, i); listener->func(stream, listener->data); } - (void) bt_ctf_stream_pos_fini(&stream->pos); + (void) bt_stream_pos_fini(&stream->pos); if (stream->pos.fd >= 0) { int ret; @@ -1843,17 +1841,17 @@ void bt_ctf_stream_destroy(struct bt_object *obj) } static -int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, +int _set_structure_field_integer(struct bt_field *structure, char *name, uint64_t value, bt_bool force) { int ret = 0; - struct bt_ctf_field_type *field_type = NULL; - struct bt_ctf_field *integer; + struct bt_field_type *field_type = NULL; + struct bt_field *integer; assert(structure); assert(name); - integer = bt_ctf_field_structure_get_field(structure, name); + integer = bt_field_structure_get_field_by_name(structure, name); if (!integer) { /* Field not found, not an error. */ BT_LOGV("Field not found: struct-field-addr=%p, " @@ -1862,16 +1860,16 @@ int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, } /* Make sure the payload has not already been set. */ - if (!force && bt_ctf_field_is_set(integer)) { + if (!force && bt_field_is_set(integer)) { /* Payload already set, not an error */ BT_LOGV("Field's payload is already set: struct-field-addr=%p, " "name=\"%s\", force=%d", structure, name, force); goto end; } - field_type = bt_ctf_field_get_type(integer); + field_type = bt_field_get_type(integer); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field_type) != BT_FIELD_TYPE_ID_INTEGER) { /* * The user most likely meant for us to populate this field * automatically. However, we can only do this if the field @@ -1880,16 +1878,16 @@ int _set_structure_field_integer(struct bt_ctf_field *structure, char *name, BT_LOGW("Invalid parameter: field's type is not an integer field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", integer, field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); ret = -1; goto end; } - if (bt_ctf_field_type_integer_get_signed(field_type)) { - ret = bt_ctf_field_signed_integer_set_value(integer, + if (bt_field_type_integer_is_signed(field_type)) { + ret = bt_field_signed_integer_set_value(integer, (int64_t) value); } else { - ret = bt_ctf_field_unsigned_integer_set_value(integer, value); + ret = bt_field_unsigned_integer_set_value(integer, value); } ret = !ret ? 1 : ret; end: @@ -1905,13 +1903,13 @@ end: * <0 if an error was encoutered */ static -int try_set_structure_field_integer(struct bt_ctf_field *structure, char *name, +int try_set_structure_field_integer(struct bt_field *structure, char *name, uint64_t value) { return _set_structure_field_integer(structure, name, value, BT_FALSE); } -const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream) +const char *bt_stream_get_name(struct bt_stream *stream) { const char *name = NULL; @@ -1926,7 +1924,7 @@ end: return name; } -int bt_ctf_stream_is_writer(struct bt_ctf_stream *stream) +int bt_stream_is_writer(struct bt_stream *stream) { int ret = -1; @@ -1942,7 +1940,7 @@ end: } BT_HIDDEN -void bt_ctf_stream_map_component_to_port(struct bt_ctf_stream *stream, +void bt_stream_map_component_to_port(struct bt_stream *stream, struct bt_component *comp, struct bt_port *port) { @@ -1961,7 +1959,7 @@ void bt_ctf_stream_map_component_to_port(struct bt_ctf_stream *stream, BT_LOGV("Adding component's destroy listener for stream: " "stream-addr=%p, stream-name=\"%s\", comp-addr=%p, " "comp-name=\"%s\", port-addr=%p, port-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), comp, bt_component_get_name(comp), port, bt_port_get_name(port)); bt_component_add_destroy_listener(comp, component_destroy_listener, @@ -1971,7 +1969,7 @@ void bt_ctf_stream_map_component_to_port(struct bt_ctf_stream *stream, } BT_HIDDEN -struct bt_port *bt_ctf_stream_port_for_component(struct bt_ctf_stream *stream, +struct bt_port *bt_stream_port_for_component(struct bt_stream *stream, struct bt_component *comp) { assert(stream); @@ -1981,10 +1979,10 @@ struct bt_port *bt_ctf_stream_port_for_component(struct bt_ctf_stream *stream, } BT_HIDDEN -void bt_ctf_stream_add_destroy_listener(struct bt_ctf_stream *stream, - bt_ctf_stream_destroy_listener_func func, void *data) +void bt_stream_add_destroy_listener(struct bt_stream *stream, + bt_stream_destroy_listener_func func, void *data) { - struct bt_ctf_stream_destroy_listener listener; + struct bt_stream_destroy_listener listener; assert(stream); assert(func); @@ -1993,12 +1991,12 @@ void bt_ctf_stream_add_destroy_listener(struct bt_ctf_stream *stream, g_array_append_val(stream->destroy_listeners, listener); BT_LOGV("Added stream destroy listener: stream-addr=%p, " "stream-name=\"%s\", func=%p, data=%p", - stream, bt_ctf_stream_get_name(stream), func, data); + stream, bt_stream_get_name(stream), func, data); } BT_HIDDEN -void bt_ctf_stream_remove_destroy_listener(struct bt_ctf_stream *stream, - bt_ctf_stream_destroy_listener_func func, void *data) +void bt_stream_remove_destroy_listener(struct bt_stream *stream, + bt_stream_destroy_listener_func func, void *data) { size_t i; @@ -2006,22 +2004,22 @@ void bt_ctf_stream_remove_destroy_listener(struct bt_ctf_stream *stream, assert(func); for (i = 0; i < stream->destroy_listeners->len; i++) { - struct bt_ctf_stream_destroy_listener *listener = + struct bt_stream_destroy_listener *listener = &g_array_index(stream->destroy_listeners, - struct bt_ctf_stream_destroy_listener, i); + struct bt_stream_destroy_listener, i); if (listener->func == func && listener->data == data) { g_array_remove_index(stream->destroy_listeners, i); i--; BT_LOGV("Removed stream destroy listener: stream-addr=%p, " "stream-name=\"%s\", func=%p, data=%p", - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), func, data); } } } -int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream) +int64_t bt_stream_get_id(struct bt_stream *stream) { int64_t ret; @@ -2034,7 +2032,7 @@ int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream) ret = stream->id; if (ret < 0) { BT_LOGV("Stream's ID is not set: addr=%p, name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); } end: diff --git a/lib/ctf-ir/trace.c b/lib/ctf-ir/trace.c index 9482e097..4a3027b4 100644 --- a/lib/ctf-ir/trace.c +++ b/lib/ctf-ir/trace.c @@ -58,20 +58,20 @@ #define DEFAULT_METADATA_STRING_SIZE 4096 struct listener_wrapper { - bt_ctf_listener_cb listener; + bt_listener_cb listener; void *data; }; -struct bt_ctf_trace_is_static_listener_elem { - bt_ctf_trace_is_static_listener func; - bt_ctf_trace_listener_removed removed; +struct bt_trace_is_static_listener_elem { + bt_trace_is_static_listener func; + bt_trace_listener_removed removed; void *data; }; static -void bt_ctf_trace_destroy(struct bt_object *obj); +void bt_trace_destroy(struct bt_object *obj); static -void bt_ctf_trace_freeze(struct bt_ctf_trace *trace); +void bt_trace_freeze(struct bt_trace *trace); static const unsigned int field_type_aliases_alignments[] = { @@ -91,19 +91,19 @@ const unsigned int field_type_aliases_sizes[] = { [FIELD_TYPE_ALIAS_UINT64_T] = 64, }; -struct bt_ctf_trace *bt_ctf_trace_create(void) +struct bt_trace *bt_trace_create(void) { - struct bt_ctf_trace *trace = NULL; + struct bt_trace *trace = NULL; - trace = g_new0(struct bt_ctf_trace, 1); + trace = g_new0(struct bt_trace, 1); if (!trace) { BT_LOGE_STR("Failed to allocate one trace."); goto error; } BT_LOGD_STR("Creating trace object."); - trace->native_byte_order = BT_CTF_BYTE_ORDER_UNSPECIFIED; - bt_object_init(trace, bt_ctf_trace_destroy); + trace->native_byte_order = BT_BYTE_ORDER_UNSPECIFIED; + bt_object_init(trace, bt_trace_destroy); trace->clocks = g_ptr_array_new_with_free_func( (GDestroyNotify) bt_put); if (!trace->clocks) { @@ -126,7 +126,7 @@ struct bt_ctf_trace *bt_ctf_trace_create(void) } /* Create the environment array object */ - trace->environment = bt_ctf_attributes_create(); + trace->environment = bt_attributes_create(); if (!trace->environment) { BT_LOGE_STR("Cannot create empty attributes object."); goto error; @@ -140,7 +140,7 @@ struct bt_ctf_trace *bt_ctf_trace_create(void) } trace->is_static_listeners = g_array_new(FALSE, TRUE, - sizeof(struct bt_ctf_trace_is_static_listener_elem)); + sizeof(struct bt_trace_is_static_listener_elem)); if (!trace->is_static_listeners) { BT_LOGE_STR("Failed to allocate one GArray."); goto error; @@ -154,7 +154,7 @@ error: return trace; } -const char *bt_ctf_trace_get_name(struct bt_ctf_trace *trace) +const char *bt_trace_get_name(struct bt_trace *trace) { const char *name = NULL; @@ -172,7 +172,7 @@ end: return name; } -int bt_ctf_trace_set_name(struct bt_ctf_trace *trace, const char *name) +int bt_trace_set_name(struct bt_trace *trace, const char *name) { int ret = 0; @@ -191,7 +191,7 @@ int bt_ctf_trace_set_name(struct bt_ctf_trace *trace, const char *name) if (trace->frozen) { BT_LOGW("Invalid parameter: trace is frozen: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } @@ -210,12 +210,12 @@ end: return ret; } -const unsigned char *bt_ctf_trace_get_uuid(struct bt_ctf_trace *trace) +const unsigned char *bt_trace_get_uuid(struct bt_trace *trace) { return trace && trace->uuid_set ? trace->uuid : NULL; } -int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace, const unsigned char *uuid) +int bt_trace_set_uuid(struct bt_trace *trace, const unsigned char *uuid) { int ret = 0; @@ -234,7 +234,7 @@ int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace, const unsigned char *uuid) if (trace->frozen) { BT_LOGW("Invalid parameter: trace is frozen: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } @@ -243,7 +243,7 @@ int bt_ctf_trace_set_uuid(struct bt_ctf_trace *trace, const unsigned char *uuid) trace->uuid_set = BT_TRUE; BT_LOGV("Set trace's UUID: addr=%p, name=\"%s\", " "uuid=\"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\"", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), (unsigned int) uuid[0], (unsigned int) uuid[1], (unsigned int) uuid[2], @@ -265,14 +265,14 @@ end: return ret; } -void bt_ctf_trace_destroy(struct bt_object *obj) +void bt_trace_destroy(struct bt_object *obj) { - struct bt_ctf_trace *trace; + struct bt_trace *trace; - trace = container_of(obj, struct bt_ctf_trace, base); + trace = container_of(obj, struct bt_trace, base); BT_LOGD("Destroying trace object: addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); /* * Call remove listeners first so that everything else still @@ -282,9 +282,9 @@ void bt_ctf_trace_destroy(struct bt_object *obj) size_t i; for (i = 0; i < trace->is_static_listeners->len; i++) { - struct bt_ctf_trace_is_static_listener_elem elem = + struct bt_trace_is_static_listener_elem elem = g_array_index(trace->is_static_listeners, - struct bt_ctf_trace_is_static_listener_elem, i); + struct bt_trace_is_static_listener_elem, i); if (elem.removed) { elem.removed(trace, elem.data); @@ -300,7 +300,7 @@ void bt_ctf_trace_destroy(struct bt_object *obj) if (trace->environment) { BT_LOGD_STR("Destroying environment attributes."); - bt_ctf_attributes_destroy(trace->environment); + bt_attributes_destroy(trace->environment); } if (trace->name) { @@ -327,7 +327,7 @@ void bt_ctf_trace_destroy(struct bt_object *obj) g_free(trace); } -int bt_ctf_trace_set_environment_field(struct bt_ctf_trace *trace, +int bt_trace_set_environment_field(struct bt_trace *trace, const char *name, struct bt_value *value) { int ret = 0; @@ -350,11 +350,11 @@ int bt_ctf_trace_set_environment_field(struct bt_ctf_trace *trace, goto end; } - if (bt_ctf_validate_identifier(name)) { + if (bt_identifier_is_valid(name)) { BT_LOGW("Invalid parameter: environment field's name is not a valid CTF identifier: " "trace-addr=%p, trace-name=\"%s\", " "env-name=\"%s\"", - trace, bt_ctf_trace_get_name(trace), name); + trace, bt_trace_get_name(trace), name); ret = -1; goto end; } @@ -363,7 +363,7 @@ int bt_ctf_trace_set_environment_field(struct bt_ctf_trace *trace, BT_LOGW("Invalid parameter: environment field's value is not an integer or string value: " "trace-addr=%p, trace-name=\"%s\", " "env-name=\"%s\", env-value-type=%s", - trace, bt_ctf_trace_get_name(trace), name, + trace, bt_trace_get_name(trace), name, bt_value_type_string(bt_value_get_type(value))); ret = -1; goto end; @@ -372,7 +372,7 @@ int bt_ctf_trace_set_environment_field(struct bt_ctf_trace *trace, if (trace->is_static) { BT_LOGW("Invalid parameter: trace is static: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } @@ -385,14 +385,14 @@ int bt_ctf_trace_set_environment_field(struct bt_ctf_trace *trace, * The object passed is frozen like all other attributes. */ struct bt_value *attribute = - bt_ctf_attributes_get_field_value_by_name( + bt_attributes_get_field_value_by_name( trace->environment, name); if (attribute) { BT_LOGW("Invalid parameter: trace is frozen and environment field already exists with this name: " "trace-addr=%p, trace-name=\"%s\", " "env-name=\"%s\"", - trace, bt_ctf_trace_get_name(trace), name); + trace, bt_trace_get_name(trace), name); BT_PUT(attribute); ret = -1; goto end; @@ -401,25 +401,25 @@ int bt_ctf_trace_set_environment_field(struct bt_ctf_trace *trace, bt_value_freeze(value); } - ret = bt_ctf_attributes_set_field_value(trace->environment, name, + ret = bt_attributes_set_field_value(trace->environment, name, value); if (ret) { BT_LOGE("Cannot set environment field's value: " "trace-addr=%p, trace-name=\"%s\", " "env-name=\"%s\"", - trace, bt_ctf_trace_get_name(trace), name); + trace, bt_trace_get_name(trace), name); } else { BT_LOGV("Set environment field's value: " "trace-addr=%p, trace-name=\"%s\", " "env-name=\"%s\", value-addr=%p", - trace, bt_ctf_trace_get_name(trace), name, value); + trace, bt_trace_get_name(trace), name, value); } end: return ret; } -int bt_ctf_trace_set_environment_field_string(struct bt_ctf_trace *trace, +int bt_trace_set_environment_field_string(struct bt_trace *trace, const char *name, const char *value) { int ret = 0; @@ -438,8 +438,8 @@ int bt_ctf_trace_set_environment_field_string(struct bt_ctf_trace *trace, goto end; } - /* bt_ctf_trace_set_environment_field() logs errors */ - ret = bt_ctf_trace_set_environment_field(trace, name, + /* bt_trace_set_environment_field() logs errors */ + ret = bt_trace_set_environment_field(trace, name, env_value_string_obj); end: @@ -447,7 +447,7 @@ end: return ret; } -int bt_ctf_trace_set_environment_field_integer(struct bt_ctf_trace *trace, +int bt_trace_set_environment_field_integer(struct bt_trace *trace, const char *name, int64_t value) { int ret = 0; @@ -460,8 +460,8 @@ int bt_ctf_trace_set_environment_field_integer(struct bt_ctf_trace *trace, goto end; } - /* bt_ctf_trace_set_environment_field() logs errors */ - ret = bt_ctf_trace_set_environment_field(trace, name, + /* bt_trace_set_environment_field() logs errors */ + ret = bt_trace_set_environment_field(trace, name, env_value_integer_obj); end: @@ -469,7 +469,7 @@ end: return ret; } -int64_t bt_ctf_trace_get_environment_field_count(struct bt_ctf_trace *trace) +int64_t bt_trace_get_environment_field_count(struct bt_trace *trace) { int64_t ret = 0; @@ -479,7 +479,7 @@ int64_t bt_ctf_trace_get_environment_field_count(struct bt_ctf_trace *trace) goto end; } - ret = bt_ctf_attributes_get_count(trace->environment); + ret = bt_attributes_get_count(trace->environment); assert(ret >= 0); end: @@ -487,7 +487,7 @@ end: } const char * -bt_ctf_trace_get_environment_field_name_by_index(struct bt_ctf_trace *trace, +bt_trace_get_environment_field_name_by_index(struct bt_trace *trace, uint64_t index) { const char *ret = NULL; @@ -497,14 +497,14 @@ bt_ctf_trace_get_environment_field_name_by_index(struct bt_ctf_trace *trace, goto end; } - ret = bt_ctf_attributes_get_field_name(trace->environment, index); + ret = bt_attributes_get_field_name(trace->environment, index); end: return ret; } -struct bt_value *bt_ctf_trace_get_environment_field_value_by_index( - struct bt_ctf_trace *trace, uint64_t index) +struct bt_value *bt_trace_get_environment_field_value_by_index( + struct bt_trace *trace, uint64_t index) { struct bt_value *ret = NULL; @@ -513,14 +513,14 @@ struct bt_value *bt_ctf_trace_get_environment_field_value_by_index( goto end; } - ret = bt_ctf_attributes_get_field_value(trace->environment, index); + ret = bt_attributes_get_field_value(trace->environment, index); end: return ret; } -struct bt_value *bt_ctf_trace_get_environment_field_value_by_name( - struct bt_ctf_trace *trace, const char *name) +struct bt_value *bt_trace_get_environment_field_value_by_name( + struct bt_trace *trace, const char *name) { struct bt_value *ret = NULL; @@ -534,15 +534,15 @@ struct bt_value *bt_ctf_trace_get_environment_field_value_by_name( goto end; } - ret = bt_ctf_attributes_get_field_value_by_name(trace->environment, + ret = bt_attributes_get_field_value_by_name(trace->environment, name); end: return ret; } -int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace, - struct bt_ctf_clock_class *clock_class) +int bt_trace_add_clock_class(struct bt_trace *trace, + struct bt_clock_class *clock_class) { int ret = 0; @@ -555,28 +555,28 @@ int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace, if (trace->is_static) { BT_LOGW("Invalid parameter: trace is static: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } - if (!bt_ctf_clock_class_is_valid(clock_class)) { + if (!bt_clock_class_is_valid(clock_class)) { BT_LOGW("Invalid parameter: clock class is invalid: " "trace-addr=%p, trace-name=\"%s\", " "clock-class-addr=%p, clock-class-name=\"%s\"", - trace, bt_ctf_trace_get_name(trace), - clock_class, bt_ctf_clock_class_get_name(clock_class)); + trace, bt_trace_get_name(trace), + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } /* Check for duplicate clock classes */ - if (bt_ctf_trace_has_clock_class(trace, clock_class)) { + if (bt_trace_has_clock_class(trace, clock_class)) { BT_LOGW("Invalid parameter: clock class already exists in trace: " "trace-addr=%p, trace-name=\"%s\", " "clock-class-addr=%p, clock-class-name=\"%s\"", - trace, bt_ctf_trace_get_name(trace), - clock_class, bt_ctf_clock_class_get_name(clock_class)); + trace, bt_trace_get_name(trace), + clock_class, bt_clock_class_get_name(clock_class)); ret = -1; goto end; } @@ -586,20 +586,20 @@ int bt_ctf_trace_add_clock_class(struct bt_ctf_trace *trace, if (trace->frozen) { BT_LOGV_STR("Freezing added clock class because trace is frozen."); - bt_ctf_clock_class_freeze(clock_class); + bt_clock_class_freeze(clock_class); } BT_LOGV("Added clock class to trace: " "trace-addr=%p, trace-name=\"%s\", " "clock-class-addr=%p, clock-class-name=\"%s\"", - trace, bt_ctf_trace_get_name(trace), - clock_class, bt_ctf_clock_class_get_name(clock_class)); + trace, bt_trace_get_name(trace), + clock_class, bt_clock_class_get_name(clock_class)); end: return ret; } -int64_t bt_ctf_trace_get_clock_class_count(struct bt_ctf_trace *trace) +int64_t bt_trace_get_clock_class_count(struct bt_trace *trace) { int64_t ret = (int64_t) -1; @@ -613,10 +613,10 @@ end: return ret; } -struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index( - struct bt_ctf_trace *trace, uint64_t index) +struct bt_clock_class *bt_trace_get_clock_class_by_index( + struct bt_trace *trace, uint64_t index) { - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -627,7 +627,7 @@ struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index( BT_LOGW("Invalid parameter: index is out of bounds: " "addr=%p, name=\"%s\", " "index=%" PRIu64 ", count=%u", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), index, trace->clocks->len); goto end; } @@ -639,12 +639,12 @@ end: } static -bool packet_header_field_type_is_valid(struct bt_ctf_trace *trace, - struct bt_ctf_field_type *packet_header_type) +bool packet_header_field_type_is_valid(struct bt_trace *trace, + struct bt_field_type *packet_header_type) { int ret; bool is_valid = true; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; if (!packet_header_type) { /* @@ -664,11 +664,11 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace *trace, } /* Packet header field type, if it exists, must be a structure */ - if (!bt_ctf_field_type_is_structure(packet_header_type)) { + if (!bt_field_type_is_structure(packet_header_type)) { BT_LOGW("Invalid packet header field type: must be a structure field type if it exists: " "ft-addr=%p, ft-id=%s", packet_header_type, - bt_ctf_field_type_id_string(packet_header_type->id)); + bt_field_type_id_string(packet_header_type->id)); goto invalid; } @@ -677,34 +677,34 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace *trace, * integer field type. Also it must be the first field of the * packet header field type. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_header_type, "magic"); if (field_type) { const char *field_name; - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet header field type: `magic` field must be an integer field type: " "magic-ft-addr=%p, magic-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet header field type: `magic` field must be an unsigned integer field type: " "magic-ft-addr=%p", field_type); goto invalid; } - if (bt_ctf_field_type_integer_get_size(field_type) != 32) { + if (bt_field_type_integer_get_size(field_type) != 32) { BT_LOGW("Invalid packet header field type: `magic` field must be a 32-bit unsigned integer field type: " "magic-ft-addr=%p, magic-ft-size=%u", field_type, - bt_ctf_field_type_integer_get_size(field_type)); + bt_field_type_integer_get_size(field_type)); goto invalid; } - ret = bt_ctf_field_type_structure_get_field_by_index( + ret = bt_field_type_structure_get_field_by_index( packet_header_type, &field_name, NULL, 0); assert(ret == 0); @@ -722,51 +722,51 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace *trace, * If there's a `uuid` field, it must be an array field type of * length 16 with an 8-bit unsigned integer element field type. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_header_type, "uuid"); if (field_type) { - struct bt_ctf_field_type *elem_ft; + struct bt_field_type *elem_ft; - if (!bt_ctf_field_type_is_array(field_type)) { + if (!bt_field_type_is_array(field_type)) { BT_LOGW("Invalid packet header field type: `uuid` field must be an array field type: " "uuid-ft-addr=%p, uuid-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_array_get_length(field_type) != 16) { + if (bt_field_type_array_get_length(field_type) != 16) { BT_LOGW("Invalid packet header field type: `uuid` array field type's length must be 16: " "uuid-ft-addr=%p, uuid-ft-length=%" PRId64, field_type, - bt_ctf_field_type_array_get_length(field_type)); + bt_field_type_array_get_length(field_type)); goto invalid; } - elem_ft = bt_ctf_field_type_array_get_element_type(field_type); + elem_ft = bt_field_type_array_get_element_type(field_type); assert(elem_ft); - if (!bt_ctf_field_type_is_integer(elem_ft)) { + if (!bt_field_type_is_integer(elem_ft)) { BT_LOGW("Invalid packet header field type: `uuid` field's element field type must be an integer field type: " "elem-ft-addr=%p, elem-ft-id=%s", elem_ft, - bt_ctf_field_type_id_string(elem_ft->id)); + bt_field_type_id_string(elem_ft->id)); bt_put(elem_ft); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(elem_ft)) { + if (bt_field_type_integer_is_signed(elem_ft)) { BT_LOGW("Invalid packet header field type: `uuid` field's element field type must be an unsigned integer field type: " "elem-ft-addr=%p", elem_ft); bt_put(elem_ft); goto invalid; } - if (bt_ctf_field_type_integer_get_size(elem_ft) != 8) { + if (bt_field_type_integer_get_size(elem_ft) != 8) { BT_LOGW("Invalid packet header field type: `uuid` field's element field type must be an 8-bit unsigned integer field type: " "elem-ft-addr=%p, elem-ft-size=%u", elem_ft, - bt_ctf_field_type_integer_get_size(elem_ft)); + bt_field_type_integer_get_size(elem_ft)); bt_put(elem_ft); goto invalid; } @@ -779,7 +779,7 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace *trace, * The `stream_id` field must exist if there's more than one * stream classes in the trace. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_header_type, "stream_id"); if (!field_type && trace->stream_classes->len >= 1) { @@ -793,15 +793,15 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace *trace, * integer field type. */ if (field_type) { - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet header field type: `stream_id` field must be an integer field type: " "stream-id-ft-addr=%p, stream-id-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet header field type: `stream_id` field must be an unsigned integer field type: " "stream-id-ft-addr=%p", field_type); goto invalid; @@ -814,18 +814,18 @@ bool packet_header_field_type_is_valid(struct bt_ctf_trace *trace, * If there's a `packet_seq_num` field, it must be an unsigned * integer field type. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_header_type, "packet_seq_num"); if (field_type) { - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet header field type: `packet_seq_num` field must be an integer field type: " "stream-id-ft-addr=%p, packet-seq-num-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet header field type: `packet_seq_num` field must be an unsigned integer field type: " "packet-seq-num-ft-addr=%p", field_type); goto invalid; @@ -845,12 +845,12 @@ end: } static -bool packet_context_field_type_is_valid(struct bt_ctf_trace *trace, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *packet_context_type) +bool packet_context_field_type_is_valid(struct bt_trace *trace, + struct bt_stream_class *stream_class, + struct bt_field_type *packet_context_type) { bool is_valid = true; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; if (!packet_context_type) { /* No packet context field type: valid at this point */ @@ -858,11 +858,11 @@ bool packet_context_field_type_is_valid(struct bt_ctf_trace *trace, } /* Packet context field type, if it exists, must be a structure */ - if (!bt_ctf_field_type_is_structure(packet_context_type)) { + if (!bt_field_type_is_structure(packet_context_type)) { BT_LOGW("Invalid packet context field type: must be a structure field type if it exists: " "ft-addr=%p, ft-id=%s", packet_context_type, - bt_ctf_field_type_id_string(packet_context_type->id)); + bt_field_type_id_string(packet_context_type->id)); goto invalid; } @@ -870,18 +870,18 @@ bool packet_context_field_type_is_valid(struct bt_ctf_trace *trace, * If there's a `packet_size` field, it must be an unsigned * integer field type. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_context_type, "packet_size"); if (field_type) { - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet context field type: `packet_size` field must be an integer field type: " "packet-size-ft-addr=%p, packet-size-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet context field type: `packet_size` field must be an unsigned integer field type: " "packet-size-ft-addr=%p", field_type); goto invalid; @@ -894,18 +894,18 @@ bool packet_context_field_type_is_valid(struct bt_ctf_trace *trace, * If there's a `content_size` field, it must be an unsigned * integer field type. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_context_type, "content_size"); if (field_type) { - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet context field type: `content_size` field must be an integer field type: " "content-size-ft-addr=%p, content-size-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet context field type: `content_size` field must be an unsigned integer field type: " "content-size-ft-addr=%p", field_type); goto invalid; @@ -918,18 +918,18 @@ bool packet_context_field_type_is_valid(struct bt_ctf_trace *trace, * If there's a `events_discarded` field, it must be an unsigned * integer field type. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_context_type, "events_discarded"); if (field_type) { - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet context field type: `events_discarded` field must be an integer field type: " "events-discarded-ft-addr=%p, events-discarded-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet context field type: `events_discarded` field must be an unsigned integer field type: " "events-discarded-ft-addr=%p", field_type); goto invalid; @@ -944,26 +944,26 @@ bool packet_context_field_type_is_valid(struct bt_ctf_trace *trace, * trace, then we cannot automatically set the mapped clock * class of this field, so it must have a mapped clock class. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_context_type, "timestamp_begin"); if (field_type) { - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet context field type: `timestamp_begin` field must be an integer field type: " "timestamp-begin-ft-addr=%p, timestamp-begin-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet context field type: `timestamp_begin` field must be an unsigned integer field type: " "timestamp-begin-ft-addr=%p", field_type); goto invalid; } if (!trace->is_created_by_writer) { - struct bt_ctf_clock_class *clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class( + struct bt_clock_class *clock_class = + bt_field_type_integer_get_mapped_clock_class( field_type); bt_put(clock_class); @@ -983,26 +983,26 @@ bool packet_context_field_type_is_valid(struct bt_ctf_trace *trace, * trace, then we cannot automatically set the mapped clock * class of this field, so it must have a mapped clock class. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( packet_context_type, "timestamp_end"); if (field_type) { - if (!bt_ctf_field_type_is_integer(field_type)) { + if (!bt_field_type_is_integer(field_type)) { BT_LOGW("Invalid packet context field type: `timestamp_end` field must be an integer field type: " "timestamp-end-ft-addr=%p, timestamp-end-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } - if (bt_ctf_field_type_integer_is_signed(field_type)) { + if (bt_field_type_integer_is_signed(field_type)) { BT_LOGW("Invalid packet context field type: `timestamp_end` field must be an unsigned integer field type: " "timestamp-end-ft-addr=%p", field_type); goto invalid; } if (!trace->is_created_by_writer) { - struct bt_ctf_clock_class *clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class( + struct bt_clock_class *clock_class = + bt_field_type_integer_get_mapped_clock_class( field_type); bt_put(clock_class); @@ -1027,12 +1027,12 @@ end: } static -bool event_header_field_type_is_valid(struct bt_ctf_trace *trace, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_field_type *event_header_type) +bool event_header_field_type_is_valid(struct bt_trace *trace, + struct bt_stream_class *stream_class, + struct bt_field_type *event_header_type) { bool is_valid = true; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; /* * We do not validate that the `timestamp` field exists here @@ -1045,7 +1045,7 @@ bool event_header_field_type_is_valid(struct bt_ctf_trace *trace, * No event header field type: stream class must have * only one event class. */ - if (bt_ctf_stream_class_get_event_class_count(stream_class) > 1) { + if (bt_stream_class_get_event_class_count(stream_class) > 1) { BT_LOGW_STR("Invalid event header field type: " "event header field type does not exist but there's more than one event class in the stream class."); goto invalid; @@ -1056,11 +1056,11 @@ bool event_header_field_type_is_valid(struct bt_ctf_trace *trace, } /* Event header field type, if it exists, must be a structure */ - if (!bt_ctf_field_type_is_structure(event_header_type)) { + if (!bt_field_type_is_structure(event_header_type)) { BT_LOGW("Invalid event header field type: must be a structure field type if it exists: " "ft-addr=%p, ft-id=%s", event_header_type, - bt_ctf_field_type_id_string(event_header_type->id)); + bt_field_type_id_string(event_header_type->id)); goto invalid; } @@ -1069,26 +1069,26 @@ bool event_header_field_type_is_valid(struct bt_ctf_trace *trace, * field type or an enumeration field type with an unsigned * integer container field type. */ - field_type = bt_ctf_field_type_structure_get_field_type_by_name( + field_type = bt_field_type_structure_get_field_type_by_name( event_header_type, "id"); if (field_type) { - struct bt_ctf_field_type *int_ft; + struct bt_field_type *int_ft; - if (bt_ctf_field_type_is_integer(field_type)) { + if (bt_field_type_is_integer(field_type)) { int_ft = bt_get(field_type); - } else if (bt_ctf_field_type_is_enumeration(field_type)) { - int_ft = bt_ctf_field_type_enumeration_get_container_type( + } else if (bt_field_type_is_enumeration(field_type)) { + int_ft = bt_field_type_enumeration_get_container_type( field_type); } else { BT_LOGW("Invalid event header field type: `id` field must be an integer or enumeration field type: " "id-ft-addr=%p, id-ft-id=%s", field_type, - bt_ctf_field_type_id_string(field_type->id)); + bt_field_type_id_string(field_type->id)); goto invalid; } assert(int_ft); - if (bt_ctf_field_type_integer_is_signed(int_ft)) { + if (bt_field_type_integer_is_signed(int_ft)) { BT_LOGW("Invalid event header field type: `id` field must be an unsigned integer or enumeration field type: " "id-ft-addr=%p", int_ft); goto invalid; @@ -1108,25 +1108,25 @@ end: return is_valid; } -int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, - struct bt_ctf_stream_class *stream_class) +int bt_trace_add_stream_class(struct bt_trace *trace, + struct bt_stream_class *stream_class) { int ret; int64_t i; int64_t stream_id; - struct bt_ctf_validation_output trace_sc_validation_output = { 0 }; - struct bt_ctf_validation_output *ec_validation_outputs = NULL; - const enum bt_ctf_validation_flag trace_sc_validation_flags = - BT_CTF_VALIDATION_FLAG_TRACE | - BT_CTF_VALIDATION_FLAG_STREAM; - const enum bt_ctf_validation_flag ec_validation_flags = - BT_CTF_VALIDATION_FLAG_EVENT; - struct bt_ctf_field_type *packet_header_type = NULL; - struct bt_ctf_field_type *packet_context_type = NULL; - struct bt_ctf_field_type *event_header_type = NULL; - struct bt_ctf_field_type *stream_event_ctx_type = NULL; + struct bt_validation_output trace_sc_validation_output = { 0 }; + struct bt_validation_output *ec_validation_outputs = NULL; + const enum bt_validation_flag trace_sc_validation_flags = + BT_VALIDATION_FLAG_TRACE | + BT_VALIDATION_FLAG_STREAM; + const enum bt_validation_flag ec_validation_flags = + BT_VALIDATION_FLAG_EVENT; + struct bt_field_type *packet_header_type = NULL; + struct bt_field_type *packet_context_type = NULL; + struct bt_field_type *event_header_type = NULL; + struct bt_field_type *stream_event_ctx_type = NULL; int64_t event_class_count; - struct bt_ctf_trace *current_parent_trace = NULL; + struct bt_trace *current_parent_trace = NULL; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -1150,28 +1150,28 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, "trace-addr=%p, trace-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64, - trace, bt_ctf_trace_get_name(trace), - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + trace, bt_trace_get_name(trace), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); - current_parent_trace = bt_ctf_stream_class_get_trace(stream_class); + current_parent_trace = bt_stream_class_get_trace(stream_class); if (current_parent_trace) { /* Stream class is already associated to a trace, abort. */ BT_LOGW("Invalid parameter: stream class is already part of a trace: " "stream-class-trace-addr=%p, " "stream-class-trace-name=\"%s\"", current_parent_trace, - bt_ctf_trace_get_name(current_parent_trace)); + bt_trace_get_name(current_parent_trace)); ret = -1; goto end; } event_class_count = - bt_ctf_stream_class_get_event_class_count(stream_class); + bt_stream_class_get_event_class_count(stream_class); assert(event_class_count >= 0); if (stream_class->clock) { - struct bt_ctf_clock_class *stream_clock_class = + struct bt_clock_class *stream_clock_class = stream_class->clock->clock_class; if (trace->is_created_by_writer) { @@ -1195,7 +1195,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, BT_LOGW("Stream class's clock's class is not part of the trace: " "clock-class-addr=%p, clock-class-name=\"%s\"", stream_clock_class, - bt_ctf_clock_class_get_name(stream_clock_class)); + bt_clock_class_get_name(stream_clock_class)); ret = -1; goto end; } @@ -1210,7 +1210,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, BT_LOGW("Cannot add stream class with a clock to a trace which was not created by a CTF writer object: " "clock-class-addr=%p, clock-class-name=\"%s\"", stream_clock_class, - bt_ctf_clock_class_get_name(stream_clock_class)); + bt_clock_class_get_name(stream_clock_class)); ret = -1; goto end; } @@ -1228,16 +1228,16 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, * class of this stream class can be validated individually. */ packet_header_type = - bt_ctf_trace_get_packet_header_type(trace); + bt_trace_get_packet_header_type(trace); packet_context_type = - bt_ctf_stream_class_get_packet_context_type(stream_class); + bt_stream_class_get_packet_context_type(stream_class); event_header_type = - bt_ctf_stream_class_get_event_header_type(stream_class); + bt_stream_class_get_event_header_type(stream_class); stream_event_ctx_type = - bt_ctf_stream_class_get_event_context_type(stream_class); + bt_stream_class_get_event_context_type(stream_class); BT_LOGD("Validating trace and stream class field types."); - ret = bt_ctf_validate_class_types(trace->environment, + ret = bt_validate_class_types(trace->environment, packet_header_type, packet_context_type, event_header_type, stream_event_ctx_type, NULL, NULL, trace->valid, stream_class->valid, 1, &trace_sc_validation_output, @@ -1269,7 +1269,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, } if (event_class_count > 0) { - ec_validation_outputs = g_new0(struct bt_ctf_validation_output, + ec_validation_outputs = g_new0(struct bt_validation_output, event_class_count); if (!ec_validation_outputs) { BT_LOGE_STR("Failed to allocate one validation output structure."); @@ -1280,16 +1280,16 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, /* Validate each event class individually */ for (i = 0; i < event_class_count; i++) { - struct bt_ctf_event_class *event_class = - bt_ctf_stream_class_get_event_class_by_index( + struct bt_event_class *event_class = + bt_stream_class_get_event_class_by_index( stream_class, i); - struct bt_ctf_field_type *event_context_type = NULL; - struct bt_ctf_field_type *event_payload_type = NULL; + struct bt_field_type *event_context_type = NULL; + struct bt_field_type *event_payload_type = NULL; event_context_type = - bt_ctf_event_class_get_context_type(event_class); + bt_event_class_get_context_type(event_class); event_payload_type = - bt_ctf_event_class_get_payload_type(event_class); + bt_event_class_get_payload_type(event_class); /* * It is important to use the field types returned by @@ -1298,9 +1298,9 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, */ BT_LOGD("Validating event class's field types: " "addr=%p, name=\"%s\", id=%" PRId64, - event_class, bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); - ret = bt_ctf_validate_class_types(trace->environment, + event_class, bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); + ret = bt_validate_class_types(trace->environment, trace_sc_validation_output.packet_header_type, trace_sc_validation_output.packet_context_type, trace_sc_validation_output.event_header_type, @@ -1329,7 +1329,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, } } - stream_id = bt_ctf_stream_class_get_id(stream_class); + stream_id = bt_stream_class_get_id(stream_class); if (stream_id < 0) { stream_id = trace->next_stream_id++; if (stream_id < 0) { @@ -1340,7 +1340,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, /* Try to assign a new stream id */ for (i = 0; i < trace->stream_classes->len; i++) { - if (stream_id == bt_ctf_stream_class_get_id( + if (stream_id == bt_stream_class_get_id( trace->stream_classes->pdata[i])) { /* Duplicate stream id found */ BT_LOGW("Duplicate stream class ID: " @@ -1350,7 +1350,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, } } - if (bt_ctf_stream_class_set_id_no_check(stream_class, + if (bt_stream_class_set_id_no_check(stream_class, stream_id)) { /* TODO Should retry with a different stream id */ BT_LOGE("Cannot set stream class's ID: " @@ -1398,7 +1398,7 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, * to map those field types to other clock classes. */ if (trace->is_created_by_writer) { - if (bt_ctf_stream_class_map_clock_class(stream_class, + if (bt_stream_class_map_clock_class(stream_class, trace_sc_validation_output.packet_context_type, trace_sc_validation_output.event_header_type)) { BT_LOGW_STR("Cannot automatically map selected stream class's field types to stream class's clock's class."); @@ -1418,49 +1418,49 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, * all the event classes of the stream class and mark them as * valid. */ - bt_ctf_validation_replace_types(trace, stream_class, NULL, + bt_validation_replace_types(trace, stream_class, NULL, &trace_sc_validation_output, trace_sc_validation_flags); trace->valid = 1; stream_class->valid = 1; /* - * Put what was not moved in bt_ctf_validation_replace_types(). + * Put what was not moved in bt_validation_replace_types(). */ - bt_ctf_validation_output_put_types(&trace_sc_validation_output); + bt_validation_output_put_types(&trace_sc_validation_output); for (i = 0; i < event_class_count; i++) { - struct bt_ctf_event_class *event_class = - bt_ctf_stream_class_get_event_class_by_index( + struct bt_event_class *event_class = + bt_stream_class_get_event_class_by_index( stream_class, i); - bt_ctf_validation_replace_types(NULL, NULL, event_class, + bt_validation_replace_types(NULL, NULL, event_class, &ec_validation_outputs[i], ec_validation_flags); event_class->valid = 1; BT_PUT(event_class); /* * Put what was not moved in - * bt_ctf_validation_replace_types(). + * bt_validation_replace_types(). */ - bt_ctf_validation_output_put_types(&ec_validation_outputs[i]); + bt_validation_output_put_types(&ec_validation_outputs[i]); } /* * Freeze the trace and the stream class. */ - bt_ctf_stream_class_freeze(stream_class); - bt_ctf_trace_freeze(trace); + bt_stream_class_freeze(stream_class); + bt_trace_freeze(trace); /* Notifiy listeners of the trace's schema modification. */ - bt_ctf_stream_class_visit(stream_class, - bt_ctf_trace_object_modification, trace); + bt_stream_class_visit(stream_class, + bt_trace_object_modification, trace); BT_LOGD("Added stream class to trace: " "trace-addr=%p, trace-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64, - trace, bt_ctf_trace_get_name(trace), - stream_class, bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + trace, bt_trace_get_name(trace), + stream_class, bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); end: if (ret) { @@ -1468,14 +1468,14 @@ end: if (ec_validation_outputs) { for (i = 0; i < event_class_count; i++) { - bt_ctf_validation_output_put_types( + bt_validation_output_put_types( &ec_validation_outputs[i]); } } } g_free(ec_validation_outputs); - bt_ctf_validation_output_put_types(&trace_sc_validation_output); + bt_validation_output_put_types(&trace_sc_validation_output); bt_put(current_parent_trace); assert(!packet_header_type); assert(!packet_context_type); @@ -1484,7 +1484,7 @@ end: return ret; } -int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace) +int64_t bt_trace_get_stream_count(struct bt_trace *trace) { int64_t ret; @@ -1500,11 +1500,11 @@ end: return ret; } -struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index( - struct bt_ctf_trace *trace, +struct bt_stream *bt_trace_get_stream_by_index( + struct bt_trace *trace, uint64_t index) { - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -1515,7 +1515,7 @@ struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index( BT_LOGW("Invalid parameter: index is out of bounds: " "addr=%p, name=\"%s\", " "index=%" PRIu64 ", count=%u", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), index, trace->streams->len); goto end; } @@ -1526,7 +1526,7 @@ end: return stream; } -int64_t bt_ctf_trace_get_stream_class_count(struct bt_ctf_trace *trace) +int64_t bt_trace_get_stream_class_count(struct bt_trace *trace) { int64_t ret; @@ -1541,10 +1541,10 @@ end: return ret; } -struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index( - struct bt_ctf_trace *trace, uint64_t index) +struct bt_stream_class *bt_trace_get_stream_class_by_index( + struct bt_trace *trace, uint64_t index) { - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -1555,7 +1555,7 @@ struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index( BT_LOGW("Invalid parameter: index is out of bounds: " "addr=%p, name=\"%s\", " "index=%" PRIu64 ", count=%u", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), index, trace->stream_classes->len); goto end; } @@ -1566,11 +1566,11 @@ end: return stream_class; } -struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id( - struct bt_ctf_trace *trace, uint64_t id_param) +struct bt_stream_class *bt_trace_get_stream_class_by_id( + struct bt_trace *trace, uint64_t id_param) { int i; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; int64_t id = (int64_t) id_param; if (!trace) { @@ -1581,17 +1581,17 @@ struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id( if (id < 0) { BT_LOGW("Invalid parameter: invalid stream class's ID: " "trace-addr=%p, trace-name=\"%s\", id=%" PRIu64, - trace, bt_ctf_trace_get_name(trace), id_param); + trace, bt_trace_get_name(trace), id_param); goto end; } for (i = 0; i < trace->stream_classes->len; i++) { - struct bt_ctf_stream_class *stream_class_candidate; + struct bt_stream_class *stream_class_candidate; stream_class_candidate = g_ptr_array_index(trace->stream_classes, i); - if (bt_ctf_stream_class_get_id(stream_class_candidate) == + if (bt_stream_class_get_id(stream_class_candidate) == (int64_t) id) { stream_class = stream_class_candidate; bt_get(stream_class); @@ -1603,11 +1603,11 @@ end: return stream_class; } -struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_name( - struct bt_ctf_trace *trace, const char *name) +struct bt_clock_class *bt_trace_get_clock_class_by_name( + struct bt_trace *trace, const char *name) { size_t i; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -1620,9 +1620,9 @@ struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_name( } for (i = 0; i < trace->clocks->len; i++) { - struct bt_ctf_clock_class *cur_clk = + struct bt_clock_class *cur_clk = g_ptr_array_index(trace->clocks, i); - const char *cur_clk_name = bt_ctf_clock_class_get_name(cur_clk); + const char *cur_clk_name = bt_clock_class_get_name(cur_clk); if (!cur_clk_name) { goto end; @@ -1640,8 +1640,8 @@ end: } BT_HIDDEN -bt_bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, - struct bt_ctf_clock_class *clock_class) +bt_bool bt_trace_has_clock_class(struct bt_trace *trace, + struct bt_clock_class *clock_class) { struct search_query query = { .value = clock_class, .found = 0 }; @@ -1653,18 +1653,18 @@ bt_bool bt_ctf_trace_has_clock_class(struct bt_ctf_trace *trace, } BT_HIDDEN -const char *get_byte_order_string(enum bt_ctf_byte_order byte_order) +const char *get_byte_order_string(enum bt_byte_order byte_order) { const char *string; switch (byte_order) { - case BT_CTF_BYTE_ORDER_LITTLE_ENDIAN: + case BT_BYTE_ORDER_LITTLE_ENDIAN: string = "le"; break; - case BT_CTF_BYTE_ORDER_BIG_ENDIAN: + case BT_BYTE_ORDER_BIG_ENDIAN: string = "be"; break; - case BT_CTF_BYTE_ORDER_NATIVE: + case BT_BYTE_ORDER_NATIVE: string = "native"; break; default: @@ -1675,18 +1675,18 @@ const char *get_byte_order_string(enum bt_ctf_byte_order byte_order) } static -int append_trace_metadata(struct bt_ctf_trace *trace, +int append_trace_metadata(struct bt_trace *trace, struct metadata_context *context) { unsigned char *uuid = trace->uuid; int ret = 0; - if (trace->native_byte_order == BT_CTF_BYTE_ORDER_NATIVE || - trace->native_byte_order == BT_CTF_BYTE_ORDER_UNSPECIFIED) { - BT_LOGW("Invalid parameter: trace's byte order cannot be BT_CTF_BYTE_ORDER_NATIVE or BT_CTF_BYTE_ORDER_UNSPECIFIED at this point; " - "set it with bt_ctf_trace_set_native_byte_order(): " + if (trace->native_byte_order == BT_BYTE_ORDER_NATIVE || + trace->native_byte_order == BT_BYTE_ORDER_UNSPECIFIED) { + BT_LOGW("Invalid parameter: trace's byte order cannot be BT_BYTE_ORDER_NATIVE or BT_BYTE_ORDER_UNSPECIFIED at this point; " + "set it with bt_trace_set_native_byte_order(): " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } @@ -1694,9 +1694,9 @@ int append_trace_metadata(struct bt_ctf_trace *trace, g_string_append(context->string, "trace {\n"); g_string_append(context->string, "\tmajor = 1;\n"); g_string_append(context->string, "\tminor = 8;\n"); - assert(trace->native_byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN || - trace->native_byte_order == BT_CTF_BYTE_ORDER_BIG_ENDIAN || - trace->native_byte_order == BT_CTF_BYTE_ORDER_NETWORK); + assert(trace->native_byte_order == BT_BYTE_ORDER_LITTLE_ENDIAN || + trace->native_byte_order == BT_BYTE_ORDER_BIG_ENDIAN || + trace->native_byte_order == BT_BYTE_ORDER_NETWORK); if (trace->uuid_set) { g_string_append_printf(context->string, @@ -1715,7 +1715,7 @@ int append_trace_metadata(struct bt_ctf_trace *trace, context->current_indentation_level++; g_string_assign(context->field_name, ""); BT_LOGD_STR("Serializing trace's packet header field type's metadata."); - ret = bt_ctf_field_type_serialize(trace->packet_header_type, + ret = bt_field_type_serialize(trace->packet_header_type, context); if (ret) { goto end; @@ -1729,13 +1729,13 @@ end: } static -void append_env_metadata(struct bt_ctf_trace *trace, +void append_env_metadata(struct bt_trace *trace, struct metadata_context *context) { int64_t i; int64_t env_size; - env_size = bt_ctf_attributes_get_count(trace->environment); + env_size = bt_attributes_get_count(trace->environment); if (env_size <= 0) { return; } @@ -1746,9 +1746,9 @@ void append_env_metadata(struct bt_ctf_trace *trace, struct bt_value *env_field_value_obj = NULL; const char *entry_name; - entry_name = bt_ctf_attributes_get_field_name( + entry_name = bt_attributes_get_field_name( trace->environment, i); - env_field_value_obj = bt_ctf_attributes_get_field_value( + env_field_value_obj = bt_attributes_get_field_value( trace->environment, i); assert(entry_name); @@ -1800,7 +1800,7 @@ loop_next: g_string_append(context->string, "};\n\n"); } -char *bt_ctf_trace_get_metadata_string(struct bt_ctf_trace *trace) +char *bt_trace_get_metadata_string(struct bt_trace *trace) { char *metadata = NULL; struct metadata_context *context = NULL; @@ -1827,14 +1827,14 @@ char *bt_ctf_trace_get_metadata_string(struct bt_ctf_trace *trace) } append_env_metadata(trace, context); g_ptr_array_foreach(trace->clocks, - (GFunc)bt_ctf_clock_class_serialize, context); + (GFunc)bt_clock_class_serialize, context); for (i = 0; i < trace->stream_classes->len; i++) { - /* bt_ctf_stream_class_serialize() logs details */ - err = bt_ctf_stream_class_serialize( + /* bt_stream_class_serialize() logs details */ + err = bt_stream_class_serialize( trace->stream_classes->pdata[i], context); if (err) { - /* bt_ctf_stream_class_serialize() logs errors */ + /* bt_stream_class_serialize() logs errors */ goto error; } } @@ -1850,10 +1850,10 @@ end: return metadata; } -enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order( - struct bt_ctf_trace *trace) +enum bt_byte_order bt_trace_get_native_byte_order( + struct bt_trace *trace) { - enum bt_ctf_byte_order ret = BT_CTF_BYTE_ORDER_UNKNOWN; + enum bt_byte_order ret = BT_BYTE_ORDER_UNKNOWN; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -1866,8 +1866,8 @@ end: return ret; } -int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace, - enum bt_ctf_byte_order byte_order) +int bt_trace_set_native_byte_order(struct bt_trace *trace, + enum bt_byte_order byte_order) { int ret = 0; @@ -1880,27 +1880,27 @@ int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace, if (trace->frozen) { BT_LOGW("Invalid parameter: trace is frozen: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } if (trace->is_created_by_writer && - byte_order == BT_CTF_BYTE_ORDER_UNSPECIFIED) { - BT_LOGW("Invalid parameter: BT_CTF_BYTE_ORDER_UNSPECIFIED byte order is not allowed for a CTF writer trace: " + byte_order == BT_BYTE_ORDER_UNSPECIFIED) { + BT_LOGW("Invalid parameter: BT_BYTE_ORDER_UNSPECIFIED byte order is not allowed for a CTF writer trace: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } - if (byte_order != BT_CTF_BYTE_ORDER_LITTLE_ENDIAN && - byte_order != BT_CTF_BYTE_ORDER_BIG_ENDIAN && - byte_order != BT_CTF_BYTE_ORDER_NETWORK) { + if (byte_order != BT_BYTE_ORDER_LITTLE_ENDIAN && + byte_order != BT_BYTE_ORDER_BIG_ENDIAN && + byte_order != BT_BYTE_ORDER_NETWORK) { BT_LOGW("Invalid parameter: invalid byte order: " "addr=%p, name=\"%s\", bo=%s", - trace, bt_ctf_trace_get_name(trace), - bt_ctf_byte_order_string(byte_order)); + trace, bt_trace_get_name(trace), + bt_byte_order_string(byte_order)); ret = -1; goto end; } @@ -1908,17 +1908,17 @@ int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace, trace->native_byte_order = byte_order; BT_LOGV("Set trace's native byte order: " "addr=%p, name=\"%s\", bo=%s", - trace, bt_ctf_trace_get_name(trace), - bt_ctf_byte_order_string(byte_order)); + trace, bt_trace_get_name(trace), + bt_byte_order_string(byte_order)); end: return ret; } -struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_type( - struct bt_ctf_trace *trace) +struct bt_field_type *bt_trace_get_packet_header_type( + struct bt_trace *trace) { - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -1931,8 +1931,8 @@ end: return field_type; } -int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace, - struct bt_ctf_field_type *packet_header_type) +int bt_trace_set_packet_header_type(struct bt_trace *trace, + struct bt_field_type *packet_header_type) { int ret = 0; @@ -1945,19 +1945,19 @@ int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace, if (trace->frozen) { BT_LOGW("Invalid parameter: trace is frozen: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = -1; goto end; } /* packet_header_type must be a structure. */ if (packet_header_type && - !bt_ctf_field_type_is_structure(packet_header_type)) { + !bt_field_type_is_structure(packet_header_type)) { BT_LOGW("Invalid parameter: packet header field type must be a structure field type if it exists: " "addr=%p, name=\"%s\", ft-addr=%p, ft-id=%s", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), packet_header_type, - bt_ctf_field_type_id_string(packet_header_type->id)); + bt_field_type_id_string(packet_header_type->id)); ret = -1; goto end; } @@ -1966,7 +1966,7 @@ int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace, trace->packet_header_type = bt_get(packet_header_type); BT_LOGV("Set trace's packet header field type: " "addr=%p, name=\"%s\", packet-context-ft-addr=%p", - trace, bt_ctf_trace_get_name(trace), packet_header_type); + trace, bt_trace_get_name(trace), packet_header_type); end: return ret; } @@ -1974,29 +1974,31 @@ end: static int64_t get_stream_class_count(void *element) { - return bt_ctf_trace_get_stream_class_count( - (struct bt_ctf_trace *) element); + return bt_trace_get_stream_class_count( + (struct bt_trace *) element); } static void *get_stream_class(void *element, int i) { - return bt_ctf_trace_get_stream_class_by_index( - (struct bt_ctf_trace *) element, i); + return bt_trace_get_stream_class_by_index( + (struct bt_trace *) element, i); } static -int visit_stream_class(void *object, bt_ctf_visitor visitor,void *data) +int visit_stream_class(void *object, bt_visitor visitor,void *data) { - return bt_ctf_stream_class_visit(object, visitor, data); + return bt_stream_class_visit(object, visitor, data); } -int bt_ctf_trace_visit(struct bt_ctf_trace *trace, - bt_ctf_visitor visitor, void *data) +int bt_trace_visit(struct bt_trace *trace, + bt_visitor visitor, void *data) { int ret; - struct bt_ctf_object obj = - { .object = trace, .type = BT_CTF_OBJECT_TYPE_TRACE }; + struct bt_visitor_object obj = { + .object = trace, + .type = BT_VISITOR_OBJECT_TYPE_TRACE + }; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -2011,7 +2013,7 @@ int bt_ctf_trace_visit(struct bt_ctf_trace *trace, } BT_LOGV("Visiting trace: addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); ret = visitor_helper(&obj, get_stream_class_count, get_stream_class, visit_stream_class, visitor, data); end: @@ -2019,7 +2021,7 @@ end: } static -int invoke_listener(struct bt_ctf_object *object, void *data) +int invoke_listener(struct bt_visitor_object *object, void *data) { struct listener_wrapper *listener_wrapper = data; @@ -2028,8 +2030,8 @@ int invoke_listener(struct bt_ctf_object *object, void *data) } // TODO: add logging to this function once we use it internally. -int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace, - bt_ctf_listener_cb listener, void *listener_data) +int bt_trace_add_listener(struct bt_trace *trace, + bt_listener_cb listener, void *listener_data) { int ret = 0; struct listener_wrapper *listener_wrapper = @@ -2044,7 +2046,7 @@ int bt_ctf_trace_add_listener(struct bt_ctf_trace *trace, listener_wrapper->data = listener_data; /* Visit the current schema. */ - ret = bt_ctf_trace_visit(trace, invoke_listener, listener_wrapper); + ret = bt_trace_visit(trace, invoke_listener, listener_wrapper); if (ret) { goto error; } @@ -2061,11 +2063,11 @@ error: } BT_HIDDEN -int bt_ctf_trace_object_modification(struct bt_ctf_object *object, +int bt_trace_object_modification(struct bt_visitor_object *object, void *trace_ptr) { size_t i; - struct bt_ctf_trace *trace = trace_ptr; + struct bt_trace *trace = trace_ptr; assert(trace); assert(object); @@ -2085,11 +2087,11 @@ end: } BT_HIDDEN -struct bt_ctf_field_type *get_field_type(enum field_type_alias alias) +struct bt_field_type *get_field_type(enum field_type_alias alias) { int ret; unsigned int alignment, size; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; if (alias >= NR_FIELD_TYPE_ALIAS) { goto end; @@ -2097,8 +2099,8 @@ struct bt_ctf_field_type *get_field_type(enum field_type_alias alias) alignment = field_type_aliases_alignments[alias]; size = field_type_aliases_sizes[alias]; - field_type = bt_ctf_field_type_integer_create(size); - ret = bt_ctf_field_type_set_alignment(field_type, alignment); + field_type = bt_field_type_integer_create(size); + ret = bt_field_type_set_alignment(field_type, alignment); if (ret) { BT_PUT(field_type); } @@ -2107,7 +2109,7 @@ end: } static -void bt_ctf_trace_freeze(struct bt_ctf_trace *trace) +void bt_trace_freeze(struct bt_trace *trace) { int i; @@ -2116,27 +2118,27 @@ void bt_ctf_trace_freeze(struct bt_ctf_trace *trace) } BT_LOGD("Freezing trace: addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); BT_LOGD_STR("Freezing packet header field type."); - bt_ctf_field_type_freeze(trace->packet_header_type); + bt_field_type_freeze(trace->packet_header_type); BT_LOGD_STR("Freezing environment attributes."); - bt_ctf_attributes_freeze(trace->environment); + bt_attributes_freeze(trace->environment); if (trace->clocks->len > 0) { BT_LOGD_STR("Freezing clock classes."); } for (i = 0; i < trace->clocks->len; i++) { - struct bt_ctf_clock_class *clock_class = + struct bt_clock_class *clock_class = g_ptr_array_index(trace->clocks, i); - bt_ctf_clock_class_freeze(clock_class); + bt_clock_class_freeze(clock_class); } trace->frozen = 1; } -bt_bool bt_ctf_trace_is_static(struct bt_ctf_trace *trace) +bt_bool bt_trace_is_static(struct bt_trace *trace) { bt_bool is_static = BT_FALSE; @@ -2151,7 +2153,7 @@ end: return is_static; } -int bt_ctf_trace_set_is_static(struct bt_ctf_trace *trace) +int bt_trace_set_is_static(struct bt_trace *trace) { int ret = 0; size_t i; @@ -2163,15 +2165,15 @@ int bt_ctf_trace_set_is_static(struct bt_ctf_trace *trace) } trace->is_static = BT_TRUE; - bt_ctf_trace_freeze(trace); + bt_trace_freeze(trace); BT_LOGV("Set trace static: addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); /* Call all the "trace is static" listeners */ for (i = 0; i < trace->is_static_listeners->len; i++) { - struct bt_ctf_trace_is_static_listener_elem elem = + struct bt_trace_is_static_listener_elem elem = g_array_index(trace->is_static_listeners, - struct bt_ctf_trace_is_static_listener_elem, i); + struct bt_trace_is_static_listener_elem, i); if (elem.func) { elem.func(trace, elem.data); @@ -2182,12 +2184,12 @@ end: return ret; } -int bt_ctf_trace_add_is_static_listener(struct bt_ctf_trace *trace, - bt_ctf_trace_is_static_listener listener, - bt_ctf_trace_listener_removed listener_removed, void *data) +int bt_trace_add_is_static_listener(struct bt_trace *trace, + bt_trace_is_static_listener listener, + bt_trace_listener_removed listener_removed, void *data) { int i; - struct bt_ctf_trace_is_static_listener_elem new_elem = { + struct bt_trace_is_static_listener_elem new_elem = { .func = listener, .removed = listener_removed, .data = data, @@ -2208,7 +2210,7 @@ int bt_ctf_trace_add_is_static_listener(struct bt_ctf_trace *trace, if (trace->is_static) { BT_LOGW("Invalid parameter: trace is already static: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); i = -1; goto end; } @@ -2216,16 +2218,16 @@ int bt_ctf_trace_add_is_static_listener(struct bt_ctf_trace *trace, if (trace->in_remove_listener) { BT_LOGW("Cannot call this function during the execution of a remove listener: " "addr=%p, name=\"%s\"", - trace, bt_ctf_trace_get_name(trace)); + trace, bt_trace_get_name(trace)); i = -1; goto end; } /* Find the next available spot */ for (i = 0; i < trace->is_static_listeners->len; i++) { - struct bt_ctf_trace_is_static_listener_elem elem = + struct bt_trace_is_static_listener_elem elem = g_array_index(trace->is_static_listeners, - struct bt_ctf_trace_is_static_listener_elem, i); + struct bt_trace_is_static_listener_elem, i); if (!elem.func) { break; @@ -2241,17 +2243,17 @@ int bt_ctf_trace_add_is_static_listener(struct bt_ctf_trace *trace, BT_LOGV("Added \"trace is static\" listener: " "trace-addr=%p, trace-name=\"%s\", func-addr=%p, " "data-addr=%p, listener-id=%d", - trace, bt_ctf_trace_get_name(trace), listener, data, i); + trace, bt_trace_get_name(trace), listener, data, i); end: return i; } -int bt_ctf_trace_remove_is_static_listener( - struct bt_ctf_trace *trace, int listener_id) +int bt_trace_remove_is_static_listener( + struct bt_trace *trace, int listener_id) { int ret = 0; - struct bt_ctf_trace_is_static_listener_elem *elem; + struct bt_trace_is_static_listener_elem *elem; if (!trace) { BT_LOGW_STR("Invalid parameter: trace is NULL."); @@ -2262,7 +2264,7 @@ int bt_ctf_trace_remove_is_static_listener( if (trace->in_remove_listener) { BT_LOGW("Cannot call this function during the execution of a remove listener: " "addr=%p, name=\"%s\", listener-id=%d", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), listener_id); ret = -1; goto end; @@ -2278,19 +2280,19 @@ int bt_ctf_trace_remove_is_static_listener( if (listener_id >= trace->is_static_listeners->len) { BT_LOGW("Invalid parameter: no listener with this listener ID: " "addr=%p, name=\"%s\", listener-id=%d", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), listener_id); ret = -1; goto end; } elem = &g_array_index(trace->is_static_listeners, - struct bt_ctf_trace_is_static_listener_elem, + struct bt_trace_is_static_listener_elem, listener_id); if (!elem->func) { BT_LOGW("Invalid parameter: no listener with this listener ID: " "addr=%p, name=\"%s\", listener-id=%d", - trace, bt_ctf_trace_get_name(trace), + trace, bt_trace_get_name(trace), listener_id); ret = -1; goto end; @@ -2300,7 +2302,7 @@ int bt_ctf_trace_remove_is_static_listener( /* Call remove listener */ BT_LOGV("Calling remove listener: " "trace-addr=%p, trace-name=\"%s\", " - "listener-id=%d", trace, bt_ctf_trace_get_name(trace), + "listener-id=%d", trace, bt_trace_get_name(trace), listener_id); trace->in_remove_listener = BT_TRUE; elem->removed(trace, elem->data); @@ -2312,7 +2314,7 @@ int bt_ctf_trace_remove_is_static_listener( elem->data = NULL; BT_LOGV("Removed \"trace is static\" listener: " "trace-addr=%p, trace-name=\"%s\", " - "listener-id=%d", trace, bt_ctf_trace_get_name(trace), + "listener-id=%d", trace, bt_trace_get_name(trace), listener_id); end: diff --git a/lib/ctf-ir/utils.c b/lib/ctf-ir/utils.c index 0b086529..12daedbd 100644 --- a/lib/ctf-ir/utils.c +++ b/lib/ctf-ir/utils.c @@ -76,7 +76,7 @@ void trace_finalize(void) } } -int bt_ctf_validate_identifier(const char *input_string) +int bt_validate_identifier(const char *input_string) { int ret = 0; char *string = NULL; @@ -118,7 +118,7 @@ end: return ret; } -bt_bool bt_ctf_identifier_is_valid(const char *identifier) +bt_bool bt_identifier_is_valid(const char *identifier) { - return bt_ctf_validate_identifier(identifier); + return bt_validate_identifier(identifier); } diff --git a/lib/ctf-ir/validation.c b/lib/ctf-ir/validation.c index 49ae67ed..dd9a7afd 100644 --- a/lib/ctf-ir/validation.c +++ b/lib/ctf-ir/validation.c @@ -47,12 +47,12 @@ */ static int validate_event_class_types(struct bt_value *environment, - struct bt_ctf_field_type *packet_header_type, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type, - struct bt_ctf_field_type *stream_event_ctx_type, - struct bt_ctf_field_type *event_context_type, - struct bt_ctf_field_type *event_payload_type) + struct bt_field_type *packet_header_type, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type, + struct bt_field_type *stream_event_ctx_type, + struct bt_field_type *event_context_type, + struct bt_field_type *event_payload_type) { int ret = 0; @@ -67,11 +67,11 @@ int validate_event_class_types(struct bt_value *environment, stream_event_ctx_type, event_context_type, event_payload_type); /* Resolve sequence type lengths and variant type tags first */ - ret = bt_ctf_resolve_types(environment, packet_header_type, + ret = bt_resolve_types(environment, packet_header_type, packet_context_type, event_header_type, stream_event_ctx_type, event_context_type, event_payload_type, - BT_CTF_RESOLVE_FLAG_EVENT_CONTEXT | - BT_CTF_RESOLVE_FLAG_EVENT_PAYLOAD); + BT_RESOLVE_FLAG_EVENT_CONTEXT | + BT_RESOLVE_FLAG_EVENT_PAYLOAD); if (ret) { BT_LOGW("Cannot resolve event class field types: ret=%d", ret); @@ -80,7 +80,7 @@ int validate_event_class_types(struct bt_value *environment, /* Validate field types individually */ if (event_context_type) { - ret = bt_ctf_field_type_validate(event_context_type); + ret = bt_field_type_validate(event_context_type); if (ret) { BT_LOGW("Invalid event class's context field type: " "ret=%d", ret); @@ -89,7 +89,7 @@ int validate_event_class_types(struct bt_value *environment, } if (event_payload_type) { - ret = bt_ctf_field_type_validate(event_payload_type); + ret = bt_field_type_validate(event_payload_type); if (ret) { BT_LOGW("Invalid event class's payload field type: " "ret=%d", ret); @@ -111,10 +111,10 @@ end: */ static int validate_stream_class_types(struct bt_value *environment, - struct bt_ctf_field_type *packet_header_type, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type, - struct bt_ctf_field_type *stream_event_ctx_type) + struct bt_field_type *packet_header_type, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type, + struct bt_field_type *stream_event_ctx_type) { int ret = 0; @@ -127,12 +127,12 @@ int validate_stream_class_types(struct bt_value *environment, stream_event_ctx_type); /* Resolve sequence type lengths and variant type tags first */ - ret = bt_ctf_resolve_types(environment, packet_header_type, + ret = bt_resolve_types(environment, packet_header_type, packet_context_type, event_header_type, stream_event_ctx_type, NULL, NULL, - BT_CTF_RESOLVE_FLAG_PACKET_CONTEXT | - BT_CTF_RESOLVE_FLAG_EVENT_HEADER | - BT_CTF_RESOLVE_FLAG_STREAM_EVENT_CTX); + BT_RESOLVE_FLAG_PACKET_CONTEXT | + BT_RESOLVE_FLAG_EVENT_HEADER | + BT_RESOLVE_FLAG_STREAM_EVENT_CTX); if (ret) { BT_LOGW("Cannot resolve stream class field types: ret=%d", ret); @@ -141,7 +141,7 @@ int validate_stream_class_types(struct bt_value *environment, /* Validate field types individually */ if (packet_context_type) { - ret = bt_ctf_field_type_validate(packet_context_type); + ret = bt_field_type_validate(packet_context_type); if (ret) { BT_LOGW("Invalid stream class's packet context field type: " "ret=%d", ret); @@ -150,7 +150,7 @@ int validate_stream_class_types(struct bt_value *environment, } if (event_header_type) { - ret = bt_ctf_field_type_validate(event_header_type); + ret = bt_field_type_validate(event_header_type); if (ret) { BT_LOGW("Invalid stream class's event header field type: " "ret=%d", ret); @@ -159,7 +159,7 @@ int validate_stream_class_types(struct bt_value *environment, } if (stream_event_ctx_type) { - ret = bt_ctf_field_type_validate( + ret = bt_field_type_validate( stream_event_ctx_type); if (ret) { BT_LOGW("Invalid stream class's event context field type: " @@ -179,7 +179,7 @@ end: */ static int validate_trace_types(struct bt_value *environment, - struct bt_ctf_field_type *packet_header_type) + struct bt_field_type *packet_header_type) { int ret = 0; @@ -187,9 +187,9 @@ int validate_trace_types(struct bt_value *environment, "packet-header-ft-addr=%p", packet_header_type); /* Resolve sequence type lengths and variant type tags first */ - ret = bt_ctf_resolve_types(environment, packet_header_type, + ret = bt_resolve_types(environment, packet_header_type, NULL, NULL, NULL, NULL, NULL, - BT_CTF_RESOLVE_FLAG_PACKET_HEADER); + BT_RESOLVE_FLAG_PACKET_HEADER); if (ret) { BT_LOGW("Cannot resolve trace field types: ret=%d", ret); @@ -198,7 +198,7 @@ int validate_trace_types(struct bt_value *environment, /* Validate field types individually */ if (packet_header_type) { - ret = bt_ctf_field_type_validate(packet_header_type); + ret = bt_field_type_validate(packet_header_type); if (ret) { BT_LOGW("Invalid trace's packet header field type: " "ret=%d", ret); @@ -217,21 +217,21 @@ end: * `field_type` is owned by the caller. */ static -int field_type_contains_sequence_or_variant_ft(struct bt_ctf_field_type *type) +int field_type_contains_sequence_or_variant_ft(struct bt_field_type *type) { int ret = 0; - enum bt_ctf_field_type_id type_id = bt_ctf_field_type_get_type_id(type); + enum bt_field_type_id type_id = bt_field_type_get_type_id(type); switch (type_id) { - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: - case BT_CTF_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_VARIANT: ret = 1; goto end; - case BT_CTF_FIELD_TYPE_ID_ARRAY: - case BT_CTF_FIELD_TYPE_ID_STRUCT: + case BT_FIELD_TYPE_ID_ARRAY: + case BT_FIELD_TYPE_ID_STRUCT: { int i; - int field_count = bt_ctf_field_type_get_field_count(type); + int field_count = bt_field_type_get_field_count(type); if (field_count < 0) { ret = -1; @@ -239,8 +239,8 @@ int field_type_contains_sequence_or_variant_ft(struct bt_ctf_field_type *type) } for (i = 0; i < field_count; ++i) { - struct bt_ctf_field_type *child_type = - bt_ctf_field_type_get_field_at_index(type, i); + struct bt_field_type *child_type = + bt_field_type_get_field_at_index(type, i); ret = field_type_contains_sequence_or_variant_ft( child_type); @@ -260,16 +260,16 @@ end: } BT_HIDDEN -int bt_ctf_validate_class_types(struct bt_value *environment, - struct bt_ctf_field_type *packet_header_type, - struct bt_ctf_field_type *packet_context_type, - struct bt_ctf_field_type *event_header_type, - struct bt_ctf_field_type *stream_event_ctx_type, - struct bt_ctf_field_type *event_context_type, - struct bt_ctf_field_type *event_payload_type, +int bt_validate_class_types(struct bt_value *environment, + struct bt_field_type *packet_header_type, + struct bt_field_type *packet_context_type, + struct bt_field_type *event_header_type, + struct bt_field_type *stream_event_ctx_type, + struct bt_field_type *event_context_type, + struct bt_field_type *event_payload_type, int trace_valid, int stream_class_valid, int event_class_valid, - struct bt_ctf_validation_output *output, - enum bt_ctf_validation_flag validate_flags) + struct bt_validation_output *output, + enum bt_validation_flag validate_flags) { int ret = 0; int contains_seq_var; @@ -294,15 +294,15 @@ int bt_ctf_validate_class_types(struct bt_value *environment, /* Set initial valid flags according to valid parameters */ if (trace_valid) { - output->valid_flags |= BT_CTF_VALIDATION_FLAG_TRACE; + output->valid_flags |= BT_VALIDATION_FLAG_TRACE; } if (stream_class_valid) { - output->valid_flags |= BT_CTF_VALIDATION_FLAG_STREAM; + output->valid_flags |= BT_VALIDATION_FLAG_STREAM; } if (event_class_valid) { - output->valid_flags |= BT_CTF_VALIDATION_FLAG_EVENT; + output->valid_flags |= BT_VALIDATION_FLAG_EVENT; } /* Own the type parameters */ @@ -314,8 +314,8 @@ int bt_ctf_validate_class_types(struct bt_value *environment, bt_get(event_payload_type); /* Validate trace */ - if ((validate_flags & BT_CTF_VALIDATION_FLAG_TRACE) && !trace_valid) { - struct bt_ctf_field_type *packet_header_type_copy = NULL; + if ((validate_flags & BT_VALIDATION_FLAG_TRACE) && !trace_valid) { + struct bt_field_type *packet_header_type_copy = NULL; /* Create field type copies */ if (packet_header_type) { @@ -334,7 +334,7 @@ int bt_ctf_validate_class_types(struct bt_value *environment, BT_LOGV_STR("Copying packet header field type because it contains at least one sequence or variant field type."); packet_header_type_copy = - bt_ctf_field_type_copy(packet_header_type); + bt_field_type_copy(packet_header_type); if (!packet_header_type_copy) { ret = -1; BT_LOGE_STR("Cannot copy packet header field type."); @@ -346,7 +346,7 @@ int bt_ctf_validate_class_types(struct bt_value *environment, * caller, it cannot be modified any way since * it will be resolved. */ - bt_ctf_field_type_freeze(packet_header_type_copy); + bt_field_type_freeze(packet_header_type_copy); } skip_packet_header_type_copy: @@ -358,16 +358,16 @@ skip_packet_header_type_copy: packet_header_type); if (valid_ret == 0) { /* Trace is valid */ - output->valid_flags |= BT_CTF_VALIDATION_FLAG_TRACE; + output->valid_flags |= BT_VALIDATION_FLAG_TRACE; } } /* Validate stream class */ - if ((validate_flags & BT_CTF_VALIDATION_FLAG_STREAM) && + if ((validate_flags & BT_VALIDATION_FLAG_STREAM) && !stream_class_valid) { - struct bt_ctf_field_type *packet_context_type_copy = NULL; - struct bt_ctf_field_type *event_header_type_copy = NULL; - struct bt_ctf_field_type *stream_event_ctx_type_copy = NULL; + struct bt_field_type *packet_context_type_copy = NULL; + struct bt_field_type *event_header_type_copy = NULL; + struct bt_field_type *stream_event_ctx_type_copy = NULL; if (packet_context_type) { contains_seq_var = @@ -385,7 +385,7 @@ skip_packet_header_type_copy: BT_LOGV_STR("Copying packet context field type because it contains at least one sequence or variant field type."); packet_context_type_copy = - bt_ctf_field_type_copy(packet_context_type); + bt_field_type_copy(packet_context_type); if (!packet_context_type_copy) { BT_LOGE_STR("Cannot copy packet context field type."); goto sc_validation_error; @@ -396,7 +396,7 @@ skip_packet_header_type_copy: * caller, it cannot be modified any way since * it will be resolved. */ - bt_ctf_field_type_freeze(packet_context_type_copy); + bt_field_type_freeze(packet_context_type_copy); } skip_packet_context_type_copy: @@ -416,7 +416,7 @@ skip_packet_context_type_copy: BT_LOGV_STR("Copying event header field type because it contains at least one sequence or variant field type."); event_header_type_copy = - bt_ctf_field_type_copy(event_header_type); + bt_field_type_copy(event_header_type); if (!event_header_type_copy) { BT_LOGE_STR("Cannot copy event header field type."); goto sc_validation_error; @@ -427,7 +427,7 @@ skip_packet_context_type_copy: * caller, it cannot be modified any way since * it will be resolved. */ - bt_ctf_field_type_freeze(event_header_type_copy); + bt_field_type_freeze(event_header_type_copy); } skip_event_header_type_copy: @@ -448,7 +448,7 @@ skip_event_header_type_copy: BT_LOGV_STR("Copying stream event context field type because it contains at least one sequence or variant field type."); stream_event_ctx_type_copy = - bt_ctf_field_type_copy(stream_event_ctx_type); + bt_field_type_copy(stream_event_ctx_type); if (!stream_event_ctx_type_copy) { BT_LOGE_STR("Cannot copy stream event context field type."); goto sc_validation_error; @@ -459,7 +459,7 @@ skip_event_header_type_copy: * caller, it cannot be modified any way since * it will be resolved. */ - bt_ctf_field_type_freeze(stream_event_ctx_type_copy); + bt_field_type_freeze(stream_event_ctx_type_copy); } skip_stream_event_ctx_type_copy: @@ -474,7 +474,7 @@ skip_stream_event_ctx_type_copy: event_header_type, stream_event_ctx_type); if (valid_ret == 0) { /* Stream class is valid */ - output->valid_flags |= BT_CTF_VALIDATION_FLAG_STREAM; + output->valid_flags |= BT_VALIDATION_FLAG_STREAM; } goto sc_validation_done; @@ -489,10 +489,10 @@ sc_validation_error: sc_validation_done: /* Validate event class */ - if ((validate_flags & BT_CTF_VALIDATION_FLAG_EVENT) && + if ((validate_flags & BT_VALIDATION_FLAG_EVENT) && !event_class_valid) { - struct bt_ctf_field_type *event_context_type_copy = NULL; - struct bt_ctf_field_type *event_payload_type_copy = NULL; + struct bt_field_type *event_context_type_copy = NULL; + struct bt_field_type *event_payload_type_copy = NULL; if (event_context_type) { contains_seq_var = @@ -510,7 +510,7 @@ sc_validation_done: BT_LOGV_STR("Copying event context field type because it contains at least one sequence or variant field type."); event_context_type_copy = - bt_ctf_field_type_copy(event_context_type); + bt_field_type_copy(event_context_type); if (!event_context_type_copy) { BT_LOGE_STR("Cannot copy event context field type."); goto ec_validation_error; @@ -521,7 +521,7 @@ sc_validation_done: * caller, it cannot be modified any way since * it will be resolved. */ - bt_ctf_field_type_freeze(event_context_type_copy); + bt_field_type_freeze(event_context_type_copy); } skip_event_context_type_copy: @@ -541,7 +541,7 @@ skip_event_context_type_copy: BT_LOGV_STR("Copying event payload field type because it contains at least one sequence or variant field type."); event_payload_type_copy = - bt_ctf_field_type_copy(event_payload_type); + bt_field_type_copy(event_payload_type); if (!event_payload_type_copy) { BT_LOGE_STR("Cannot copy event payload field type."); goto ec_validation_error; @@ -552,7 +552,7 @@ skip_event_context_type_copy: * caller, it cannot be modified any way since * it will be resolved. */ - bt_ctf_field_type_freeze(event_payload_type_copy); + bt_field_type_freeze(event_payload_type_copy); } skip_event_payload_type_copy: @@ -567,7 +567,7 @@ skip_event_payload_type_copy: event_context_type, event_payload_type); if (valid_ret == 0) { /* Event class is valid */ - output->valid_flags |= BT_CTF_VALIDATION_FLAG_EVENT; + output->valid_flags |= BT_VALIDATION_FLAG_EVENT; } goto ec_validation_done; @@ -604,21 +604,21 @@ error: } BT_HIDDEN -void bt_ctf_validation_replace_types(struct bt_ctf_trace *trace, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_event_class *event_class, - struct bt_ctf_validation_output *output, - enum bt_ctf_validation_flag replace_flags) +void bt_validation_replace_types(struct bt_trace *trace, + struct bt_stream_class *stream_class, + struct bt_event_class *event_class, + struct bt_validation_output *output, + enum bt_validation_flag replace_flags) { - if ((replace_flags & BT_CTF_VALIDATION_FLAG_TRACE) && trace) { - bt_ctf_field_type_freeze(trace->packet_header_type); + if ((replace_flags & BT_VALIDATION_FLAG_TRACE) && trace) { + bt_field_type_freeze(trace->packet_header_type); BT_MOVE(trace->packet_header_type, output->packet_header_type); } - if ((replace_flags & BT_CTF_VALIDATION_FLAG_STREAM) && stream_class) { - bt_ctf_field_type_freeze(stream_class->packet_context_type); - bt_ctf_field_type_freeze(stream_class->event_header_type); - bt_ctf_field_type_freeze(stream_class->event_context_type); + if ((replace_flags & BT_VALIDATION_FLAG_STREAM) && stream_class) { + bt_field_type_freeze(stream_class->packet_context_type); + bt_field_type_freeze(stream_class->event_header_type); + bt_field_type_freeze(stream_class->event_context_type); BT_MOVE(stream_class->packet_context_type, output->packet_context_type); BT_MOVE(stream_class->event_header_type, @@ -627,17 +627,17 @@ void bt_ctf_validation_replace_types(struct bt_ctf_trace *trace, output->stream_event_ctx_type); } - if ((replace_flags & BT_CTF_VALIDATION_FLAG_EVENT) && event_class) { - bt_ctf_field_type_freeze(event_class->context); - bt_ctf_field_type_freeze(event_class->fields); + if ((replace_flags & BT_VALIDATION_FLAG_EVENT) && event_class) { + bt_field_type_freeze(event_class->context); + bt_field_type_freeze(event_class->fields); BT_MOVE(event_class->context, output->event_context_type); BT_MOVE(event_class->fields, output->event_payload_type); } } BT_HIDDEN -void bt_ctf_validation_output_put_types( - struct bt_ctf_validation_output *output) +void bt_validation_output_put_types( + struct bt_validation_output *output) { BT_PUT(output->packet_header_type); BT_PUT(output->packet_context_type); diff --git a/lib/ctf-ir/visitor.c b/lib/ctf-ir/visitor.c index 115b54ac..e2ec1fe3 100644 --- a/lib/ctf-ir/visitor.c +++ b/lib/ctf-ir/visitor.c @@ -30,11 +30,11 @@ #include BT_HIDDEN -int visitor_helper(struct bt_ctf_object *root, +int visitor_helper(struct bt_visitor_object *root, bt_child_count_accessor child_counter, bt_child_accessor child_accessor, bt_child_visitor child_visitor, - bt_ctf_visitor visitor, + bt_visitor visitor, void *data) { int ret, child_count, i; @@ -68,9 +68,10 @@ end: return ret; } -enum bt_ctf_object_type bt_ctf_object_get_type(struct bt_ctf_object *object) +enum bt_visitor_object_type bt_visitor_object_get_type( + struct bt_visitor_object *object) { - enum bt_ctf_object_type ret = BT_CTF_OBJECT_TYPE_UNKNOWN; + enum bt_visitor_object_type ret = BT_VISITOR_OBJECT_TYPE_UNKNOWN; if (!object) { goto end; @@ -81,7 +82,7 @@ end: return ret; } -void *bt_ctf_object_get_object(struct bt_ctf_object *object) +void *bt_visitor_object_get_object(struct bt_visitor_object *object) { void *ret = NULL; diff --git a/lib/ctf-writer/clock.c b/lib/ctf-writer/clock.c index 0549ee0a..5afe3fd5 100644 --- a/lib/ctf-writer/clock.c +++ b/lib/ctf-writer/clock.c @@ -60,7 +60,7 @@ struct bt_ctf_clock *bt_ctf_clock_create(const char *name) clock->value = 0; /* Pre-2.0.0 backward compatibility: default frequency is 1 GHz */ - clock->clock_class = bt_ctf_clock_class_create(name, 1000000000); + clock->clock_class = bt_clock_class_create(name, 1000000000); if (!clock->clock_class) { goto error; } @@ -71,7 +71,7 @@ struct bt_ctf_clock *bt_ctf_clock_create(const char *name) goto error; } - ret = bt_ctf_clock_class_set_uuid(clock->clock_class, cc_uuid); + ret = bt_clock_class_set_uuid(clock->clock_class, cc_uuid); assert(ret == 0); return clock; @@ -85,7 +85,7 @@ const char *bt_ctf_clock_get_name(struct bt_ctf_clock *clock) const char *name = NULL; if (clock) { - name = bt_ctf_clock_class_get_name(clock->clock_class); + name = bt_clock_class_get_name(clock->clock_class); } return name; @@ -96,7 +96,7 @@ const char *bt_ctf_clock_get_description(struct bt_ctf_clock *clock) const char *description = NULL; if (clock) { - description = bt_ctf_clock_class_get_description( + description = bt_clock_class_get_description( clock->clock_class); } @@ -108,7 +108,7 @@ int bt_ctf_clock_set_description(struct bt_ctf_clock *clock, const char *desc) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_set_description(clock->clock_class, + ret = bt_clock_class_set_description(clock->clock_class, desc); } @@ -120,7 +120,7 @@ uint64_t bt_ctf_clock_get_frequency(struct bt_ctf_clock *clock) uint64_t freq = -1ULL; if (clock) { - freq = bt_ctf_clock_class_get_frequency(clock->clock_class); + freq = bt_clock_class_get_frequency(clock->clock_class); } return freq; @@ -131,7 +131,7 @@ int bt_ctf_clock_set_frequency(struct bt_ctf_clock *clock, uint64_t freq) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_set_frequency(clock->clock_class, + ret = bt_clock_class_set_frequency(clock->clock_class, freq); } @@ -143,7 +143,7 @@ uint64_t bt_ctf_clock_get_precision(struct bt_ctf_clock *clock) uint64_t precision = -1ULL; if (clock) { - precision = bt_ctf_clock_class_get_precision( + precision = bt_clock_class_get_precision( clock->clock_class); } @@ -155,7 +155,7 @@ int bt_ctf_clock_set_precision(struct bt_ctf_clock *clock, uint64_t precision) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_set_precision(clock->clock_class, + ret = bt_clock_class_set_precision(clock->clock_class, precision); } @@ -167,7 +167,7 @@ int bt_ctf_clock_get_offset_s(struct bt_ctf_clock *clock, int64_t *offset_s) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_get_offset_s(clock->clock_class, + ret = bt_clock_class_get_offset_s(clock->clock_class, offset_s); } @@ -179,7 +179,7 @@ int bt_ctf_clock_set_offset_s(struct bt_ctf_clock *clock, int64_t offset_s) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_set_offset_s(clock->clock_class, + ret = bt_clock_class_set_offset_s(clock->clock_class, offset_s); } @@ -191,7 +191,7 @@ int bt_ctf_clock_get_offset(struct bt_ctf_clock *clock, int64_t *offset) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_get_offset_cycles(clock->clock_class, + ret = bt_clock_class_get_offset_cycles(clock->clock_class, offset); } @@ -203,7 +203,7 @@ int bt_ctf_clock_set_offset(struct bt_ctf_clock *clock, int64_t offset) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_set_offset_cycles(clock->clock_class, + ret = bt_clock_class_set_offset_cycles(clock->clock_class, offset); } @@ -215,7 +215,7 @@ int bt_ctf_clock_get_is_absolute(struct bt_ctf_clock *clock) int is_absolute = -1; if (clock) { - is_absolute = bt_ctf_clock_class_is_absolute( + is_absolute = bt_clock_class_is_absolute( clock->clock_class); } @@ -227,7 +227,7 @@ int bt_ctf_clock_set_is_absolute(struct bt_ctf_clock *clock, int is_absolute) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_set_is_absolute(clock->clock_class, + ret = bt_clock_class_set_is_absolute(clock->clock_class, is_absolute); } @@ -239,7 +239,7 @@ const unsigned char *bt_ctf_clock_get_uuid(struct bt_ctf_clock *clock) const unsigned char *uuid = NULL; if (clock) { - uuid = bt_ctf_clock_class_get_uuid(clock->clock_class); + uuid = bt_clock_class_get_uuid(clock->clock_class); } return uuid; @@ -250,7 +250,7 @@ int bt_ctf_clock_set_uuid(struct bt_ctf_clock *clock, const unsigned char *uuid) int ret = -1; if (clock) { - ret = bt_ctf_clock_class_set_uuid(clock->clock_class, uuid); + ret = bt_clock_class_set_uuid(clock->clock_class, uuid); } return ret; diff --git a/lib/ctf-writer/serialize.c b/lib/ctf-writer/serialize.c index 11ce8b44..459cf9df 100644 --- a/lib/ctf-writer/serialize.c +++ b/lib/ctf-writer/serialize.c @@ -60,16 +60,16 @@ union intval { * optimisation. */ static -int aligned_integer_write(struct bt_ctf_stream_pos *pos, +int aligned_integer_write(struct bt_stream_pos *pos, union intval value, unsigned int alignment, unsigned int size, - bt_bool is_signed, enum bt_ctf_byte_order byte_order) + bt_bool is_signed, enum bt_byte_order byte_order) { - bt_bool rbo = (byte_order != BT_CTF_MY_BYTE_ORDER); /* reverse byte order */ + bt_bool rbo = (byte_order != BT_MY_BYTE_ORDER); /* reverse byte order */ - if (!bt_ctf_stream_pos_align(pos, alignment)) + if (!bt_stream_pos_align(pos, alignment)) return -EFAULT; - if (!bt_ctf_stream_pos_access_ok(pos, size)) + if (!bt_stream_pos_access_ok(pos, size)) return -EFAULT; assert(!(pos->offset % CHAR_BIT)); @@ -79,7 +79,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, { uint8_t v = value.unsignd; - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } case 16: @@ -88,7 +88,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, if (rbo) v = GUINT16_SWAP_LE_BE(v); - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } case 32: @@ -97,7 +97,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, if (rbo) v = GUINT32_SWAP_LE_BE(v); - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } case 64: @@ -106,7 +106,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, if (rbo) v = GUINT64_SWAP_LE_BE(v); - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } default: @@ -118,7 +118,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, { uint8_t v = value.signd; - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } case 16: @@ -127,7 +127,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, if (rbo) v = GUINT16_SWAP_LE_BE(v); - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } case 32: @@ -136,7 +136,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, if (rbo) v = GUINT32_SWAP_LE_BE(v); - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } case 64: @@ -145,7 +145,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, if (rbo) v = GUINT64_SWAP_LE_BE(v); - memcpy(bt_ctf_stream_pos_get_addr(pos), &v, sizeof(v)); + memcpy(bt_stream_pos_get_addr(pos), &v, sizeof(v)); break; } default: @@ -153,15 +153,15 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos, } } - if (!bt_ctf_stream_pos_move(pos, size)) + if (!bt_stream_pos_move(pos, size)) return -EFAULT; return 0; } static -int integer_write(struct bt_ctf_stream_pos *pos, union intval value, +int integer_write(struct bt_stream_pos *pos, union intval value, unsigned int alignment, unsigned int size, bt_bool is_signed, - enum bt_ctf_byte_order byte_order) + enum bt_byte_order byte_order) { if (!(alignment % CHAR_BIT) && !(size % CHAR_BIT)) { @@ -169,14 +169,14 @@ int integer_write(struct bt_ctf_stream_pos *pos, union intval value, size, is_signed, byte_order); } - if (!bt_ctf_stream_pos_align(pos, alignment)) + if (!bt_stream_pos_align(pos, alignment)) return -EFAULT; - if (!bt_ctf_stream_pos_access_ok(pos, size)) + if (!bt_stream_pos_access_ok(pos, size)) return -EFAULT; if (!is_signed) { - if (byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN) + if (byte_order == BT_BYTE_ORDER_LITTLE_ENDIAN) bt_bitfield_write_le(mmap_align_addr(pos->base_mma) + pos->mmap_base_offset, unsigned char, pos->offset, size, value.unsignd); @@ -185,7 +185,7 @@ int integer_write(struct bt_ctf_stream_pos *pos, union intval value, pos->mmap_base_offset, unsigned char, pos->offset, size, value.unsignd); } else { - if (byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN) + if (byte_order == BT_BYTE_ORDER_LITTLE_ENDIAN) bt_bitfield_write_le(mmap_align_addr(pos->base_mma) + pos->mmap_base_offset, unsigned char, pos->offset, size, value.signd); @@ -195,23 +195,23 @@ int integer_write(struct bt_ctf_stream_pos *pos, union intval value, pos->offset, size, value.signd); } - if (!bt_ctf_stream_pos_move(pos, size)) + if (!bt_stream_pos_move(pos, size)) return -EFAULT; return 0; } BT_HIDDEN -int bt_ctf_field_integer_write(struct bt_ctf_field_integer *int_field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_integer_write(struct bt_field_integer *int_field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { - struct bt_ctf_field_type *type = int_field->parent.type; - struct bt_ctf_field_type_integer *int_type = (void *) type; - enum bt_ctf_byte_order byte_order; + struct bt_field_type *type = int_field->parent.type; + struct bt_field_type_integer *int_type = (void *) type; + enum bt_byte_order byte_order; union intval value; byte_order = int_type->user_byte_order; - if (byte_order == BT_CTF_BYTE_ORDER_NATIVE) { + if (byte_order == BT_BYTE_ORDER_NATIVE) { byte_order = native_byte_order; } @@ -223,19 +223,19 @@ int bt_ctf_field_integer_write(struct bt_ctf_field_integer *int_field, } BT_HIDDEN -int bt_ctf_field_floating_point_write( - struct bt_ctf_field_floating_point *flt_field, - struct bt_ctf_stream_pos *pos, - enum bt_ctf_byte_order native_byte_order) +int bt_field_floating_point_write( + struct bt_field_floating_point *flt_field, + struct bt_stream_pos *pos, + enum bt_byte_order native_byte_order) { - struct bt_ctf_field_type *type = flt_field->parent.type; - struct bt_ctf_field_type_floating_point *flt_type = (void *) type; - enum bt_ctf_byte_order byte_order; + struct bt_field_type *type = flt_field->parent.type; + struct bt_field_type_floating_point *flt_type = (void *) type; + enum bt_byte_order byte_order; union intval value; unsigned int size; byte_order = flt_type->user_byte_order; - if (byte_order == BT_CTF_BYTE_ORDER_NATIVE) { + if (byte_order == BT_BYTE_ORDER_NATIVE) { byte_order = native_byte_order; } @@ -266,7 +266,7 @@ int bt_ctf_field_floating_point_write( } BT_HIDDEN -void bt_ctf_stream_pos_packet_seek(struct bt_ctf_stream_pos *pos, size_t index, +void bt_stream_pos_packet_seek(struct bt_stream_pos *pos, size_t index, int whence) { int ret; diff --git a/lib/ctf-writer/writer.c b/lib/ctf-writer/writer.c index 2978cdfb..ce884ea6 100644 --- a/lib/ctf-writer/writer.c +++ b/lib/ctf-writer/writer.c @@ -53,43 +53,43 @@ static void bt_ctf_writer_destroy(struct bt_object *obj); static -int init_trace_packet_header(struct bt_ctf_trace *trace) +int init_trace_packet_header(struct bt_trace *trace) { int ret = 0; - struct bt_ctf_field *magic = NULL, *uuid_array = NULL; - struct bt_ctf_field_type *_uint32_t = + struct bt_field *magic = NULL, *uuid_array = NULL; + struct bt_field_type *_uint32_t = get_field_type(FIELD_TYPE_ALIAS_UINT32_T); - struct bt_ctf_field_type *_uint8_t = + struct bt_field_type *_uint8_t = get_field_type(FIELD_TYPE_ALIAS_UINT8_T); - struct bt_ctf_field_type *trace_packet_header_type = - bt_ctf_field_type_structure_create(); - struct bt_ctf_field_type *uuid_array_type = - bt_ctf_field_type_array_create(_uint8_t, 16); + struct bt_field_type *trace_packet_header_type = + bt_field_type_structure_create(); + struct bt_field_type *uuid_array_type = + bt_field_type_array_create(_uint8_t, 16); if (!trace_packet_header_type || !uuid_array_type) { ret = -1; goto end; } - ret = bt_ctf_field_type_structure_add_field(trace_packet_header_type, + ret = bt_field_type_structure_add_field(trace_packet_header_type, _uint32_t, "magic"); if (ret) { goto end; } - ret = bt_ctf_field_type_structure_add_field(trace_packet_header_type, + ret = bt_field_type_structure_add_field(trace_packet_header_type, uuid_array_type, "uuid"); if (ret) { goto end; } - ret = bt_ctf_field_type_structure_add_field(trace_packet_header_type, + ret = bt_field_type_structure_add_field(trace_packet_header_type, _uint32_t, "stream_id"); if (ret) { goto end; } - ret = bt_ctf_trace_set_packet_header_type(trace, + ret = bt_trace_set_packet_header_type(trace, trace_packet_header_type); if (ret) { goto end; @@ -128,7 +128,7 @@ struct bt_ctf_writer *bt_ctf_writer_create(const char *path) goto error_destroy; } - writer->trace = bt_ctf_trace_create(); + writer->trace = bt_trace_create(); if (!writer->trace) { goto error_destroy; } @@ -145,7 +145,7 @@ struct bt_ctf_writer *bt_ctf_writer_create(const char *path) goto error_destroy; } - ret = bt_ctf_trace_set_uuid(writer->trace, uuid); + ret = bt_trace_set_uuid(writer->trace, uuid); if (ret) { goto error_destroy; } @@ -155,7 +155,7 @@ struct bt_ctf_writer *bt_ctf_writer_create(const char *path) bt_put(writer->trace); /* Default to little-endian */ - ret = bt_ctf_writer_set_byte_order(writer, BT_CTF_BYTE_ORDER_NATIVE); + ret = bt_ctf_writer_set_byte_order(writer, BT_BYTE_ORDER_NATIVE); assert(ret == 0); /* Create trace directory if necessary and open a metadata file */ @@ -202,9 +202,9 @@ void bt_ctf_writer_destroy(struct bt_object *obj) g_free(writer); } -struct bt_ctf_trace *bt_ctf_writer_get_trace(struct bt_ctf_writer *writer) +struct bt_trace *bt_ctf_writer_get_trace(struct bt_ctf_writer *writer) { - struct bt_ctf_trace *trace = NULL; + struct bt_trace *trace = NULL; if (!writer) { goto end; @@ -216,10 +216,10 @@ end: return trace; } -struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, - struct bt_ctf_stream_class *stream_class) +struct bt_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, + struct bt_stream_class *stream_class) { - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; int stream_class_count; bt_bool stream_class_found = BT_FALSE; int i; @@ -229,14 +229,14 @@ struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, } /* Make sure the stream class is part of the writer's trace */ - stream_class_count = bt_ctf_trace_get_stream_class_count(writer->trace); + stream_class_count = bt_trace_get_stream_class_count(writer->trace); if (stream_class_count < 0) { goto error; } for (i = 0; i < stream_class_count; i++) { - struct bt_ctf_stream_class *existing_stream_class = - bt_ctf_trace_get_stream_class_by_index( + struct bt_stream_class *existing_stream_class = + bt_trace_get_stream_class_by_index( writer->trace, i); if (existing_stream_class == stream_class) { @@ -251,7 +251,7 @@ struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, } if (!stream_class_found) { - int ret = bt_ctf_trace_add_stream_class(writer->trace, + int ret = bt_trace_add_stream_class(writer->trace, stream_class); if (ret) { @@ -259,7 +259,7 @@ struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer, } } - stream = bt_ctf_stream_create(stream_class, NULL); + stream = bt_stream_create(stream_class, NULL); if (!stream) { goto error; } @@ -281,7 +281,7 @@ int bt_ctf_writer_add_environment_field(struct bt_ctf_writer *writer, goto end; } - ret = bt_ctf_trace_set_environment_field_string(writer->trace, + ret = bt_trace_set_environment_field_string(writer->trace, name, value); end: return ret; @@ -296,7 +296,7 @@ int bt_ctf_writer_add_environment_field_int64(struct bt_ctf_writer *writer, goto end; } - ret = bt_ctf_trace_set_environment_field_integer(writer->trace, name, + ret = bt_trace_set_environment_field_integer(writer->trace, name, value); end: return ret; @@ -311,7 +311,7 @@ int bt_ctf_writer_add_clock(struct bt_ctf_writer *writer, goto end; } - ret = bt_ctf_trace_add_clock_class(writer->trace, clock->clock_class); + ret = bt_trace_add_clock_class(writer->trace, clock->clock_class); end: return ret; } @@ -324,7 +324,7 @@ char *bt_ctf_writer_get_metadata_string(struct bt_ctf_writer *writer) goto end; } - metadata_string = bt_ctf_trace_get_metadata_string( + metadata_string = bt_trace_get_metadata_string( writer->trace); end: return metadata_string; @@ -339,7 +339,7 @@ void bt_ctf_writer_flush_metadata(struct bt_ctf_writer *writer) goto end; } - metadata_string = bt_ctf_trace_get_metadata_string( + metadata_string = bt_trace_get_metadata_string( writer->trace); if (!metadata_string) { goto end; @@ -366,7 +366,7 @@ end: } int bt_ctf_writer_set_byte_order(struct bt_ctf_writer *writer, - enum bt_ctf_byte_order byte_order) + enum bt_byte_order byte_order) { int ret = 0; @@ -375,11 +375,11 @@ int bt_ctf_writer_set_byte_order(struct bt_ctf_writer *writer, goto end; } - if (byte_order == BT_CTF_BYTE_ORDER_NATIVE) { - byte_order = BT_CTF_MY_BYTE_ORDER; + if (byte_order == BT_BYTE_ORDER_NATIVE) { + byte_order = BT_MY_BYTE_ORDER; } - ret = bt_ctf_trace_set_native_byte_order(writer->trace, + ret = bt_trace_set_native_byte_order(writer->trace, byte_order); end: return ret; diff --git a/lib/graph/clock-class-priority-map.c b/lib/graph/clock-class-priority-map.c index 1377e4df..b385d39b 100644 --- a/lib/graph/clock-class-priority-map.c +++ b/lib/graph/clock-class-priority-map.c @@ -114,11 +114,11 @@ end: return ret; } -struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class_by_index( +struct bt_clock_class *bt_clock_class_priority_map_get_clock_class_by_index( struct bt_clock_class_priority_map *cc_prio_map, uint64_t index) { - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; if (!cc_prio_map) { BT_LOGW_STR("Invalid parameter: clock class priority map is NULL."); @@ -139,12 +139,12 @@ end: return clock_class; } -struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class_by_name( +struct bt_clock_class *bt_clock_class_priority_map_get_clock_class_by_name( struct bt_clock_class_priority_map *cc_prio_map, const char *name) { size_t i; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; if (!cc_prio_map) { BT_LOGW_STR("Invalid parameter: clock class priority map is NULL."); @@ -157,10 +157,10 @@ struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class_by_name( } for (i = 0; i < cc_prio_map->entries->len; i++) { - struct bt_ctf_clock_class *cur_cc = + struct bt_clock_class *cur_cc = g_ptr_array_index(cc_prio_map->entries, i); const char *cur_cc_name = - bt_ctf_clock_class_get_name(cur_cc); + bt_clock_class_get_name(cur_cc); assert(cur_cc_name); @@ -177,7 +177,7 @@ end: struct clock_class_prio { uint64_t prio; - struct bt_ctf_clock_class *clock_class; + struct bt_clock_class *clock_class; }; static @@ -194,7 +194,7 @@ void current_highest_prio_gh_func(gpointer key, gpointer value, } static -struct clock_class_prio bt_ctf_clock_class_priority_map_current_highest_prio( +struct clock_class_prio bt_clock_class_priority_map_current_highest_prio( struct bt_clock_class_priority_map *cc_prio_map) { struct clock_class_prio func_data = { @@ -207,11 +207,11 @@ struct clock_class_prio bt_ctf_clock_class_priority_map_current_highest_prio( return func_data; } -struct bt_ctf_clock_class * +struct bt_clock_class * bt_clock_class_priority_map_get_highest_priority_clock_class( struct bt_clock_class_priority_map *cc_prio_map) { - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; if (!cc_prio_map) { BT_LOGW_STR("Invalid parameter: clock class priority map is NULL."); @@ -226,7 +226,7 @@ end: int bt_clock_class_priority_map_get_clock_class_priority( struct bt_clock_class_priority_map *cc_prio_map, - struct bt_ctf_clock_class *clock_class, uint64_t *priority) + struct bt_clock_class *clock_class, uint64_t *priority) { int ret = 0; uint64_t *prio; @@ -255,7 +255,7 @@ int bt_clock_class_priority_map_get_clock_class_priority( "cc-prio-map-addr=%p, clock-class-addr=%p, " "clock-class-name=\"%s\"", cc_prio_map, clock_class, - bt_ctf_clock_class_get_name(clock_class)); + bt_clock_class_get_name(clock_class)); ret = -1; goto end; } @@ -268,14 +268,14 @@ end: int bt_clock_class_priority_map_add_clock_class( struct bt_clock_class_priority_map *cc_prio_map, - struct bt_ctf_clock_class *clock_class, uint64_t priority) + struct bt_clock_class *clock_class, uint64_t priority) { int ret = 0; uint64_t *prio_ptr = NULL; struct clock_class_prio cc_prio; // FIXME when available: check - // bt_ctf_clock_class_is_valid(clock_class) + // bt_clock_class_is_valid(clock_class) if (!cc_prio_map) { BT_LOGW_STR("Invalid parameter: clock class priority map is NULL."); ret = -1; @@ -317,7 +317,7 @@ int bt_clock_class_priority_map_add_clock_class( prio_ptr = NULL; set_highest_prio: - cc_prio = bt_ctf_clock_class_priority_map_current_highest_prio( + cc_prio = bt_clock_class_priority_map_current_highest_prio( cc_prio_map); assert(cc_prio.clock_class); cc_prio_map->highest_prio_cc = cc_prio.clock_class; @@ -327,9 +327,9 @@ set_highest_prio: "highest-prio-clock-class-addr=%p, " "highest-prio-clock-class-name=\"%s\"", cc_prio_map, clock_class, - bt_ctf_clock_class_get_name(clock_class), + bt_clock_class_get_name(clock_class), cc_prio.clock_class, - bt_ctf_clock_class_get_name(cc_prio.clock_class)); + bt_clock_class_get_name(cc_prio.clock_class)); end: g_free(prio_ptr); @@ -350,7 +350,7 @@ struct bt_clock_class_priority_map *bt_clock_class_priority_map_copy( } for (i = 0; i < orig_cc_prio_map->entries->len; i++) { - struct bt_ctf_clock_class *clock_class = + struct bt_clock_class *clock_class = g_ptr_array_index(orig_cc_prio_map->entries, i); uint64_t *prio = g_hash_table_lookup(orig_cc_prio_map->prios, clock_class); @@ -362,7 +362,7 @@ struct bt_clock_class_priority_map *bt_clock_class_priority_map_copy( "cc-prio-map-copy-addr=%p, clock-class-addr=%p, " "clock-class-name=\"%s\"", cc_prio_map, clock_class, - bt_ctf_clock_class_get_name(clock_class)); + bt_clock_class_get_name(clock_class)); goto error; } } diff --git a/lib/graph/iterator.c b/lib/graph/iterator.c index c2020874..c5a00d62 100644 --- a/lib/graph/iterator.c +++ b/lib/graph/iterator.c @@ -62,13 +62,13 @@ #include struct discarded_elements_state { - struct bt_ctf_clock_value *cur_begin; + struct bt_clock_value *cur_begin; uint64_t cur_count; }; struct stream_state { - struct bt_ctf_stream *stream; /* owned by this */ - struct bt_ctf_packet *cur_packet; /* owned by this */ + struct bt_stream *stream; /* owned by this */ + struct bt_packet *cur_packet; /* owned by this */ struct discarded_elements_state discarded_packets_state; struct discarded_elements_state discarded_events_state; bt_bool is_ended; @@ -94,14 +94,14 @@ struct action { /* ACTION_TYPE_MAP_PORT_TO_COMP_IN_STREAM */ struct { - struct bt_ctf_stream *stream; /* owned by this */ + struct bt_stream *stream; /* owned by this */ struct bt_component *component; /* owned by this */ struct bt_port *port; /* owned by this */ } map_port_to_comp_in_stream; /* ACTION_TYPE_ADD_STREAM_STATE */ struct { - struct bt_ctf_stream *stream; /* owned by this */ + struct bt_stream *stream; /* owned by this */ struct stream_state *stream_state; /* owned by this */ } add_stream_state; @@ -113,21 +113,21 @@ struct action { /* ACTION_TYPE_SET_STREAM_STATE_CUR_PACKET */ struct { struct stream_state *stream_state; /* weak */ - struct bt_ctf_packet *packet; /* owned by this */ + struct bt_packet *packet; /* owned by this */ } set_stream_state_cur_packet; /* ACTION_TYPE_UPDATE_STREAM_STATE_DISCARDED_PACKETS */ /* ACTION_TYPE_UPDATE_STREAM_STATE_DISCARDED_EVENTS */ struct { struct stream_state *stream_state; /* weak */ - struct bt_ctf_clock_value *cur_begin; /* owned by this */ + struct bt_clock_value *cur_begin; /* owned by this */ uint64_t cur_count; } update_stream_state_discarded_elements; } payload; }; static -void stream_destroy_listener(struct bt_ctf_stream *stream, void *data) +void stream_destroy_listener(struct bt_stream *stream, void *data) { struct bt_notification_iterator_private_connection *iterator = data; @@ -257,7 +257,7 @@ void apply_actions(struct bt_notification_iterator_private_connection *iterator) action->payload.push_notif.notif = NULL; break; case ACTION_TYPE_MAP_PORT_TO_COMP_IN_STREAM: - bt_ctf_stream_map_component_to_port( + bt_stream_map_component_to_port( action->payload.map_port_to_comp_in_stream.stream, action->payload.map_port_to_comp_in_stream.component, action->payload.map_port_to_comp_in_stream.port); @@ -287,7 +287,7 @@ void apply_actions(struct bt_notification_iterator_private_connection *iterator) * could be reused for another stream, and they * must have different states. */ - bt_ctf_stream_add_destroy_listener( + bt_stream_add_destroy_listener( action->payload.set_stream_state_is_ended.stream_state->stream, stream_destroy_listener, iterator); action->payload.set_stream_state_is_ended.stream_state->is_ended = BT_TRUE; @@ -325,7 +325,7 @@ void apply_actions(struct bt_notification_iterator_private_connection *iterator) } static -struct stream_state *create_stream_state(struct bt_ctf_stream *stream) +struct stream_state *create_stream_state(struct bt_stream *stream) { struct stream_state *stream_state = g_new0(struct stream_state, 1); @@ -354,7 +354,7 @@ struct stream_state *create_stream_state(struct bt_ctf_stream *stream) stream_state->stream = bt_get(stream); BT_LOGV("Created stream state: stream-addr=%p, stream-name=\"%s\", " "stream-state-addr=%p", - stream, bt_ctf_stream_get_name(stream), stream_state); + stream, bt_stream_get_name(stream), stream_state); end: return stream_state; @@ -422,7 +422,7 @@ void bt_private_connection_notification_iterator_destroy(struct bt_object *obj) assert(stream_gptr); BT_LOGD_STR("Removing stream's destroy listener for notification iterator."); - bt_ctf_stream_remove_destroy_listener( + bt_stream_remove_destroy_listener( (void *) stream_gptr, stream_destroy_listener, iterator); } @@ -788,8 +788,8 @@ static bt_bool validate_notification( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *notif, - struct bt_ctf_stream *notif_stream, - struct bt_ctf_packet *notif_packet) + struct bt_stream *notif_stream, + struct bt_packet *notif_packet) { bt_bool is_valid = BT_TRUE; struct stream_state *stream_state; @@ -797,7 +797,7 @@ bt_bool validate_notification( assert(notif_stream); stream_comp_cur_port = - bt_ctf_stream_port_for_component(notif_stream, + bt_stream_port_for_component(notif_stream, iterator->upstream_component); if (!stream_comp_cur_port) { /* @@ -832,7 +832,7 @@ bt_bool validate_notification( "iter-upstream-port-addr=%p, " "iter-upstream-port-name=%s", notif_stream, - bt_ctf_stream_get_name(notif_stream), + bt_stream_get_name(notif_stream), stream_comp_cur_port, bt_port_get_name(stream_comp_cur_port), iterator->upstream_port, @@ -850,7 +850,7 @@ bt_bool validate_notification( "stream-addr=%p, stream-name=\"%s\", " "stream-state-addr=%p", notif_stream, - bt_ctf_stream_get_name(notif_stream), stream_state); + bt_stream_get_name(notif_stream), stream_state); if (stream_state->is_ended) { /* @@ -864,7 +864,7 @@ bt_bool validate_notification( BT_LOGW("Stream is already ended: " "stream-addr=%p, stream-name=\"%s\"", notif_stream, - bt_ctf_stream_get_name(notif_stream)); + bt_stream_get_name(notif_stream)); is_valid = BT_FALSE; goto end; } @@ -879,7 +879,7 @@ bt_bool validate_notification( BT_LOGW("Duplicate stream beginning notification: " "stream-addr=%p, stream-name=\"%s\"", notif_stream, - bt_ctf_stream_get_name(notif_stream)); + bt_stream_get_name(notif_stream)); is_valid = BT_FALSE; goto end; case BT_NOTIFICATION_TYPE_PACKET_BEGIN: @@ -889,7 +889,7 @@ bt_bool validate_notification( "stream-addr=%p, stream-name=\"%s\", " "packet-addr=%p", notif_stream, - bt_ctf_stream_get_name(notif_stream), + bt_stream_get_name(notif_stream), notif_packet); is_valid = BT_FALSE; goto end; @@ -939,7 +939,7 @@ void add_action_push_notif( static int add_action_push_notif_stream_begin( struct bt_notification_iterator_private_connection *iterator, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { int ret = 0; struct bt_notification *stream_begin_notif = NULL; @@ -962,7 +962,7 @@ int add_action_push_notif_stream_begin( add_action_push_notif(iterator, stream_begin_notif); BT_LOGV("Added \"push stream beginning notification\" action: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; error: @@ -976,7 +976,7 @@ end: static int add_action_push_notif_stream_end( struct bt_notification_iterator_private_connection *iterator, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { int ret = 0; struct bt_notification *stream_end_notif = NULL; @@ -999,7 +999,7 @@ int add_action_push_notif_stream_end( add_action_push_notif(iterator, stream_end_notif); BT_LOGV("Added \"push stream end notification\" action: " "stream-addr=%p, stream-name=\"%s\"", - stream, bt_ctf_stream_get_name(stream)); + stream, bt_stream_get_name(stream)); goto end; error: @@ -1013,7 +1013,7 @@ end: static int add_action_push_notif_packet_begin( struct bt_notification_iterator_private_connection *iterator, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { int ret = 0; struct bt_notification *packet_begin_notif = NULL; @@ -1049,7 +1049,7 @@ end: static int add_action_push_notif_packet_end( struct bt_notification_iterator_private_connection *iterator, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { int ret = 0; struct bt_notification *packet_end_notif = NULL; @@ -1104,7 +1104,7 @@ static void add_action_set_stream_state_cur_packet( struct bt_notification_iterator_private_connection *iterator, struct stream_state *stream_state, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { struct action action = { .type = ACTION_TYPE_SET_STREAM_STATE_CUR_PACKET, @@ -1126,7 +1126,7 @@ void add_action_update_stream_state_discarded_elements( struct bt_notification_iterator_private_connection *iterator, enum action_type type, struct stream_state *stream_state, - struct bt_ctf_clock_value *cur_begin, + struct bt_clock_value *cur_begin, uint64_t cur_count) { struct action action = { @@ -1157,7 +1157,7 @@ static int ensure_stream_state_exists( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *stream_begin_notif, - struct bt_ctf_stream *notif_stream, + struct bt_stream *notif_stream, struct stream_state **_stream_state) { int ret = 0; @@ -1220,32 +1220,32 @@ end: } static -struct bt_ctf_field *get_struct_field_uint(struct bt_ctf_field *struct_field, +struct bt_field *get_struct_field_uint(struct bt_field *struct_field, const char *field_name) { - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *ft = NULL; + struct bt_field *field = NULL; + struct bt_field_type *ft = NULL; - field = bt_ctf_field_structure_get_field_by_name(struct_field, + field = bt_field_structure_get_field_by_name(struct_field, field_name); if (!field) { BT_LOGV_STR("`%s` field does not exist."); goto end; } - if (!bt_ctf_field_is_integer(field)) { + if (!bt_field_is_integer(field)) { BT_LOGV("Skipping `%s` field because its type is not an integer field type: " "field-addr=%p, ft-addr=%p, ft-id=%s", field_name, - field, ft, bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(ft))); + field, ft, bt_field_type_id_string( + bt_field_type_get_type_id(ft))); BT_PUT(field); goto end; } - ft = bt_ctf_field_get_type(field); + ft = bt_field_get_type(field); assert(ft); - if (bt_ctf_field_type_integer_is_signed(ft)) { + if (bt_field_type_integer_is_signed(ft)) { BT_LOGV("Skipping `%s` integer field because its type is signed: " "field-addr=%p, ft-addr=%p", field_name, field, ft); BT_PUT(field); @@ -1258,14 +1258,14 @@ end: } static -uint64_t get_packet_context_events_discarded(struct bt_ctf_packet *packet) +uint64_t get_packet_context_events_discarded(struct bt_packet *packet) { - struct bt_ctf_field *packet_context = NULL; - struct bt_ctf_field *field = NULL; + struct bt_field *packet_context = NULL; + struct bt_field *field = NULL; uint64_t retval = -1ULL; int ret; - packet_context = bt_ctf_packet_get_context(packet); + packet_context = bt_packet_get_context(packet); if (!packet_context) { goto end; } @@ -1278,8 +1278,8 @@ uint64_t get_packet_context_events_discarded(struct bt_ctf_packet *packet) goto end; } - assert(bt_ctf_field_is_integer(field)); - ret = bt_ctf_field_unsigned_integer_get_value(field, &retval); + assert(bt_field_is_integer(field)); + ret = bt_field_unsigned_integer_get_value(field, &retval); if (ret) { BT_LOGV("Cannot get raw value of packet's context field's `events_discarded` integer field: " "packet-addr=%p, field-addr=%p", @@ -1295,14 +1295,14 @@ end: } static -uint64_t get_packet_context_packet_seq_num(struct bt_ctf_packet *packet) +uint64_t get_packet_context_packet_seq_num(struct bt_packet *packet) { - struct bt_ctf_field *packet_context = NULL; - struct bt_ctf_field *field = NULL; + struct bt_field *packet_context = NULL; + struct bt_field *field = NULL; uint64_t retval = -1ULL; int ret; - packet_context = bt_ctf_packet_get_context(packet); + packet_context = bt_packet_get_context(packet); if (!packet_context) { goto end; } @@ -1315,8 +1315,8 @@ uint64_t get_packet_context_packet_seq_num(struct bt_ctf_packet *packet) goto end; } - assert(bt_ctf_field_is_integer(field)); - ret = bt_ctf_field_unsigned_integer_get_value(field, &retval); + assert(bt_field_is_integer(field)); + ret = bt_field_unsigned_integer_get_value(field, &retval); if (ret) { BT_LOGV("Cannot get raw value of packet's context field's `packet_seq_num` integer field: " "packet-addr=%p, field-addr=%p", @@ -1334,9 +1334,9 @@ end: static int handle_discarded_packets( struct bt_notification_iterator_private_connection *iterator, - struct bt_ctf_packet *packet, - struct bt_ctf_clock_value *ts_begin, - struct bt_ctf_clock_value *ts_end, + struct bt_packet *packet, + struct bt_clock_value *ts_begin, + struct bt_clock_value *ts_end, struct stream_state *stream_state) { struct bt_notification *notif = NULL; @@ -1409,9 +1409,9 @@ end: static int handle_discarded_events( struct bt_notification_iterator_private_connection *iterator, - struct bt_ctf_packet *packet, - struct bt_ctf_clock_value *ts_begin, - struct bt_ctf_clock_value *ts_end, + struct bt_packet *packet, + struct bt_clock_value *ts_begin, + struct bt_clock_value *ts_end, struct stream_state *stream_state) { struct bt_notification *notif = NULL; @@ -1467,14 +1467,14 @@ end: } static -int get_field_clock_value(struct bt_ctf_field *root_field, +int get_field_clock_value(struct bt_field *root_field, const char *field_name, - struct bt_ctf_clock_value **user_clock_val) + struct bt_clock_value **user_clock_val) { - struct bt_ctf_field *field; - struct bt_ctf_field_type *ft = NULL; - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_field *field; + struct bt_field_type *ft = NULL; + struct bt_clock_class *clock_class = NULL; + struct bt_clock_value *clock_value = NULL; uint64_t val; int ret = 0; @@ -1484,9 +1484,9 @@ int get_field_clock_value(struct bt_ctf_field *root_field, goto end; } - ft = bt_ctf_field_get_type(field); + ft = bt_field_get_type(field); assert(ft); - clock_class = bt_ctf_field_type_integer_get_mapped_clock_class(ft); + clock_class = bt_field_type_integer_get_mapped_clock_class(ft); if (!clock_class) { BT_LOGW("Integer field type has no mapped clock class but it's expected to have one: " "ft-addr=%p", ft); @@ -1494,7 +1494,7 @@ int get_field_clock_value(struct bt_ctf_field *root_field, goto end; } - ret = bt_ctf_field_unsigned_integer_get_value(field, &val); + ret = bt_field_unsigned_integer_get_value(field, &val); if (ret) { BT_LOGW("Cannot get integer field's raw value: " "field-addr=%p", field); @@ -1502,7 +1502,7 @@ int get_field_clock_value(struct bt_ctf_field *root_field, goto end; } - clock_value = bt_ctf_clock_value_create(clock_class, val); + clock_value = bt_clock_value_create(clock_class, val); if (!clock_value) { BT_LOGE_STR("Cannot create clock value from clock class."); ret = -1; @@ -1522,16 +1522,16 @@ end: } static -int get_ts_begin_ts_end_from_packet(struct bt_ctf_packet *packet, - struct bt_ctf_clock_value **user_ts_begin, - struct bt_ctf_clock_value **user_ts_end) +int get_ts_begin_ts_end_from_packet(struct bt_packet *packet, + struct bt_clock_value **user_ts_begin, + struct bt_clock_value **user_ts_end) { - struct bt_ctf_field *packet_context = NULL; - struct bt_ctf_clock_value *ts_begin = NULL; - struct bt_ctf_clock_value *ts_end = NULL; + struct bt_field *packet_context = NULL; + struct bt_clock_value *ts_begin = NULL; + struct bt_clock_value *ts_end = NULL; int ret = 0; - packet_context = bt_ctf_packet_get_context(packet); + packet_context = bt_packet_get_context(packet); if (!packet_context) { goto end; } @@ -1570,10 +1570,10 @@ end: static int handle_discarded_elements( struct bt_notification_iterator_private_connection *iterator, - struct bt_ctf_packet *packet, struct stream_state *stream_state) + struct bt_packet *packet, struct stream_state *stream_state) { - struct bt_ctf_clock_value *ts_begin = NULL; - struct bt_ctf_clock_value *ts_end = NULL; + struct bt_clock_value *ts_begin = NULL; + struct bt_clock_value *ts_end = NULL; int ret; ret = get_ts_begin_ts_end_from_packet(packet, &ts_begin, &ts_end); @@ -1612,7 +1612,7 @@ static int handle_packet_switch( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *packet_begin_notif, - struct bt_ctf_packet *new_packet, + struct bt_packet *new_packet, struct stream_state *stream_state) { int ret = 0; @@ -1672,7 +1672,7 @@ static int handle_notif_stream_begin( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *notif, - struct bt_ctf_stream *notif_stream) + struct bt_stream *notif_stream) { int ret = 0; struct stream_state *stream_state; @@ -1699,7 +1699,7 @@ static int handle_notif_stream_end( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *notif, - struct bt_ctf_stream *notif_stream) + struct bt_stream *notif_stream) { int ret = 0; struct stream_state *stream_state; @@ -1734,7 +1734,7 @@ static int handle_notif_discarded_elements( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *notif, - struct bt_ctf_stream *notif_stream) + struct bt_stream *notif_stream) { int ret = 0; struct stream_state *stream_state; @@ -1763,8 +1763,8 @@ static int handle_notif_packet_begin( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *notif, - struct bt_ctf_stream *notif_stream, - struct bt_ctf_packet *notif_packet) + struct bt_stream *notif_stream, + struct bt_packet *notif_packet) { int ret = 0; struct stream_state *stream_state; @@ -1797,8 +1797,8 @@ static int handle_notif_packet_end( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *notif, - struct bt_ctf_stream *notif_stream, - struct bt_ctf_packet *notif_packet) + struct bt_stream *notif_stream, + struct bt_packet *notif_packet) { int ret = 0; struct stream_state *stream_state; @@ -1834,8 +1834,8 @@ static int handle_notif_event( struct bt_notification_iterator_private_connection *iterator, struct bt_notification *notif, - struct bt_ctf_stream *notif_stream, - struct bt_ctf_packet *notif_packet) + struct bt_stream *notif_stream, + struct bt_packet *notif_packet) { int ret = 0; struct stream_state *stream_state; @@ -1871,9 +1871,9 @@ int enqueue_notification_and_automatic( struct bt_notification *notif) { int ret = 0; - struct bt_ctf_event *notif_event = NULL; - struct bt_ctf_stream *notif_stream = NULL; - struct bt_ctf_packet *notif_packet = NULL; + struct bt_event *notif_event = NULL; + struct bt_stream *notif_stream = NULL; + struct bt_packet *notif_packet = NULL; assert(notif); @@ -1888,7 +1888,7 @@ int enqueue_notification_and_automatic( case BT_NOTIFICATION_TYPE_EVENT: notif_event = bt_notification_event_borrow_event(notif); assert(notif_event); - notif_packet = bt_ctf_event_borrow_packet(notif_event); + notif_packet = bt_event_borrow_packet(notif_event); assert(notif_packet); break; case BT_NOTIFICATION_TYPE_STREAM_BEGIN: @@ -1925,7 +1925,7 @@ int enqueue_notification_and_automatic( } if (notif_packet) { - notif_stream = bt_ctf_packet_borrow_stream(notif_packet); + notif_stream = bt_packet_borrow_stream(notif_packet); assert(notif_stream); } diff --git a/lib/graph/notification/discarded-elements.c b/lib/graph/notification/discarded-elements.c index 69b54035..f1369131 100644 --- a/lib/graph/notification/discarded-elements.c +++ b/lib/graph/notification/discarded-elements.c @@ -53,9 +53,9 @@ void bt_notification_discarded_elements_destroy(struct bt_object *obj) BT_HIDDEN struct bt_notification *bt_notification_discarded_elements_create( enum bt_notification_type type, - struct bt_ctf_stream *stream, - struct bt_ctf_clock_value *begin_clock_value, - struct bt_ctf_clock_value *end_clock_value, + struct bt_stream *stream, + struct bt_clock_value *begin_clock_value, + struct bt_clock_value *end_clock_value, uint64_t count) { struct bt_notification_discarded_elements *notification; @@ -70,7 +70,7 @@ struct bt_notification *bt_notification_discarded_elements_create( "begin-clock-value-addr=%p, end-clock-value-addr=%p, " "count=%" PRIu64, bt_notification_type_string(type), stream, - bt_ctf_stream_get_name(stream), begin_clock_value, + bt_stream_get_name(stream), begin_clock_value, end_clock_value, count); notification = g_new0(struct bt_notification_discarded_elements, 1); if (!notification) { @@ -90,7 +90,7 @@ struct bt_notification *bt_notification_discarded_elements_create( "begin-clock-value-addr=%p, end-clock-value-addr=%p, " "count=%" PRIu64 ", addr=%p", bt_notification_type_string(type), stream, - bt_ctf_stream_get_name(stream), begin_clock_value, + bt_stream_get_name(stream), begin_clock_value, end_clock_value, count, ret_notif); goto end; @@ -102,12 +102,12 @@ end: } BT_HIDDEN -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_elements_get_begin_clock_value( enum bt_notification_type type, struct bt_notification *notification) { - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_value *clock_value = NULL; struct bt_notification_discarded_elements *discarded_elems_notif; if (!notification) { @@ -133,12 +133,12 @@ end: } BT_HIDDEN -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_elements_get_end_clock_value( enum bt_notification_type type, struct bt_notification *notification) { - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_value *clock_value = NULL; struct bt_notification_discarded_elements *discarded_elems_notif; if (!notification) { @@ -194,11 +194,11 @@ end: } BT_HIDDEN -struct bt_ctf_stream *bt_notification_discarded_elements_get_stream( +struct bt_stream *bt_notification_discarded_elements_get_stream( enum bt_notification_type type, struct bt_notification *notification) { - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; struct bt_notification_discarded_elements *discarded_elems_notif; if (!notification) { diff --git a/lib/graph/notification/discarded-events.c b/lib/graph/notification/discarded-events.c index e6189231..24794678 100644 --- a/lib/graph/notification/discarded-events.c +++ b/lib/graph/notification/discarded-events.c @@ -25,7 +25,7 @@ #include #include -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_events_get_begin_clock_value( struct bt_notification *notification) { @@ -33,7 +33,7 @@ bt_notification_discarded_events_get_begin_clock_value( BT_NOTIFICATION_TYPE_DISCARDED_EVENTS, notification); } -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_events_get_end_clock_value( struct bt_notification *notification) { @@ -48,7 +48,7 @@ int64_t bt_notification_discarded_events_get_count( BT_NOTIFICATION_TYPE_DISCARDED_EVENTS, notification); } -struct bt_ctf_stream *bt_notification_discarded_events_get_stream( +struct bt_stream *bt_notification_discarded_events_get_stream( struct bt_notification *notification) { return bt_notification_discarded_elements_get_stream( diff --git a/lib/graph/notification/discarded-packets.c b/lib/graph/notification/discarded-packets.c index 0425a346..5d9b0ec3 100644 --- a/lib/graph/notification/discarded-packets.c +++ b/lib/graph/notification/discarded-packets.c @@ -25,7 +25,7 @@ #include #include -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_packets_get_begin_clock_value( struct bt_notification *notification) { @@ -33,7 +33,7 @@ bt_notification_discarded_packets_get_begin_clock_value( BT_NOTIFICATION_TYPE_DISCARDED_PACKETS, notification); } -struct bt_ctf_clock_value * +struct bt_clock_value * bt_notification_discarded_packets_get_end_clock_value( struct bt_notification *notification) { @@ -48,7 +48,7 @@ int64_t bt_notification_discarded_packets_get_count( BT_NOTIFICATION_TYPE_DISCARDED_PACKETS, notification); } -struct bt_ctf_stream *bt_notification_discarded_packets_get_stream( +struct bt_stream *bt_notification_discarded_packets_get_stream( struct bt_notification *notification) { return bt_notification_discarded_elements_get_stream( diff --git a/lib/graph/notification/event.c b/lib/graph/notification/event.c index d205e66d..73165737 100644 --- a/lib/graph/notification/event.c +++ b/lib/graph/notification/event.c @@ -68,19 +68,19 @@ bt_bool validate_clock_classes(struct bt_notification_event *notif) int trace_cc_count; int cc_prio_map_cc_count; size_t cc_prio_map_cc_i, trace_cc_i; - struct bt_ctf_clock_value *clock_value = NULL; - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_trace *trace = NULL; + struct bt_clock_value *clock_value = NULL; + struct bt_clock_class *clock_class = NULL; + struct bt_event_class *event_class = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_trace *trace = NULL; - event_class = bt_ctf_event_borrow_event_class(notif->event); + event_class = bt_event_borrow_event_class(notif->event); assert(event_class); - stream_class = bt_ctf_event_class_borrow_stream_class(event_class); + stream_class = bt_event_class_borrow_stream_class(event_class); assert(stream_class); - trace = bt_ctf_stream_class_borrow_trace(stream_class); + trace = bt_stream_class_borrow_trace(stream_class); assert(trace); - trace_cc_count = bt_ctf_trace_get_clock_class_count(trace); + trace_cc_count = bt_trace_get_clock_class_count(trace); assert(trace_cc_count >= 0); cc_prio_map_cc_count = bt_clock_class_priority_map_get_clock_class_count( @@ -95,7 +95,7 @@ bt_bool validate_clock_classes(struct bt_notification_event *notif) bt_clock_class_priority_map_get_clock_class_by_index( notif->cc_prio_map, cc_prio_map_cc_i); assert(clock_class); - clock_value = bt_ctf_event_get_clock_value(notif->event, + clock_value = bt_event_get_clock_value(notif->event, clock_class); if (!clock_value) { BT_LOGW("Event has no clock value for a clock class which exists in the notification's clock class priority map: " @@ -105,18 +105,18 @@ bt_bool validate_clock_classes(struct bt_notification_event *notif) "cc-prio-map-addr=%p, " "clock-class-addr=%p, clock-class-name=\"%s\"", notif, notif->event, event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), notif->cc_prio_map, clock_class, - bt_ctf_clock_class_get_name(clock_class)); + bt_clock_class_get_name(clock_class)); is_valid = BT_FALSE; goto end; } for (trace_cc_i = 0; trace_cc_i < trace_cc_count; trace_cc_i++) { - struct bt_ctf_clock_class *trace_clock_class = - bt_ctf_trace_get_clock_class_by_index(trace, + struct bt_clock_class *trace_clock_class = + bt_trace_get_clock_class_by_index(trace, trace_cc_i); assert(trace_clock_class); @@ -133,9 +133,9 @@ bt_bool validate_clock_classes(struct bt_notification_event *notif) "notif-addr=%p, trace-addr=%p, " "trace-name=\"%s\", cc-prio-map-addr=%p, " "clock-class-addr=%p, clock-class-name=\"%s\"", - notif, trace, bt_ctf_trace_get_name(trace), + notif, trace, bt_trace_get_name(trace), notif->cc_prio_map, clock_class, - bt_ctf_clock_class_get_name(clock_class)); + bt_clock_class_get_name(clock_class)); is_valid = BT_FALSE; goto end; } @@ -151,23 +151,23 @@ end: } static -bool event_has_trace(struct bt_ctf_event *event) +bool event_has_trace(struct bt_event *event) { - struct bt_ctf_event_class *event_class; - struct bt_ctf_stream_class *stream_class; + struct bt_event_class *event_class; + struct bt_stream_class *stream_class; - event_class = bt_ctf_event_borrow_event_class(event); + event_class = bt_event_borrow_event_class(event); assert(event_class); - stream_class = bt_ctf_event_class_borrow_stream_class(event_class); + stream_class = bt_event_class_borrow_stream_class(event_class); assert(stream_class); - return bt_ctf_stream_class_borrow_trace(stream_class) != NULL; + return bt_stream_class_borrow_trace(stream_class) != NULL; } -struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event, +struct bt_notification *bt_notification_event_create(struct bt_event *event, struct bt_clock_class_priority_map *cc_prio_map) { struct bt_notification_event *notification = NULL; - struct bt_ctf_event_class *event_class; + struct bt_event_class *event_class; if (!event) { BT_LOGW_STR("Invalid parameter: event is NULL."); @@ -186,24 +186,24 @@ struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event, } assert(cc_prio_map); - event_class = bt_ctf_event_borrow_event_class(event); + event_class = bt_event_borrow_event_class(event); assert(event_class); BT_LOGD("Creating event notification object: " "event-addr=%p, event-class-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "cc-prio-map-addr=%p", event, event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), cc_prio_map); + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), cc_prio_map); - if (!bt_ctf_event_borrow_packet(event)) { + if (!bt_event_borrow_packet(event)) { BT_LOGW("Invalid parameter: event has no packet: " "event-addr=%p, event-class-addr=%p, " "event-class-name=\"%s\", " "event-class-id=%" PRId64, event, event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); goto error; } @@ -213,8 +213,8 @@ struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event, "event-class-name=\"%s\", " "event-class-id=%" PRId64, event, event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); goto error; } @@ -234,13 +234,13 @@ struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event, "event-class-name=\"%s\", " "event-class-id=%" PRId64, event, event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class)); + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class)); goto error; } BT_LOGD_STR("Freezing event notification's event."); - bt_ctf_event_freeze(notification->event); + bt_event_freeze(notification->event); BT_LOGD_STR("Freezing event notification's clock class priority map."); bt_clock_class_priority_map_freeze(notification->cc_prio_map); BT_LOGD("Created event notification object: " @@ -248,8 +248,8 @@ struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event, "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "cc-prio-map-addr=%p, notif-addr=%p", event, event_class, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), cc_prio_map, + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), cc_prio_map, notification); goto end; @@ -261,10 +261,10 @@ end: return ¬ification->parent; } -struct bt_ctf_event *bt_notification_event_get_event( +struct bt_event *bt_notification_event_get_event( struct bt_notification *notification) { - struct bt_ctf_event *event = NULL; + struct bt_event *event = NULL; struct bt_notification_event *event_notification; if (!notification) { diff --git a/lib/graph/notification/inactivity.c b/lib/graph/notification/inactivity.c index bb9425ca..118b18d6 100644 --- a/lib/graph/notification/inactivity.c +++ b/lib/graph/notification/inactivity.c @@ -129,11 +129,11 @@ end: return cc_prio_map; } -struct bt_ctf_clock_value *bt_notification_inactivity_get_clock_value( +struct bt_clock_value *bt_notification_inactivity_get_clock_value( struct bt_notification *notification, - struct bt_ctf_clock_class *clock_class) + struct bt_clock_class *clock_class) { - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_value *clock_value = NULL; struct bt_notification_inactivity *inactivity_notification; if (!notification) { @@ -167,11 +167,11 @@ end: int bt_notification_inactivity_set_clock_value( struct bt_notification *notification, - struct bt_ctf_clock_value *clock_value) + struct bt_clock_value *clock_value) { int ret = 0; uint64_t prio; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_clock_class *clock_class = NULL; struct bt_notification_inactivity *inactivity_notification; if (!notification) { @@ -204,7 +204,7 @@ int bt_notification_inactivity_set_clock_value( inactivity_notification = container_of(notification, struct bt_notification_inactivity, parent); - clock_class = bt_ctf_clock_value_get_class(clock_value); + clock_class = bt_clock_value_get_class(clock_value); ret = bt_clock_class_priority_map_get_clock_class_priority( inactivity_notification->cc_prio_map, clock_class, &prio); if (ret) { @@ -214,7 +214,7 @@ int bt_notification_inactivity_set_clock_value( "clock-value-addr=%p", inactivity_notification, inactivity_notification->cc_prio_map, - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), clock_value); ret = -1; goto end; @@ -229,7 +229,7 @@ int bt_notification_inactivity_set_clock_value( "clock-value-addr=%p", inactivity_notification, inactivity_notification->cc_prio_map, - clock_class, bt_ctf_clock_class_get_name(clock_class), + clock_class, bt_clock_class_get_name(clock_class), clock_value); end: diff --git a/lib/graph/notification/packet.c b/lib/graph/notification/packet.c index d0286eec..76a9337b 100644 --- a/lib/graph/notification/packet.c +++ b/lib/graph/notification/packet.c @@ -63,29 +63,29 @@ void bt_notification_packet_end_destroy(struct bt_object *obj) } struct bt_notification *bt_notification_packet_begin_create( - struct bt_ctf_packet *packet) + struct bt_packet *packet) { struct bt_notification_packet_begin *notification; - struct bt_ctf_stream *stream; - struct bt_ctf_stream_class *stream_class; + struct bt_stream *stream; + struct bt_stream_class *stream_class; if (!packet) { BT_LOGW_STR("Invalid parameter: packet is NULL."); goto error; } - stream = bt_ctf_packet_borrow_stream(packet); + stream = bt_packet_borrow_stream(packet); assert(stream); - stream_class = bt_ctf_stream_borrow_stream_class(stream); + stream_class = bt_stream_borrow_stream_class(stream); assert(stream_class); BT_LOGD("Creating packet beginning notification object: " "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64, - packet, stream, bt_ctf_stream_get_name(stream), + packet, stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); notification = g_new0(struct bt_notification_packet_begin, 1); if (!notification) { BT_LOGE_STR("Failed to allocate one packet beginning notification."); @@ -100,19 +100,19 @@ struct bt_notification *bt_notification_packet_begin_create( "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", addr=%p", - packet, stream, bt_ctf_stream_get_name(stream), + packet, stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), notification); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), notification); return ¬ification->parent; error: return NULL; } -struct bt_ctf_packet *bt_notification_packet_begin_get_packet( +struct bt_packet *bt_notification_packet_begin_get_packet( struct bt_notification *notification) { - struct bt_ctf_packet *ret = NULL; + struct bt_packet *ret = NULL; struct bt_notification_packet_begin *packet_begin; if (!notification) { @@ -136,29 +136,29 @@ end: } struct bt_notification *bt_notification_packet_end_create( - struct bt_ctf_packet *packet) + struct bt_packet *packet) { struct bt_notification_packet_end *notification; - struct bt_ctf_stream *stream; - struct bt_ctf_stream_class *stream_class; + struct bt_stream *stream; + struct bt_stream_class *stream_class; if (!packet) { BT_LOGW_STR("Invalid parameter: packet is NULL."); goto error; } - stream = bt_ctf_packet_borrow_stream(packet); + stream = bt_packet_borrow_stream(packet); assert(stream); - stream_class = bt_ctf_stream_borrow_stream_class(stream); + stream_class = bt_stream_borrow_stream_class(stream); assert(stream_class); BT_LOGD("Creating packet end notification object: " "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64, - packet, stream, bt_ctf_stream_get_name(stream), + packet, stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); notification = g_new0(struct bt_notification_packet_end, 1); if (!notification) { BT_LOGE_STR("Failed to allocate one packet end notification."); @@ -173,19 +173,19 @@ struct bt_notification *bt_notification_packet_end_create( "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", addr=%p", - packet, stream, bt_ctf_stream_get_name(stream), + packet, stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), notification); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), notification); return ¬ification->parent; error: return NULL; } -struct bt_ctf_packet *bt_notification_packet_end_get_packet( +struct bt_packet *bt_notification_packet_end_get_packet( struct bt_notification *notification) { - struct bt_ctf_packet *ret = NULL; + struct bt_packet *ret = NULL; struct bt_notification_packet_end *packet_end; if (!notification) { diff --git a/lib/graph/notification/stream.c b/lib/graph/notification/stream.c index 9908c970..c036d1bf 100644 --- a/lib/graph/notification/stream.c +++ b/lib/graph/notification/stream.c @@ -47,17 +47,17 @@ void bt_notification_stream_end_destroy(struct bt_object *obj) } struct bt_notification *bt_notification_stream_end_create( - struct bt_ctf_stream *stream) + struct bt_stream *stream) { struct bt_notification_stream_end *notification; - struct bt_ctf_stream_class *stream_class; + struct bt_stream_class *stream_class; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); goto error; } - stream_class = bt_ctf_stream_borrow_stream_class(stream); + stream_class = bt_stream_borrow_stream_class(stream); assert(stream_class); if (stream->pos.fd >= 0) { @@ -65,9 +65,9 @@ struct bt_notification *bt_notification_stream_end_create( "stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name\"%s\", " "stream-class-id=%" PRId64, - stream, bt_ctf_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream, bt_stream_get_name(stream), stream_class, + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); goto error; } @@ -75,10 +75,10 @@ struct bt_notification *bt_notification_stream_end_create( "stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); notification = g_new0(struct bt_notification_stream_end, 1); if (!notification) { BT_LOGE_STR("Failed to allocate one stream end notification."); @@ -93,20 +93,20 @@ struct bt_notification *bt_notification_stream_end_create( "stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", addr=%p", - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), notification); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), notification); return ¬ification->parent; error: return NULL; } -struct bt_ctf_stream *bt_notification_stream_end_get_stream( +struct bt_stream *bt_notification_stream_end_get_stream( struct bt_notification *notification) { struct bt_notification_stream_end *stream_end; - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; if (!notification) { BT_LOGW_STR("Invalid parameter: notification is NULL."); @@ -143,17 +143,17 @@ void bt_notification_stream_begin_destroy(struct bt_object *obj) } struct bt_notification *bt_notification_stream_begin_create( - struct bt_ctf_stream *stream) + struct bt_stream *stream) { struct bt_notification_stream_begin *notification; - struct bt_ctf_stream_class *stream_class; + struct bt_stream_class *stream_class; if (!stream) { BT_LOGW_STR("Invalid parameter: stream is NULL."); goto error; } - stream_class = bt_ctf_stream_borrow_stream_class(stream); + stream_class = bt_stream_borrow_stream_class(stream); assert(stream_class); if (stream->pos.fd >= 0) { @@ -161,9 +161,9 @@ struct bt_notification *bt_notification_stream_begin_create( "stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name\"%s\", " "stream-class-id=%" PRId64, - stream, bt_ctf_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + stream, bt_stream_get_name(stream), stream_class, + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); goto error; } @@ -171,10 +171,10 @@ struct bt_notification *bt_notification_stream_begin_create( "stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64, - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class)); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class)); notification = g_new0(struct bt_notification_stream_begin, 1); if (!notification) { BT_LOGE_STR("Failed to allocate one stream beginning notification."); @@ -189,20 +189,20 @@ struct bt_notification *bt_notification_stream_begin_create( "stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", addr=%p", - stream, bt_ctf_stream_get_name(stream), + stream, bt_stream_get_name(stream), stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), notification); + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), notification); return ¬ification->parent; error: return NULL; } -struct bt_ctf_stream *bt_notification_stream_begin_get_stream( +struct bt_stream *bt_notification_stream_begin_get_stream( struct bt_notification *notification) { struct bt_notification_stream_begin *stream_begin; - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; if (!notification) { BT_LOGW_STR("Invalid parameter: notification is NULL."); diff --git a/plugins/ctf/common/btr/btr.c b/plugins/ctf/common/btr/btr.c index c0f0ac79..e393f301 100644 --- a/plugins/ctf/common/btr/btr.c +++ b/plugins/ctf/common/btr/btr.c @@ -61,7 +61,7 @@ struct stack_entry { * * Owned by this. */ - struct bt_ctf_field_type *base_type; + struct bt_field_type *base_type; /* Length of base field (always 1 for variant types) */ int64_t base_len; @@ -87,12 +87,12 @@ enum btr_state { }; /* Binary type reader */ -struct bt_ctf_btr { +struct bt_btr { /* Bisit stack */ struct stack *stack; /* Current basic field type */ - struct bt_ctf_field_type *cur_basic_field_type; + struct bt_field_type *cur_basic_field_type; /* Current state */ enum btr_state state; @@ -104,13 +104,13 @@ struct bt_ctf_btr { * types for which the common boundary is not the boundary of * a byte cannot have different byte orders. * - * This is set to BT_CTF_BYTE_ORDER_UNKNOWN on reset and when + * This is set to BT_BYTE_ORDER_UNKNOWN on reset and when * the last basic field type was a string type. */ - enum bt_ctf_byte_order last_bo; + enum bt_byte_order last_bo; /* Current byte order (copied to last_bo after a successful read) */ - enum bt_ctf_byte_order cur_bo; + enum bt_byte_order cur_bo; /* Stitch buffer infos */ struct { @@ -148,7 +148,7 @@ struct bt_ctf_btr { /* User stuff */ struct { /* Callback functions */ - struct bt_ctf_btr_cbs cbs; + struct bt_btr_cbs cbs; /* Private data */ void *data; @@ -224,24 +224,24 @@ void stack_destroy(struct stack *stack) } static inline -int64_t get_compound_field_type_length(struct bt_ctf_btr *btr, - struct bt_ctf_field_type *field_type) +int64_t get_compound_field_type_length(struct bt_btr *btr, + struct bt_field_type *field_type) { int64_t length; - switch (bt_ctf_field_type_get_type_id(field_type)) { - case BT_CTF_FIELD_TYPE_ID_STRUCT: - length = (int64_t) bt_ctf_field_type_structure_get_field_count( + switch (bt_field_type_get_type_id(field_type)) { + case BT_FIELD_TYPE_ID_STRUCT: + length = (int64_t) bt_field_type_structure_get_field_count( field_type); break; - case BT_CTF_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_VARIANT: /* Variant field types always "contain" a single type */ length = 1; break; - case BT_CTF_FIELD_TYPE_ID_ARRAY: - length = bt_ctf_field_type_array_get_length(field_type); + case BT_FIELD_TYPE_ID_ARRAY: + length = bt_field_type_array_get_length(field_type); break; - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_SEQUENCE: length = btr->user.cbs.query.get_sequence_length(field_type, btr->user.data); break; @@ -249,16 +249,16 @@ int64_t get_compound_field_type_length(struct bt_ctf_btr *btr, BT_LOGW("Cannot get field type's field count: btr-addr=%p, " "ft-addr=%p, ft-id=%s", btr, field_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(field_type))); - length = BT_CTF_BTR_STATUS_ERROR; + bt_field_type_id_string( + bt_field_type_get_type_id(field_type))); + length = BT_BTR_STATUS_ERROR; } return length; } static -int stack_push(struct stack *stack, struct bt_ctf_field_type *base_type, +int stack_push(struct stack *stack, struct bt_field_type *base_type, size_t base_len) { int ret = 0; @@ -270,14 +270,14 @@ int stack_push(struct stack *stack, struct bt_ctf_field_type *base_type, BT_LOGV("Pushing field type on stack: stack-addr=%p, " "ft-addr=%p, ft-id=%s, base-length=%zu, " "stack-size-before=%u, stack-size-after=%u", - stack, base_type, bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(base_type)), + stack, base_type, bt_field_type_id_string( + bt_field_type_get_type_id(base_type)), base_len, stack->entries->len, stack->entries->len + 1); entry = g_new0(struct stack_entry, 1); if (!entry) { BT_LOGE("Failed to allocate one stack entry: stack-addr=%p", stack); - ret = BT_CTF_BTR_STATUS_ERROR; + ret = BT_BTR_STATUS_ERROR; goto end; } @@ -291,8 +291,8 @@ end: } static -int stack_push_with_len(struct bt_ctf_btr *btr, - struct bt_ctf_field_type *base_type) +int stack_push_with_len(struct bt_btr *btr, + struct bt_field_type *base_type) { int ret = 0; int64_t base_len = get_compound_field_type_length(btr, base_type); @@ -300,9 +300,9 @@ int stack_push_with_len(struct bt_ctf_btr *btr, if (base_len < 0) { BT_LOGW("Cannot get compound field type's field count: " "btr-addr=%p, ft-addr=%p, ft-id=%s", - btr, base_type, bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(base_type))); - ret = BT_CTF_BTR_STATUS_ERROR; + btr, base_type, bt_field_type_id_string( + bt_field_type_get_type_id(base_type))); + ret = BT_BTR_STATUS_ERROR; goto end; } @@ -359,13 +359,13 @@ struct stack_entry *stack_top(struct stack *stack) } static inline -size_t available_bits(struct bt_ctf_btr *btr) +size_t available_bits(struct bt_btr *btr) { return btr->buf.sz - btr->buf.at; } static inline -void consume_bits(struct bt_ctf_btr *btr, size_t incr) +void consume_bits(struct bt_btr *btr, size_t incr) { BT_LOGV("Advancing cursor: btr-addr=%p, cur-before=%zu, cur-after=%zu", btr, btr->buf.at, btr->buf.at + incr); @@ -373,25 +373,25 @@ void consume_bits(struct bt_ctf_btr *btr, size_t incr) } static inline -bool has_enough_bits(struct bt_ctf_btr *btr, size_t sz) +bool has_enough_bits(struct bt_btr *btr, size_t sz) { return available_bits(btr) >= sz; } static inline -bool at_least_one_bit_left(struct bt_ctf_btr *btr) +bool at_least_one_bit_left(struct bt_btr *btr) { return has_enough_bits(btr, 1); } static inline -size_t packet_at(struct bt_ctf_btr *btr) +size_t packet_at(struct bt_btr *btr) { return btr->buf.packet_offset + btr->buf.at; } static inline -size_t buf_at_from_addr(struct bt_ctf_btr *btr) +size_t buf_at_from_addr(struct bt_btr *btr) { /* * Considering this: @@ -410,35 +410,35 @@ size_t buf_at_from_addr(struct bt_ctf_btr *btr) } static inline -int get_basic_field_type_size(struct bt_ctf_btr *btr, - struct bt_ctf_field_type *field_type) +int get_basic_field_type_size(struct bt_btr *btr, + struct bt_field_type *field_type) { int size; - switch (bt_ctf_field_type_get_type_id(field_type)) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: - size = bt_ctf_field_type_integer_get_size(field_type); + switch (bt_field_type_get_type_id(field_type)) { + case BT_FIELD_TYPE_ID_INTEGER: + size = bt_field_type_integer_get_size(field_type); break; - case BT_CTF_FIELD_TYPE_ID_FLOAT: + case BT_FIELD_TYPE_ID_FLOAT: { int exp_dig, mant_dig; exp_dig = - bt_ctf_field_type_floating_point_get_exponent_digits( + bt_field_type_floating_point_get_exponent_digits( field_type); mant_dig = - bt_ctf_field_type_floating_point_get_mantissa_digits( + bt_field_type_floating_point_get_mantissa_digits( field_type); assert(exp_dig >= 0); assert(mant_dig >= 0); size = exp_dig + mant_dig; break; } - case BT_CTF_FIELD_TYPE_ID_ENUM: + case BT_FIELD_TYPE_ID_ENUM: { - struct bt_ctf_field_type *int_type; + struct bt_field_type *int_type; - int_type = bt_ctf_field_type_enumeration_get_container_type( + int_type = bt_field_type_enumeration_get_container_type( field_type); assert(int_type); size = get_basic_field_type_size(btr, int_type); @@ -446,7 +446,7 @@ int get_basic_field_type_size(struct bt_ctf_btr *btr, break; } default: - size = BT_CTF_BTR_STATUS_ERROR; + size = BT_BTR_STATUS_ERROR; break; } @@ -454,20 +454,20 @@ int get_basic_field_type_size(struct bt_ctf_btr *btr, } static -void stitch_reset(struct bt_ctf_btr *btr) +void stitch_reset(struct bt_btr *btr) { btr->stitch.offset = 0; btr->stitch.at = 0; } static inline -size_t stitch_at_from_addr(struct bt_ctf_btr *btr) +size_t stitch_at_from_addr(struct bt_btr *btr) { return btr->stitch.offset + btr->stitch.at; } static -void stitch_append_from_buf(struct bt_ctf_btr *btr, size_t sz) +void stitch_append_from_buf(struct bt_btr *btr, size_t sz) { size_t stitch_byte_at; size_t buf_byte_at; @@ -489,13 +489,13 @@ void stitch_append_from_buf(struct bt_ctf_btr *btr, size_t sz) } static -void stitch_append_from_remaining_buf(struct bt_ctf_btr *btr) +void stitch_append_from_remaining_buf(struct bt_btr *btr) { stitch_append_from_buf(btr, available_bits(btr)); } static -void stitch_set_from_remaining_buf(struct bt_ctf_btr *btr) +void stitch_set_from_remaining_buf(struct bt_btr *btr) { stitch_reset(btr); btr->stitch.offset = IN_BYTE_OFFSET(buf_at_from_addr(btr)); @@ -503,17 +503,17 @@ void stitch_set_from_remaining_buf(struct bt_ctf_btr *btr) } static inline -enum bt_ctf_btr_status read_unsigned_bitfield(const uint8_t *buf, size_t at, - int64_t field_size, enum bt_ctf_byte_order bo, uint64_t *v) +enum bt_btr_status read_unsigned_bitfield(const uint8_t *buf, size_t at, + int64_t field_size, enum bt_byte_order bo, uint64_t *v) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_btr_status status = BT_BTR_STATUS_OK; switch (bo) { - case BT_CTF_BYTE_ORDER_BIG_ENDIAN: - case BT_CTF_BYTE_ORDER_NETWORK: + case BT_BYTE_ORDER_BIG_ENDIAN: + case BT_BYTE_ORDER_NETWORK: bt_bitfield_read_be(buf, uint8_t, at, field_size, v); break; - case BT_CTF_BYTE_ORDER_LITTLE_ENDIAN: + case BT_BYTE_ORDER_LITTLE_ENDIAN: bt_bitfield_read_le(buf, uint8_t, at, field_size, v); break; default: @@ -523,22 +523,22 @@ enum bt_ctf_btr_status read_unsigned_bitfield(const uint8_t *buf, size_t at, BT_LOGV("Read unsigned bit array: cur=%zu, size=%" PRId64 ", " "bo=%s, val=%" PRIu64, at, field_size, - bt_ctf_byte_order_string(bo), *v); + bt_byte_order_string(bo), *v); return status; } static inline -enum bt_ctf_btr_status read_signed_bitfield(const uint8_t *buf, size_t at, - int64_t field_size, enum bt_ctf_byte_order bo, int64_t *v) +enum bt_btr_status read_signed_bitfield(const uint8_t *buf, size_t at, + int64_t field_size, enum bt_byte_order bo, int64_t *v) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_btr_status status = BT_BTR_STATUS_OK; switch (bo) { - case BT_CTF_BYTE_ORDER_BIG_ENDIAN: - case BT_CTF_BYTE_ORDER_NETWORK: + case BT_BYTE_ORDER_BIG_ENDIAN: + case BT_BYTE_ORDER_NETWORK: bt_bitfield_read_be(buf, uint8_t, at, field_size, v); break; - case BT_CTF_BYTE_ORDER_LITTLE_ENDIAN: + case BT_BYTE_ORDER_LITTLE_ENDIAN: bt_bitfield_read_le(buf, uint8_t, at, field_size, v); break; default: @@ -548,18 +548,18 @@ enum bt_ctf_btr_status read_signed_bitfield(const uint8_t *buf, size_t at, BT_LOGV("Read signed bit array: cur=%zu, size=%" PRId64 ", " "bo=%s, val=%" PRId64, at, field_size, - bt_ctf_byte_order_string(bo), *v); + bt_byte_order_string(bo), *v); return status; } -typedef enum bt_ctf_btr_status (* read_basic_and_call_cb_t)(struct bt_ctf_btr *, +typedef enum bt_btr_status (* read_basic_and_call_cb_t)(struct bt_btr *, const uint8_t *, size_t); static inline -enum bt_ctf_btr_status validate_contiguous_bo(struct bt_ctf_btr *btr, - enum bt_ctf_byte_order next_bo) +enum bt_btr_status validate_contiguous_bo(struct bt_btr *btr, + enum bt_byte_order next_bo) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_btr_status status = BT_BTR_STATUS_OK; /* Always valid when at a byte boundary */ if (packet_at(btr) % 8 == 0) { @@ -567,56 +567,56 @@ enum bt_ctf_btr_status validate_contiguous_bo(struct bt_ctf_btr *btr, } /* Always valid if last byte order is unknown */ - if (btr->last_bo == BT_CTF_BYTE_ORDER_UNKNOWN) { + if (btr->last_bo == BT_BYTE_ORDER_UNKNOWN) { goto end; } /* Always valid if next byte order is unknown */ - if (next_bo == BT_CTF_BYTE_ORDER_UNKNOWN) { + if (next_bo == BT_BYTE_ORDER_UNKNOWN) { goto end; } /* Make sure last byte order is compatible with the next byte order */ switch (btr->last_bo) { - case BT_CTF_BYTE_ORDER_BIG_ENDIAN: - case BT_CTF_BYTE_ORDER_NETWORK: - if (next_bo != BT_CTF_BYTE_ORDER_BIG_ENDIAN && - next_bo != BT_CTF_BYTE_ORDER_NETWORK) { - status = BT_CTF_BTR_STATUS_ERROR; + case BT_BYTE_ORDER_BIG_ENDIAN: + case BT_BYTE_ORDER_NETWORK: + if (next_bo != BT_BYTE_ORDER_BIG_ENDIAN && + next_bo != BT_BYTE_ORDER_NETWORK) { + status = BT_BTR_STATUS_ERROR; } break; - case BT_CTF_BYTE_ORDER_LITTLE_ENDIAN: - if (next_bo != BT_CTF_BYTE_ORDER_LITTLE_ENDIAN) { - status = BT_CTF_BTR_STATUS_ERROR; + case BT_BYTE_ORDER_LITTLE_ENDIAN: + if (next_bo != BT_BYTE_ORDER_LITTLE_ENDIAN) { + status = BT_BTR_STATUS_ERROR; } break; default: - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; } end: if (status < 0) { BT_LOGW("Cannot read bit array: two different byte orders not at a byte boundary: " "btr-addr=%p, last-bo=%s, next-bo=%s", - btr, bt_ctf_byte_order_string(btr->last_bo), - bt_ctf_byte_order_string(next_bo)); + btr, bt_byte_order_string(btr->last_bo), + bt_byte_order_string(next_bo)); } return status; } static -enum bt_ctf_btr_status read_basic_float_and_call_cb(struct bt_ctf_btr *btr, +enum bt_btr_status read_basic_float_and_call_cb(struct bt_btr *btr, const uint8_t *buf, size_t at) { int ret; double dblval; int64_t field_size; - enum bt_ctf_byte_order bo; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_byte_order bo; + enum bt_btr_status status = BT_BTR_STATUS_OK; field_size = get_basic_field_type_size(btr, btr->cur_basic_field_type); - bo = bt_ctf_field_type_get_byte_order(btr->cur_basic_field_type); + bo = bt_field_type_get_byte_order(btr->cur_basic_field_type); btr->cur_bo = bo; switch (field_size) { @@ -628,17 +628,17 @@ enum bt_ctf_btr_status read_basic_float_and_call_cb(struct bt_ctf_btr *btr, float f; } f32; - ret = bt_ctf_field_type_floating_point_get_mantissa_digits( + ret = bt_field_type_floating_point_get_mantissa_digits( btr->cur_basic_field_type); assert(ret == 24); - ret = bt_ctf_field_type_floating_point_get_exponent_digits( + ret = bt_field_type_floating_point_get_exponent_digits( btr->cur_basic_field_type); assert(ret == 8); status = read_unsigned_bitfield(buf, at, field_size, bo, &v); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { BT_LOGW("Cannot read unsigned 32-bit bit array for floating point number field: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } @@ -653,18 +653,18 @@ enum bt_ctf_btr_status read_basic_float_and_call_cb(struct bt_ctf_btr *btr, double d; } f64; - ret = bt_ctf_field_type_floating_point_get_mantissa_digits( + ret = bt_field_type_floating_point_get_mantissa_digits( btr->cur_basic_field_type); assert(ret == 53); - ret = bt_ctf_field_type_floating_point_get_exponent_digits( + ret = bt_field_type_floating_point_get_exponent_digits( btr->cur_basic_field_type); assert(ret == 11); status = read_unsigned_bitfield(buf, at, field_size, bo, &f64.u); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { BT_LOGW("Cannot read unsigned 64-bit bit array for floating point number field: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } @@ -675,7 +675,7 @@ enum bt_ctf_btr_status read_basic_float_and_call_cb(struct bt_ctf_btr *btr, /* Only 32-bit and 64-bit fields are supported currently */ BT_LOGW("Only 32-bit and 64-bit floating point number fields are supported: " "btr-addr=%p", btr); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -687,10 +687,10 @@ enum bt_ctf_btr_status read_basic_float_and_call_cb(struct bt_ctf_btr *btr, status = btr->user.cbs.types.floating_point(dblval, btr->cur_basic_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); } } @@ -699,27 +699,27 @@ end: } static inline -enum bt_ctf_btr_status read_basic_int_and_call(struct bt_ctf_btr *btr, +enum bt_btr_status read_basic_int_and_call(struct bt_btr *btr, const uint8_t *buf, size_t at, - struct bt_ctf_field_type *int_type, - struct bt_ctf_field_type *orig_type) + struct bt_field_type *int_type, + struct bt_field_type *orig_type) { - int signd; + bt_bool signd; int64_t field_size; - enum bt_ctf_byte_order bo; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_byte_order bo; + enum bt_btr_status status = BT_BTR_STATUS_OK; - signd = bt_ctf_field_type_integer_get_signed(int_type); + signd = bt_field_type_integer_is_signed(int_type); field_size = get_basic_field_type_size(btr, int_type); if (field_size < 1) { BT_LOGW("Cannot get integer field type's size: " "btr=%p, at=%zu, ft-addr=%p", btr, at, int_type); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } - bo = bt_ctf_field_type_get_byte_order(int_type); + bo = bt_field_type_get_byte_order(int_type); /* * Update current byte order now because we could be reading @@ -732,10 +732,10 @@ enum bt_ctf_btr_status read_basic_int_and_call(struct bt_ctf_btr *btr, int64_t v; status = read_signed_bitfield(buf, at, field_size, bo, &v); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { BT_LOGW("Cannot read signed bit array for signed integer field: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } @@ -744,21 +744,21 @@ enum bt_ctf_btr_status read_basic_int_and_call(struct bt_ctf_btr *btr, status = btr->user.cbs.types.signed_int(v, btr->cur_basic_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); } } } else { uint64_t v; status = read_unsigned_bitfield(buf, at, field_size, bo, &v); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { BT_LOGW("Cannot read unsigned bit array for unsigned integer field: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } @@ -767,11 +767,11 @@ enum bt_ctf_btr_status read_basic_int_and_call(struct bt_ctf_btr *btr, status = btr->user.cbs.types.unsigned_int(v, btr->cur_basic_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); } } } @@ -781,7 +781,7 @@ end: } static -enum bt_ctf_btr_status read_basic_int_and_call_cb(struct bt_ctf_btr *btr, +enum bt_btr_status read_basic_int_and_call_cb(struct bt_btr *btr, const uint8_t *buf, size_t at) { return read_basic_int_and_call(btr, buf, at, btr->cur_basic_field_type, @@ -789,13 +789,13 @@ enum bt_ctf_btr_status read_basic_int_and_call_cb(struct bt_ctf_btr *btr, } static -enum bt_ctf_btr_status read_basic_enum_and_call_cb(struct bt_ctf_btr *btr, +enum bt_btr_status read_basic_enum_and_call_cb(struct bt_btr *btr, const uint8_t *buf, size_t at) { - struct bt_ctf_field_type *int_field_type; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + struct bt_field_type *int_field_type; + enum bt_btr_status status = BT_BTR_STATUS_OK; - int_field_type = bt_ctf_field_type_enumeration_get_container_type( + int_field_type = bt_field_type_enumeration_get_container_type( btr->cur_basic_field_type); assert(int_field_type); status = read_basic_int_and_call(btr, buf, at, @@ -805,17 +805,17 @@ enum bt_ctf_btr_status read_basic_enum_and_call_cb(struct bt_ctf_btr *btr, } static inline -enum bt_ctf_btr_status read_basic_type_and_call_continue(struct bt_ctf_btr *btr, +enum bt_btr_status read_basic_type_and_call_continue(struct bt_btr *btr, read_basic_and_call_cb_t read_basic_and_call_cb) { size_t available; int64_t field_size; int64_t needed_bits; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_btr_status status = BT_BTR_STATUS_OK; if (!at_least_one_bit_left(btr)) { BT_LOGV("Reached end of data: btr-addr=%p", btr); - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; goto end; } @@ -824,7 +824,7 @@ enum bt_ctf_btr_status read_basic_type_and_call_continue(struct bt_ctf_btr *btr, BT_LOGW("Cannot get basic field type's size: " "btr-addr=%p, ft-addr=%p", btr, btr->cur_basic_field_type); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -839,11 +839,11 @@ enum bt_ctf_btr_status read_basic_type_and_call_continue(struct bt_ctf_btr *btr, stitch_append_from_buf(btr, needed_bits); status = read_basic_and_call_cb(btr, btr->stitch.buf, btr->stitch.offset); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { BT_LOGW("Cannot read basic field: " "btr-addr=%p, ft-addr=%p, status=%s", btr, btr->cur_basic_field_type, - bt_ctf_btr_status_string(status)); + bt_btr_status_string(status)); goto end; } @@ -862,24 +862,24 @@ enum bt_ctf_btr_status read_basic_type_and_call_continue(struct bt_ctf_btr *btr, /* We are here; it means we don't have enough data to decode this */ BT_LOGV_STR("Not enough data to read the next basic field: appending to stitch buffer."); stitch_append_from_remaining_buf(btr); - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; end: return status; } static inline -enum bt_ctf_btr_status read_basic_type_and_call_begin(struct bt_ctf_btr *btr, +enum bt_btr_status read_basic_type_and_call_begin(struct bt_btr *btr, read_basic_and_call_cb_t read_basic_and_call_cb) { size_t available; int64_t field_size; - enum bt_ctf_byte_order bo; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_byte_order bo; + enum bt_btr_status status = BT_BTR_STATUS_OK; if (!at_least_one_bit_left(btr)) { BT_LOGV("Reached end of data: btr-addr=%p", btr); - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; goto end; } @@ -888,13 +888,13 @@ enum bt_ctf_btr_status read_basic_type_and_call_begin(struct bt_ctf_btr *btr, BT_LOGW("Cannot get basic field type's size: " "btr-addr=%p, ft-addr=%p", btr, btr->cur_basic_field_type); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } - bo = bt_ctf_field_type_get_byte_order(btr->cur_basic_field_type); + bo = bt_field_type_get_byte_order(btr->cur_basic_field_type); status = validate_contiguous_bo(btr, bo); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { /* validate_contiguous_bo() logs errors */ goto end; } @@ -905,11 +905,11 @@ enum bt_ctf_btr_status read_basic_type_and_call_begin(struct bt_ctf_btr *btr, /* We have all the bits; decode and set now */ status = read_basic_and_call_cb(btr, btr->buf.addr, buf_at_from_addr(btr)); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { BT_LOGW("Cannot read basic field: " "btr-addr=%p, ft-addr=%p, status=%s", btr, btr->cur_basic_field_type, - bt_ctf_btr_status_string(status)); + bt_btr_status_string(status)); goto end; } @@ -932,72 +932,72 @@ enum bt_ctf_btr_status read_basic_type_and_call_begin(struct bt_ctf_btr *btr, BT_LOGV_STR("Not enough data to read the next basic field: setting stitch buffer."); stitch_set_from_remaining_buf(btr); btr->state = BTR_STATE_READ_BASIC_CONTINUE; - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; end: return status; } static inline -enum bt_ctf_btr_status read_basic_int_type_and_call_begin( - struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_int_type_and_call_begin( + struct bt_btr *btr) { return read_basic_type_and_call_begin(btr, read_basic_int_and_call_cb); } static inline -enum bt_ctf_btr_status read_basic_int_type_and_call_continue( - struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_int_type_and_call_continue( + struct bt_btr *btr) { return read_basic_type_and_call_continue(btr, read_basic_int_and_call_cb); } static inline -enum bt_ctf_btr_status read_basic_float_type_and_call_begin( - struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_float_type_and_call_begin( + struct bt_btr *btr) { return read_basic_type_and_call_begin(btr, read_basic_float_and_call_cb); } static inline -enum bt_ctf_btr_status read_basic_float_type_and_call_continue( - struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_float_type_and_call_continue( + struct bt_btr *btr) { return read_basic_type_and_call_continue(btr, read_basic_float_and_call_cb); } static inline -enum bt_ctf_btr_status read_basic_enum_type_and_call_begin( - struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_enum_type_and_call_begin( + struct bt_btr *btr) { return read_basic_type_and_call_begin(btr, read_basic_enum_and_call_cb); } static inline -enum bt_ctf_btr_status read_basic_enum_type_and_call_continue( - struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_enum_type_and_call_continue( + struct bt_btr *btr) { return read_basic_type_and_call_continue(btr, read_basic_enum_and_call_cb); } static inline -enum bt_ctf_btr_status read_basic_string_type_and_call( - struct bt_ctf_btr *btr, bool begin) +enum bt_btr_status read_basic_string_type_and_call( + struct bt_btr *btr, bool begin) { size_t buf_at_bytes; const uint8_t *result; size_t available_bytes; const uint8_t *first_chr; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_btr_status status = BT_BTR_STATUS_OK; if (!at_least_one_bit_left(btr)) { BT_LOGV("Reached end of data: btr-addr=%p", btr); - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; goto end; } @@ -1012,10 +1012,10 @@ enum bt_ctf_btr_status read_basic_string_type_and_call( status = btr->user.cbs.types.string_begin( btr->cur_basic_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } } @@ -1029,18 +1029,18 @@ enum bt_ctf_btr_status read_basic_string_type_and_call( available_bytes, btr->cur_basic_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } } consume_bits(btr, BYTES_TO_BITS(available_bytes)); btr->state = BTR_STATE_READ_BASIC_CONTINUE; - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; } else { /* Found the null character */ size_t result_len = (size_t) (result - first_chr); @@ -1052,11 +1052,11 @@ enum bt_ctf_btr_status read_basic_string_type_and_call( result_len, btr->cur_basic_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } } @@ -1066,11 +1066,11 @@ enum bt_ctf_btr_status read_basic_string_type_and_call( status = btr->user.cbs.types.string_end( btr->cur_basic_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: " "btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } } @@ -1093,31 +1093,31 @@ end: } static inline -enum bt_ctf_btr_status read_basic_begin_state(struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_begin_state(struct bt_btr *btr) { - enum bt_ctf_btr_status status; + enum bt_btr_status status; assert(btr->cur_basic_field_type); - switch (bt_ctf_field_type_get_type_id(btr->cur_basic_field_type)) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: + switch (bt_field_type_get_type_id(btr->cur_basic_field_type)) { + case BT_FIELD_TYPE_ID_INTEGER: status = read_basic_int_type_and_call_begin(btr); break; - case BT_CTF_FIELD_TYPE_ID_FLOAT: + case BT_FIELD_TYPE_ID_FLOAT: status = read_basic_float_type_and_call_begin(btr); break; - case BT_CTF_FIELD_TYPE_ID_ENUM: + case BT_FIELD_TYPE_ID_ENUM: status = read_basic_enum_type_and_call_begin(btr); break; - case BT_CTF_FIELD_TYPE_ID_STRING: + case BT_FIELD_TYPE_ID_STRING: status = read_basic_string_type_and_call(btr, true); break; default: BT_LOGF("Unknown basic field type ID: " "btr-addr=%p, ft-addr=%p, ft-id=%s", btr, btr->cur_basic_field_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id( + bt_field_type_id_string( + bt_field_type_get_type_id( btr->cur_basic_field_type))); abort(); } @@ -1126,31 +1126,31 @@ enum bt_ctf_btr_status read_basic_begin_state(struct bt_ctf_btr *btr) } static inline -enum bt_ctf_btr_status read_basic_continue_state(struct bt_ctf_btr *btr) +enum bt_btr_status read_basic_continue_state(struct bt_btr *btr) { - enum bt_ctf_btr_status status; + enum bt_btr_status status; assert(btr->cur_basic_field_type); - switch (bt_ctf_field_type_get_type_id(btr->cur_basic_field_type)) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: + switch (bt_field_type_get_type_id(btr->cur_basic_field_type)) { + case BT_FIELD_TYPE_ID_INTEGER: status = read_basic_int_type_and_call_continue(btr); break; - case BT_CTF_FIELD_TYPE_ID_FLOAT: + case BT_FIELD_TYPE_ID_FLOAT: status = read_basic_float_type_and_call_continue(btr); break; - case BT_CTF_FIELD_TYPE_ID_ENUM: + case BT_FIELD_TYPE_ID_ENUM: status = read_basic_enum_type_and_call_continue(btr); break; - case BT_CTF_FIELD_TYPE_ID_STRING: + case BT_FIELD_TYPE_ID_STRING: status = read_basic_string_type_and_call(btr, false); break; default: BT_LOGF("Unknown basic field type ID: " "btr-addr=%p, ft-addr=%p, ft-id=%s", btr, btr->cur_basic_field_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id( + bt_field_type_id_string( + bt_field_type_get_type_id( btr->cur_basic_field_type))); abort(); } @@ -1159,7 +1159,7 @@ enum bt_ctf_btr_status read_basic_continue_state(struct bt_ctf_btr *btr) } static inline -size_t bits_to_skip_to_align_to(struct bt_ctf_btr *btr, size_t align) +size_t bits_to_skip_to_align_to(struct bt_btr *btr, size_t align) { size_t aligned_packet_at; @@ -1168,22 +1168,22 @@ size_t bits_to_skip_to_align_to(struct bt_ctf_btr *btr, size_t align) } static inline -enum bt_ctf_btr_status align_type_state(struct bt_ctf_btr *btr, - struct bt_ctf_field_type *field_type, enum btr_state next_state) +enum bt_btr_status align_type_state(struct bt_btr *btr, + struct bt_field_type *field_type, enum btr_state next_state) { int field_alignment; size_t skip_bits; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_btr_status status = BT_BTR_STATUS_OK; /* Get field's alignment */ - field_alignment = bt_ctf_field_type_get_alignment(field_type); + field_alignment = bt_field_type_get_alignment(field_type); if (field_alignment < 0) { BT_LOGW("Cannot get field type's alignment: " "btr-addr=%p, ft-addr=%p, ft-id=%s", btr, field_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(field_type))); - status = BT_CTF_BTR_STATUS_ERROR; + bt_field_type_id_string( + bt_field_type_get_type_id(field_type))); + status = BT_BTR_STATUS_ERROR; goto end; } @@ -1206,7 +1206,7 @@ enum bt_ctf_btr_status align_type_state(struct bt_ctf_btr *btr, /* Make sure there's at least one bit left */ if (!at_least_one_bit_left(btr)) { - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; goto end; } @@ -1222,7 +1222,7 @@ enum bt_ctf_btr_status align_type_state(struct bt_ctf_btr *btr, } else { /* No: need more data */ BT_LOGV("Reached end of data when aligning: btr-addr=%p", btr); - status = BT_CTF_BTR_STATUS_EOF; + status = BT_BTR_STATUS_EOF; } end: @@ -1230,21 +1230,21 @@ end: } static inline -bool is_compound_type(struct bt_ctf_field_type *field_type) +bool is_compound_type(struct bt_field_type *field_type) { - enum bt_ctf_field_type_id id = bt_ctf_field_type_get_type_id(field_type); + enum bt_field_type_id id = bt_field_type_get_type_id(field_type); - return id == BT_CTF_FIELD_TYPE_ID_STRUCT || id == BT_CTF_FIELD_TYPE_ID_ARRAY || - id == BT_CTF_FIELD_TYPE_ID_SEQUENCE || id == BT_CTF_FIELD_TYPE_ID_VARIANT; + return id == BT_FIELD_TYPE_ID_STRUCT || id == BT_FIELD_TYPE_ID_ARRAY || + id == BT_FIELD_TYPE_ID_SEQUENCE || id == BT_FIELD_TYPE_ID_VARIANT; } static inline -enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) +enum bt_btr_status next_field_state(struct bt_btr *btr) { int ret; struct stack_entry *top; - struct bt_ctf_field_type *next_field_type = NULL; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + struct bt_field_type *next_field_type = NULL; + enum bt_btr_status status = BT_BTR_STATUS_OK; if (stack_empty(btr->stack)) { goto end; @@ -1259,10 +1259,10 @@ enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) status = btr->user.cbs.types.compound_end( top->base_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } } @@ -1280,26 +1280,26 @@ enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) } /* Get next field's type */ - switch (bt_ctf_field_type_get_type_id(top->base_type)) { - case BT_CTF_FIELD_TYPE_ID_STRUCT: - ret = bt_ctf_field_type_structure_get_field( + switch (bt_field_type_get_type_id(top->base_type)) { + case BT_FIELD_TYPE_ID_STRUCT: + ret = bt_field_type_structure_get_field_by_index( top->base_type, NULL, &next_field_type, top->index); if (ret) { next_field_type = NULL; } break; - case BT_CTF_FIELD_TYPE_ID_ARRAY: + case BT_FIELD_TYPE_ID_ARRAY: next_field_type = - bt_ctf_field_type_array_get_element_type( + bt_field_type_array_get_element_type( top->base_type); break; - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_SEQUENCE: next_field_type = - bt_ctf_field_type_sequence_get_element_type( + bt_field_type_sequence_get_element_type( top->base_type); break; - case BT_CTF_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_VARIANT: /* Variant types are dynamic: query the user, he should know! */ next_field_type = btr->user.cbs.query.get_variant_type( @@ -1314,10 +1314,10 @@ enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) "btr-addr=%p, base-ft-addr=%p, base-ft-id=%s, " "index=%" PRId64, btr, top->base_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(top->base_type)), + bt_field_type_id_string( + bt_field_type_get_type_id(top->base_type)), top->index); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -1327,10 +1327,10 @@ enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) status = btr->user.cbs.types.compound_begin( next_field_type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(status)); - if (status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(status)); + if (status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); goto end; } } @@ -1338,7 +1338,7 @@ enum bt_ctf_btr_status next_field_state(struct bt_ctf_btr *btr) ret = stack_push_with_len(btr, next_field_type); if (ret) { /* stack_push_with_len() logs errors */ - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -1363,9 +1363,9 @@ end: } static inline -enum bt_ctf_btr_status handle_state(struct bt_ctf_btr *btr) +enum bt_btr_status handle_state(struct bt_btr *btr) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; + enum bt_btr_status status = BT_BTR_STATUS_OK; BT_LOGV("Handling state: btr-addr=%p, state=%s", btr, btr_state_string(btr->state)); @@ -1393,16 +1393,16 @@ enum bt_ctf_btr_status handle_state(struct bt_ctf_btr *btr) } BT_LOGV("Handled state: btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(status)); + btr, bt_btr_status_string(status)); return status; } -struct bt_ctf_btr *bt_ctf_btr_create(struct bt_ctf_btr_cbs cbs, void *data) +struct bt_btr *bt_btr_create(struct bt_btr_cbs cbs, void *data) { - struct bt_ctf_btr *btr; + struct bt_btr *btr; BT_LOGD_STR("Creating binary type reader (BTR)."); - btr = g_new0(struct bt_ctf_btr, 1); + btr = g_new0(struct bt_btr, 1); if (!btr) { BT_LOGE_STR("Failed to allocate one binary type reader."); goto end; @@ -1411,7 +1411,7 @@ struct bt_ctf_btr *bt_ctf_btr_create(struct bt_ctf_btr_cbs cbs, void *data) btr->stack = stack_new(); if (!btr->stack) { BT_LOGE_STR("Cannot create BTR's stack."); - bt_ctf_btr_destroy(btr); + bt_btr_destroy(btr); btr = NULL; goto end; } @@ -1425,7 +1425,7 @@ end: return btr; } -void bt_ctf_btr_destroy(struct bt_ctf_btr *btr) +void bt_btr_destroy(struct bt_btr *btr) { if (btr->stack) { stack_destroy(btr->stack); @@ -1437,18 +1437,18 @@ void bt_ctf_btr_destroy(struct bt_ctf_btr *btr) } static -void reset(struct bt_ctf_btr *btr) +void reset(struct bt_btr *btr) { BT_LOGD("Resetting BTR: addr=%p", btr); stack_clear(btr->stack); BT_PUT(btr->cur_basic_field_type); stitch_reset(btr); btr->buf.addr = NULL; - btr->last_bo = BT_CTF_BYTE_ORDER_UNKNOWN; + btr->last_bo = BT_BYTE_ORDER_UNKNOWN; } static -void update_packet_offset(struct bt_ctf_btr *btr) +void update_packet_offset(struct bt_btr *btr) { BT_LOGV("Updating packet offset for next call: " "btr-addr=%p, cur-packet-offset=%zu, next-packet-offset=%zu", @@ -1457,10 +1457,10 @@ void update_packet_offset(struct bt_ctf_btr *btr) btr->buf.packet_offset += btr->buf.at; } -size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, - struct bt_ctf_field_type *type, const uint8_t *buf, +size_t bt_btr_start(struct bt_btr *btr, + struct bt_field_type *type, const uint8_t *buf, size_t offset, size_t packet_offset, size_t sz, - enum bt_ctf_btr_status *status) + enum bt_btr_status *status) { assert(btr); assert(buf); @@ -1473,7 +1473,7 @@ size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, btr->buf.packet_offset = packet_offset; btr->buf.buf_sz = sz; btr->buf.sz = BYTES_TO_BITS(sz) - offset; - *status = BT_CTF_BTR_STATUS_OK; + *status = BT_BTR_STATUS_OK; BT_LOGV("Starting decoding: btr-addr=%p, ft-addr=%p, " "buf-addr=%p, buf-size=%zu, offset=%zu, " @@ -1490,10 +1490,10 @@ size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, *status = btr->user.cbs.types.compound_begin( type, btr->user.data); BT_LOGV("User function returned: status=%s", - bt_ctf_btr_status_string(*status)); - if (*status != BT_CTF_BTR_STATUS_OK) { + bt_btr_status_string(*status)); + if (*status != BT_BTR_STATUS_OK) { BT_LOGW("User function failed: btr-addr=%p, status=%s", - btr, bt_ctf_btr_status_string(*status)); + btr, bt_btr_status_string(*status)); goto end; } } @@ -1501,7 +1501,7 @@ size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, stack_ret = stack_push_with_len(btr, type); if (stack_ret) { /* stack_push_with_len() logs errors */ - *status = BT_CTF_BTR_STATUS_ERROR; + *status = BT_BTR_STATUS_ERROR; goto end; } @@ -1518,7 +1518,7 @@ size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, while (true) { *status = handle_state(btr); - if (*status != BT_CTF_BTR_STATUS_OK || + if (*status != BT_BTR_STATUS_OK || btr->state == BTR_STATE_DONE) { break; } @@ -1531,9 +1531,9 @@ end: return btr->buf.at; } -size_t bt_ctf_btr_continue(struct bt_ctf_btr *btr, +size_t bt_btr_continue(struct bt_btr *btr, const uint8_t *buf, size_t sz, - enum bt_ctf_btr_status *status) + enum bt_btr_status *status) { assert(btr); assert(buf); @@ -1543,7 +1543,7 @@ size_t bt_ctf_btr_continue(struct bt_ctf_btr *btr, btr->buf.at = 0; btr->buf.buf_sz = sz; btr->buf.sz = BYTES_TO_BITS(sz); - *status = BT_CTF_BTR_STATUS_OK; + *status = BT_BTR_STATUS_OK; BT_LOGV("Continuing decoding: btr-addr=%p, buf-addr=%p, buf-size=%zu", btr, buf, sz); @@ -1553,7 +1553,7 @@ size_t bt_ctf_btr_continue(struct bt_ctf_btr *btr, while (true) { *status = handle_state(btr); - if (*status != BT_CTF_BTR_STATUS_OK || + if (*status != BT_BTR_STATUS_OK || btr->state == BTR_STATE_DONE) { break; } diff --git a/plugins/ctf/common/btr/btr.h b/plugins/ctf/common/btr/btr.h index 4b5e7bc7..55d95912 100644 --- a/plugins/ctf/common/btr/btr.h +++ b/plugins/ctf/common/btr/btr.h @@ -51,37 +51,37 @@ /** * Binary type reader API status codes. */ -enum bt_ctf_btr_status { +enum bt_btr_status { /** Out of memory. */ - BT_CTF_BTR_STATUS_ENOMEM = -5, + BT_BTR_STATUS_ENOMEM = -5, /** * The binary stream reader reached the end of the user-provided * buffer, but data is still needed to finish decoding the * requested type. * - * The user needs to call bt_ctf_btr_continue() as long as - * #BT_CTF_BTR_STATUS_EOF is returned to complete the decoding + * The user needs to call bt_btr_continue() as long as + * #BT_BTR_STATUS_EOF is returned to complete the decoding * process of a given type. */ - BT_CTF_BTR_STATUS_EOF = 1, + BT_BTR_STATUS_EOF = 1, /** Invalid argument. */ - BT_CTF_BTR_STATUS_INVAL = -3, + BT_BTR_STATUS_INVAL = -3, /** General error. */ - BT_CTF_BTR_STATUS_ERROR = -1, + BT_BTR_STATUS_ERROR = -1, /** Everything okay. */ - BT_CTF_BTR_STATUS_OK = 0, + BT_BTR_STATUS_OK = 0, }; /** Type reader. */ -struct bt_ctf_btr; +struct bt_btr; /* * Type reader user callback functions. */ -struct bt_ctf_btr_cbs { +struct bt_btr_cbs { /** * Type callback functions. * @@ -93,7 +93,7 @@ struct bt_ctf_btr_cbs { * Each function also receives the CTF IR field type associated * with the call, and user data (registered to the type reader * calling them). This field type is a weak reference; the - * callback function must use bt_ctf_field_type_get() to keep + * callback function must use bt_field_type_get() to keep * its own reference of it. * * Actual CTF IR fields are \em not created here; this would be @@ -103,9 +103,9 @@ struct bt_ctf_btr_cbs { * All the type callback functions return one of the following * values: * - * - #BT_CTF_BTR_STATUS_OK: Everything is okay; + * - #BT_BTR_STATUS_OK: Everything is okay; * continue the decoding process. - * - #BT_CTF_BTR_STATUS_ERROR: General error (reported + * - #BT_BTR_STATUS_ERROR: General error (reported * to type reader's user). * * Any member of this structure may be set to \c NULL, should @@ -122,11 +122,11 @@ struct bt_ctf_btr_cbs { * @param type Integer or enumeration type (weak * reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* signed_int)(int64_t value, - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* signed_int)(int64_t value, + struct bt_field_type *type, void *data); /** * Called when an unsigned integer type is completely @@ -138,11 +138,11 @@ struct bt_ctf_btr_cbs { * @param type Integer or enumeration type (weak * reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* unsigned_int)(uint64_t value, - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* unsigned_int)(uint64_t value, + struct bt_field_type *type, void *data); /** * Called when a floating point number type is @@ -152,42 +152,42 @@ struct bt_ctf_btr_cbs { * @param type Floating point number type (weak * reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* floating_point)(double value, - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* floating_point)(double value, + struct bt_field_type *type, void *data); /** * Called when a string type begins. * * All the following user callback function calls will - * be made to bt_ctf_btr_cbs::types::string(), each of + * be made to bt_btr_cbs::types::string(), each of * them providing one substring of the complete string * type's value. * * @param type Beginning string type (weak reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* string_begin)( - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* string_begin)( + struct bt_field_type *type, void *data); /** * Called when a string type's substring is decoded - * (between a call to bt_ctf_btr_cbs::types::string_begin() - * and a call to bt_ctf_btr_cbs::types::string_end()). + * (between a call to bt_btr_cbs::types::string_begin() + * and a call to bt_btr_cbs::types::string_end()). * * @param value String value (\em not null-terminated) * @param len String value length * @param type String type (weak reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* string)(const char *value, - size_t len, struct bt_ctf_field_type *type, + enum bt_btr_status (* string)(const char *value, + size_t len, struct bt_field_type *type, void *data); /** @@ -195,11 +195,11 @@ struct bt_ctf_btr_cbs { * * @param type Ending string type (weak reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* string_end)( - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* string_end)( + struct bt_field_type *type, void *data); /** * Called when a compound type begins. @@ -207,32 +207,32 @@ struct bt_ctf_btr_cbs { * All the following type callback function calls will * signal sequential elements of this compound type, * until the next corresponding - * bt_ctf_btr_cbs::types::compound_end() is called. + * bt_btr_cbs::types::compound_end() is called. * * If \p type is a variant type, then only one type * callback function call will follow before the call to - * bt_ctf_btr_cbs::types::compound_end(). This single + * bt_btr_cbs::types::compound_end(). This single * call indicates the selected type of this variant * type. * * @param type Beginning compound type (weak reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* compound_begin)( - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* compound_begin)( + struct bt_field_type *type, void *data); /** * Called when a compound type ends. * * @param type Ending compound type (weak reference) * @param data User data - * @returns #BT_CTF_BTR_STATUS_OK or - * #BT_CTF_BTR_STATUS_ERROR + * @returns #BT_BTR_STATUS_OK or + * #BT_BTR_STATUS_ERROR */ - enum bt_ctf_btr_status (* compound_end)( - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* compound_end)( + struct bt_field_type *type, void *data); } types; /** @@ -251,9 +251,9 @@ struct bt_ctf_btr_cbs { * @param type Sequence type (weak reference) * @param data User data * @returns Sequence length or - * #BT_CTF_BTR_STATUS_ERROR on error + * #BT_BTR_STATUS_ERROR on error */ - int64_t (* get_sequence_length)(struct bt_ctf_field_type *type, + int64_t (* get_sequence_length)(struct bt_field_type *type, void *data); /** @@ -265,8 +265,8 @@ struct bt_ctf_btr_cbs { * @returns Current selected type (owned by * this) or \c NULL on error */ - struct bt_ctf_field_type * (* get_variant_type)( - struct bt_ctf_field_type *type, void *data); + struct bt_field_type * (* get_variant_type)( + struct bt_field_type *type, void *data); } query; }; @@ -277,14 +277,14 @@ struct bt_ctf_btr_cbs { * @param data User data (passed to user callback functions) * @returns New binary type reader on success, or \c NULL on error */ -struct bt_ctf_btr *bt_ctf_btr_create(struct bt_ctf_btr_cbs cbs, void *data); +struct bt_btr *bt_btr_create(struct bt_btr_cbs cbs, void *data); /** * Destroys a CTF binary type reader, freeing all internal resources. * * @param btr Binary type reader */ -void bt_ctf_btr_destroy(struct bt_ctf_btr *btr); +void bt_btr_destroy(struct bt_btr *btr); /** * Decodes a given CTF type from a buffer of bytes. @@ -294,18 +294,18 @@ void bt_ctf_btr_destroy(struct bt_ctf_btr *btr); * The \p status output parameter is where a status is written, amongst * the following: * - * - #BT_CTF_BTR_STATUS_OK: Decoding is done. - * - #BT_CTF_BTR_STATUS_EOF: The end of the buffer was reached, + * - #BT_BTR_STATUS_OK: Decoding is done. + * - #BT_BTR_STATUS_EOF: The end of the buffer was reached, * but more data is needed to finish the decoding process of the - * requested type. The user needs to call bt_ctf_btr_continue() - * as long as #BT_CTF_BTR_STATUS_EOF is returned to complete the + * requested type. The user needs to call bt_btr_continue() + * as long as #BT_BTR_STATUS_EOF is returned to complete the * decoding process of the original type. - * - #BT_CTF_BTR_STATUS_INVAL: Invalid argument. - * - #BT_CTF_BTR_STATUS_ERROR: General error. + * - #BT_BTR_STATUS_INVAL: Invalid argument. + * - #BT_BTR_STATUS_ERROR: General error. * * Calling this function resets the type reader's internal state. If - * #BT_CTF_BTR_STATUS_EOF is returned, bt_ctf_btr_continue() needs to - * be called next, \em not bt_ctf_btr_decode(). + * #BT_BTR_STATUS_EOF is returned, bt_btr_continue() needs to + * be called next, \em not bt_btr_decode(). * * @param btr Binary type reader * @param type Type to decode (weak reference) @@ -317,10 +317,10 @@ void bt_ctf_btr_destroy(struct bt_ctf_btr *btr); * @param status Returned status (see description above) * @returns Number of consumed bits */ -size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, - struct bt_ctf_field_type *type, const uint8_t *buf, +size_t bt_btr_start(struct bt_btr *btr, + struct bt_field_type *type, const uint8_t *buf, size_t offset, size_t packet_offset, size_t sz, - enum bt_ctf_btr_status *status); + enum bt_btr_status *status); /** * Continues the decoding process a given CTF type. @@ -330,14 +330,14 @@ size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, * The \p status output parameter is where a status is placed, amongst * the following: * - * - #BT_CTF_BTR_STATUS_OK: decoding is done. - * - #BT_CTF_BTR_STATUS_EOF: the end of the buffer was reached, + * - #BT_BTR_STATUS_OK: decoding is done. + * - #BT_BTR_STATUS_EOF: the end of the buffer was reached, * but more data is needed to finish the decoding process of the - * requested type. The user needs to call bt_ctf_btr_continue() - * as long as #BT_CTF_BTR_STATUS_EOF is returned to complete the + * requested type. The user needs to call bt_btr_continue() + * as long as #BT_BTR_STATUS_EOF is returned to complete the * decoding process of the original type. - * - #BT_CTF_BTR_STATUS_INVAL: invalid argument. - * - #BT_CTF_BTR_STATUS_ERROR: general error. + * - #BT_BTR_STATUS_INVAL: invalid argument. + * - #BT_BTR_STATUS_ERROR: general error. * * @param btr Binary type reader * @param buf Buffer @@ -345,24 +345,24 @@ size_t bt_ctf_btr_start(struct bt_ctf_btr *btr, * @param status Returned status (see description above) * @returns Number of consumed bits */ -size_t bt_ctf_btr_continue(struct bt_ctf_btr *btr, +size_t bt_btr_continue(struct bt_btr *btr, const uint8_t *buf, size_t sz, - enum bt_ctf_btr_status *status); + enum bt_btr_status *status); static inline -const char *bt_ctf_btr_status_string(enum bt_ctf_btr_status status) +const char *bt_btr_status_string(enum bt_btr_status status) { switch (status) { - case BT_CTF_BTR_STATUS_ENOMEM: - return "BT_CTF_BTR_STATUS_ENOMEM"; - case BT_CTF_BTR_STATUS_EOF: - return "BT_CTF_BTR_STATUS_EOF"; - case BT_CTF_BTR_STATUS_INVAL: - return "BT_CTF_BTR_STATUS_INVAL"; - case BT_CTF_BTR_STATUS_ERROR: - return "BT_CTF_BTR_STATUS_ERROR"; - case BT_CTF_BTR_STATUS_OK: - return "BT_CTF_BTR_STATUS_OK"; + case BT_BTR_STATUS_ENOMEM: + return "BT_BTR_STATUS_ENOMEM"; + case BT_BTR_STATUS_EOF: + return "BT_BTR_STATUS_EOF"; + case BT_BTR_STATUS_INVAL: + return "BT_BTR_STATUS_INVAL"; + case BT_BTR_STATUS_ERROR: + return "BT_BTR_STATUS_ERROR"; + case BT_BTR_STATUS_OK: + return "BT_BTR_STATUS_OK"; default: return "(unknown)"; } diff --git a/plugins/ctf/common/metadata/ast.h b/plugins/ctf/common/metadata/ast.h index 6d9e43bf..9e697bda 100644 --- a/plugins/ctf/common/metadata/ast.h +++ b/plugins/ctf/common/metadata/ast.h @@ -317,7 +317,7 @@ struct ctf_visitor_generate_ir *ctf_visitor_generate_ir_create( void ctf_visitor_generate_ir_destroy(struct ctf_visitor_generate_ir *visitor); BT_HIDDEN -struct bt_ctf_trace *ctf_visitor_generate_ir_get_trace( +struct bt_trace *ctf_visitor_generate_ir_get_trace( struct ctf_visitor_generate_ir *visitor); BT_HIDDEN diff --git a/plugins/ctf/common/metadata/decoder.c b/plugins/ctf/common/metadata/decoder.c index 814da165..c52b4fc6 100644 --- a/plugins/ctf/common/metadata/decoder.c +++ b/plugins/ctf/common/metadata/decoder.c @@ -552,7 +552,7 @@ end: } BT_HIDDEN -struct bt_ctf_trace *ctf_metadata_decoder_get_trace( +struct bt_trace *ctf_metadata_decoder_get_trace( struct ctf_metadata_decoder *mdec) { return ctf_visitor_generate_ir_get_trace(mdec->visitor); diff --git a/plugins/ctf/common/metadata/decoder.h b/plugins/ctf/common/metadata/decoder.h index 6ab0f30b..832de03b 100644 --- a/plugins/ctf/common/metadata/decoder.h +++ b/plugins/ctf/common/metadata/decoder.h @@ -18,7 +18,7 @@ #include #include -struct bt_ctf_trace; +struct bt_trace; /* A CTF metadata decoder object */ struct ctf_metadata_decoder; @@ -96,7 +96,7 @@ enum ctf_metadata_decoder_status ctf_metadata_decoder_decode( * ctf_metadata_decoder_destroy(). */ BT_HIDDEN -struct bt_ctf_trace *ctf_metadata_decoder_get_trace( +struct bt_trace *ctf_metadata_decoder_get_trace( struct ctf_metadata_decoder *metadata_decoder); /* diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index 34c3716a..f5fab152 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -146,7 +146,7 @@ enum loglevel { #define _BT_LIST_FIRST_ENTRY(_ptr, _type, _member) \ bt_list_entry((_ptr)->next, _type, _member) -#define _BT_CTF_FIELD_TYPE_INIT(_name) struct bt_ctf_field_type *_name = NULL; +#define _BT_FIELD_TYPE_INIT(_name) struct bt_field_type *_name = NULL; #define _BT_LOGE_DUP_ATTR(_node, _attr, _entity) \ _BT_LOGE_LINENO((_node)->lineno, \ @@ -171,7 +171,7 @@ struct ctx_decl_scope { /* * Alias name to field type. * - * GQuark -> struct bt_ctf_field_type * + * GQuark -> struct bt_field_type * */ GHashTable *decl_map; @@ -184,7 +184,7 @@ struct ctx_decl_scope { */ struct ctx { /* Trace being filled (owned by this) */ - struct bt_ctf_trace *trace; + struct bt_trace *trace; /* Current declaration scope (top of the stack) */ struct ctx_decl_scope *current_scope; @@ -199,7 +199,7 @@ struct ctx { char *trace_name_suffix; /* Trace attributes */ - enum bt_ctf_byte_order trace_bo; + enum bt_byte_order trace_bo; uint64_t trace_major; uint64_t trace_minor; unsigned char trace_uuid[BABELTRACE_UUID_LEN]; @@ -207,7 +207,7 @@ struct ctx { /* * Stream IDs to stream classes. * - * int64_t -> struct bt_ctf_stream_class * + * int64_t -> struct bt_stream_class * */ GHashTable *stream_classes; @@ -238,7 +238,7 @@ struct ctx_decl_scope *ctx_decl_scope_create(struct ctx_decl_scope *par_scope) } scope->decl_map = g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, (GDestroyNotify) bt_ctf_field_type_put); + NULL, (GDestroyNotify) bt_put); scope->parent_scope = par_scope; end: @@ -305,13 +305,13 @@ end: * @returns Declaration, or NULL if not found */ static -struct bt_ctf_field_type *ctx_decl_scope_lookup_prefix_alias( +struct bt_field_type *ctx_decl_scope_lookup_prefix_alias( struct ctx_decl_scope *scope, char prefix, const char *name, int levels) { GQuark qname = 0; int cur_levels = 0; - _BT_CTF_FIELD_TYPE_INIT(decl); + _BT_FIELD_TYPE_INIT(decl); struct ctx_decl_scope *cur_scope = scope; assert(scope); @@ -353,7 +353,7 @@ error: * @returns Declaration, or NULL if not found */ static -struct bt_ctf_field_type *ctx_decl_scope_lookup_alias( +struct bt_field_type *ctx_decl_scope_lookup_alias( struct ctx_decl_scope *scope, const char *name, int levels) { return ctx_decl_scope_lookup_prefix_alias(scope, _PREFIX_ALIAS, @@ -369,7 +369,7 @@ struct bt_ctf_field_type *ctx_decl_scope_lookup_alias( * @returns Declaration, or NULL if not found */ static -struct bt_ctf_field_type *ctx_decl_scope_lookup_enum( +struct bt_field_type *ctx_decl_scope_lookup_enum( struct ctx_decl_scope *scope, const char *name, int levels) { return ctx_decl_scope_lookup_prefix_alias(scope, _PREFIX_ENUM, @@ -385,7 +385,7 @@ struct bt_ctf_field_type *ctx_decl_scope_lookup_enum( * @returns Declaration, or NULL if not found */ static -struct bt_ctf_field_type *ctx_decl_scope_lookup_struct( +struct bt_field_type *ctx_decl_scope_lookup_struct( struct ctx_decl_scope *scope, const char *name, int levels) { return ctx_decl_scope_lookup_prefix_alias(scope, _PREFIX_STRUCT, @@ -401,7 +401,7 @@ struct bt_ctf_field_type *ctx_decl_scope_lookup_struct( * @returns Declaration, or NULL if not found */ static -struct bt_ctf_field_type *ctx_decl_scope_lookup_variant( +struct bt_field_type *ctx_decl_scope_lookup_variant( struct ctx_decl_scope *scope, const char *name, int levels) { return ctx_decl_scope_lookup_prefix_alias(scope, _PREFIX_VARIANT, @@ -419,11 +419,11 @@ struct bt_ctf_field_type *ctx_decl_scope_lookup_variant( */ static int ctx_decl_scope_register_prefix_alias(struct ctx_decl_scope *scope, - char prefix, const char *name, struct bt_ctf_field_type *decl) + char prefix, const char *name, struct bt_field_type *decl) { int ret = 0; GQuark qname = 0; - _BT_CTF_FIELD_TYPE_INIT(edecl); + _BT_FIELD_TYPE_INIT(edecl); assert(scope); assert(name); @@ -464,7 +464,7 @@ error: */ static int ctx_decl_scope_register_alias(struct ctx_decl_scope *scope, - const char *name, struct bt_ctf_field_type *decl) + const char *name, struct bt_field_type *decl) { return ctx_decl_scope_register_prefix_alias(scope, _PREFIX_ALIAS, name, decl); @@ -480,7 +480,7 @@ int ctx_decl_scope_register_alias(struct ctx_decl_scope *scope, */ static int ctx_decl_scope_register_enum(struct ctx_decl_scope *scope, - const char *name, struct bt_ctf_field_type *decl) + const char *name, struct bt_field_type *decl) { return ctx_decl_scope_register_prefix_alias(scope, _PREFIX_ENUM, name, decl); @@ -496,7 +496,7 @@ int ctx_decl_scope_register_enum(struct ctx_decl_scope *scope, */ static int ctx_decl_scope_register_struct(struct ctx_decl_scope *scope, - const char *name, struct bt_ctf_field_type *decl) + const char *name, struct bt_field_type *decl) { return ctx_decl_scope_register_prefix_alias(scope, _PREFIX_STRUCT, name, decl); @@ -512,7 +512,7 @@ int ctx_decl_scope_register_struct(struct ctx_decl_scope *scope, */ static int ctx_decl_scope_register_variant(struct ctx_decl_scope *scope, - const char *name, struct bt_ctf_field_type *decl) + const char *name, struct bt_field_type *decl) { return ctx_decl_scope_register_prefix_alias(scope, _PREFIX_VARIANT, name, decl); @@ -564,7 +564,7 @@ end: * @returns New visitor context, or NULL on error */ static -struct ctx *ctx_create(struct bt_ctf_trace *trace, +struct ctx *ctx_create(struct bt_trace *trace, const struct ctf_metadata_decoder_config *decoder_config, const char *trace_name_suffix) { @@ -604,7 +604,7 @@ struct ctx *ctx_create(struct bt_ctf_trace *trace, ctx->trace = trace; ctx->current_scope = scope; scope = NULL; - ctx->trace_bo = BT_CTF_BYTE_ORDER_NATIVE; + ctx->trace_bo = BT_BYTE_ORDER_NATIVE; ctx->decoder_config = *decoder_config; return ctx; @@ -662,7 +662,7 @@ end: static int visit_type_specifier_list(struct ctx *ctx, struct ctf_node *ts_list, - struct bt_ctf_field_type **decl); + struct bt_field_type **decl); static char *remove_underscores_from_field_ref(const char *field_ref) @@ -1041,10 +1041,10 @@ end: } static -enum bt_ctf_byte_order byte_order_from_unary_expr(struct ctf_node *unary_expr) +enum bt_byte_order byte_order_from_unary_expr(struct ctf_node *unary_expr) { const char *str; - enum bt_ctf_byte_order bo = BT_CTF_BYTE_ORDER_UNKNOWN; + enum bt_byte_order bo = BT_BYTE_ORDER_UNKNOWN; if (unary_expr->u.unary_expression.type != UNARY_STRING) { _BT_LOGE_NODE(unary_expr, @@ -1055,11 +1055,11 @@ enum bt_ctf_byte_order byte_order_from_unary_expr(struct ctf_node *unary_expr) str = unary_expr->u.unary_expression.u.string; if (!strcmp(str, "be") || !strcmp(str, "network")) { - bo = BT_CTF_BYTE_ORDER_BIG_ENDIAN; + bo = BT_BYTE_ORDER_BIG_ENDIAN; } else if (!strcmp(str, "le")) { - bo = BT_CTF_BYTE_ORDER_LITTLE_ENDIAN; + bo = BT_BYTE_ORDER_LITTLE_ENDIAN; } else if (!strcmp(str, "native")) { - bo = BT_CTF_BYTE_ORDER_NATIVE; + bo = BT_BYTE_ORDER_NATIVE; } else { _BT_LOGE_NODE(unary_expr, "Unexpected \"byte_order\" attribute value: " @@ -1073,13 +1073,13 @@ end: } static -enum bt_ctf_byte_order get_real_byte_order(struct ctx *ctx, +enum bt_byte_order get_real_byte_order(struct ctx *ctx, struct ctf_node *uexpr) { - enum bt_ctf_byte_order bo = byte_order_from_unary_expr(uexpr); + enum bt_byte_order bo = byte_order_from_unary_expr(uexpr); - if (bo == BT_CTF_BYTE_ORDER_NATIVE) { - bo = bt_ctf_trace_get_native_byte_order(ctx->trace); + if (bo == BT_BYTE_ORDER_NATIVE) { + bo = bt_trace_get_native_byte_order(ctx->trace); } return bo; @@ -1274,8 +1274,8 @@ end: static int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, GQuark *field_name, struct ctf_node *node_type_declarator, - struct bt_ctf_field_type **field_decl, - struct bt_ctf_field_type *nested_decl) + struct bt_field_type **field_decl, + struct bt_field_type *nested_decl) { /* * During this whole function, nested_decl is always OURS, @@ -1314,7 +1314,7 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, if (node_type_declarator && !bt_list_empty(pointers)) { GQuark qalias; - _BT_CTF_FIELD_TYPE_INIT(nested_decl_copy); + _BT_FIELD_TYPE_INIT(nested_decl_copy); /* * If we have a pointer declarator, it HAS to @@ -1334,7 +1334,7 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, } /* Make a copy of it */ - nested_decl_copy = bt_ctf_field_type_copy(nested_decl); + nested_decl_copy = bt_field_type_copy(nested_decl); BT_PUT(nested_decl); if (!nested_decl_copy) { _BT_LOGE_NODE(node_type_declarator, @@ -1346,10 +1346,10 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, BT_MOVE(nested_decl, nested_decl_copy); /* Force integer's base to 16 since it's a pointer */ - if (bt_ctf_field_type_is_integer(nested_decl)) { - ret = bt_ctf_field_type_integer_set_base( + if (bt_field_type_is_integer(nested_decl)) { + ret = bt_field_type_integer_set_base( nested_decl, - BT_CTF_INTEGER_BASE_HEXADECIMAL); + BT_INTEGER_BASE_HEXADECIMAL); assert(ret == 0); } } else { @@ -1387,8 +1387,8 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, goto end; } else { struct ctf_node *first; - _BT_CTF_FIELD_TYPE_INIT(decl); - _BT_CTF_FIELD_TYPE_INIT(outer_field_decl); + _BT_FIELD_TYPE_INIT(decl); + _BT_FIELD_TYPE_INIT(outer_field_decl); struct bt_list_head *length = &node_type_declarator-> u.type_declarator.u.nested.length; @@ -1414,10 +1414,10 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, case UNARY_UNSIGNED_CONSTANT: { size_t len; - _BT_CTF_FIELD_TYPE_INIT(array_decl); + _BT_FIELD_TYPE_INIT(array_decl); len = first->u.unary_expression.u.unsigned_constant; - array_decl = bt_ctf_field_type_array_create(nested_decl, + array_decl = bt_field_type_array_create(nested_decl, len); BT_PUT(nested_decl); if (!array_decl) { @@ -1433,7 +1433,7 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, case UNARY_STRING: { /* Lookup unsigned integer definition, create seq. */ - _BT_CTF_FIELD_TYPE_INIT(seq_decl); + _BT_FIELD_TYPE_INIT(seq_decl); char *length_name = concatenate_unary_strings(length); char *length_name_no_underscore; @@ -1451,7 +1451,7 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list, ret = -EINVAL; goto error; } - seq_decl = bt_ctf_field_type_sequence_create( + seq_decl = bt_field_type_sequence_create( nested_decl, length_name_no_underscore); free(length_name_no_underscore); g_free(length_name); @@ -1513,19 +1513,19 @@ error: static int visit_struct_decl_field(struct ctx *ctx, - struct bt_ctf_field_type *struct_decl, + struct bt_field_type *struct_decl, struct ctf_node *type_specifier_list, struct bt_list_head *type_declarators) { int ret = 0; struct ctf_node *iter; - _BT_CTF_FIELD_TYPE_INIT(field_decl); + _BT_FIELD_TYPE_INIT(field_decl); bt_list_for_each_entry(iter, type_declarators, siblings) { field_decl = NULL; GQuark qfield_name; const char *field_name; - _BT_CTF_FIELD_TYPE_INIT(efield_decl); + _BT_FIELD_TYPE_INIT(efield_decl); ret = visit_type_declarator(ctx, type_specifier_list, &qfield_name, iter, &field_decl, NULL); @@ -1541,7 +1541,7 @@ int visit_struct_decl_field(struct ctx *ctx, /* Check if field with same name already exists */ efield_decl = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( struct_decl, field_name); if (efield_decl) { BT_PUT(efield_decl); @@ -1553,7 +1553,7 @@ int visit_struct_decl_field(struct ctx *ctx, } /* Add field to structure */ - ret = bt_ctf_field_type_structure_add_field(struct_decl, + ret = bt_field_type_structure_add_field(struct_decl, field_decl, field_name); BT_PUT(field_decl); if (ret) { @@ -1575,19 +1575,19 @@ error: static int visit_variant_decl_field(struct ctx *ctx, - struct bt_ctf_field_type *variant_decl, + struct bt_field_type *variant_decl, struct ctf_node *type_specifier_list, struct bt_list_head *type_declarators) { int ret = 0; struct ctf_node *iter; - _BT_CTF_FIELD_TYPE_INIT(field_decl); + _BT_FIELD_TYPE_INIT(field_decl); bt_list_for_each_entry(iter, type_declarators, siblings) { field_decl = NULL; GQuark qfield_name; const char *field_name; - _BT_CTF_FIELD_TYPE_INIT(efield_decl); + _BT_FIELD_TYPE_INIT(efield_decl); ret = visit_type_declarator(ctx, type_specifier_list, &qfield_name, iter, &field_decl, NULL); @@ -1603,7 +1603,7 @@ int visit_variant_decl_field(struct ctx *ctx, /* Check if field with same name already exists */ efield_decl = - bt_ctf_field_type_variant_get_field_type_by_name( + bt_field_type_variant_get_field_type_by_name( variant_decl, field_name); if (efield_decl) { BT_PUT(efield_decl); @@ -1615,7 +1615,7 @@ int visit_variant_decl_field(struct ctx *ctx, } /* Add field to structure */ - ret = bt_ctf_field_type_variant_add_field(variant_decl, + ret = bt_field_type_variant_add_field(variant_decl, field_decl, field_name); BT_PUT(field_decl); if (ret) { @@ -1642,7 +1642,7 @@ int visit_typedef(struct ctx *ctx, struct ctf_node *type_specifier_list, int ret = 0; GQuark qidentifier; struct ctf_node *iter; - _BT_CTF_FIELD_TYPE_INIT(type_decl); + _BT_FIELD_TYPE_INIT(type_decl); bt_list_for_each_entry(iter, type_declarators, siblings) { ret = visit_type_declarator(ctx, type_specifier_list, @@ -1655,8 +1655,8 @@ int visit_typedef(struct ctx *ctx, struct ctf_node *type_specifier_list, } /* Do not allow typedef and typealias of untagged variants */ - if (bt_ctf_field_type_is_variant(type_decl)) { - if (bt_ctf_field_type_variant_get_tag_name(type_decl)) { + if (bt_field_type_is_variant(type_decl)) { + if (bt_field_type_variant_get_tag_name(type_decl)) { _BT_LOGE_NODE(iter, "Type definition of untagged variant field type is not allowed."); ret = -EPERM; @@ -1688,7 +1688,7 @@ int visit_typealias(struct ctx *ctx, struct ctf_node *target, GQuark qalias; struct ctf_node *node; GQuark qdummy_field_name; - _BT_CTF_FIELD_TYPE_INIT(type_decl); + _BT_FIELD_TYPE_INIT(type_decl); /* Create target type declaration */ if (bt_list_empty(&target->u.typealias_target.type_declarators)) { @@ -1710,8 +1710,8 @@ int visit_typealias(struct ctx *ctx, struct ctf_node *target, } /* Do not allow typedef and typealias of untagged variants */ - if (bt_ctf_field_type_is_variant(type_decl)) { - if (bt_ctf_field_type_variant_get_tag_name(type_decl)) { + if (bt_field_type_is_variant(type_decl)) { + if (bt_field_type_variant_get_tag_name(type_decl)) { _BT_LOGE_NODE(target, "Type definition of untagged variant field type is not allowed."); ret = -EPERM; @@ -1753,7 +1753,7 @@ end: static int visit_struct_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, - struct bt_ctf_field_type *struct_decl) + struct bt_field_type *struct_decl) { int ret = 0; @@ -1803,7 +1803,7 @@ end: static int visit_variant_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, - struct bt_ctf_field_type *variant_decl) + struct bt_field_type *variant_decl) { int ret = 0; @@ -1856,7 +1856,7 @@ static int visit_struct_decl(struct ctx *ctx, const char *name, struct bt_list_head *decl_list, int has_body, struct bt_list_head *min_align, - struct bt_ctf_field_type **struct_decl) + struct bt_field_type **struct_decl) { int ret = 0; @@ -1864,7 +1864,7 @@ int visit_struct_decl(struct ctx *ctx, const char *name, /* For named struct (without body), lookup in declaration scope */ if (!has_body) { - _BT_CTF_FIELD_TYPE_INIT(struct_decl_copy); + _BT_FIELD_TYPE_INIT(struct_decl_copy); if (!name) { BT_LOGE_STR("Bodyless structure field type: missing name."); @@ -1882,7 +1882,7 @@ int visit_struct_decl(struct ctx *ctx, const char *name, } /* Make a copy of it */ - struct_decl_copy = bt_ctf_field_type_copy(*struct_decl); + struct_decl_copy = bt_field_type_copy(*struct_decl); if (!struct_decl_copy) { BT_LOGE_STR("Cannot create copy of structure field type."); ret = -EINVAL; @@ -1895,7 +1895,7 @@ int visit_struct_decl(struct ctx *ctx, const char *name, uint64_t min_align_value = 0; if (name) { - _BT_CTF_FIELD_TYPE_INIT(estruct_decl); + _BT_FIELD_TYPE_INIT(estruct_decl); estruct_decl = ctx_decl_scope_lookup_struct( ctx->current_scope, name, 1); @@ -1917,7 +1917,7 @@ int visit_struct_decl(struct ctx *ctx, const char *name, } } - *struct_decl = bt_ctf_field_type_structure_create(); + *struct_decl = bt_field_type_structure_create(); if (!*struct_decl) { BT_LOGE_STR("Cannot create empty structure field type."); ret = -ENOMEM; @@ -1925,7 +1925,7 @@ int visit_struct_decl(struct ctx *ctx, const char *name, } if (min_align_value != 0) { - ret = bt_ctf_field_type_set_alignment(*struct_decl, + ret = bt_field_type_set_alignment(*struct_decl, min_align_value); if (ret) { BT_LOGE("Cannot set structure field type's alignment: " @@ -1976,16 +1976,16 @@ error: static int visit_variant_decl(struct ctx *ctx, const char *name, const char *tag, struct bt_list_head *decl_list, - int has_body, struct bt_ctf_field_type **variant_decl) + int has_body, struct bt_field_type **variant_decl) { int ret = 0; - _BT_CTF_FIELD_TYPE_INIT(untagged_variant_decl); + _BT_FIELD_TYPE_INIT(untagged_variant_decl); *variant_decl = NULL; /* For named variant (without body), lookup in declaration scope */ if (!has_body) { - _BT_CTF_FIELD_TYPE_INIT(variant_decl_copy); + _BT_FIELD_TYPE_INIT(variant_decl_copy); if (!name) { BT_LOGE_STR("Bodyless variant field type: missing name."); @@ -2004,7 +2004,7 @@ int visit_variant_decl(struct ctx *ctx, const char *name, } /* Make a copy of it */ - variant_decl_copy = bt_ctf_field_type_copy( + variant_decl_copy = bt_field_type_copy( untagged_variant_decl); if (!variant_decl_copy) { BT_LOGE_STR("Cannot create copy of variant field type."); @@ -2017,7 +2017,7 @@ int visit_variant_decl(struct ctx *ctx, const char *name, struct ctf_node *entry_node; if (name) { - struct bt_ctf_field_type *evariant_decl = + struct bt_field_type *evariant_decl = ctx_decl_scope_lookup_struct(ctx->current_scope, name, 1); @@ -2030,7 +2030,7 @@ int visit_variant_decl(struct ctx *ctx, const char *name, } } - untagged_variant_decl = bt_ctf_field_type_variant_create(NULL, + untagged_variant_decl = bt_field_type_variant_create(NULL, NULL); if (!untagged_variant_decl) { BT_LOGE_STR("Cannot create empty variant field type."); @@ -2089,7 +2089,7 @@ int visit_variant_decl(struct ctx *ctx, const char *name, goto error; } - ret = bt_ctf_field_type_variant_set_tag_name( + ret = bt_field_type_variant_set_tag_name( untagged_variant_decl, tag_no_underscore); free(tag_no_underscore); if (ret) { @@ -2115,7 +2115,7 @@ error: static int visit_enum_decl_entry(struct ctx *ctx, struct ctf_node *enumerator, - struct bt_ctf_field_type *enum_decl, int64_t *last, int is_signed) + struct bt_field_type *enum_decl, int64_t *last, bt_bool is_signed) { int ret = 0; int nr_vals = 0; @@ -2185,7 +2185,7 @@ int visit_enum_decl_entry(struct ctx *ctx, struct ctf_node *enumerator, ret = bt_ctf_field_type_enumeration_add_mapping(enum_decl, label, start, end); } else { - ret = bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_decl, + ret = bt_field_type_enumeration_add_mapping_unsigned(enum_decl, label, (uint64_t) start, (uint64_t) end); } if (ret) { @@ -2209,17 +2209,17 @@ int visit_enum_decl(struct ctx *ctx, const char *name, struct ctf_node *container_type, struct bt_list_head *enumerator_list, int has_body, - struct bt_ctf_field_type **enum_decl) + struct bt_field_type **enum_decl) { int ret = 0; GQuark qdummy_id; - _BT_CTF_FIELD_TYPE_INIT(integer_decl); + _BT_FIELD_TYPE_INIT(integer_decl); *enum_decl = NULL; /* For named enum (without body), lookup in declaration scope */ if (!has_body) { - _BT_CTF_FIELD_TYPE_INIT(enum_decl_copy); + _BT_FIELD_TYPE_INIT(enum_decl_copy); if (!name) { BT_LOGE_STR("Bodyless enumeration field type: missing name."); @@ -2237,7 +2237,7 @@ int visit_enum_decl(struct ctx *ctx, const char *name, } /* Make a copy of it */ - enum_decl_copy = bt_ctf_field_type_copy(*enum_decl); + enum_decl_copy = bt_field_type_copy(*enum_decl); if (!enum_decl_copy) { BT_LOGE_STR("Cannot create copy of enumeration field type."); ret = -EINVAL; @@ -2251,7 +2251,7 @@ int visit_enum_decl(struct ctx *ctx, const char *name, int64_t last_value = 0; if (name) { - _BT_CTF_FIELD_TYPE_INIT(eenum_decl); + _BT_FIELD_TYPE_INIT(eenum_decl); eenum_decl = ctx_decl_scope_lookup_enum( ctx->current_scope, name, 1); @@ -2284,16 +2284,16 @@ int visit_enum_decl(struct ctx *ctx, const char *name, assert(integer_decl); - if (!bt_ctf_field_type_is_integer(integer_decl)) { + if (!bt_field_type_is_integer(integer_decl)) { BT_LOGE("Container field type for enumeration field type is not an integer field type: " "ft-id=%s", - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(integer_decl))); + bt_field_type_id_string( + bt_field_type_get_type_id(integer_decl))); ret = -EINVAL; goto error; } - *enum_decl = bt_ctf_field_type_enumeration_create(integer_decl); + *enum_decl = bt_field_type_enumeration_create(integer_decl); if (!*enum_decl) { BT_LOGE_STR("Cannot create enumeration field type."); ret = -ENOMEM; @@ -2303,7 +2303,7 @@ int visit_enum_decl(struct ctx *ctx, const char *name, bt_list_for_each_entry(iter, enumerator_list, siblings) { ret = visit_enum_decl_entry(ctx, iter, *enum_decl, &last_value, - bt_ctf_field_type_integer_get_signed(integer_decl)); + bt_field_type_integer_is_signed(integer_decl)); if (ret) { _BT_LOGE_NODE(iter, "Cannot visit enumeration field type entry: " @@ -2337,11 +2337,11 @@ error: static int visit_type_specifier(struct ctx *ctx, struct ctf_node *type_specifier_list, - struct bt_ctf_field_type **decl) + struct bt_field_type **decl) { int ret = 0; GString *str = NULL; - _BT_CTF_FIELD_TYPE_INIT(decl_copy); + _BT_FIELD_TYPE_INIT(decl_copy); *decl = NULL; str = g_string_new(""); @@ -2361,7 +2361,7 @@ int visit_type_specifier(struct ctx *ctx, } /* Make a copy of the type declaration */ - decl_copy = bt_ctf_field_type_copy(*decl); + decl_copy = bt_field_type_copy(*decl); if (!decl_copy) { _BT_LOGE_NODE(type_specifier_list, "Cannot create field type copy."); @@ -2388,18 +2388,18 @@ error: static int visit_integer_decl(struct ctx *ctx, struct bt_list_head *expressions, - struct bt_ctf_field_type **integer_decl) + struct bt_field_type **integer_decl) { int set = 0; int ret = 0; - int signedness = 0; + bt_bool signedness = 0; struct ctf_node *expression; uint64_t alignment = 0, size = 0; - struct bt_ctf_clock_class *mapped_clock = NULL; - enum bt_ctf_string_encoding encoding = BT_CTF_STRING_ENCODING_NONE; - enum bt_ctf_integer_base base = BT_CTF_INTEGER_BASE_DECIMAL; - enum bt_ctf_byte_order byte_order = - bt_ctf_trace_get_native_byte_order(ctx->trace); + struct bt_clock_class *mapped_clock = NULL; + enum bt_string_encoding encoding = BT_STRING_ENCODING_NONE; + enum bt_integer_base base = BT_INTEGER_BASE_DECIMAL; + enum bt_byte_order byte_order = + bt_trace_get_native_byte_order(ctx->trace); *integer_decl = NULL; @@ -2448,7 +2448,7 @@ int visit_integer_decl(struct ctx *ctx, } byte_order = get_real_byte_order(ctx, right); - if (byte_order == BT_CTF_BYTE_ORDER_UNKNOWN) { + if (byte_order == BT_BYTE_ORDER_UNKNOWN) { _BT_LOGE_NODE(right, "Invalid `byte_order` attribute in integer field type: " "ret=%d", ret); @@ -2542,16 +2542,16 @@ int visit_integer_decl(struct ctx *ctx, switch (constant) { case 2: - base = BT_CTF_INTEGER_BASE_BINARY; + base = BT_INTEGER_BASE_BINARY; break; case 8: - base = BT_CTF_INTEGER_BASE_OCTAL; + base = BT_INTEGER_BASE_OCTAL; break; case 10: - base = BT_CTF_INTEGER_BASE_DECIMAL; + base = BT_INTEGER_BASE_DECIMAL; break; case 16: - base = BT_CTF_INTEGER_BASE_HEXADECIMAL; + base = BT_INTEGER_BASE_HEXADECIMAL; break; default: _BT_LOGE_NODE(right, @@ -2579,20 +2579,20 @@ int visit_integer_decl(struct ctx *ctx, !strcmp(s_right, "d") || !strcmp(s_right, "i") || !strcmp(s_right, "u")) { - base = BT_CTF_INTEGER_BASE_DECIMAL; + base = BT_INTEGER_BASE_DECIMAL; } else if (!strcmp(s_right, "hexadecimal") || !strcmp(s_right, "hex") || !strcmp(s_right, "x") || !strcmp(s_right, "X") || !strcmp(s_right, "p")) { - base = BT_CTF_INTEGER_BASE_HEXADECIMAL; + base = BT_INTEGER_BASE_HEXADECIMAL; } else if (!strcmp(s_right, "octal") || !strcmp(s_right, "oct") || !strcmp(s_right, "o")) { - base = BT_CTF_INTEGER_BASE_OCTAL; + base = BT_INTEGER_BASE_OCTAL; } else if (!strcmp(s_right, "binary") || !strcmp(s_right, "b")) { - base = BT_CTF_INTEGER_BASE_BINARY; + base = BT_INTEGER_BASE_BINARY; } else { _BT_LOGE_NODE(right, "Unexpected unary expression for integer field type's `base` attribute: " @@ -2646,12 +2646,12 @@ int visit_integer_decl(struct ctx *ctx, !strcmp(s_right, "utf8") || !strcmp(s_right, "utf-8") || !strcmp(s_right, "UTF-8")) { - encoding = BT_CTF_STRING_ENCODING_UTF8; + encoding = BT_STRING_ENCODING_UTF8; } else if (!strcmp(s_right, "ASCII") || !strcmp(s_right, "ascii")) { - encoding = BT_CTF_STRING_ENCODING_ASCII; + encoding = BT_STRING_ENCODING_ASCII; } else if (!strcmp(s_right, "none")) { - encoding = BT_CTF_STRING_ENCODING_NONE; + encoding = BT_STRING_ENCODING_NONE; } else { _BT_LOGE_NODE(right, "Invalid `encoding` attribute in integer field type: " @@ -2705,7 +2705,7 @@ int visit_integer_decl(struct ctx *ctx, continue; } - mapped_clock = bt_ctf_trace_get_clock_class_by_name( + mapped_clock = bt_trace_get_clock_class_by_name( ctx->trace, clock_name); if (!mapped_clock) { _BT_LOGE_NODE(right, @@ -2741,23 +2741,23 @@ int visit_integer_decl(struct ctx *ctx, } } - *integer_decl = bt_ctf_field_type_integer_create((unsigned int) size); + *integer_decl = bt_field_type_integer_create((unsigned int) size); if (!*integer_decl) { BT_LOGE_STR("Cannot create integer field type."); ret = -ENOMEM; goto error; } - ret = bt_ctf_field_type_integer_set_signed(*integer_decl, signedness); - ret |= bt_ctf_field_type_integer_set_base(*integer_decl, base); - ret |= bt_ctf_field_type_integer_set_encoding(*integer_decl, encoding); - ret |= bt_ctf_field_type_set_alignment(*integer_decl, + ret = bt_field_type_integer_set_is_signed(*integer_decl, signedness); + ret |= bt_field_type_integer_set_base(*integer_decl, base); + ret |= bt_field_type_integer_set_encoding(*integer_decl, encoding); + ret |= bt_field_type_set_alignment(*integer_decl, (unsigned int) alignment); - ret |= bt_ctf_field_type_set_byte_order(*integer_decl, byte_order); + ret |= bt_field_type_set_byte_order(*integer_decl, byte_order); if (mapped_clock) { /* Move clock */ - ret |= bt_ctf_field_type_integer_set_mapped_clock_class( + ret |= bt_field_type_integer_set_mapped_clock_class( *integer_decl, mapped_clock); bt_put(mapped_clock); mapped_clock = NULL; @@ -2784,14 +2784,14 @@ error: static int visit_floating_point_number_decl(struct ctx *ctx, struct bt_list_head *expressions, - struct bt_ctf_field_type **float_decl) + struct bt_field_type **float_decl) { int set = 0; int ret = 0; struct ctf_node *expression; uint64_t alignment = 1, exp_dig = 0, mant_dig = 0; - enum bt_ctf_byte_order byte_order = - bt_ctf_trace_get_native_byte_order(ctx->trace); + enum bt_byte_order byte_order = + bt_trace_get_native_byte_order(ctx->trace); *float_decl = NULL; @@ -2821,7 +2821,7 @@ int visit_floating_point_number_decl(struct ctx *ctx, } byte_order = get_real_byte_order(ctx, right); - if (byte_order == BT_CTF_BYTE_ORDER_UNKNOWN) { + if (byte_order == BT_BYTE_ORDER_UNKNOWN) { _BT_LOGE_NODE(right, "Invalid `byte_order` attribute in floating point number field type: " "ret=%d", ret); @@ -2938,19 +2938,19 @@ int visit_floating_point_number_decl(struct ctx *ctx, } } - *float_decl = bt_ctf_field_type_floating_point_create(); + *float_decl = bt_field_type_floating_point_create(); if (!*float_decl) { BT_LOGE_STR("Cannot create floating point number field type."); ret = -ENOMEM; goto error; } - ret = bt_ctf_field_type_floating_point_set_exponent_digits( + ret = bt_field_type_floating_point_set_exponent_digits( *float_decl, exp_dig); - ret |= bt_ctf_field_type_floating_point_set_mantissa_digits( + ret |= bt_field_type_floating_point_set_mantissa_digits( *float_decl, mant_dig); - ret |= bt_ctf_field_type_set_byte_order(*float_decl, byte_order); - ret |= bt_ctf_field_type_set_alignment(*float_decl, alignment); + ret |= bt_field_type_set_byte_order(*float_decl, byte_order); + ret |= bt_field_type_set_alignment(*float_decl, alignment); if (ret) { BT_LOGE_STR("Cannot configure floating point number field type."); ret = -EINVAL; @@ -2968,12 +2968,12 @@ error: static int visit_string_decl(struct ctx *ctx, struct bt_list_head *expressions, - struct bt_ctf_field_type **string_decl) + struct bt_field_type **string_decl) { int set = 0; int ret = 0; struct ctf_node *expression; - enum bt_ctf_string_encoding encoding = BT_CTF_STRING_ENCODING_UTF8; + enum bt_string_encoding encoding = BT_STRING_ENCODING_UTF8; *string_decl = NULL; @@ -3025,12 +3025,12 @@ int visit_string_decl(struct ctx *ctx, !strcmp(s_right, "utf8") || !strcmp(s_right, "utf-8") || !strcmp(s_right, "UTF-8")) { - encoding = BT_CTF_STRING_ENCODING_UTF8; + encoding = BT_STRING_ENCODING_UTF8; } else if (!strcmp(s_right, "ASCII") || !strcmp(s_right, "ascii")) { - encoding = BT_CTF_STRING_ENCODING_ASCII; + encoding = BT_STRING_ENCODING_ASCII; } else if (!strcmp(s_right, "none")) { - encoding = BT_CTF_STRING_ENCODING_NONE; + encoding = BT_STRING_ENCODING_NONE; } else { _BT_LOGE_NODE(right, "Invalid `encoding` attribute in string field type: " @@ -3051,14 +3051,14 @@ int visit_string_decl(struct ctx *ctx, } } - *string_decl = bt_ctf_field_type_string_create(); + *string_decl = bt_field_type_string_create(); if (!*string_decl) { BT_LOGE_STR("Cannot create string field type."); ret = -ENOMEM; goto error; } - ret = bt_ctf_field_type_string_set_encoding(*string_decl, encoding); + ret = bt_field_type_string_set_encoding(*string_decl, encoding); if (ret) { BT_LOGE_STR("Cannot configure string field type."); ret = -EINVAL; @@ -3076,7 +3076,7 @@ error: static int visit_type_specifier_list(struct ctx *ctx, struct ctf_node *ts_list, - struct bt_ctf_field_type **decl) + struct bt_field_type **decl) { int ret = 0; struct ctf_node *first, *node; @@ -3199,12 +3199,12 @@ error: static int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, - struct bt_ctf_event_class *event_class, int64_t *stream_id, + struct bt_event_class *event_class, int64_t *stream_id, int *set) { int ret = 0; char *left = NULL; - _BT_CTF_FIELD_TYPE_INIT(decl); + _BT_FIELD_TYPE_INIT(decl); switch (node->type) { case NODE_TYPEDEF: @@ -3264,7 +3264,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, goto error; } - ret = bt_ctf_event_class_set_id(event_class, id); + ret = bt_event_class_set_id(event_class, id); if (ret) { _BT_LOGE_NODE(node, "Cannot set event class's ID: " @@ -3315,7 +3315,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, } assert(decl); - ret = bt_ctf_event_class_set_context_type( + ret = bt_event_class_set_context_type( event_class, decl); BT_PUT(decl); if (ret) { @@ -3345,7 +3345,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, } assert(decl); - ret = bt_ctf_event_class_set_payload_type( + ret = bt_event_class_set_payload_type( event_class, decl); BT_PUT(decl); if (ret) { @@ -3357,8 +3357,8 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, _SET(set, _EVENT_FIELDS_SET); } else if (!strcmp(left, "loglevel")) { uint64_t loglevel_value; - enum bt_ctf_event_class_log_level log_level = - BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED; + enum bt_event_class_log_level log_level = + BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED; if (_IS_SET(set, _EVENT_LOGLEVEL_SET)) { _BT_LOGE_DUP_ATTR(node, "loglevel", @@ -3378,57 +3378,57 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, switch (loglevel_value) { case 0: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY; + log_level = BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY; break; case 1: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT; + log_level = BT_EVENT_CLASS_LOG_LEVEL_ALERT; break; case 2: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL; + log_level = BT_EVENT_CLASS_LOG_LEVEL_CRITICAL; break; case 3: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR; + log_level = BT_EVENT_CLASS_LOG_LEVEL_ERROR; break; case 4: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING; + log_level = BT_EVENT_CLASS_LOG_LEVEL_WARNING; break; case 5: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE; + log_level = BT_EVENT_CLASS_LOG_LEVEL_NOTICE; break; case 6: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO; + log_level = BT_EVENT_CLASS_LOG_LEVEL_INFO; break; case 7: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM; break; case 8: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM; break; case 9: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS; break; case 10: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE; break; case 11: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT; break; case 12: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION; break; case 13: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE; break; case 14: - log_level = BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG; + log_level = BT_EVENT_CLASS_LOG_LEVEL_DEBUG; break; default: _BT_LOGW_NODE(node, "Not setting event class's log level because its value is unknown: " "log-level=%" PRIu64, loglevel_value); } - if (log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) { - ret = bt_ctf_event_class_set_log_level( + if (log_level != BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) { + ret = bt_event_class_set_log_level( event_class, log_level); if (ret) { _BT_LOGE_NODE(node, @@ -3461,7 +3461,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node, _BT_LOGW_NODE(node, "Not setting event class's EMF URI because it's empty."); } else { - ret = bt_ctf_event_class_set_emf_uri( + ret = bt_event_class_set_emf_uri( event_class, right); if (ret) { _BT_LOGE_NODE(node, @@ -3547,25 +3547,25 @@ error: static int reset_event_decl_types(struct ctx *ctx, - struct bt_ctf_event_class *event_class) + struct bt_event_class *event_class) { int ret = 0; /* Context type. */ - ret = bt_ctf_event_class_set_context_type(event_class, NULL); + ret = bt_event_class_set_context_type(event_class, NULL); if (ret) { BT_LOGE("Cannot reset initial event class's context field type: " "event-name=\"%s\"", - bt_ctf_event_class_get_name(event_class)); + bt_event_class_get_name(event_class)); goto end; } /* Event payload. */ - ret = bt_ctf_event_class_set_payload_type(event_class, NULL); + ret = bt_event_class_set_payload_type(event_class, NULL); if (ret) { BT_LOGE("Cannot reset initial event class's payload field type: " "event-name=\"%s\"", - bt_ctf_event_class_get_name(event_class)); + bt_event_class_get_name(event_class)); goto end; } end: @@ -3574,26 +3574,26 @@ end: static int reset_stream_decl_types(struct ctx *ctx, - struct bt_ctf_stream_class *stream_class) + struct bt_stream_class *stream_class) { int ret = 0; /* Packet context. */ - ret = bt_ctf_stream_class_set_packet_context_type(stream_class, NULL); + ret = bt_stream_class_set_packet_context_type(stream_class, NULL); if (ret) { BT_LOGE_STR("Cannot reset initial stream class's packet context field type."); goto end; } /* Event header. */ - ret = bt_ctf_stream_class_set_event_header_type(stream_class, NULL); + ret = bt_stream_class_set_event_header_type(stream_class, NULL); if (ret) { BT_LOGE_STR("Cannot reset initial stream class's event header field type."); goto end; } /* Event context. */ - ret = bt_ctf_stream_class_set_event_context_type(stream_class, NULL); + ret = bt_stream_class_set_event_context_type(stream_class, NULL); if (ret) { BT_LOGE_STR("Cannot reset initial stream class's event context field type."); goto end; @@ -3603,12 +3603,12 @@ end: } static -struct bt_ctf_stream_class *create_reset_stream_class(struct ctx *ctx) +struct bt_stream_class *create_reset_stream_class(struct ctx *ctx) { int ret; - struct bt_ctf_stream_class *stream_class; + struct bt_stream_class *stream_class; - stream_class = bt_ctf_stream_class_create_empty(NULL); + stream_class = bt_stream_class_create_empty(NULL); if (!stream_class) { BT_LOGE_STR("Cannot create empty stream class."); goto error; @@ -3640,9 +3640,9 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) struct ctf_node *iter; int64_t stream_id = -1; char *event_name = NULL; - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_event_class *eevent_class; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_event_class *event_class = NULL; + struct bt_event_class *eevent_class; + struct bt_stream_class *stream_class = NULL; struct bt_list_head *decl_list = &node->u.event.declaration_list; bool pop_scope = false; @@ -3659,7 +3659,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) goto error; } - event_class = bt_ctf_event_class_create(event_name); + event_class = bt_event_class_create(event_name); /* * Unset context and fields to override the default ones. @@ -3693,10 +3693,10 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) if (!_IS_SET(&set, _EVENT_STREAM_ID_SET)) { GList *keys = NULL; int64_t *new_stream_id; - struct bt_ctf_stream_class *new_stream_class; + struct bt_stream_class *new_stream_class; size_t stream_class_count = g_hash_table_size(ctx->stream_classes) + - bt_ctf_trace_get_stream_class_count(ctx->trace); + bt_trace_get_stream_class_count(ctx->trace); /* * Allow missing stream_id if there is only a single @@ -3714,7 +3714,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) goto error; } - ret = bt_ctf_stream_class_set_id(new_stream_class, + ret = bt_stream_class_set_id(new_stream_class, stream_id); if (ret) { _BT_LOGE_NODE(node, @@ -3746,13 +3746,13 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) stream_id = *((int64_t *) keys->data); g_list_free(keys); } else { - assert(bt_ctf_trace_get_stream_class_count( + assert(bt_trace_get_stream_class_count( ctx->trace) == 1); stream_class = - bt_ctf_trace_get_stream_class_by_index( + bt_trace_get_stream_class_by_index( ctx->trace, 0); assert(stream_class); - stream_id = bt_ctf_stream_class_get_id( + stream_id = bt_stream_class_get_id( stream_class); BT_PUT(stream_class); } @@ -3771,7 +3771,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) stream_class = g_hash_table_lookup(ctx->stream_classes, &stream_id); bt_get(stream_class); if (!stream_class) { - stream_class = bt_ctf_trace_get_stream_class_by_id(ctx->trace, + stream_class = bt_trace_get_stream_class_by_id(ctx->trace, stream_id); if (!stream_class) { _BT_LOGE_NODE(node, @@ -3786,7 +3786,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) if (!_IS_SET(&set, _EVENT_ID_SET)) { /* Allow only one event without ID per stream */ - if (bt_ctf_stream_class_get_event_class_count(stream_class) != + if (bt_stream_class_get_event_class_count(stream_class) != 0) { _BT_LOGE_NODE(node, "Missing `id` attribute in event class."); @@ -3795,7 +3795,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) } /* Automatic ID */ - ret = bt_ctf_event_class_set_id(event_class, 0); + ret = bt_event_class_set_id(event_class, 0); if (ret) { _BT_LOGE_NODE(node, "Cannot set event class's ID: id=0, ret=%d", @@ -3804,14 +3804,14 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) } } - event_id = bt_ctf_event_class_get_id(event_class); + event_id = bt_event_class_get_id(event_class); if (event_id < 0) { _BT_LOGE_NODE(node, "Cannot get event class's ID."); ret = -EINVAL; goto error; } - eevent_class = bt_ctf_stream_class_get_event_class_by_id(stream_class, + eevent_class = bt_stream_class_get_event_class_by_id(stream_class, event_id); if (eevent_class) { BT_PUT(eevent_class); @@ -3822,7 +3822,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node) goto error; } - ret = bt_ctf_stream_class_add_event_class(stream_class, event_class); + ret = bt_stream_class_add_event_class(stream_class, event_class); BT_PUT(event_class); if (ret) { _BT_LOGE_NODE(node, @@ -3847,24 +3847,24 @@ end: static int auto_map_field_to_trace_clock_class(struct ctx *ctx, - struct bt_ctf_field_type *ft) + struct bt_field_type *ft) { - struct bt_ctf_clock_class *clock_class_to_map_to = NULL; - struct bt_ctf_clock_class *mapped_clock_class = NULL; + struct bt_clock_class *clock_class_to_map_to = NULL; + struct bt_clock_class *mapped_clock_class = NULL; int ret = 0; int64_t clock_class_count; - if (!ft || !bt_ctf_field_type_is_integer(ft)) { + if (!ft || !bt_field_type_is_integer(ft)) { goto end; } mapped_clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class(ft); + bt_field_type_integer_get_mapped_clock_class(ft); if (mapped_clock_class) { goto end; } - clock_class_count = bt_ctf_trace_get_clock_class_count(ctx->trace); + clock_class_count = bt_trace_get_clock_class_count(ctx->trace); assert(clock_class_count >= 0); switch (clock_class_count) { @@ -3874,7 +3874,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx, * point. Create an implicit one at 1 GHz, * named `default`, and use this clock class. */ - clock_class_to_map_to = bt_ctf_clock_class_create("default", + clock_class_to_map_to = bt_clock_class_create("default", 1000000000); if (!clock_class_to_map_to) { BT_LOGE_STR("Cannot create a clock class."); @@ -3882,7 +3882,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx, goto end; } - ret = bt_ctf_trace_add_clock_class(ctx->trace, + ret = bt_trace_add_clock_class(ctx->trace, clock_class_to_map_to); if (ret) { BT_LOGE_STR("Cannot add clock class to trace."); @@ -3895,7 +3895,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx, * this point: use this one. */ clock_class_to_map_to = - bt_ctf_trace_get_clock_class_by_index(ctx->trace, 0); + bt_trace_get_clock_class_by_index(ctx->trace, 0); assert(clock_class_to_map_to); break; default: @@ -3911,12 +3911,12 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx, } assert(clock_class_to_map_to); - ret = bt_ctf_field_type_integer_set_mapped_clock_class(ft, + ret = bt_field_type_integer_set_mapped_clock_class(ft, clock_class_to_map_to); if (ret) { BT_LOGE("Cannot map field type's field to trace's clock class: " "clock-class-name=\"%s\", ret=%d", - bt_ctf_clock_class_get_name(clock_class_to_map_to), + bt_clock_class_get_name(clock_class_to_map_to), ret); goto end; } @@ -3929,7 +3929,7 @@ end: static int auto_map_fields_to_trace_clock_class(struct ctx *ctx, - struct bt_ctf_field_type *root_ft, const char *field_name) + struct bt_field_type *root_ft, const char *field_name) { int ret = 0; int64_t i, count; @@ -3938,28 +3938,28 @@ int auto_map_fields_to_trace_clock_class(struct ctx *ctx, goto end; } - if (!bt_ctf_field_type_is_structure(root_ft) && - !bt_ctf_field_type_is_variant(root_ft)) { + if (!bt_field_type_is_structure(root_ft) && + !bt_field_type_is_variant(root_ft)) { goto end; } - if (bt_ctf_field_type_is_structure(root_ft)) { - count = bt_ctf_field_type_structure_get_field_count(root_ft); + if (bt_field_type_is_structure(root_ft)) { + count = bt_field_type_structure_get_field_count(root_ft); } else { - count = bt_ctf_field_type_variant_get_field_count(root_ft); + count = bt_field_type_variant_get_field_count(root_ft); } assert(count >= 0); for (i = 0; i < count; i++) { - _BT_CTF_FIELD_TYPE_INIT(ft); + _BT_FIELD_TYPE_INIT(ft); const char *name; - if (bt_ctf_field_type_is_structure(root_ft)) { - ret = bt_ctf_field_type_structure_get_field_by_index( + if (bt_field_type_is_structure(root_ft)) { + ret = bt_field_type_structure_get_field_by_index( root_ft, &name, &ft, i); - } else if (bt_ctf_field_type_is_variant(root_ft)) { - ret = bt_ctf_field_type_variant_get_field_by_index( + } else if (bt_field_type_is_variant(root_ft)) { + ret = bt_field_type_variant_get_field_by_index( root_ft, &name, &ft, i); } @@ -3991,11 +3991,11 @@ end: static int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node, - struct bt_ctf_stream_class *stream_class, int *set) + struct bt_stream_class *stream_class, int *set) { int ret = 0; char *left = NULL; - _BT_CTF_FIELD_TYPE_INIT(decl); + _BT_FIELD_TYPE_INIT(decl); switch (node->type) { case NODE_TYPEDEF: @@ -4055,7 +4055,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node, goto error; } - ret = bt_ctf_stream_class_set_id(stream_class, id); + ret = bt_stream_class_set_id(stream_class, id); if (ret) { _BT_LOGE_NODE(node, "Cannot set stream class's ID: " @@ -4092,7 +4092,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node, goto error; } - ret = bt_ctf_stream_class_set_event_header_type( + ret = bt_stream_class_set_event_header_type( stream_class, decl); BT_PUT(decl); if (ret) { @@ -4123,7 +4123,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node, assert(decl); - ret = bt_ctf_stream_class_set_event_context_type( + ret = bt_stream_class_set_event_context_type( stream_class, decl); BT_PUT(decl); if (ret) { @@ -4169,7 +4169,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node, goto error; } - ret = bt_ctf_stream_class_set_packet_context_type( + ret = bt_stream_class_set_packet_context_type( stream_class, decl); BT_PUT(decl); if (ret) { @@ -4212,8 +4212,8 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) int set = 0; int ret = 0; struct ctf_node *iter; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_stream_class *existing_stream_class = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_stream_class *existing_stream_class = NULL; struct bt_list_head *decl_list = &node->u.stream.declaration_list; if (node->visited) { @@ -4249,11 +4249,11 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) if (_IS_SET(&set, _STREAM_ID_SET)) { /* Check that packet header has stream_id field */ - _BT_CTF_FIELD_TYPE_INIT(stream_id_decl); - _BT_CTF_FIELD_TYPE_INIT(packet_header_decl); + _BT_FIELD_TYPE_INIT(stream_id_decl); + _BT_FIELD_TYPE_INIT(packet_header_decl); packet_header_decl = - bt_ctf_trace_get_packet_header_type(ctx->trace); + bt_trace_get_packet_header_type(ctx->trace); if (!packet_header_decl) { _BT_LOGE_NODE(node, "Stream class has a `id` attribute, " @@ -4262,7 +4262,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) } stream_id_decl = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( packet_header_decl, "stream_id"); BT_PUT(packet_header_decl); if (!stream_id_decl) { @@ -4272,7 +4272,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) goto error; } - if (!bt_ctf_field_type_is_integer(stream_id_decl)) { + if (!bt_field_type_is_integer(stream_id_decl)) { BT_PUT(stream_id_decl); _BT_LOGE_NODE(node, "Stream class has a `id` attribute, " @@ -4291,11 +4291,11 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) } /* Automatic ID: 0 */ - ret = bt_ctf_stream_class_set_id(stream_class, 0); + ret = bt_stream_class_set_id(stream_class, 0); assert(ret == 0); } - id = bt_ctf_stream_class_get_id(stream_class); + id = bt_stream_class_get_id(stream_class); if (id < 0) { _BT_LOGE_NODE(node, "Cannot get stream class's ID."); @@ -4307,7 +4307,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) * Make sure that this stream class's ID is currently unique in * the trace. */ - existing_stream_class = bt_ctf_trace_get_stream_class_by_id(ctx->trace, + existing_stream_class = bt_trace_get_stream_class_by_id(ctx->trace, id); if (g_hash_table_lookup(ctx->stream_classes, &id) || existing_stream_class) { @@ -4345,7 +4345,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set) { int ret = 0; char *left = NULL; - _BT_CTF_FIELD_TYPE_INIT(packet_header_decl); + _BT_FIELD_TYPE_INIT(packet_header_decl); switch (node->type) { case NODE_TYPEDEF: @@ -4424,7 +4424,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set) goto error; } - ret = bt_ctf_trace_set_uuid(ctx->trace, ctx->trace_uuid); + ret = bt_trace_set_uuid(ctx->trace, ctx->trace_uuid); if (ret) { _BT_LOGE_NODE(node, "Cannot set trace's UUID."); goto error; @@ -4461,7 +4461,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set) } assert(packet_header_decl); - ret = bt_ctf_trace_set_packet_header_type(ctx->trace, + ret = bt_trace_set_packet_header_type(ctx->trace, packet_header_decl); BT_PUT(packet_header_decl); if (ret) { @@ -4619,7 +4619,7 @@ int visit_env(struct ctx *ctx, struct ctf_node *node) } } - ret = bt_ctf_trace_set_environment_field_string( + ret = bt_trace_set_environment_field_string( ctx->trace, left, right); g_free(right); @@ -4647,7 +4647,7 @@ int visit_env(struct ctx *ctx, struct ctf_node *node) goto error; } - ret = bt_ctf_trace_set_environment_field_integer( + ret = bt_trace_set_environment_field_integer( ctx->trace, left, v); if (ret) { _BT_LOGE_NODE(entry_node, @@ -4697,7 +4697,7 @@ int set_trace_byte_order(struct ctx *ctx, struct ctf_node *trace_node) } if (!strcmp(left, "byte_order")) { - enum bt_ctf_byte_order bo; + enum bt_byte_order bo; if (_IS_SET(&set, _TRACE_BYTE_ORDER_SET)) { _BT_LOGE_DUP_ATTR(node, "byte_order", @@ -4711,13 +4711,13 @@ int set_trace_byte_order(struct ctx *ctx, struct ctf_node *trace_node) &node->u.ctf_expression.right, struct ctf_node, siblings); bo = byte_order_from_unary_expr(right_node); - if (bo == BT_CTF_BYTE_ORDER_UNKNOWN) { + if (bo == BT_BYTE_ORDER_UNKNOWN) { _BT_LOGE_NODE(node, "Invalid `byte_order` attribute in trace (`trace` block): " "expecting `le`, `be`, or `network`."); ret = -EINVAL; goto error; - } else if (bo == BT_CTF_BYTE_ORDER_NATIVE) { + } else if (bo == BT_BYTE_ORDER_NATIVE) { _BT_LOGE_NODE(node, "Invalid `byte_order` attribute in trace (`trace` block): " "cannot be set to `native` here."); @@ -4726,7 +4726,7 @@ int set_trace_byte_order(struct ctx *ctx, struct ctf_node *trace_node) } ctx->trace_bo = bo; - ret = bt_ctf_trace_set_native_byte_order( + ret = bt_trace_set_native_byte_order( ctx->trace, bo); if (ret) { _BT_LOGE_NODE(node, @@ -4758,7 +4758,7 @@ error: static int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, - struct bt_ctf_clock_class *clock, int *set) + struct bt_clock_class *clock, int *set) { int ret = 0; char *left = NULL; @@ -4796,7 +4796,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_name(clock, right); + ret = bt_clock_class_set_name(clock, right); if (ret) { _BT_LOGE_NODE(entry_node, "cannot set clock class's name"); @@ -4822,7 +4822,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_uuid(clock, uuid); + ret = bt_clock_class_set_uuid(clock, uuid); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's UUID."); @@ -4849,7 +4849,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_description(clock, right); + ret = bt_clock_class_set_description(clock, right); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's description."); @@ -4885,7 +4885,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_frequency(clock, freq); + ret = bt_clock_class_set_frequency(clock, freq); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's frequency."); @@ -4912,7 +4912,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_precision(clock, precision); + ret = bt_clock_class_set_precision(clock, precision); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's precision."); @@ -4939,7 +4939,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_offset_s(clock, offset_s); + ret = bt_clock_class_set_offset_s(clock, offset_s); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's offset in seconds."); @@ -4965,7 +4965,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_offset_cycles(clock, offset); + ret = bt_clock_class_set_offset_cycles(clock, offset); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's offset in cycles."); @@ -4994,7 +4994,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node, goto error; } - ret = bt_ctf_clock_class_set_is_absolute(clock, ret); + ret = bt_clock_class_set_is_absolute(clock, ret); if (ret) { _BT_LOGE_NODE(entry_node, "Cannot set clock class's absolute flag."); @@ -5035,21 +5035,21 @@ int64_t cycles_from_ns(uint64_t frequency, int64_t ns) } static -int apply_clock_class_offset(struct ctx *ctx, struct bt_ctf_clock_class *clock) +int apply_clock_class_offset(struct ctx *ctx, struct bt_clock_class *clock) { int ret; uint64_t freq; int64_t offset_cycles; int64_t offset_to_apply; - freq = bt_ctf_clock_class_get_frequency(clock); + freq = bt_clock_class_get_frequency(clock); if (freq == -1ULL) { BT_LOGE_STR("Cannot get clock class's frequency."); ret = -1; goto end; } - ret = bt_ctf_clock_class_get_offset_cycles(clock, &offset_cycles); + ret = bt_clock_class_get_offset_cycles(clock, &offset_cycles); if (ret) { BT_LOGE_STR("Cannot get clock class's offset in cycles."); ret = -1; @@ -5060,7 +5060,7 @@ int apply_clock_class_offset(struct ctx *ctx, struct bt_ctf_clock_class *clock) ctx->decoder_config.clock_class_offset_s * 1000000000LL + ctx->decoder_config.clock_class_offset_ns; offset_cycles += cycles_from_ns(freq, offset_to_apply); - ret = bt_ctf_clock_class_set_offset_cycles(clock, offset_cycles); + ret = bt_clock_class_set_offset_cycles(clock, offset_cycles); end: return ret; @@ -5071,7 +5071,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) { int ret = 0; int set = 0; - struct bt_ctf_clock_class *clock; + struct bt_clock_class *clock; struct ctf_node *entry_node; struct bt_list_head *decl_list = &clock_node->u.clock.declaration_list; const char *clock_class_name; @@ -5083,7 +5083,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) clock_node->visited = TRUE; /* CTF 1.8's default frequency for a clock class is 1 GHz */ - clock = bt_ctf_clock_class_create(NULL, 1000000000); + clock = bt_clock_class_create(NULL, 1000000000); if (!clock) { _BT_LOGE_NODE(clock_node, "Cannot create default clock class."); @@ -5108,7 +5108,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) goto error; } - clock_class_name = bt_ctf_clock_class_get_name(clock); + clock_class_name = bt_clock_class_get_name(clock); assert(clock_class_name); if (ctx->is_lttng && strcmp(clock_class_name, "monotonic") == 0) { /* @@ -5117,7 +5117,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) * it's a condition to be able to sort notifications * from different sources. */ - ret = bt_ctf_clock_class_set_is_absolute(clock, 1); + ret = bt_clock_class_set_is_absolute(clock, 1); if (ret) { _BT_LOGE_NODE(clock_node, "Cannot set clock class's absolute flag."); @@ -5132,7 +5132,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node) goto error; } - ret = bt_ctf_trace_add_clock_class(ctx->trace, clock); + ret = bt_trace_add_clock_class(ctx->trace, clock); if (ret) { _BT_LOGE_NODE(clock_node, "Cannot add clock class to trace."); @@ -5178,7 +5178,7 @@ int visit_root_decl(struct ctx *ctx, struct ctf_node *root_decl_node) break; case NODE_TYPE_SPECIFIER_LIST: { - _BT_CTF_FIELD_TYPE_INIT(decl); + _BT_FIELD_TYPE_INIT(decl); /* * Just add the type specifier to the root @@ -5215,7 +5215,7 @@ int set_trace_name(struct ctx *ctx) int ret = 0; struct bt_value *value = NULL; - assert(bt_ctf_trace_get_stream_class_count(ctx->trace) == 0); + assert(bt_trace_get_stream_class_count(ctx->trace) == 0); name = g_string_new(NULL); if (!name) { BT_LOGE_STR("Failed to allocate a GString."); @@ -5227,7 +5227,7 @@ int set_trace_name(struct ctx *ctx) * Check if we have a trace environment string value named `hostname`. * If so, use it as the trace name's prefix. */ - value = bt_ctf_trace_get_environment_field_value_by_name(ctx->trace, + value = bt_trace_get_environment_field_value_by_name(ctx->trace, "hostname"); if (bt_value_is_string(value)) { const char *hostname; @@ -5245,7 +5245,7 @@ int set_trace_name(struct ctx *ctx) g_string_append(name, ctx->trace_name_suffix); } - ret = bt_ctf_trace_set_name(ctx->trace, name->str); + ret = bt_trace_set_name(ctx->trace, name->str); if (ret) { BT_LOGE("Cannot set trace's name: name=\"%s\"", name->str); goto error; @@ -5274,7 +5274,7 @@ int move_ctx_stream_classes_to_trace(struct ctx *ctx) gpointer key, stream_class; if (g_hash_table_size(ctx->stream_classes) > 0 && - bt_ctf_trace_get_stream_class_count(ctx->trace) == 0) { + bt_trace_get_stream_class_count(ctx->trace) == 0) { /* * We're about to add the first stream class to the * trace. This will freeze the trace, and after this @@ -5291,10 +5291,10 @@ int move_ctx_stream_classes_to_trace(struct ctx *ctx) g_hash_table_iter_init(&iter, ctx->stream_classes); while (g_hash_table_iter_next(&iter, &key, &stream_class)) { - ret = bt_ctf_trace_add_stream_class(ctx->trace, + ret = bt_trace_add_stream_class(ctx->trace, stream_class); if (ret) { - int64_t id = bt_ctf_stream_class_get_id(stream_class); + int64_t id = bt_stream_class_get_id(stream_class); BT_LOGE("Cannot add stream class to trace: id=%" PRId64, id); goto end; @@ -5314,16 +5314,16 @@ struct ctf_visitor_generate_ir *ctf_visitor_generate_ir_create( { int ret; struct ctx *ctx = NULL; - struct bt_ctf_trace *trace; + struct bt_trace *trace; - trace = bt_ctf_trace_create(); + trace = bt_trace_create(); if (!trace) { BT_LOGE_STR("Cannot create empty trace."); goto error; } /* Set packet header to NULL to override the default one */ - ret = bt_ctf_trace_set_packet_header_type(trace, NULL); + ret = bt_trace_set_packet_header_type(trace, NULL); if (ret) { BT_LOGE_STR("Cannot reset initial trace's packet header field type."); goto error; @@ -5355,7 +5355,7 @@ void ctf_visitor_generate_ir_destroy(struct ctf_visitor_generate_ir *visitor) } BT_HIDDEN -struct bt_ctf_trace *ctf_visitor_generate_ir_get_trace( +struct bt_trace *ctf_visitor_generate_ir_get_trace( struct ctf_visitor_generate_ir *visitor) { struct ctx *ctx = (void *) visitor; @@ -5387,7 +5387,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor, * have the native byte order yet, and we don't have any * trace block yet, then fail with EINCOMPLETE. */ - if (ctx->trace_bo == BT_CTF_BYTE_ORDER_NATIVE) { + if (ctx->trace_bo == BT_BYTE_ORDER_NATIVE) { bt_list_for_each_entry(iter, &node->u.root.trace, siblings) { if (got_trace_decl) { _BT_LOGE_NODE(node, @@ -5414,8 +5414,8 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor, } } - assert(ctx->trace_bo == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN || - ctx->trace_bo == BT_CTF_BYTE_ORDER_BIG_ENDIAN); + assert(ctx->trace_bo == BT_BYTE_ORDER_LITTLE_ENDIAN || + ctx->trace_bo == BT_BYTE_ORDER_BIG_ENDIAN); assert(ctx->current_scope && ctx->current_scope->parent_scope == NULL); diff --git a/plugins/ctf/common/notif-iter/notif-iter.c b/plugins/ctf/common/notif-iter/notif-iter.c index a5d9e5c8..d7164952 100644 --- a/plugins/ctf/common/notif-iter/notif-iter.c +++ b/plugins/ctf/common/notif-iter/notif-iter.c @@ -42,7 +42,7 @@ #include "notif-iter.h" #include "../btr/btr.h" -struct bt_ctf_notif_iter; +struct bt_notif_iter; /* A visit stack entry */ struct stack_entry { @@ -57,7 +57,7 @@ struct stack_entry { * * Field is owned by this. */ - struct bt_ctf_field *base; + struct bt_field *base; /* index of next field to set */ size_t index; @@ -121,13 +121,13 @@ struct stream_class_field_path_cache { }; struct field_cb_override { - enum bt_ctf_btr_status (* func)(void *value, - struct bt_ctf_field_type *type, void *data); + enum bt_btr_status (* func)(void *value, + struct bt_field_type *type, void *data); void *data; }; /* CTF notification iterator */ -struct bt_ctf_notif_iter { +struct bt_notif_iter { /* Visit stack */ struct stack *stack; @@ -138,34 +138,34 @@ struct bt_ctf_notif_iter { * btr_compound_begin_cb(). It points to one of the fields in * dscopes below. */ - struct bt_ctf_field **cur_dscope_field; + struct bt_field **cur_dscope_field; /* Trace and classes (owned by this) */ struct { - struct bt_ctf_trace *trace; - struct bt_ctf_stream_class *stream_class; - struct bt_ctf_event_class *event_class; + struct bt_trace *trace; + struct bt_stream_class *stream_class; + struct bt_event_class *event_class; } meta; /* Current packet (NULL if not created yet) */ - struct bt_ctf_packet *packet; + struct bt_packet *packet; /* Current stream (NULL if not set yet) */ - struct bt_ctf_stream *stream; + struct bt_stream *stream; /* * Current timestamp_end field (to consider before switching packets). */ - struct bt_ctf_field *cur_timestamp_end; + struct bt_field *cur_timestamp_end; /* Database of current dynamic scopes (owned by this) */ struct { - struct bt_ctf_field *trace_packet_header; - struct bt_ctf_field *stream_packet_context; - struct bt_ctf_field *stream_event_header; - struct bt_ctf_field *stream_event_context; - struct bt_ctf_field *event_context; - struct bt_ctf_field *event_payload; + struct bt_field *trace_packet_header; + struct bt_field *stream_packet_context; + struct bt_field *stream_event_header; + struct bt_field *stream_event_context; + struct bt_field *event_context; + struct bt_field *event_payload; } dscopes; /* @@ -179,7 +179,7 @@ struct bt_ctf_notif_iter { * This should be used to implement the behaviour of integer fields * mapped to clocks and other "tagged" fields (in CTF 2). * - * bt_ctf_field_type to struct field_cb_override + * bt_field_type to struct field_cb_override */ GHashTable *field_overrides; @@ -205,11 +205,11 @@ struct bt_ctf_notif_iter { } buf; /* Binary type reader */ - struct bt_ctf_btr *btr; + struct bt_btr *btr; /* Current medium data */ struct { - struct bt_ctf_notif_iter_medium_ops medops; + struct bt_notif_iter_medium_ops medops; size_t max_request_sz; void *data; } medium; @@ -226,7 +226,7 @@ struct bt_ctf_notif_iter { */ off_t cur_packet_offset; - /* bt_ctf_clock_class to uint64_t. */ + /* bt_clock_class to uint64_t. */ GHashTable *clock_states; /* @@ -241,7 +241,7 @@ struct bt_ctf_notif_iter { */ struct stream_class_field_path_cache *cur_sc_field_path_cache; - /* bt_ctf_stream_class to struct stream_class_field_path_cache. */ + /* bt_stream_class to struct stream_class_field_path_cache. */ GHashTable *sc_field_path_caches; }; @@ -295,11 +295,11 @@ const char *state_string(enum state state) } static -int bt_ctf_notif_iter_switch_packet(struct bt_ctf_notif_iter *notit); +int bt_notif_iter_switch_packet(struct bt_notif_iter *notit); static -enum bt_ctf_btr_status btr_timestamp_end_cb(void *value, - struct bt_ctf_field_type *type, void *data); +enum bt_btr_status btr_timestamp_end_cb(void *value, + struct bt_field_type *type, void *data); static void stack_entry_free_func(gpointer data) @@ -311,7 +311,7 @@ void stack_entry_free_func(gpointer data) } static -struct stack *stack_new(struct bt_ctf_notif_iter *notit) +struct stack *stack_new(struct bt_notif_iter *notit) { struct stack *stack = NULL; @@ -345,7 +345,7 @@ void stack_destroy(struct stack *stack) } static -int stack_push(struct stack *stack, struct bt_ctf_field *base) +int stack_push(struct stack *stack, struct bt_field *base) { int ret = 0; struct stack_entry *entry; @@ -418,32 +418,32 @@ void stack_clear(struct stack *stack) } static inline -enum bt_ctf_notif_iter_status notif_iter_status_from_m_status( - enum bt_ctf_notif_iter_medium_status m_status) +enum bt_notif_iter_status notif_iter_status_from_m_status( + enum bt_notif_iter_medium_status m_status) { return (int) m_status; } static inline -size_t buf_size_bits(struct bt_ctf_notif_iter *notit) +size_t buf_size_bits(struct bt_notif_iter *notit) { return notit->buf.sz * 8; } static inline -size_t buf_available_bits(struct bt_ctf_notif_iter *notit) +size_t buf_available_bits(struct bt_notif_iter *notit) { return buf_size_bits(notit) - notit->buf.at; } static inline -size_t packet_at(struct bt_ctf_notif_iter *notit) +size_t packet_at(struct bt_notif_iter *notit) { return notit->buf.packet_offset + notit->buf.at; } static inline -void buf_consume_bits(struct bt_ctf_notif_iter *notit, size_t incr) +void buf_consume_bits(struct bt_notif_iter *notit, size_t incr) { BT_LOGV("Advancing cursor: notit-addr=%p, cur-before=%zu, cur-after=%zu", notit, notit->buf.at, notit->buf.at + incr); @@ -451,12 +451,12 @@ void buf_consume_bits(struct bt_ctf_notif_iter *notit, size_t incr) } static -enum bt_ctf_notif_iter_status request_medium_bytes( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status request_medium_bytes( + struct bt_notif_iter *notit) { uint8_t *buffer_addr = NULL; size_t buffer_sz = 0; - enum bt_ctf_notif_iter_medium_status m_status; + enum bt_notif_iter_medium_status m_status; BT_LOGV("Calling user function (request bytes): notit-addr=%p, " "request-size=%zu", notit, notit->medium.max_request_sz); @@ -464,9 +464,9 @@ enum bt_ctf_notif_iter_status request_medium_bytes( notit->medium.max_request_sz, &buffer_addr, &buffer_sz, notit->medium.data); BT_LOGV("User function returned: status=%s, buf-addr=%p, buf-size=%zu", - bt_ctf_notif_iter_medium_status_string(m_status), + bt_notif_iter_medium_status_string(m_status), buffer_addr, buffer_sz); - if (m_status == BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK) { + if (m_status == BT_NOTIF_ITER_MEDIUM_STATUS_OK) { assert(buffer_sz != 0); /* New packet offset is old one + old size (in bits) */ @@ -488,12 +488,12 @@ enum bt_ctf_notif_iter_status request_medium_bytes( notit->buf.sz, notit->buf.addr); BT_LOGV_MEM(buffer_addr, buffer_sz, "Returned bytes at %p:", buffer_addr); - } else if (m_status == BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF) { - struct bt_ctf_field_type *ph_ft = - bt_ctf_trace_get_packet_header_type(notit->meta.trace); - struct bt_ctf_field_type *eh_ft = NULL; - struct bt_ctf_field_type *sec_ft = NULL; - struct bt_ctf_field_type *ec_ft = NULL; + } else if (m_status == BT_NOTIF_ITER_MEDIUM_STATUS_EOF) { + struct bt_field_type *ph_ft = + bt_trace_get_packet_header_type(notit->meta.trace); + struct bt_field_type *eh_ft = NULL; + struct bt_field_type *sec_ft = NULL; + struct bt_field_type *ec_ft = NULL; /* * User returned end of stream: validate that we're not @@ -519,9 +519,9 @@ enum bt_ctf_notif_iter_status request_medium_bytes( } } - eh_ft = bt_ctf_stream_class_get_event_header_type( + eh_ft = bt_stream_class_get_event_header_type( notit->meta.stream_class); - sec_ft = bt_ctf_stream_class_get_event_context_type( + sec_ft = bt_stream_class_get_event_context_type( notit->meta.stream_class); if (notit->state == STATE_DSCOPE_STREAM_EVENT_HEADER_BEGIN) { @@ -553,7 +553,7 @@ enum bt_ctf_notif_iter_status request_medium_bytes( goto bad_state; } - ec_ft = bt_ctf_event_class_get_context_type( + ec_ft = bt_event_class_get_context_type( notit->meta.event_class); if (notit->state == STATE_DSCOPE_EVENT_CONTEXT_BEGIN) { @@ -587,9 +587,9 @@ bad_state: /* All other states are invalid */ BT_LOGW("User function returned %s, but notification iterator is in an unexpected state: " "state=%s", - bt_ctf_notif_iter_medium_status_string(m_status), + bt_notif_iter_medium_status_string(m_status), state_string(notit->state)); - m_status = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR; + m_status = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR; good_state: bt_put(ph_ft); @@ -598,21 +598,21 @@ good_state: bt_put(ec_ft); } else if (m_status < 0) { BT_LOGW("User function failed: status=%s", - bt_ctf_notif_iter_medium_status_string(m_status)); + bt_notif_iter_medium_status_string(m_status)); } return notif_iter_status_from_m_status(m_status); } static inline -enum bt_ctf_notif_iter_status buf_ensure_available_bits( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status buf_ensure_available_bits( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; if (buf_available_bits(notit) == 0) { /* - * This _cannot_ return BT_CTF_NOTIF_ITER_STATUS_OK + * This _cannot_ return BT_NOTIF_ITER_STATUS_OK * _and_ no bits. */ status = request_medium_bytes(notit); @@ -622,26 +622,26 @@ enum bt_ctf_notif_iter_status buf_ensure_available_bits( } static -enum bt_ctf_notif_iter_status read_dscope_begin_state( - struct bt_ctf_notif_iter *notit, - struct bt_ctf_field_type *dscope_field_type, +enum bt_notif_iter_status read_dscope_begin_state( + struct bt_notif_iter *notit, + struct bt_field_type *dscope_field_type, enum state done_state, enum state continue_state, - struct bt_ctf_field **dscope_field) + struct bt_field **dscope_field) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - enum bt_ctf_btr_status btr_status; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + enum bt_btr_status btr_status; size_t consumed_bits; status = buf_ensure_available_bits(notit); - if (status != BT_CTF_NOTIF_ITER_STATUS_OK) { + if (status != BT_NOTIF_ITER_STATUS_OK) { if (status < 0) { BT_LOGW("Cannot ensure that buffer has at least one byte: " "notif-addr=%p, status=%s", - notit, bt_ctf_notif_iter_status_string(status)); + notit, bt_notif_iter_status_string(status)); } else { BT_LOGV("Cannot ensure that buffer has at least one byte: " "notif-addr=%p, status=%s", - notit, bt_ctf_notif_iter_status_string(status)); + notit, bt_notif_iter_status_string(status)); } goto end; @@ -651,26 +651,26 @@ enum bt_ctf_notif_iter_status read_dscope_begin_state( notit->cur_dscope_field = dscope_field; BT_LOGV("Starting BTR: notit-addr=%p, btr-addr=%p, ft-addr=%p", notit, notit->btr, dscope_field_type); - consumed_bits = bt_ctf_btr_start(notit->btr, dscope_field_type, + consumed_bits = bt_btr_start(notit->btr, dscope_field_type, notit->buf.addr, notit->buf.at, packet_at(notit), notit->buf.sz, &btr_status); BT_LOGV("BTR consumed bits: size=%zu", consumed_bits); switch (btr_status) { - case BT_CTF_BTR_STATUS_OK: + case BT_BTR_STATUS_OK: /* type was read completely */ BT_LOGV_STR("Field was completely decoded."); notit->state = done_state; break; - case BT_CTF_BTR_STATUS_EOF: + case BT_BTR_STATUS_EOF: BT_LOGV_STR("BTR needs more data to decode field completely."); notit->state = continue_state; break; default: BT_LOGW("BTR failed to start: notit-addr=%p, btr-addr=%p, " "status=%s", notit, notit->btr, - bt_ctf_btr_status_string(btr_status)); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + bt_btr_status_string(btr_status)); + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } @@ -682,23 +682,23 @@ end: } static -enum bt_ctf_notif_iter_status read_dscope_continue_state( - struct bt_ctf_notif_iter *notit, enum state done_state) +enum bt_notif_iter_status read_dscope_continue_state( + struct bt_notif_iter *notit, enum state done_state) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - enum bt_ctf_btr_status btr_status; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + enum bt_btr_status btr_status; size_t consumed_bits; status = buf_ensure_available_bits(notit); - if (status != BT_CTF_NOTIF_ITER_STATUS_OK) { + if (status != BT_NOTIF_ITER_STATUS_OK) { if (status < 0) { BT_LOGW("Cannot ensure that buffer has at least one byte: " "notif-addr=%p, status=%s", - notit, bt_ctf_notif_iter_status_string(status)); + notit, bt_notif_iter_status_string(status)); } else { BT_LOGV("Cannot ensure that buffer has at least one byte: " "notif-addr=%p, status=%s", - notit, bt_ctf_notif_iter_status_string(status)); + notit, bt_notif_iter_status_string(status)); } goto end; @@ -706,25 +706,25 @@ enum bt_ctf_notif_iter_status read_dscope_continue_state( BT_LOGV("Continuing BTR: notit-addr=%p, btr-addr=%p", notit, notit->btr); - consumed_bits = bt_ctf_btr_continue(notit->btr, notit->buf.addr, + consumed_bits = bt_btr_continue(notit->btr, notit->buf.addr, notit->buf.sz, &btr_status); BT_LOGV("BTR consumed bits: size=%zu", consumed_bits); switch (btr_status) { - case BT_CTF_BTR_STATUS_OK: + case BT_BTR_STATUS_OK: /* Type was read completely. */ BT_LOGV_STR("Field was completely decoded."); notit->state = done_state; break; - case BT_CTF_BTR_STATUS_EOF: + case BT_BTR_STATUS_EOF: /* Stay in this continue state. */ BT_LOGV_STR("BTR needs more data to decode field completely."); break; default: BT_LOGW("BTR failed to continue: notit-addr=%p, btr-addr=%p, " "status=%s", notit, notit->btr, - bt_ctf_btr_status_string(btr_status)); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + bt_btr_status_string(btr_status)); + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } @@ -735,7 +735,7 @@ end: } static -void put_event_dscopes(struct bt_ctf_notif_iter *notit) +void put_event_dscopes(struct bt_notif_iter *notit) { BT_LOGV_STR("Putting event header field."); BT_PUT(notit->dscopes.stream_event_header); @@ -748,7 +748,7 @@ void put_event_dscopes(struct bt_ctf_notif_iter *notit) } static -void put_all_dscopes(struct bt_ctf_notif_iter *notit) +void put_all_dscopes(struct bt_notif_iter *notit) { BT_LOGV_STR("Putting packet header field."); BT_PUT(notit->dscopes.trace_packet_header); @@ -758,20 +758,20 @@ void put_all_dscopes(struct bt_ctf_notif_iter *notit) } static -enum bt_ctf_notif_iter_status read_packet_header_begin_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_packet_header_begin_state( + struct bt_notif_iter *notit) { - struct bt_ctf_field_type *packet_header_type = NULL; - enum bt_ctf_notif_iter_status ret = BT_CTF_NOTIF_ITER_STATUS_OK; + struct bt_field_type *packet_header_type = NULL; + enum bt_notif_iter_status ret = BT_NOTIF_ITER_STATUS_OK; - if (bt_ctf_notif_iter_switch_packet(notit)) { + if (bt_notif_iter_switch_packet(notit)) { BT_LOGW("Cannot switch packet: notit-addr=%p", notit); - ret = BT_CTF_NOTIF_ITER_STATUS_ERROR; + ret = BT_NOTIF_ITER_STATUS_ERROR; goto end; } /* Packet header type is common to the whole trace. */ - packet_header_type = bt_ctf_trace_get_packet_header_type( + packet_header_type = bt_trace_get_packet_header_type( notit->meta.trace); if (!packet_header_type) { notit->state = STATE_AFTER_TRACE_PACKET_HEADER; @@ -781,7 +781,7 @@ enum bt_ctf_notif_iter_status read_packet_header_begin_state( BT_LOGV("Decoding packet header field:" "notit-addr=%p, trace-addr=%p, trace-name=\"%s\", ft-addr=%p", notit, notit->meta.trace, - bt_ctf_trace_get_name(notit->meta.trace), packet_header_type); + bt_trace_get_name(notit->meta.trace), packet_header_type); ret = read_dscope_begin_state(notit, packet_header_type, STATE_AFTER_TRACE_PACKET_HEADER, STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE, @@ -791,7 +791,7 @@ enum bt_ctf_notif_iter_status read_packet_header_begin_state( "notit-addr=%p, trace-addr=%p, " "trace-name=\"%s\", ft-addr=%p", notit, notit->meta.trace, - bt_ctf_trace_get_name(notit->meta.trace), + bt_trace_get_name(notit->meta.trace), packet_header_type); } end: @@ -800,32 +800,32 @@ end: } static -enum bt_ctf_notif_iter_status read_packet_header_continue_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_packet_header_continue_state( + struct bt_notif_iter *notit) { return read_dscope_continue_state(notit, STATE_AFTER_TRACE_PACKET_HEADER); } static inline -bool is_struct_type(struct bt_ctf_field_type *field_type) +bool is_struct_type(struct bt_field_type *field_type) { - return bt_ctf_field_type_get_type_id(field_type) == - BT_CTF_FIELD_TYPE_ID_STRUCT; + return bt_field_type_get_type_id(field_type) == + BT_FIELD_TYPE_ID_STRUCT; } static inline -bool is_variant_type(struct bt_ctf_field_type *field_type) +bool is_variant_type(struct bt_field_type *field_type) { - return bt_ctf_field_type_get_type_id(field_type) == - BT_CTF_FIELD_TYPE_ID_VARIANT; + return bt_field_type_get_type_id(field_type) == + BT_FIELD_TYPE_ID_VARIANT; } static struct stream_class_field_path_cache * create_stream_class_field_path_cache_entry( - struct bt_ctf_notif_iter *notit, - struct bt_ctf_stream_class *stream_class) + struct bt_notif_iter *notit, + struct bt_stream_class *stream_class) { int v = -1; int id = -1; @@ -834,18 +834,18 @@ create_stream_class_field_path_cache_entry( int content_size = -1; struct stream_class_field_path_cache *cache_entry = g_new0( struct stream_class_field_path_cache, 1); - struct bt_ctf_field_type *event_header = NULL, *packet_context = NULL; + struct bt_field_type *event_header = NULL, *packet_context = NULL; if (!cache_entry) { BT_LOGE_STR("Failed to allocate one stream class field path cache."); goto end; } - event_header = bt_ctf_stream_class_get_event_header_type(stream_class); - if (event_header && bt_ctf_field_type_is_structure(event_header)) { + event_header = bt_stream_class_get_event_header_type(stream_class); + if (event_header && bt_field_type_is_structure(event_header)) { int i, count; - count = bt_ctf_field_type_structure_get_field_count( + count = bt_field_type_structure_get_field_count( event_header); assert(count >= 0); @@ -853,7 +853,7 @@ create_stream_class_field_path_cache_entry( int ret; const char *name; - ret = bt_ctf_field_type_structure_get_field( + ret = bt_field_type_structure_get_field_by_index( event_header, &name, NULL, i); if (ret) { BT_LOGE("Cannot get event header structure field type's field: " @@ -862,8 +862,8 @@ create_stream_class_field_path_cache_entry( "stream-class-id=%" PRId64 ", " "ft-addr=%p, index=%d", notit, stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_header, i); goto error; } @@ -880,26 +880,26 @@ create_stream_class_field_path_cache_entry( } } - packet_context = bt_ctf_stream_class_get_packet_context_type( + packet_context = bt_stream_class_get_packet_context_type( stream_class); - if (packet_context && bt_ctf_field_type_is_structure(packet_context)) { + if (packet_context && bt_field_type_is_structure(packet_context)) { int i, count; - count = bt_ctf_field_type_structure_get_field_count( + count = bt_field_type_structure_get_field_count( packet_context); assert(count >= 0); for (i = 0; i < count; i++) { int ret; const char *name; - struct bt_ctf_field_type *field_type; + struct bt_field_type *field_type; if (timestamp_end != -1 && packet_size != -1 && content_size != -1) { break; } - ret = bt_ctf_field_type_structure_get_field( + ret = bt_field_type_structure_get_field_by_index( packet_context, &name, &field_type, i); if (ret) { BT_LOGE("Cannot get packet context structure field type's field: " @@ -908,8 +908,8 @@ create_stream_class_field_path_cache_entry( "stream-class-id=%" PRId64 ", " "ft-addr=%p, index=%d", notit, stream_class, - bt_ctf_stream_class_get_name(stream_class), - bt_ctf_stream_class_get_id(stream_class), + bt_stream_class_get_name(stream_class), + bt_stream_class_get_id(stream_class), event_header, i); goto error; } @@ -957,8 +957,8 @@ error: static struct stream_class_field_path_cache *get_stream_class_field_path_cache( - struct bt_ctf_notif_iter *notit, - struct bt_ctf_stream_class *stream_class) + struct bt_notif_iter *notit, + struct bt_stream_class *stream_class) { bool cache_entry_found; struct stream_class_field_path_cache *cache_entry; @@ -977,20 +977,20 @@ struct stream_class_field_path_cache *get_stream_class_field_path_cache( } static inline -enum bt_ctf_notif_iter_status set_current_stream_class( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status set_current_stream_class( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field_type *packet_header_type = NULL; - struct bt_ctf_field_type *stream_id_field_type = NULL; - struct bt_ctf_stream_class *new_stream_class = NULL; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field_type *packet_header_type = NULL; + struct bt_field_type *stream_id_field_type = NULL; + struct bt_stream_class *new_stream_class = NULL; uint64_t stream_id; /* Clear the current stream class field path cache. */ notit->cur_sc_field_path_cache = NULL; /* Is there any "stream_id" field in the packet header? */ - packet_header_type = bt_ctf_trace_get_packet_header_type( + packet_header_type = bt_trace_get_packet_header_type( notit->meta.trace); if (!packet_header_type) { /* @@ -1004,27 +1004,27 @@ enum bt_ctf_notif_iter_status set_current_stream_class( // TODO: optimalize! stream_id_field_type = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( packet_header_type, "stream_id"); if (stream_id_field_type) { /* Find appropriate stream class using current stream ID */ int ret; - struct bt_ctf_field *stream_id_field = NULL; + struct bt_field *stream_id_field = NULL; assert(notit->dscopes.trace_packet_header); // TODO: optimalize! - stream_id_field = bt_ctf_field_structure_get_field( + stream_id_field = bt_field_structure_get_field_by_name( notit->dscopes.trace_packet_header, "stream_id"); assert(stream_id_field); - ret = bt_ctf_field_unsigned_integer_get_value( + ret = bt_field_unsigned_integer_get_value( stream_id_field, &stream_id); assert(!ret); BT_PUT(stream_id_field); } else { single_stream_class: /* Only one stream: pick the first stream class */ - assert(bt_ctf_trace_get_stream_class_count( + assert(bt_trace_get_stream_class_count( notit->meta.trace) == 1); stream_id = 0; } @@ -1033,17 +1033,17 @@ single_stream_class: "stream-class-id=%" PRIu64 ", " "trace-addr=%p, trace-name=\"%s\"", notit, stream_id, notit->meta.trace, - bt_ctf_trace_get_name(notit->meta.trace)); + bt_trace_get_name(notit->meta.trace)); - new_stream_class = bt_ctf_trace_get_stream_class_by_id( + new_stream_class = bt_trace_get_stream_class_by_id( notit->meta.trace, stream_id); if (!new_stream_class) { BT_LOGW("No stream class with ID of stream class ID to use in trace: " "notit-addr=%p, stream-class-id=%" PRIu64 ", " "trace-addr=%p, trace-name=\"%s\"", notit, stream_id, notit->meta.trace, - bt_ctf_trace_get_name(notit->meta.trace)); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + bt_trace_get_name(notit->meta.trace)); + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } @@ -1058,14 +1058,14 @@ single_stream_class: "next-stream-class-id=%" PRId64 ", " "trace-addr=%p, trace-name=\"%s\"", notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), new_stream_class, - bt_ctf_stream_class_get_name(new_stream_class), - bt_ctf_stream_class_get_id(new_stream_class), + bt_stream_class_get_name(new_stream_class), + bt_stream_class_get_id(new_stream_class), notit->meta.trace, - bt_ctf_trace_get_name(notit->meta.trace)); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + bt_trace_get_name(notit->meta.trace)); + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } } else { @@ -1076,8 +1076,8 @@ single_stream_class: "notit-addr=%p, stream-class-addr=%p, " "stream-class-name=\"%s\", stream-class-id=%" PRId64, notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class)); + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class)); /* * Retrieve (or lazily create) the current stream class field path @@ -1090,9 +1090,9 @@ single_stream_class: "notit-addr=%p, stream-class-addr=%p, " "stream-class-name=\"%s\", stream-class-id=%" PRId64, notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class)); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class)); + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } end: @@ -1103,13 +1103,13 @@ end: } static -enum bt_ctf_notif_iter_status after_packet_header_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status after_packet_header_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status; + enum bt_notif_iter_status status; status = set_current_stream_class(notit); - if (status == BT_CTF_NOTIF_ITER_STATUS_OK) { + if (status == BT_NOTIF_ITER_STATUS_OK) { notit->state = STATE_DSCOPE_STREAM_PACKET_CONTEXT_BEGIN; } @@ -1117,22 +1117,22 @@ enum bt_ctf_notif_iter_status after_packet_header_state( } static -enum bt_ctf_notif_iter_status read_packet_context_begin_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_packet_context_begin_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field_type *packet_context_type; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field_type *packet_context_type; assert(notit->meta.stream_class); - packet_context_type = bt_ctf_stream_class_get_packet_context_type( + packet_context_type = bt_stream_class_get_packet_context_type( notit->meta.stream_class); if (!packet_context_type) { BT_LOGV("No packet packet context field type in stream class: continuing: " "notit-addr=%p, stream-class-addr=%p, " "stream-class-name=\"%s\", stream-class-id=%" PRId64, notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class)); + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class)); notit->state = STATE_AFTER_STREAM_PACKET_CONTEXT; goto end; } @@ -1142,8 +1142,8 @@ enum bt_ctf_notif_iter_status read_packet_context_begin_state( "stream-class-name=\"%s\", stream-class-id=%" PRId64 ", " "ft-addr=%p", notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), packet_context_type); status = read_dscope_begin_state(notit, packet_context_type, STATE_AFTER_STREAM_PACKET_CONTEXT, @@ -1155,8 +1155,8 @@ enum bt_ctf_notif_iter_status read_packet_context_begin_state( "stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", ft-addr=%p", notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), packet_context_type); } @@ -1166,32 +1166,32 @@ end: } static -enum bt_ctf_notif_iter_status read_packet_context_continue_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_packet_context_continue_state( + struct bt_notif_iter *notit) { return read_dscope_continue_state(notit, STATE_AFTER_STREAM_PACKET_CONTEXT); } static -enum bt_ctf_notif_iter_status set_current_packet_content_sizes( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status set_current_packet_content_sizes( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field *packet_size_field = NULL; - struct bt_ctf_field *content_size_field = NULL; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field *packet_size_field = NULL; + struct bt_field *content_size_field = NULL; uint64_t content_size = -1ULL, packet_size = -1ULL; if (!notit->dscopes.stream_packet_context) { goto end; } - packet_size_field = bt_ctf_field_structure_get_field( + packet_size_field = bt_field_structure_get_field_by_name( notit->dscopes.stream_packet_context, "packet_size"); - content_size_field = bt_ctf_field_structure_get_field( + content_size_field = bt_field_structure_get_field_by_name( notit->dscopes.stream_packet_context, "content_size"); if (packet_size_field) { - int ret = bt_ctf_field_unsigned_integer_get_value( + int ret = bt_field_unsigned_integer_get_value( packet_size_field, &packet_size); assert(ret == 0); @@ -1199,7 +1199,7 @@ enum bt_ctf_notif_iter_status set_current_packet_content_sizes( BT_LOGW("Invalid packet size: packet context field indicates packet size is zero: " "notit-addr=%p, packet-context-field-addr=%p", notit, notit->dscopes.stream_packet_context); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } else if ((packet_size % 8) != 0) { BT_LOGW("Invalid packet size: packet context field indicates packet size is not a multiple of 8: " @@ -1207,13 +1207,13 @@ enum bt_ctf_notif_iter_status set_current_packet_content_sizes( "packet-size=%" PRIu64, notit, notit->dscopes.stream_packet_context, packet_size); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } } if (content_size_field) { - int ret = bt_ctf_field_unsigned_integer_get_value( + int ret = bt_field_unsigned_integer_get_value( content_size_field, &content_size); assert(ret == 0); @@ -1227,7 +1227,7 @@ enum bt_ctf_notif_iter_status set_current_packet_content_sizes( "packet-size=%" PRIu64 ", content-size=%" PRIu64, notit, notit->dscopes.stream_packet_context, packet_size, content_size); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } @@ -1252,13 +1252,13 @@ end: } static -enum bt_ctf_notif_iter_status after_packet_context_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status after_packet_context_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status; + enum bt_notif_iter_status status; status = set_current_packet_content_sizes(notit); - if (status == BT_CTF_NOTIF_ITER_STATUS_OK) { + if (status == BT_NOTIF_ITER_STATUS_OK) { notit->state = STATE_EMIT_NOTIF_NEW_PACKET; } @@ -1266,11 +1266,11 @@ enum bt_ctf_notif_iter_status after_packet_context_state( } static -enum bt_ctf_notif_iter_status read_event_header_begin_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_event_header_begin_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field_type *event_header_type = NULL; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field_type *event_header_type = NULL; /* Reset the position of the last event header */ notit->buf.last_eh_at = notit->buf.at; @@ -1289,12 +1289,12 @@ enum bt_ctf_notif_iter_status read_event_header_begin_state( "notit-addr=%p, content-size=%" PRId64 ", " "cur=%zu", notit, notit->cur_content_size, packet_at(notit)); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } } - event_header_type = bt_ctf_stream_class_get_event_header_type( + event_header_type = bt_stream_class_get_event_header_type( notit->meta.stream_class); if (!event_header_type) { notit->state = STATE_AFTER_STREAM_EVENT_HEADER; @@ -1307,8 +1307,8 @@ enum bt_ctf_notif_iter_status read_event_header_begin_state( "stream-class-name=\"%s\", stream-class-id=%" PRId64 ", " "ft-addr=%p", notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), event_header_type); status = read_dscope_begin_state(notit, event_header_type, STATE_AFTER_STREAM_EVENT_HEADER, @@ -1320,8 +1320,8 @@ enum bt_ctf_notif_iter_status read_event_header_begin_state( "stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", ft-addr=%p", notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), event_header_type); } end: @@ -1331,15 +1331,15 @@ end: } static -enum bt_ctf_notif_iter_status read_event_header_continue_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_event_header_continue_state( + struct bt_notif_iter *notit) { return read_dscope_continue_state(notit, STATE_AFTER_STREAM_EVENT_HEADER); } static inline -enum bt_ctf_notif_iter_status set_current_event_class(struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status set_current_event_class(struct bt_notif_iter *notit) { /* * The assert() calls in this function are okay because it is @@ -1347,14 +1347,14 @@ enum bt_ctf_notif_iter_status set_current_event_class(struct bt_ctf_notif_iter * * validated for CTF correctness before decoding actual streams. */ - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field_type *event_header_type; - struct bt_ctf_field_type *id_field_type = NULL; - struct bt_ctf_field_type *v_field_type = NULL; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field_type *event_header_type; + struct bt_field_type *id_field_type = NULL; + struct bt_field_type *v_field_type = NULL; uint64_t event_id = -1ULL; int ret; - event_header_type = bt_ctf_stream_class_get_event_header_type( + event_header_type = bt_stream_class_get_event_header_type( notit->meta.stream_class); if (!event_header_type) { /* @@ -1366,9 +1366,9 @@ enum bt_ctf_notif_iter_status set_current_event_class(struct bt_ctf_notif_iter * /* Is there any "id"/"v" field in the event header? */ assert(is_struct_type(event_header_type)); - id_field_type = bt_ctf_field_type_structure_get_field_type_by_name( + id_field_type = bt_field_type_structure_get_field_type_by_name( event_header_type, "id"); - v_field_type = bt_ctf_field_type_structure_get_field_type_by_name( + v_field_type = bt_field_type_structure_get_field_type_by_name( event_header_type, "v"); assert(notit->dscopes.stream_event_header); if (v_field_type) { @@ -1380,30 +1380,30 @@ enum bt_ctf_notif_iter_status set_current_event_class(struct bt_ctf_notif_iter * * |_____|_| |_||_| |_|\__, | C A S E ™ * |___/ */ - struct bt_ctf_field *v_field = NULL; - struct bt_ctf_field *v_struct_field = NULL; - struct bt_ctf_field *v_struct_id_field = NULL; + struct bt_field *v_field = NULL; + struct bt_field *v_struct_field = NULL; + struct bt_field *v_struct_id_field = NULL; // TODO: optimalize! - v_field = bt_ctf_field_structure_get_field( + v_field = bt_field_structure_get_field_by_name( notit->dscopes.stream_event_header, "v"); assert(v_field); v_struct_field = - bt_ctf_field_variant_get_current_field(v_field); + bt_field_variant_get_current_field(v_field); if (!v_struct_field) { goto end_v_field_type; } // TODO: optimalize! v_struct_id_field = - bt_ctf_field_structure_get_field(v_struct_field, "id"); + bt_field_structure_get_field_by_name(v_struct_field, "id"); if (!v_struct_id_field) { goto end_v_field_type; } - if (bt_ctf_field_is_integer(v_struct_id_field)) { - ret = bt_ctf_field_unsigned_integer_get_value( + if (bt_field_is_integer(v_struct_id_field)) { + ret = bt_field_unsigned_integer_get_value( v_struct_id_field, &event_id); if (ret) { BT_LOGV("Cannot get value of unsigned integer field (`id`): continuing: " @@ -1421,26 +1421,26 @@ end_v_field_type: if (id_field_type && event_id == -1ULL) { /* Check "id" field */ - struct bt_ctf_field *id_field = NULL; + struct bt_field *id_field = NULL; int ret_get_value = 0; // TODO: optimalize! - id_field = bt_ctf_field_structure_get_field( + id_field = bt_field_structure_get_field_by_name( notit->dscopes.stream_event_header, "id"); if (!id_field) { goto check_event_id; } - if (bt_ctf_field_is_integer(id_field)) { - ret_get_value = bt_ctf_field_unsigned_integer_get_value( + if (bt_field_is_integer(id_field)) { + ret_get_value = bt_field_unsigned_integer_get_value( id_field, &event_id); - } else if (bt_ctf_field_is_enumeration(id_field)) { - struct bt_ctf_field *container; + } else if (bt_field_is_enumeration(id_field)) { + struct bt_field *container; - container = bt_ctf_field_enumeration_get_container( + container = bt_field_enumeration_get_container( id_field); assert(container); - ret_get_value = bt_ctf_field_unsigned_integer_get_value( + ret_get_value = bt_field_unsigned_integer_get_value( container, &event_id); BT_PUT(container); } @@ -1453,7 +1453,7 @@ check_event_id: if (event_id == -1ULL) { single_event_class: /* Event ID not found: single event? */ - assert(bt_ctf_stream_class_get_event_class_count( + assert(bt_stream_class_get_event_class_count( notit->meta.stream_class) == 1); event_id = 0; } @@ -1463,11 +1463,11 @@ single_event_class: "stream-class-id=%" PRId64 ", " "event-class-id=%" PRIu64, notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), event_id); BT_PUT(notit->meta.event_class); - notit->meta.event_class = bt_ctf_stream_class_get_event_class_by_id( + notit->meta.event_class = bt_stream_class_get_event_class_by_id( notit->meta.stream_class, event_id); if (!notit->meta.event_class) { BT_LOGW("No event class with ID of event class ID to use in stream class: " @@ -1476,10 +1476,10 @@ single_event_class: "stream-class-id=%" PRId64 ", " "event-class-id=%" PRIu64, notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), event_id); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } @@ -1487,8 +1487,8 @@ single_event_class: "notit-addr=%p, event-class-addr=%p, " "event-class-name=\"%s\", event-class-id=%" PRId64, notit, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class)); + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class)); end: BT_PUT(event_header_type); @@ -1499,13 +1499,13 @@ end: } static -enum bt_ctf_notif_iter_status after_event_header_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status after_event_header_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status; + enum bt_notif_iter_status status; status = set_current_event_class(notit); - if (status != BT_CTF_NOTIF_ITER_STATUS_OK) { + if (status != BT_NOTIF_ITER_STATUS_OK) { goto end; } @@ -1516,13 +1516,13 @@ end: } static -enum bt_ctf_notif_iter_status read_stream_event_context_begin_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_stream_event_context_begin_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field_type *stream_event_context_type; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field_type *stream_event_context_type; - stream_event_context_type = bt_ctf_stream_class_get_event_context_type( + stream_event_context_type = bt_stream_class_get_event_context_type( notit->meta.stream_class); if (!stream_event_context_type) { notit->state = STATE_DSCOPE_EVENT_CONTEXT_BEGIN; @@ -1534,8 +1534,8 @@ enum bt_ctf_notif_iter_status read_stream_event_context_begin_state( "stream-class-name=\"%s\", stream-class-id=%" PRId64 ", " "ft-addr=%p", notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), stream_event_context_type); status = read_dscope_begin_state(notit, stream_event_context_type, STATE_DSCOPE_EVENT_CONTEXT_BEGIN, @@ -1547,8 +1547,8 @@ enum bt_ctf_notif_iter_status read_stream_event_context_begin_state( "stream-class-name=\"%s\", " "stream-class-id=%" PRId64 ", ft-addr=%p", notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), stream_event_context_type); } @@ -1559,21 +1559,21 @@ end: } static -enum bt_ctf_notif_iter_status read_stream_event_context_continue_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_stream_event_context_continue_state( + struct bt_notif_iter *notit) { return read_dscope_continue_state(notit, STATE_DSCOPE_EVENT_CONTEXT_BEGIN); } static -enum bt_ctf_notif_iter_status read_event_context_begin_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_event_context_begin_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field_type *event_context_type; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field_type *event_context_type; - event_context_type = bt_ctf_event_class_get_context_type( + event_context_type = bt_event_class_get_context_type( notit->meta.event_class); if (!event_context_type) { notit->state = STATE_DSCOPE_EVENT_PAYLOAD_BEGIN; @@ -1585,8 +1585,8 @@ enum bt_ctf_notif_iter_status read_event_context_begin_state( "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "ft-addr=%p", notit, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), event_context_type); status = read_dscope_begin_state(notit, event_context_type, STATE_DSCOPE_EVENT_PAYLOAD_BEGIN, @@ -1598,8 +1598,8 @@ enum bt_ctf_notif_iter_status read_event_context_begin_state( "event-class-name=\"%s\", " "event-class-id=%" PRId64 ", ft-addr=%p", notit, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), event_context_type); } @@ -1610,21 +1610,21 @@ end: } static -enum bt_ctf_notif_iter_status read_event_context_continue_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_event_context_continue_state( + struct bt_notif_iter *notit) { return read_dscope_continue_state(notit, STATE_DSCOPE_EVENT_PAYLOAD_BEGIN); } static -enum bt_ctf_notif_iter_status read_event_payload_begin_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_event_payload_begin_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; - struct bt_ctf_field_type *event_payload_type; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; + struct bt_field_type *event_payload_type; - event_payload_type = bt_ctf_event_class_get_payload_type( + event_payload_type = bt_event_class_get_payload_type( notit->meta.event_class); if (!event_payload_type) { notit->state = STATE_EMIT_NOTIF_EVENT; @@ -1636,8 +1636,8 @@ enum bt_ctf_notif_iter_status read_event_payload_begin_state( "event-class-name=\"%s\", event-class-id=%" PRId64 ", " "ft-addr=%p", notit, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), event_payload_type); status = read_dscope_begin_state(notit, event_payload_type, STATE_EMIT_NOTIF_EVENT, @@ -1649,8 +1649,8 @@ enum bt_ctf_notif_iter_status read_event_payload_begin_state( "event-class-name=\"%s\", " "event-class-id=%" PRId64 ", ft-addr=%p", notit, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), event_payload_type); } @@ -1661,17 +1661,17 @@ end: } static -enum bt_ctf_notif_iter_status read_event_payload_continue_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status read_event_payload_continue_state( + struct bt_notif_iter *notit) { return read_dscope_continue_state(notit, STATE_EMIT_NOTIF_EVENT); } static -enum bt_ctf_notif_iter_status skip_packet_padding_state( - struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status skip_packet_padding_state( + struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; size_t bits_to_skip; assert(notit->cur_packet_size > 0); @@ -1685,7 +1685,7 @@ enum bt_ctf_notif_iter_status skip_packet_padding_state( BT_LOGV("Trying to skip %zu bits of padding: notit-addr=%p, size=%zu", bits_to_skip, notit, bits_to_skip); status = buf_ensure_available_bits(notit); - if (status != BT_CTF_NOTIF_ITER_STATUS_OK) { + if (status != BT_NOTIF_ITER_STATUS_OK) { goto end; } @@ -1705,9 +1705,9 @@ end: } static inline -enum bt_ctf_notif_iter_status handle_state(struct bt_ctf_notif_iter *notit) +enum bt_notif_iter_status handle_state(struct bt_notif_iter *notit) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; const enum state state = notit->state; BT_LOGV("Handling state: notit-addr=%p, state=%s", @@ -1783,7 +1783,7 @@ enum bt_ctf_notif_iter_status handle_state(struct bt_ctf_notif_iter *notit) BT_LOGV("Handled state: notit-addr=%p, status=%s, " "prev-state=%s, cur-state=%s", - notit, bt_ctf_notif_iter_status_string(status), + notit, bt_notif_iter_status_string(status), state_string(state), state_string(notit->state)); return status; } @@ -1792,7 +1792,7 @@ enum bt_ctf_notif_iter_status handle_state(struct bt_ctf_notif_iter *notit) * Resets the internal state of a CTF notification iterator. */ static -void bt_ctf_notif_iter_reset(struct bt_ctf_notif_iter *notit) +void bt_notif_iter_reset(struct bt_notif_iter *notit) { assert(notit); BT_LOGD("Resetting notification iterator: addr=%p", notit); @@ -1814,7 +1814,7 @@ void bt_ctf_notif_iter_reset(struct bt_ctf_notif_iter *notit) } static -int bt_ctf_notif_iter_switch_packet(struct bt_ctf_notif_iter *notit) +int bt_notif_iter_switch_packet(struct bt_notif_iter *notit) { int ret = 0; @@ -1868,40 +1868,40 @@ end: } static -struct bt_ctf_field *get_next_field(struct bt_ctf_notif_iter *notit) +struct bt_field *get_next_field(struct bt_notif_iter *notit) { - struct bt_ctf_field *next_field = NULL; - struct bt_ctf_field *base_field; - struct bt_ctf_field_type *base_type; + struct bt_field *next_field = NULL; + struct bt_field *base_field; + struct bt_field_type *base_type; size_t index; assert(!stack_empty(notit->stack)); index = stack_top(notit->stack)->index; base_field = stack_top(notit->stack)->base; assert(base_field); - base_type = bt_ctf_field_get_type(base_field); + base_type = bt_field_get_type(base_field); assert(base_type); - switch (bt_ctf_field_type_get_type_id(base_type)) { - case BT_CTF_FIELD_TYPE_ID_STRUCT: - next_field = bt_ctf_field_structure_get_field_by_index( + switch (bt_field_type_get_type_id(base_type)) { + case BT_FIELD_TYPE_ID_STRUCT: + next_field = bt_field_structure_get_field_by_index( base_field, index); break; - case BT_CTF_FIELD_TYPE_ID_ARRAY: - next_field = bt_ctf_field_array_get_field(base_field, index); + case BT_FIELD_TYPE_ID_ARRAY: + next_field = bt_field_array_get_field(base_field, index); break; - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: - next_field = bt_ctf_field_sequence_get_field(base_field, index); + case BT_FIELD_TYPE_ID_SEQUENCE: + next_field = bt_field_sequence_get_field(base_field, index); break; - case BT_CTF_FIELD_TYPE_ID_VARIANT: - next_field = bt_ctf_field_variant_get_current_field(base_field); + case BT_FIELD_TYPE_ID_VARIANT: + next_field = bt_field_variant_get_current_field(base_field); break; default: BT_LOGF("Unknown base field type ID: " "notit-addr=%p, ft-addr=%p, ft-id=%s", notit, base_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(base_type))); + bt_field_type_id_string( + bt_field_type_get_type_id(base_type))); abort(); } @@ -1911,22 +1911,22 @@ struct bt_ctf_field *get_next_field(struct bt_ctf_notif_iter *notit) static void update_clock_state(uint64_t *state, - struct bt_ctf_field *value_field) + struct bt_field *value_field) { - struct bt_ctf_field_type *value_type = NULL; + struct bt_field_type *value_type = NULL; uint64_t requested_new_value; uint64_t requested_new_value_mask; uint64_t cur_value_masked; int requested_new_value_size; int ret; - value_type = bt_ctf_field_get_type(value_field); + value_type = bt_field_get_type(value_field); assert(value_type); - assert(bt_ctf_field_type_is_integer(value_type)); + assert(bt_field_type_is_integer(value_type)); requested_new_value_size = - bt_ctf_field_type_integer_get_size(value_type); + bt_field_type_integer_get_size(value_type); assert(requested_new_value_size > 0); - ret = bt_ctf_field_unsigned_integer_get_value(value_field, + ret = bt_field_unsigned_integer_get_value(value_field, &requested_new_value); assert(!ret); @@ -1964,18 +1964,18 @@ end: } static -enum bt_ctf_btr_status update_clock(struct bt_ctf_notif_iter *notit, - struct bt_ctf_field *int_field) +enum bt_btr_status update_clock(struct bt_notif_iter *notit, + struct bt_field *int_field) { gboolean clock_class_found; uint64_t *clock_state = NULL; - struct bt_ctf_field_type *int_field_type = NULL; - enum bt_ctf_btr_status ret = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_field_type *int_field_type = NULL; + enum bt_btr_status ret = BT_BTR_STATUS_OK; + struct bt_clock_class *clock_class = NULL; - int_field_type = bt_ctf_field_get_type(int_field); + int_field_type = bt_field_get_type(int_field); assert(int_field_type); - clock_class = bt_ctf_field_type_integer_get_mapped_clock_class( + clock_class = bt_field_type_integer_get_mapped_clock_class( int_field_type); if (likely(!clock_class)) { goto end; @@ -1987,7 +1987,7 @@ enum bt_ctf_btr_status update_clock(struct bt_ctf_notif_iter *notit, clock_state = g_new0(uint64_t, 1); if (!clock_state) { BT_LOGE_STR("Failed to allocate a uint64_t."); - ret = BT_CTF_BTR_STATUS_ENOMEM; + ret = BT_BTR_STATUS_ENOMEM; goto end; } @@ -2000,7 +2000,7 @@ enum bt_ctf_btr_status update_clock(struct bt_ctf_notif_iter *notit, "notit-addr=%p, clock-class-addr=%p, " "clock-class-name=\"%s\", value=%" PRIu64, notit, clock_class, - bt_ctf_clock_class_get_name(clock_class), *clock_state); + bt_clock_class_get_name(clock_class), *clock_state); update_clock_state(clock_state, int_field); end: bt_put(int_field_type); @@ -2009,55 +2009,55 @@ end: } static -enum bt_ctf_btr_status btr_unsigned_int_common(uint64_t value, - struct bt_ctf_field_type *type, void *data, - struct bt_ctf_field **out_int_field) -{ - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_field *field = NULL; - struct bt_ctf_field *int_field = NULL; - struct bt_ctf_notif_iter *notit = data; +enum bt_btr_status btr_unsigned_int_common(uint64_t value, + struct bt_field_type *type, void *data, + struct bt_field **out_int_field) +{ + enum bt_btr_status status = BT_BTR_STATUS_OK; + struct bt_field *field = NULL; + struct bt_field *int_field = NULL; + struct bt_notif_iter *notit = data; int ret; BT_LOGV("Common unsigned integer function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s, value=%" PRIu64, notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type)), + bt_field_type_id_string( + bt_field_type_get_type_id(type)), value); /* Create next field */ field = get_next_field(notit); if (!field) { BT_LOGW("Cannot get next field: notit-addr=%p", notit); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end_no_put; } - switch(bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: + switch(bt_field_type_get_type_id(type)) { + case BT_FIELD_TYPE_ID_INTEGER: /* Integer field is created field */ BT_MOVE(int_field, field); bt_get(type); break; - case BT_CTF_FIELD_TYPE_ID_ENUM: - int_field = bt_ctf_field_enumeration_get_container(field); + case BT_FIELD_TYPE_ID_ENUM: + int_field = bt_field_enumeration_get_container(field); assert(int_field); - type = bt_ctf_field_get_type(int_field); + type = bt_field_get_type(int_field); assert(type); break; default: BT_LOGF("Unexpected field type ID: " "notit-addr=%p, ft-addr=%p, ft-id=%s", notit, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); + bt_field_type_id_string( + bt_field_type_get_type_id(type))); abort(); } assert(int_field); - ret = bt_ctf_field_unsigned_integer_set_value(int_field, value); + ret = bt_field_unsigned_integer_set_value(int_field, value); assert(ret == 0); stack_top(notit->stack)->index++; *out_int_field = int_field; @@ -2069,19 +2069,19 @@ end_no_put: } static -enum bt_ctf_btr_status btr_timestamp_end_cb(void *value, - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_timestamp_end_cb(void *value, + struct bt_field_type *type, void *data) { - enum bt_ctf_btr_status status; - struct bt_ctf_field *field = NULL; - struct bt_ctf_notif_iter *notit = data; + enum bt_btr_status status; + struct bt_field *field = NULL; + struct bt_notif_iter *notit = data; BT_LOGV("`timestamp_end` unsigned integer function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s", notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); + bt_field_type_id_string( + bt_field_type_get_type_id(type))); status = btr_unsigned_int_common(*((uint64_t *) value), type, data, &field); @@ -2091,20 +2091,20 @@ enum bt_ctf_btr_status btr_timestamp_end_cb(void *value, } static -enum bt_ctf_btr_status btr_unsigned_int_cb(uint64_t value, - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_unsigned_int_cb(uint64_t value, + struct bt_field_type *type, void *data) { - struct bt_ctf_notif_iter *notit = data; - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_field *field = NULL; + struct bt_notif_iter *notit = data; + enum bt_btr_status status = BT_BTR_STATUS_OK; + struct bt_field *field = NULL; struct field_cb_override *override; BT_LOGV("Unsigned integer function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s, value=%" PRIu64, notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type)), + bt_field_type_id_string( + bt_field_type_get_type_id(type)), value); override = g_hash_table_lookup(notit->field_overrides, type); if (unlikely(override)) { @@ -2114,7 +2114,7 @@ enum bt_ctf_btr_status btr_unsigned_int_cb(uint64_t value, } status = btr_unsigned_int_common(value, type, data, &field); - if (status != BT_CTF_BTR_STATUS_OK) { + if (status != BT_BTR_STATUS_OK) { /* btr_unsigned_int_common() logs errors */ goto end; } @@ -2126,54 +2126,54 @@ end: } static -enum bt_ctf_btr_status btr_signed_int_cb(int64_t value, - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_signed_int_cb(int64_t value, + struct bt_field_type *type, void *data) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_field *field = NULL; - struct bt_ctf_field *int_field = NULL; - struct bt_ctf_notif_iter *notit = data; + enum bt_btr_status status = BT_BTR_STATUS_OK; + struct bt_field *field = NULL; + struct bt_field *int_field = NULL; + struct bt_notif_iter *notit = data; int ret; BT_LOGV("Signed integer function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s, value=%" PRId64, notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type)), + bt_field_type_id_string( + bt_field_type_get_type_id(type)), value); /* create next field */ field = get_next_field(notit); if (!field) { BT_LOGW("Cannot get next field: notit-addr=%p", notit); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end_no_put; } - switch(bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: + switch(bt_field_type_get_type_id(type)) { + case BT_FIELD_TYPE_ID_INTEGER: /* Integer field is created field */ BT_MOVE(int_field, field); bt_get(type); break; - case BT_CTF_FIELD_TYPE_ID_ENUM: - int_field = bt_ctf_field_enumeration_get_container(field); + case BT_FIELD_TYPE_ID_ENUM: + int_field = bt_field_enumeration_get_container(field); assert(int_field); - type = bt_ctf_field_get_type(int_field); + type = bt_field_get_type(int_field); assert(type); break; default: BT_LOGF("Unexpected field type ID: " "notit-addr=%p, ft-addr=%p, ft-id=%s", notit, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); + bt_field_type_id_string( + bt_field_type_get_type_id(type))); abort(); } assert(int_field); - ret = bt_ctf_field_signed_integer_set_value(int_field, value); + ret = bt_field_signed_integer_set_value(int_field, value); assert(!ret); stack_top(notit->stack)->index++; status = update_clock(notit, int_field); @@ -2186,31 +2186,31 @@ end_no_put: } static -enum bt_ctf_btr_status btr_floating_point_cb(double value, - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_floating_point_cb(double value, + struct bt_field_type *type, void *data) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_field *field = NULL; - struct bt_ctf_notif_iter *notit = data; + enum bt_btr_status status = BT_BTR_STATUS_OK; + struct bt_field *field = NULL; + struct bt_notif_iter *notit = data; int ret; BT_LOGV("Floating point number function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s, value=%f", notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type)), + bt_field_type_id_string( + bt_field_type_get_type_id(type)), value); /* Create next field */ field = get_next_field(notit); if (!field) { BT_LOGW("Cannot get next field: notit-addr=%p", notit); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } - ret = bt_ctf_field_floating_point_set_value(field, value); + ret = bt_field_floating_point_set_value(field, value); assert(!ret); stack_top(notit->stack)->index++; @@ -2220,26 +2220,26 @@ end: } static -enum bt_ctf_btr_status btr_string_begin_cb( - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_string_begin_cb( + struct bt_field_type *type, void *data) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_field *field = NULL; - struct bt_ctf_notif_iter *notit = data; + enum bt_btr_status status = BT_BTR_STATUS_OK; + struct bt_field *field = NULL; + struct bt_notif_iter *notit = data; int ret; BT_LOGV("String (beginning) function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s", notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); + bt_field_type_id_string( + bt_field_type_get_type_id(type))); /* Create next field */ field = get_next_field(notit); if (!field) { BT_LOGW("Cannot get next field: notit-addr=%p", notit); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -2252,7 +2252,7 @@ enum bt_ctf_btr_status btr_string_begin_cb( if (ret) { BT_LOGE("Cannot push string field on stack: " "notit-addr=%p, field-addr=%p", notit, field); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -2261,12 +2261,12 @@ enum bt_ctf_btr_status btr_string_begin_cb( * case of a length 0 string the btr_string_cb won't be called and * we will end up with an unset string payload. */ - ret = bt_ctf_field_string_set_value(field, ""); + ret = bt_field_string_set_value(field, ""); if (ret) { BT_LOGE("Cannot initialize string field's value to an empty string: " "notit-addr=%p, field-addr=%p, ret=%d", notit, field, ret); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -2277,20 +2277,20 @@ end: } static -enum bt_ctf_btr_status btr_string_cb(const char *value, - size_t len, struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_string_cb(const char *value, + size_t len, struct bt_field_type *type, void *data) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_field *field = NULL; - struct bt_ctf_notif_iter *notit = data; + enum bt_btr_status status = BT_BTR_STATUS_OK; + struct bt_field *field = NULL; + struct bt_notif_iter *notit = data; int ret; BT_LOGV("String (substring) function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s, string-length=%zu", notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type)), + bt_field_type_id_string( + bt_field_type_get_type_id(type)), len); /* Get string field */ @@ -2298,12 +2298,12 @@ enum bt_ctf_btr_status btr_string_cb(const char *value, assert(field); /* Append current string */ - ret = bt_ctf_field_string_append_len(field, value, len); + ret = bt_field_string_append_len(field, value, len); if (ret) { BT_LOGE("Cannot append substring to string field's value: " "notit-addr=%p, field-addr=%p, string-length=%zu, " "ret=%d", notit, field, len, ret); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -2312,45 +2312,45 @@ end: } static -enum bt_ctf_btr_status btr_string_end_cb( - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_string_end_cb( + struct bt_field_type *type, void *data) { - struct bt_ctf_notif_iter *notit = data; + struct bt_notif_iter *notit = data; BT_LOGV("String (end) function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s", notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); + bt_field_type_id_string( + bt_field_type_get_type_id(type))); /* Pop string field */ stack_pop(notit->stack); /* Go to next field */ stack_top(notit->stack)->index++; - return BT_CTF_BTR_STATUS_OK; + return BT_BTR_STATUS_OK; } -enum bt_ctf_btr_status btr_compound_begin_cb( - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_compound_begin_cb( + struct bt_field_type *type, void *data) { - enum bt_ctf_btr_status status = BT_CTF_BTR_STATUS_OK; - struct bt_ctf_notif_iter *notit = data; - struct bt_ctf_field *field; + enum bt_btr_status status = BT_BTR_STATUS_OK; + struct bt_notif_iter *notit = data; + struct bt_field *field; int ret; BT_LOGV("Compound (beginning) function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s", notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); + bt_field_type_id_string( + bt_field_type_get_type_id(type))); /* Create field */ if (stack_empty(notit->stack)) { /* Root: create dynamic scope field */ - *notit->cur_dscope_field = bt_ctf_field_create(type); + *notit->cur_dscope_field = bt_field_create(type); field = *notit->cur_dscope_field; /* @@ -2365,16 +2365,16 @@ enum bt_ctf_btr_status btr_compound_begin_cb( BT_LOGE("Cannot create compound field: " "notit-addr=%p, ft-addr=%p, ft-id=%s", notit, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); - status = BT_CTF_BTR_STATUS_ERROR; + bt_field_type_id_string( + bt_field_type_get_type_id(type))); + status = BT_BTR_STATUS_ERROR; goto end; } } else { field = get_next_field(notit); if (!field) { BT_LOGW("Cannot get next field: notit-addr=%p", notit); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } } @@ -2386,10 +2386,10 @@ enum bt_ctf_btr_status btr_compound_begin_cb( BT_LOGE("Cannot push compound field onto the stack: " "notit-addr=%p, ft-addr=%p, ft-id=%s, ret=%d", notit, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type)), + bt_field_type_id_string( + bt_field_type_get_type_id(type)), ret); - status = BT_CTF_BTR_STATUS_ERROR; + status = BT_BTR_STATUS_ERROR; goto end; } @@ -2399,17 +2399,17 @@ end: return status; } -enum bt_ctf_btr_status btr_compound_end_cb( - struct bt_ctf_field_type *type, void *data) +enum bt_btr_status btr_compound_end_cb( + struct bt_field_type *type, void *data) { - struct bt_ctf_notif_iter *notit = data; + struct bt_notif_iter *notit = data; BT_LOGV("Compound (end) function called from BTR: " "notit-addr=%p, btr-addr=%p, ft-addr=%p, " "ft-id=%s", notit, notit->btr, type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(type))); + bt_field_type_id_string( + bt_field_type_get_type_id(type))); assert(!stack_empty(notit->stack)); /* Pop stack */ @@ -2420,18 +2420,18 @@ enum bt_ctf_btr_status btr_compound_end_cb( stack_top(notit->stack)->index++; } - return BT_CTF_BTR_STATUS_OK; + return BT_BTR_STATUS_OK; } static -struct bt_ctf_field *resolve_field(struct bt_ctf_notif_iter *notit, - struct bt_ctf_field_path *path) +struct bt_field *resolve_field(struct bt_notif_iter *notit, + struct bt_field_path *path) { - struct bt_ctf_field *field = NULL; + struct bt_field *field = NULL; unsigned int i; if (BT_LOG_ON_VERBOSE) { - GString *gstr = bt_ctf_field_path_string(path); + GString *gstr = bt_field_path_string(path); BT_LOGV("Resolving field path: notit-addr=%p, field-path=\"%s\"", notit, gstr ? gstr->str : NULL); @@ -2441,57 +2441,57 @@ struct bt_ctf_field *resolve_field(struct bt_ctf_notif_iter *notit, } } - switch (bt_ctf_field_path_get_root_scope(path)) { - case BT_CTF_SCOPE_TRACE_PACKET_HEADER: + switch (bt_field_path_get_root_scope(path)) { + case BT_SCOPE_TRACE_PACKET_HEADER: field = notit->dscopes.trace_packet_header; break; - case BT_CTF_SCOPE_STREAM_PACKET_CONTEXT: + case BT_SCOPE_STREAM_PACKET_CONTEXT: field = notit->dscopes.stream_packet_context; break; - case BT_CTF_SCOPE_STREAM_EVENT_HEADER: + case BT_SCOPE_STREAM_EVENT_HEADER: field = notit->dscopes.stream_event_header; break; - case BT_CTF_SCOPE_STREAM_EVENT_CONTEXT: + case BT_SCOPE_STREAM_EVENT_CONTEXT: field = notit->dscopes.stream_event_context; break; - case BT_CTF_SCOPE_EVENT_CONTEXT: + case BT_SCOPE_EVENT_CONTEXT: field = notit->dscopes.event_context; break; - case BT_CTF_SCOPE_EVENT_FIELDS: + case BT_SCOPE_EVENT_FIELDS: field = notit->dscopes.event_payload; break; default: BT_LOGF("Cannot resolve field path: unknown scope: " "notit-addr=%p, root-scope=%s", - notit, bt_ctf_scope_string( - bt_ctf_field_path_get_root_scope(path))); + notit, bt_scope_string( + bt_field_path_get_root_scope(path))); abort(); } if (!field) { BT_LOGW("Cannot resolve field path: root field not found: " "notit-addr=%p, root-scope=%s", - notit, bt_ctf_scope_string( - bt_ctf_field_path_get_root_scope(path))); + notit, bt_scope_string( + bt_field_path_get_root_scope(path))); goto end; } bt_get(field); - for (i = 0; i < bt_ctf_field_path_get_index_count(path); ++i) { - struct bt_ctf_field *next_field = NULL; - struct bt_ctf_field_type *field_type; - int index = bt_ctf_field_path_get_index(path, i); + for (i = 0; i < bt_field_path_get_index_count(path); ++i) { + struct bt_field *next_field = NULL; + struct bt_field_type *field_type; + int index = bt_field_path_get_index(path, i); - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); if (is_struct_type(field_type)) { - next_field = bt_ctf_field_structure_get_field_by_index( + next_field = bt_field_structure_get_field_by_index( field, index); } else if (is_variant_type(field_type)) { next_field = - bt_ctf_field_variant_get_current_field(field); + bt_field_variant_get_current_field(field); } BT_PUT(field); @@ -2501,8 +2501,8 @@ struct bt_ctf_field *resolve_field(struct bt_ctf_notif_iter *notit, BT_LOGW("Cannot find next field: " "notit-addr=%p, ft-addr=%p, ft-id=%s, index=%d", notit, field_type, - bt_ctf_field_type_id_string( - bt_ctf_field_type_get_type_id(field_type)), + bt_field_type_id_string( + bt_field_type_get_type_id(field_type)), index); goto end; } @@ -2516,17 +2516,17 @@ end: } static -int64_t btr_get_sequence_length_cb(struct bt_ctf_field_type *type, void *data) +int64_t btr_get_sequence_length_cb(struct bt_field_type *type, void *data) { int64_t ret = -1; int iret; - struct bt_ctf_field *seq_field; - struct bt_ctf_field_path *field_path; - struct bt_ctf_notif_iter *notit = data; - struct bt_ctf_field *length_field = NULL; + struct bt_field *seq_field; + struct bt_field_path *field_path; + struct bt_notif_iter *notit = data; + struct bt_field *length_field = NULL; uint64_t length; - field_path = bt_ctf_field_type_sequence_get_length_field_path(type); + field_path = bt_field_type_sequence_get_length_field_path(type); assert(field_path); length_field = resolve_field(notit, field_path); if (!length_field) { @@ -2536,7 +2536,7 @@ int64_t btr_get_sequence_length_cb(struct bt_ctf_field_type *type, void *data) goto end; } - iret = bt_ctf_field_unsigned_integer_get_value(length_field, &length); + iret = bt_field_unsigned_integer_get_value(length_field, &length); if (iret) { BT_LOGE("Cannot get value of sequence length field: " "notit-addr=%p, field-addr=%p", @@ -2545,7 +2545,7 @@ int64_t btr_get_sequence_length_cb(struct bt_ctf_field_type *type, void *data) } seq_field = stack_top(notit->stack)->base; - iret = bt_ctf_field_sequence_set_length(seq_field, length_field); + iret = bt_field_sequence_set_length(seq_field, length_field); if (iret) { BT_LOGE("Cannot set sequence field's length field: " "notit-addr=%p, seq-field-addr=%p, " @@ -2564,17 +2564,17 @@ end: } static -struct bt_ctf_field_type *btr_get_variant_type_cb( - struct bt_ctf_field_type *type, void *data) +struct bt_field_type *btr_get_variant_type_cb( + struct bt_field_type *type, void *data) { - struct bt_ctf_field_path *path; - struct bt_ctf_notif_iter *notit = data; - struct bt_ctf_field *var_field; - struct bt_ctf_field *tag_field = NULL; - struct bt_ctf_field *selected_field = NULL; - struct bt_ctf_field_type *selected_field_type = NULL; + struct bt_field_path *path; + struct bt_notif_iter *notit = data; + struct bt_field *var_field; + struct bt_field *tag_field = NULL; + struct bt_field *selected_field = NULL; + struct bt_field_type *selected_field_type = NULL; - path = bt_ctf_field_type_variant_get_tag_field_path(type); + path = bt_field_type_variant_get_tag_field_path(type); assert(path); tag_field = resolve_field(notit, path); if (!tag_field) { @@ -2597,7 +2597,7 @@ struct bt_ctf_field_type *btr_get_variant_type_cb( * field. */ var_field = stack_top(notit->stack)->base; - selected_field = bt_ctf_field_variant_get_field(var_field, tag_field); + selected_field = bt_field_variant_get_field(var_field, tag_field); if (!selected_field) { BT_LOGW("Cannot get variant field's selection using tag field: " "notit-addr=%p, var-field-addr=%p, tag-field-addr=%p", @@ -2605,7 +2605,7 @@ struct bt_ctf_field_type *btr_get_variant_type_cb( goto end; } - selected_field_type = bt_ctf_field_get_type(selected_field); + selected_field_type = bt_field_get_type(selected_field); end: BT_PUT(tag_field); @@ -2616,36 +2616,36 @@ end: } static -int set_event_clocks(struct bt_ctf_event *event, - struct bt_ctf_notif_iter *notit) +int set_event_clocks(struct bt_event *event, + struct bt_notif_iter *notit) { int ret; GHashTableIter iter; - struct bt_ctf_clock_class *clock_class; + struct bt_clock_class *clock_class; uint64_t *clock_state; g_hash_table_iter_init(&iter, notit->clock_states); while (g_hash_table_iter_next(&iter, (gpointer) &clock_class, (gpointer) &clock_state)) { - struct bt_ctf_clock_value *clock_value; + struct bt_clock_value *clock_value; - clock_value = bt_ctf_clock_value_create(clock_class, + clock_value = bt_clock_value_create(clock_class, *clock_state); if (!clock_value) { BT_LOGE("Cannot create clock value from clock class: " "notit-addr=%p, clock-class-addr=%p, " "clock-class-name=\"%s\"", notit, clock_class, - bt_ctf_clock_class_get_name(clock_class)); + bt_clock_class_get_name(clock_class)); ret = -1; goto end; } - ret = bt_ctf_event_set_clock_value(event, clock_value); + ret = bt_event_set_clock_value(event, clock_value); bt_put(clock_value); if (ret) { - struct bt_ctf_event_class *event_class = - bt_ctf_event_get_class(event); + struct bt_event_class *event_class = + bt_event_get_class(event); assert(event_class); BT_LOGE("Cannot set event's clock value: " @@ -2656,10 +2656,10 @@ int set_event_clocks(struct bt_ctf_event *event, "clock-class-name=\"%s\", " "clock-value-addr=%p", notit, event, - bt_ctf_event_class_get_name(event_class), - bt_ctf_event_class_get_id(event_class), + bt_event_class_get_name(event_class), + bt_event_class_get_id(event_class), clock_class, - bt_ctf_clock_class_get_name(clock_class), + bt_clock_class_get_name(clock_class), clock_value); bt_put(event_class); goto end; @@ -2672,34 +2672,34 @@ end: } static -struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit) +struct bt_event *create_event(struct bt_notif_iter *notit) { int ret; - struct bt_ctf_event *event; + struct bt_event *event; BT_LOGV("Creating event for event notification: " "notit-addr=%p, event-class-addr=%p, " "event-class-name=\"%s\", " "event-class-id=%" PRId64, notit, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class)); + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class)); /* Create event object. */ - event = bt_ctf_event_create(notit->meta.event_class); + event = bt_event_create(notit->meta.event_class); if (!event) { BT_LOGE("Cannot create event: " "notit-addr=%p, event-class-addr=%p, " "event-class-name=\"%s\", " "event-class-id=%" PRId64, notit, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class)); + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class)); goto error; } /* Set header, stream event context, context, and payload fields. */ - ret = bt_ctf_event_set_header(event, + ret = bt_event_set_header(event, notit->dscopes.stream_event_header); if (ret) { BT_LOGE("Cannot set event's header field: " @@ -2707,13 +2707,13 @@ struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit) "event-class-name=\"%s\", " "event-class-id=%" PRId64 ", field-addr=%p", notit, event, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), notit->dscopes.stream_event_header); goto error; } - ret = bt_ctf_event_set_stream_event_context(event, + ret = bt_event_set_stream_event_context(event, notit->dscopes.stream_event_context); if (ret) { BT_LOGE("Cannot set event's context field: " @@ -2721,13 +2721,13 @@ struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit) "event-class-name=\"%s\", " "event-class-id=%" PRId64 ", field-addr=%p", notit, event, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), notit->dscopes.stream_event_context); goto error; } - ret = bt_ctf_event_set_event_context(event, + ret = bt_event_set_event_context(event, notit->dscopes.event_context); if (ret) { BT_LOGE("Cannot set event's stream event context field: " @@ -2735,13 +2735,13 @@ struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit) "event-class-name=\"%s\", " "event-class-id=%" PRId64 ", field-addr=%p", notit, event, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), notit->dscopes.event_context); goto error; } - ret = bt_ctf_event_set_event_payload(event, + ret = bt_event_set_event_payload(event, notit->dscopes.event_payload); if (ret) { BT_LOGE("Cannot set event's payload field: " @@ -2749,8 +2749,8 @@ struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit) "event-class-name=\"%s\", " "event-class-id=%" PRId64 ", field-addr=%p", notit, event, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), notit->dscopes.event_payload); goto error; } @@ -2762,22 +2762,22 @@ struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit) "event-class-name=\"%s\", " "event-class-id=%" PRId64, notit, event, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class)); + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class)); goto error; } /* Associate with current packet. */ assert(notit->packet); - ret = bt_ctf_event_set_packet(event, notit->packet); + ret = bt_event_set_packet(event, notit->packet); if (ret) { BT_LOGE("Cannot set event's header field: " "notit-addr=%p, event-addr=%p, event-class-addr=%p, " "event-class-name=\"%s\", " "event-class-id=%" PRId64 ", packet-addr=%p", notit, event, notit->meta.event_class, - bt_ctf_event_class_get_name(notit->meta.event_class), - bt_ctf_event_class_get_id(notit->meta.event_class), + bt_event_class_get_name(notit->meta.event_class), + bt_event_class_get_id(notit->meta.event_class), notit->packet); goto error; } @@ -2792,9 +2792,9 @@ end: } static -uint64_t get_cur_stream_instance_id(struct bt_ctf_notif_iter *notit) +uint64_t get_cur_stream_instance_id(struct bt_notif_iter *notit) { - struct bt_ctf_field *stream_instance_id_field = NULL; + struct bt_field *stream_instance_id_field = NULL; uint64_t stream_instance_id = -1ULL; int ret; @@ -2802,13 +2802,13 @@ uint64_t get_cur_stream_instance_id(struct bt_ctf_notif_iter *notit) goto end; } - stream_instance_id_field = bt_ctf_field_structure_get_field_by_name( + stream_instance_id_field = bt_field_structure_get_field_by_name( notit->dscopes.trace_packet_header, "stream_instance_id"); if (!stream_instance_id_field) { goto end; } - ret = bt_ctf_field_unsigned_integer_get_value(stream_instance_id_field, + ret = bt_field_unsigned_integer_get_value(stream_instance_id_field, &stream_instance_id); if (ret) { stream_instance_id = -1ULL; @@ -2821,17 +2821,17 @@ end: } static -int set_stream(struct bt_ctf_notif_iter *notit) +int set_stream(struct bt_notif_iter *notit) { int ret = 0; - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; BT_LOGV("Calling user function (get stream): notit-addr=%p, " "stream-class-addr=%p, stream-class-name=\"%s\", " "stream-class-id=%" PRId64, notit, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class)); + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class)); stream = bt_get(notit->medium.medops.get_stream( notit->meta.stream_class, get_cur_stream_instance_id(notit), notit->medium.data)); @@ -2856,10 +2856,10 @@ end: } static -void create_packet(struct bt_ctf_notif_iter *notit) +void create_packet(struct bt_notif_iter *notit) { int ret; - struct bt_ctf_packet *packet = NULL; + struct bt_packet *packet = NULL; BT_LOGV("Creating packet for packet notification: " "notit-addr=%p", notit); @@ -2876,11 +2876,11 @@ void create_packet(struct bt_ctf_notif_iter *notit) "stream-class-name=\"%s\", " "stream-class-id=%" PRId64, notit, notit->stream, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class)); + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class)); /* Create packet */ - packet = bt_ctf_packet_create(notit->stream); + packet = bt_packet_create(notit->stream); if (!packet) { BT_LOGE("Cannot create packet from stream: " "notit-addr=%p, stream-addr=%p, " @@ -2888,14 +2888,14 @@ void create_packet(struct bt_ctf_notif_iter *notit) "stream-class-name=\"%s\", " "stream-class-id=%" PRId64, notit, notit->stream, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class)); + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class)); goto error; } /* Set packet's context and header fields */ if (notit->dscopes.trace_packet_header) { - ret = bt_ctf_packet_set_header(packet, + ret = bt_packet_set_header(packet, notit->dscopes.trace_packet_header); if (ret) { BT_LOGE("Cannot set packet's header field: " @@ -2906,15 +2906,15 @@ void create_packet(struct bt_ctf_notif_iter *notit) "stream-class-id=%" PRId64 ", " "field-addr=%p", notit, packet, notit->stream, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), notit->dscopes.trace_packet_header); goto error; } } if (notit->dscopes.stream_packet_context) { - ret = bt_ctf_packet_set_context(packet, + ret = bt_packet_set_context(packet, notit->dscopes.stream_packet_context); if (ret) { BT_LOGE("Cannot set packet's context field: " @@ -2925,8 +2925,8 @@ void create_packet(struct bt_ctf_notif_iter *notit) "stream-class-id=%" PRId64 ", " "field-addr=%p", notit, packet, notit->stream, notit->meta.stream_class, - bt_ctf_stream_class_get_name(notit->meta.stream_class), - bt_ctf_stream_class_get_id(notit->meta.stream_class), + bt_stream_class_get_name(notit->meta.stream_class), + bt_stream_class_get_id(notit->meta.stream_class), notit->dscopes.trace_packet_header); goto error; } @@ -2942,7 +2942,7 @@ end: } static -void notify_new_packet(struct bt_ctf_notif_iter *notit, +void notify_new_packet(struct bt_notif_iter *notit, struct bt_notification **notification) { struct bt_notification *ret; @@ -2966,7 +2966,7 @@ void notify_new_packet(struct bt_ctf_notif_iter *notit, } static -void notify_end_of_packet(struct bt_ctf_notif_iter *notit, +void notify_end_of_packet(struct bt_notif_iter *notit, struct bt_notification **notification) { struct bt_notification *ret; @@ -2987,11 +2987,11 @@ void notify_end_of_packet(struct bt_ctf_notif_iter *notit, } static -void notify_event(struct bt_ctf_notif_iter *notit, +void notify_event(struct bt_notif_iter *notit, struct bt_clock_class_priority_map *cc_prio_map, struct bt_notification **notification) { - struct bt_ctf_event *event = NULL; + struct bt_event *event = NULL; struct bt_notification *ret = NULL; /* Make sure that the event contains at least one bit of data */ @@ -3024,31 +3024,31 @@ end: } static -void init_trace_field_path_cache(struct bt_ctf_trace *trace, +void init_trace_field_path_cache(struct bt_trace *trace, struct trace_field_path_cache *trace_field_path_cache) { int stream_id = -1; int stream_instance_id = -1; int i, count; - struct bt_ctf_field_type *packet_header = NULL; + struct bt_field_type *packet_header = NULL; - packet_header = bt_ctf_trace_get_packet_header_type(trace); + packet_header = bt_trace_get_packet_header_type(trace); if (!packet_header) { goto end; } - if (!bt_ctf_field_type_is_structure(packet_header)) { + if (!bt_field_type_is_structure(packet_header)) { goto end; } - count = bt_ctf_field_type_structure_get_field_count(packet_header); + count = bt_field_type_structure_get_field_count(packet_header); assert(count >= 0); for (i = 0; (i < count && (stream_id == -1 || stream_instance_id == -1)); i++) { int ret; const char *field_name; - ret = bt_ctf_field_type_structure_get_field(packet_header, + ret = bt_field_type_structure_get_field_by_index(packet_header, &field_name, NULL, i); if (ret) { BT_LOGE("Cannot get structure field's field: " @@ -3072,12 +3072,12 @@ end: } BT_HIDDEN -struct bt_ctf_notif_iter *bt_ctf_notif_iter_create(struct bt_ctf_trace *trace, +struct bt_notif_iter *bt_notif_iter_create(struct bt_trace *trace, size_t max_request_sz, - struct bt_ctf_notif_iter_medium_ops medops, void *data) + struct bt_notif_iter_medium_ops medops, void *data) { - struct bt_ctf_notif_iter *notit = NULL; - struct bt_ctf_btr_cbs cbs = { + struct bt_notif_iter *notit = NULL; + struct bt_btr_cbs cbs = { .types = { .signed_int = btr_signed_int_cb, .unsigned_int = btr_unsigned_int_cb, @@ -3100,8 +3100,8 @@ struct bt_ctf_notif_iter *bt_ctf_notif_iter_create(struct bt_ctf_trace *trace, BT_LOGD("Creating CTF plugin notification iterator: " "trace-addr=%p, trace-name=\"%s\", max-request-size=%zu, " "data=%p", - trace, bt_ctf_trace_get_name(trace), max_request_sz, data); - notit = g_new0(struct bt_ctf_notif_iter, 1); + trace, bt_trace_get_name(trace), max_request_sz, data); + notit = g_new0(struct bt_notif_iter, 1); if (!notit) { BT_LOGE_STR("Failed to allocate one CTF plugin notification iterator."); goto end; @@ -3122,13 +3122,13 @@ struct bt_ctf_notif_iter *bt_ctf_notif_iter_create(struct bt_ctf_trace *trace, goto error; } - notit->btr = bt_ctf_btr_create(cbs, notit); + notit->btr = bt_btr_create(cbs, notit); if (!notit->btr) { BT_LOGE_STR("Failed to create binary type reader (BTR)."); goto error; } - bt_ctf_notif_iter_reset(notit); + bt_notif_iter_reset(notit); init_trace_field_path_cache(trace, ¬it->trace_field_path_cache); notit->sc_field_path_caches = g_hash_table_new_full(g_direct_hash, g_direct_equal, bt_put, g_free); @@ -3147,7 +3147,7 @@ struct bt_ctf_notif_iter *bt_ctf_notif_iter_create(struct bt_ctf_trace *trace, BT_LOGD("Created CTF plugin notification iterator: " "trace-addr=%p, trace-name=\"%s\", max-request-size=%zu, " "data=%p, notit-addr=%p", - trace, bt_ctf_trace_get_name(trace), max_request_sz, data, + trace, bt_trace_get_name(trace), max_request_sz, data, notit); notit->cur_packet_offset = 0; @@ -3155,12 +3155,12 @@ end: return notit; error: - bt_ctf_notif_iter_destroy(notit); + bt_notif_iter_destroy(notit); notit = NULL; goto end; } -void bt_ctf_notif_iter_destroy(struct bt_ctf_notif_iter *notit) +void bt_notif_iter_destroy(struct bt_notif_iter *notit) { BT_PUT(notit->meta.trace); BT_PUT(notit->meta.stream_class); @@ -3179,7 +3179,7 @@ void bt_ctf_notif_iter_destroy(struct bt_ctf_notif_iter *notit) if (notit->btr) { BT_LOGD("Destroying BTR: btr-addr=%p", notit->btr); - bt_ctf_btr_destroy(notit->btr); + bt_btr_destroy(notit->btr); } if (notit->clock_states) { @@ -3197,12 +3197,12 @@ void bt_ctf_notif_iter_destroy(struct bt_ctf_notif_iter *notit) g_free(notit); } -enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_next_notification( - struct bt_ctf_notif_iter *notit, +enum bt_notif_iter_status bt_notif_iter_get_next_notification( + struct bt_notif_iter *notit, struct bt_clock_class_priority_map *cc_prio_map, struct bt_notification **notification) { - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; assert(notit); assert(notification); @@ -3212,13 +3212,13 @@ enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_next_notification( while (true) { status = handle_state(notit); - if (status == BT_CTF_NOTIF_ITER_STATUS_AGAIN) { - BT_LOGV_STR("Medium returned BT_CTF_NOTIF_ITER_STATUS_AGAIN."); + if (status == BT_NOTIF_ITER_STATUS_AGAIN) { + BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_AGAIN."); goto end; } - if (status != BT_CTF_NOTIF_ITER_STATUS_OK) { - if (status == BT_CTF_NOTIF_ITER_STATUS_EOF) { - BT_LOGV_STR("Medium returned BT_CTF_NOTIF_ITER_STATUS_EOF."); + if (status != BT_NOTIF_ITER_STATUS_OK) { + if (status == BT_NOTIF_ITER_STATUS_EOF) { + BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_EOF."); } else { BT_LOGW("Cannot handle state: " "notit-addr=%p, state=%s", @@ -3232,32 +3232,32 @@ enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_next_notification( /* notify_new_packet() logs errors */ notify_new_packet(notit, notification); if (!*notification) { - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; } goto end; case STATE_EMIT_NOTIF_EVENT: /* notify_event() logs errors */ notify_event(notit, cc_prio_map, notification); if (!*notification) { - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; } goto end; case STATE_EMIT_NOTIF_END_OF_PACKET: /* Update clock with timestamp_end field. */ if (notit->cur_timestamp_end) { - enum bt_ctf_btr_status btr_status; - struct bt_ctf_field_type *field_type = - bt_ctf_field_get_type( + enum bt_btr_status btr_status; + struct bt_field_type *field_type = + bt_field_get_type( notit->cur_timestamp_end); assert(field_type); btr_status = update_clock(notit, notit->cur_timestamp_end); BT_PUT(field_type); - if (btr_status != BT_CTF_BTR_STATUS_OK) { + if (btr_status != BT_BTR_STATUS_OK) { BT_LOGW("Cannot update stream's clock value: " "notit-addr=%p", notit); - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } } @@ -3265,7 +3265,7 @@ enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_next_notification( /* notify_end_of_packet() logs errors */ notify_end_of_packet(notit, notification); if (!*notification) { - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; } goto end; default: @@ -3279,13 +3279,13 @@ end: } BT_HIDDEN -enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_packet_header_context_fields( - struct bt_ctf_notif_iter *notit, - struct bt_ctf_field **packet_header_field, - struct bt_ctf_field **packet_context_field) +enum bt_notif_iter_status bt_notif_iter_get_packet_header_context_fields( + struct bt_notif_iter *notit, + struct bt_field **packet_header_field, + struct bt_field **packet_context_field) { int ret; - enum bt_ctf_notif_iter_status status = BT_CTF_NOTIF_ITER_STATUS_OK; + enum bt_notif_iter_status status = BT_NOTIF_ITER_STATUS_OK; assert(notit); @@ -3296,13 +3296,13 @@ enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_packet_header_context_fields while (true) { status = handle_state(notit); - if (status == BT_CTF_NOTIF_ITER_STATUS_AGAIN) { - BT_LOGV_STR("Medium returned BT_CTF_NOTIF_ITER_STATUS_AGAIN."); + if (status == BT_NOTIF_ITER_STATUS_AGAIN) { + BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_AGAIN."); goto end; } - if (status != BT_CTF_NOTIF_ITER_STATUS_OK) { - if (status == BT_CTF_NOTIF_ITER_STATUS_EOF) { - BT_LOGV_STR("Medium returned BT_CTF_NOTIF_ITER_STATUS_EOF."); + if (status != BT_NOTIF_ITER_STATUS_OK) { + if (status == BT_NOTIF_ITER_STATUS_EOF) { + BT_LOGV_STR("Medium returned BT_NOTIF_ITER_STATUS_EOF."); } else { BT_LOGW("Cannot handle state: " "notit-addr=%p, state=%s", @@ -3349,7 +3349,7 @@ set_fields: ret = set_current_packet_content_sizes(notit); if (ret) { - status = BT_CTF_NOTIF_ITER_STATUS_ERROR; + status = BT_NOTIF_ITER_STATUS_ERROR; goto end; } end: @@ -3357,7 +3357,7 @@ end: } BT_HIDDEN -void bt_ctf_notif_iter_set_medops_data(struct bt_ctf_notif_iter *notit, +void bt_notif_iter_set_medops_data(struct bt_notif_iter *notit, void *medops_data) { assert(notit); @@ -3365,54 +3365,54 @@ void bt_ctf_notif_iter_set_medops_data(struct bt_ctf_notif_iter *notit, } BT_HIDDEN -enum bt_ctf_notif_iter_status bt_ctf_notif_iter_seek( - struct bt_ctf_notif_iter *notit, off_t offset) +enum bt_notif_iter_status bt_notif_iter_seek( + struct bt_notif_iter *notit, off_t offset) { - enum bt_ctf_notif_iter_status ret = BT_CTF_NOTIF_ITER_STATUS_OK; - enum bt_ctf_notif_iter_medium_status medium_status; + enum bt_notif_iter_status ret = BT_NOTIF_ITER_STATUS_OK; + enum bt_notif_iter_medium_status medium_status; assert(notit); if (offset < 0) { BT_LOGE("Cannot seek to negative offset: offset=%jd", offset); - ret = BT_CTF_NOTIF_ITER_STATUS_INVAL; + ret = BT_NOTIF_ITER_STATUS_INVAL; goto end; } if (!notit->medium.medops.seek) { - ret = BT_CTF_NOTIF_ITER_STATUS_UNSUPPORTED; + ret = BT_NOTIF_ITER_STATUS_UNSUPPORTED; BT_LOGD("Aborting seek as the iterator's underlying media does not implement seek support."); goto end; } medium_status = notit->medium.medops.seek( - BT_CTF_NOTIF_ITER_SEEK_WHENCE_SET, offset, + BT_NOTIF_ITER_SEEK_WHENCE_SET, offset, notit->medium.data); - if (medium_status != BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK) { - if (medium_status == BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF) { - ret = BT_CTF_NOTIF_ITER_STATUS_EOF; + if (medium_status != BT_NOTIF_ITER_MEDIUM_STATUS_OK) { + if (medium_status == BT_NOTIF_ITER_MEDIUM_STATUS_EOF) { + ret = BT_NOTIF_ITER_STATUS_EOF; } else { - ret = BT_CTF_NOTIF_ITER_STATUS_ERROR; + ret = BT_NOTIF_ITER_STATUS_ERROR; goto end; } } - bt_ctf_notif_iter_reset(notit); + bt_notif_iter_reset(notit); notit->cur_packet_offset = offset; end: return ret; } BT_HIDDEN -off_t bt_ctf_notif_iter_get_current_packet_offset( - struct bt_ctf_notif_iter *notit) +off_t bt_notif_iter_get_current_packet_offset( + struct bt_notif_iter *notit) { assert(notit); return notit->cur_packet_offset; } BT_HIDDEN -off_t bt_ctf_notif_iter_get_current_packet_size( - struct bt_ctf_notif_iter *notit) +off_t bt_notif_iter_get_current_packet_size( + struct bt_notif_iter *notit) { assert(notit); return notit->cur_packet_size; diff --git a/plugins/ctf/common/notif-iter/notif-iter.h b/plugins/ctf/common/notif-iter/notif-iter.h index 5cc8ff8b..ff707309 100644 --- a/plugins/ctf/common/notif-iter/notif-iter.h +++ b/plugins/ctf/common/notif-iter/notif-iter.h @@ -44,78 +44,78 @@ /** * Medium operations status codes. */ -enum bt_ctf_notif_iter_medium_status { +enum bt_notif_iter_medium_status { /** * End of file. * * The medium function called by the notification iterator * function reached the end of the file. */ - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF = 1, + BT_NOTIF_ITER_MEDIUM_STATUS_EOF = 1, /** * There is no data available right now, try again later. */ - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN = 11, + BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN = 11, /** Unsupported operation. */ - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_UNSUPPORTED = -3, + BT_NOTIF_ITER_MEDIUM_STATUS_UNSUPPORTED = -3, /** Invalid argument. */ - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL = -2, + BT_NOTIF_ITER_MEDIUM_STATUS_INVAL = -2, /** General error. */ - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR = -1, + BT_NOTIF_ITER_MEDIUM_STATUS_ERROR = -1, /** Everything okay. */ - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK = 0, + BT_NOTIF_ITER_MEDIUM_STATUS_OK = 0, }; /** * CTF notification iterator API status code. */ -enum bt_ctf_notif_iter_status { +enum bt_notif_iter_status { /** * End of file. * * The medium function called by the notification iterator * function reached the end of the file. */ - BT_CTF_NOTIF_ITER_STATUS_EOF = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF, + BT_NOTIF_ITER_STATUS_EOF = BT_NOTIF_ITER_MEDIUM_STATUS_EOF, /** * There is no data available right now, try again later. * * Some condition resulted in the - * bt_ctf_notif_iter_medium_ops::request_bytes() user function not + * bt_notif_iter_medium_ops::request_bytes() user function not * having access to any data now. You should retry calling the * last called notification iterator function once the situation * is resolved. */ - BT_CTF_NOTIF_ITER_STATUS_AGAIN = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN, + BT_NOTIF_ITER_STATUS_AGAIN = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN, /** Invalid argument. */ - BT_CTF_NOTIF_ITER_STATUS_INVAL = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL, + BT_NOTIF_ITER_STATUS_INVAL = BT_NOTIF_ITER_MEDIUM_STATUS_INVAL, /** Unsupported operation. */ - BT_CTF_NOTIF_ITER_STATUS_UNSUPPORTED = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_UNSUPPORTED, + BT_NOTIF_ITER_STATUS_UNSUPPORTED = BT_NOTIF_ITER_MEDIUM_STATUS_UNSUPPORTED, /** General error. */ - BT_CTF_NOTIF_ITER_STATUS_ERROR = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR, + BT_NOTIF_ITER_STATUS_ERROR = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR, /** Everything okay. */ - BT_CTF_NOTIF_ITER_STATUS_OK = 0, + BT_NOTIF_ITER_STATUS_OK = 0, }; /** * CTF notification iterator seek operation directives. */ -enum bt_ctf_notif_iter_seek_whence { +enum bt_notif_iter_seek_whence { /** * Set the iterator's position to an absolute offset in the underlying * medium. */ - BT_CTF_NOTIF_ITER_SEEK_WHENCE_SET, + BT_NOTIF_ITER_SEEK_WHENCE_SET, }; /** @@ -124,7 +124,7 @@ enum bt_ctf_notif_iter_seek_whence { * Those user functions are called by the notification iterator * functions to request medium actions. */ -struct bt_ctf_notif_iter_medium_ops { +struct bt_notif_iter_medium_ops { /** * Returns the next byte buffer to be used by the binary file * reader to deserialize binary data. @@ -152,36 +152,36 @@ struct bt_ctf_notif_iter_medium_ops { * * This function must return one of the following statuses: * - * - #BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK: Everything + * - #BT_NOTIF_ITER_MEDIUM_STATUS_OK: Everything * is okay, i.e. \p buffer_sz is set to a positive value * reflecting the number of available bytes in the buffer * starting at the address written in \p buffer_addr. - * - #BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN: No data is + * - #BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN: No data is * available right now. In this case, the notification * iterator function called by the user returns - * #BT_CTF_NOTIF_ITER_STATUS_AGAIN, and it is the user's + * #BT_NOTIF_ITER_STATUS_AGAIN, and it is the user's * responsibility to make sure enough data becomes available * before calling the \em same notification iterator * function again to continue the decoding process. - * - #BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF: The end of + * - #BT_NOTIF_ITER_MEDIUM_STATUS_EOF: The end of * the file was reached, and no more data will ever be * available for this file. In this case, the notification * iterator function called by the user returns - * #BT_CTF_NOTIF_ITER_STATUS_EOF. This must \em not be + * #BT_NOTIF_ITER_STATUS_EOF. This must \em not be * returned when returning at least one byte of data to the * caller, i.e. this must be returned when there's * absolutely nothing left; should the request size be * larger than what's left in the file, this function must * return what's left, setting \p buffer_sz to the number of * remaining bytes, and return - * #BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF on the \em following + * #BT_NOTIF_ITER_MEDIUM_STATUS_EOF on the \em following * call. - * - #BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR: A fatal + * - #BT_NOTIF_ITER_MEDIUM_STATUS_ERROR: A fatal * error occured during this operation. In this case, the * notification iterator function called by the user returns - * #BT_CTF_NOTIF_ITER_STATUS_ERROR. + * #BT_NOTIF_ITER_STATUS_ERROR. * - * If #BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK is not returned, the + * If #BT_NOTIF_ITER_MEDIUM_STATUS_OK is not returned, the * values of \p buffer_sz and \p buffer_addr are \em ignored by * the caller. * @@ -191,7 +191,7 @@ struct bt_ctf_notif_iter_medium_ops { * @param data User data * @returns Status code (see description above) */ - enum bt_ctf_notif_iter_medium_status (* request_bytes)( + enum bt_notif_iter_medium_status (* request_bytes)( size_t request_sz, uint8_t **buffer_addr, size_t *buffer_sz, void *data); @@ -202,13 +202,13 @@ struct bt_ctf_notif_iter_medium_ops { * to a given absolute or relative position, as indicated by * the whence directive. * - * @param whence One of #bt_ctf_notif_iter_seek_whence values + * @param whence One of #bt_notif_iter_seek_whence values * @param offset Offset to use for the given directive * @param data User data - * @returns One of #bt_ctf_notif_iter_medium_status values + * @returns One of #bt_notif_iter_medium_status values */ - enum bt_ctf_notif_iter_medium_status (* seek)( - enum bt_ctf_notif_iter_seek_whence whence, + enum bt_notif_iter_medium_status (* seek)( + enum bt_notif_iter_seek_whence whence, off_t offset, void *data); /** @@ -226,38 +226,38 @@ struct bt_ctf_notif_iter_medium_ops { * @returns Stream instance (weak reference) or * \c NULL on error */ - struct bt_ctf_stream * (* get_stream)( - struct bt_ctf_stream_class *stream_class, + struct bt_stream * (* get_stream)( + struct bt_stream_class *stream_class, uint64_t stream_id, void *data); }; /** CTF notification iterator. */ -struct bt_ctf_notif_iter; +struct bt_notif_iter; // TODO: Replace by the real thing -enum bt_ctf_notif_iter_notif_type { - BT_CTF_NOTIF_ITER_NOTIF_NEW_PACKET, - BT_CTF_NOTIF_ITER_NOTIF_END_OF_PACKET, - BT_CTF_NOTIF_ITER_NOTIF_EVENT, +enum bt_notif_iter_notif_type { + BT_NOTIF_ITER_NOTIF_NEW_PACKET, + BT_NOTIF_ITER_NOTIF_END_OF_PACKET, + BT_NOTIF_ITER_NOTIF_EVENT, }; -struct bt_ctf_notif_iter_notif { - enum bt_ctf_notif_iter_notif_type type; +struct bt_notif_iter_notif { + enum bt_notif_iter_notif_type type; }; -struct bt_ctf_notif_iter_notif_new_packet { - struct bt_ctf_notif_iter_notif base; - struct bt_ctf_packet *packet; +struct bt_notif_iter_notif_new_packet { + struct bt_notif_iter_notif base; + struct bt_packet *packet; }; -struct bt_ctf_notif_iter_notif_end_of_packet { - struct bt_ctf_notif_iter_notif base; - struct bt_ctf_packet *packet; +struct bt_notif_iter_notif_end_of_packet { + struct bt_notif_iter_notif base; + struct bt_packet *packet; }; -struct bt_ctf_notif_iter_notif_event { - struct bt_ctf_notif_iter_notif base; - struct bt_ctf_event *event; +struct bt_notif_iter_notif_event { + struct bt_notif_iter_notif base; + struct bt_event *event; }; /** @@ -269,7 +269,7 @@ struct bt_ctf_notif_iter_notif_event { * @param trace Trace to read * @param max_request_sz Maximum buffer size, in bytes, to * request to - * bt_ctf_notif_iter_medium_ops::request_bytes() + * bt_notif_iter_medium_ops::request_bytes() * at a time * @param medops Medium operations * @param medops_data User data (passed to medium operations) @@ -277,8 +277,8 @@ struct bt_ctf_notif_iter_notif_event { * success, or \c NULL on error */ BT_HIDDEN -struct bt_ctf_notif_iter *bt_ctf_notif_iter_create(struct bt_ctf_trace *trace, - size_t max_request_sz, struct bt_ctf_notif_iter_medium_ops medops, +struct bt_notif_iter *bt_notif_iter_create(struct bt_trace *trace, + size_t max_request_sz, struct bt_notif_iter_medium_ops medops, void *medops_data); /** @@ -289,17 +289,17 @@ struct bt_ctf_notif_iter *bt_ctf_notif_iter_create(struct bt_ctf_trace *trace, * @param notif_iter CTF notification iterator */ BT_HIDDEN -void bt_ctf_notif_iter_destroy(struct bt_ctf_notif_iter *notif_iter); +void bt_notif_iter_destroy(struct bt_notif_iter *notif_iter); /** * Returns the next notification from a CTF notification iterator. * - * Upon successful completion, #BT_CTF_NOTIF_ITER_STATUS_OK is + * Upon successful completion, #BT_NOTIF_ITER_STATUS_OK is * returned, and the next notification is written to \p notif. * In this case, the caller is responsible for calling * bt_notification_put() on the returned notification. * - * If this function returns #BT_CTF_NOTIF_ITER_STATUS_AGAIN, the caller + * If this function returns #BT_NOTIF_ITER_STATUS_AGAIN, the caller * should make sure that data becomes available to its medium, and * call this function again, until another status is returned. * @@ -307,12 +307,12 @@ void bt_ctf_notif_iter_destroy(struct bt_ctf_notif_iter *notif_iter); * @param cc_prio_map Clock class priority map to use when * creating an event notification * @param notification Returned notification if the function's - * return value is #BT_CTF_NOTIF_ITER_STATUS_OK - * @returns One of #bt_ctf_notif_iter_status values + * return value is #BT_NOTIF_ITER_STATUS_OK + * @returns One of #bt_notif_iter_status values */ BT_HIDDEN -enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_next_notification( - struct bt_ctf_notif_iter *notit, +enum bt_notif_iter_status bt_notif_iter_get_next_notification( + struct bt_notif_iter *notit, struct bt_clock_class_priority_map *cc_prio_map, struct bt_notification **notification); @@ -326,70 +326,70 @@ enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_next_notification( * no packet header field) * @param packet_context_field Packet context field (\c NULL if there's * no packet context field) - * @returns One of #bt_ctf_notif_iter_status values + * @returns One of #bt_notif_iter_status values */ BT_HIDDEN -enum bt_ctf_notif_iter_status bt_ctf_notif_iter_get_packet_header_context_fields( - struct bt_ctf_notif_iter *notit, - struct bt_ctf_field **packet_header_field, - struct bt_ctf_field **packet_context_field); +enum bt_notif_iter_status bt_notif_iter_get_packet_header_context_fields( + struct bt_notif_iter *notit, + struct bt_field **packet_header_field, + struct bt_field **packet_context_field); BT_HIDDEN -void bt_ctf_notif_iter_set_medops_data(struct bt_ctf_notif_iter *notit, +void bt_notif_iter_set_medops_data(struct bt_notif_iter *notit, void *medops_data); BT_HIDDEN -enum bt_ctf_notif_iter_status bt_ctf_notif_iter_seek( - struct bt_ctf_notif_iter *notit, off_t offset); +enum bt_notif_iter_status bt_notif_iter_seek( + struct bt_notif_iter *notit, off_t offset); /* * Get the current packet's offset in bytes relative to the media's initial * position. */ BT_HIDDEN -off_t bt_ctf_notif_iter_get_current_packet_offset( - struct bt_ctf_notif_iter *notit); +off_t bt_notif_iter_get_current_packet_offset( + struct bt_notif_iter *notit); /* Get the current packet's size (in bits). */ BT_HIDDEN -off_t bt_ctf_notif_iter_get_current_packet_size( - struct bt_ctf_notif_iter *notit); +off_t bt_notif_iter_get_current_packet_size( + struct bt_notif_iter *notit); static inline -const char *bt_ctf_notif_iter_medium_status_string( - enum bt_ctf_notif_iter_medium_status status) +const char *bt_notif_iter_medium_status_string( + enum bt_notif_iter_medium_status status) { switch (status) { - case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF: - return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF"; - case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN: - return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN"; - case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL: - return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL"; - case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR: - return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR"; - case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK: - return "BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK"; + case BT_NOTIF_ITER_MEDIUM_STATUS_EOF: + return "BT_NOTIF_ITER_MEDIUM_STATUS_EOF"; + case BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN: + return "BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN"; + case BT_NOTIF_ITER_MEDIUM_STATUS_INVAL: + return "BT_NOTIF_ITER_MEDIUM_STATUS_INVAL"; + case BT_NOTIF_ITER_MEDIUM_STATUS_ERROR: + return "BT_NOTIF_ITER_MEDIUM_STATUS_ERROR"; + case BT_NOTIF_ITER_MEDIUM_STATUS_OK: + return "BT_NOTIF_ITER_MEDIUM_STATUS_OK"; default: return "(unknown)"; } } static inline -const char *bt_ctf_notif_iter_status_string( - enum bt_ctf_notif_iter_status status) +const char *bt_notif_iter_status_string( + enum bt_notif_iter_status status) { switch (status) { - case BT_CTF_NOTIF_ITER_STATUS_EOF: - return "BT_CTF_NOTIF_ITER_STATUS_EOF"; - case BT_CTF_NOTIF_ITER_STATUS_AGAIN: - return "BT_CTF_NOTIF_ITER_STATUS_AGAIN"; - case BT_CTF_NOTIF_ITER_STATUS_INVAL: - return "BT_CTF_NOTIF_ITER_STATUS_INVAL"; - case BT_CTF_NOTIF_ITER_STATUS_ERROR: - return "BT_CTF_NOTIF_ITER_STATUS_ERROR"; - case BT_CTF_NOTIF_ITER_STATUS_OK: - return "BT_CTF_NOTIF_ITER_STATUS_OK"; + case BT_NOTIF_ITER_STATUS_EOF: + return "BT_NOTIF_ITER_STATUS_EOF"; + case BT_NOTIF_ITER_STATUS_AGAIN: + return "BT_NOTIF_ITER_STATUS_AGAIN"; + case BT_NOTIF_ITER_STATUS_INVAL: + return "BT_NOTIF_ITER_STATUS_INVAL"; + case BT_NOTIF_ITER_STATUS_ERROR: + return "BT_NOTIF_ITER_STATUS_ERROR"; + case BT_NOTIF_ITER_STATUS_OK: + return "BT_NOTIF_ITER_STATUS_OK"; default: return "(unknown)"; } diff --git a/plugins/ctf/common/utils/utils.c b/plugins/ctf/common/utils/utils.c index 9af59dab..02c488c5 100644 --- a/plugins/ctf/common/utils/utils.c +++ b/plugins/ctf/common/utils/utils.c @@ -27,12 +27,12 @@ #include "utils.h" -struct bt_ctf_stream_class *ctf_utils_stream_class_from_packet_header( - struct bt_ctf_trace *trace, - struct bt_ctf_field *packet_header_field) +struct bt_stream_class *ctf_utils_stream_class_from_packet_header( + struct bt_trace *trace, + struct bt_field *packet_header_field) { - struct bt_ctf_field *stream_id_field = NULL; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_field *stream_id_field = NULL; + struct bt_stream_class *stream_class = NULL; uint64_t stream_id = -1ULL; int ret; @@ -40,13 +40,13 @@ struct bt_ctf_stream_class *ctf_utils_stream_class_from_packet_header( goto single_stream_class; } - stream_id_field = bt_ctf_field_structure_get_field_by_name( + stream_id_field = bt_field_structure_get_field_by_name( packet_header_field, "stream_id"); if (!stream_id_field) { goto single_stream_class; } - ret = bt_ctf_field_unsigned_integer_get_value(stream_id_field, + ret = bt_field_unsigned_integer_get_value(stream_id_field, &stream_id); if (ret) { stream_id = -1ULL; @@ -55,13 +55,13 @@ struct bt_ctf_stream_class *ctf_utils_stream_class_from_packet_header( if (stream_id == -1ULL) { single_stream_class: /* Single stream class */ - if (bt_ctf_trace_get_stream_class_count(trace) == 0) { + if (bt_trace_get_stream_class_count(trace) == 0) { goto end; } - stream_class = bt_ctf_trace_get_stream_class_by_index(trace, 0); + stream_class = bt_trace_get_stream_class_by_index(trace, 0); } else { - stream_class = bt_ctf_trace_get_stream_class_by_id(trace, + stream_class = bt_trace_get_stream_class_by_id(trace, stream_id); } diff --git a/plugins/ctf/common/utils/utils.h b/plugins/ctf/common/utils/utils.h index 1a32d1ce..f6d170bb 100644 --- a/plugins/ctf/common/utils/utils.h +++ b/plugins/ctf/common/utils/utils.h @@ -28,8 +28,8 @@ #include #include -struct bt_ctf_stream_class *ctf_utils_stream_class_from_packet_header( - struct bt_ctf_trace *trace, - struct bt_ctf_field *packet_header_field); +struct bt_stream_class *ctf_utils_stream_class_from_packet_header( + struct bt_trace *trace, + struct bt_field *packet_header_field); #endif /* CTF_UTILS_H */ diff --git a/plugins/ctf/fs-sink/write.c b/plugins/ctf/fs-sink/write.c index eec76c7e..c9941ac5 100644 --- a/plugins/ctf/fs-sink/write.c +++ b/plugins/ctf/fs-sink/write.c @@ -38,13 +38,13 @@ #include "writer.h" static -void unref_stream_class(struct bt_ctf_stream_class *writer_stream_class) +void unref_stream_class(struct bt_stream_class *writer_stream_class) { bt_put(writer_stream_class); } static -void unref_stream(struct bt_ctf_stream_class *writer_stream) +void unref_stream(struct bt_stream_class *writer_stream) { bt_put(writer_stream); } @@ -59,9 +59,9 @@ static gboolean empty_streams_ht(gpointer key, gpointer value, gpointer user_data) { int ret; - struct bt_ctf_stream *writer_stream = value; + struct bt_stream *writer_stream = value; - ret = bt_ctf_stream_flush(writer_stream); + ret = bt_stream_flush(writer_stream); if (ret) { BT_LOGD_STR("Failed to flush stream while emptying hash table."); } @@ -86,7 +86,7 @@ void check_completed_trace(gpointer key, gpointer value, gpointer user_data) } static -void trace_is_static_listener(struct bt_ctf_trace *trace, void *data) +void trace_is_static_listener(struct bt_trace *trace, void *data) { struct fs_writer *fs_writer = data; int trace_completed = 1; @@ -103,17 +103,17 @@ void trace_is_static_listener(struct bt_ctf_trace *trace, void *data) } static -struct bt_ctf_stream_class *insert_new_stream_class( +struct bt_stream_class *insert_new_stream_class( struct writer_component *writer_component, struct fs_writer *fs_writer, - struct bt_ctf_stream_class *stream_class) + struct bt_stream_class *stream_class) { - struct bt_ctf_stream_class *writer_stream_class = NULL; - struct bt_ctf_trace *trace = NULL, *writer_trace = NULL; + struct bt_stream_class *writer_stream_class = NULL; + struct bt_trace *trace = NULL, *writer_trace = NULL; struct bt_ctf_writer *ctf_writer = fs_writer->writer; enum bt_component_status ret; - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); writer_trace = bt_ctf_writer_get_trace(ctf_writer); @@ -133,7 +133,7 @@ struct bt_ctf_stream_class *insert_new_stream_class( goto error; } - ret = bt_ctf_trace_add_stream_class(writer_trace, writer_stream_class); + ret = bt_trace_add_stream_class(writer_trace, writer_stream_class); if (ret) { BT_LOGE_STR("Failed to add stream_class."); goto error; @@ -155,7 +155,7 @@ end: static enum fs_writer_stream_state *insert_new_stream_state( struct writer_component *writer_component, - struct fs_writer *fs_writer, struct bt_ctf_stream *stream) + struct fs_writer *fs_writer, struct bt_stream *stream) { enum fs_writer_stream_state *v = NULL; @@ -214,7 +214,7 @@ end: static int make_trace_path(struct writer_component *writer_component, - struct bt_ctf_trace *trace, char *trace_path) + struct bt_trace *trace, char *trace_path) { int ret; const char *trace_name; @@ -222,7 +222,7 @@ int make_trace_path(struct writer_component *writer_component, if (writer_component->single_trace) { trace_name = "\0"; } else { - trace_name = bt_ctf_trace_get_name(trace); + trace_name = bt_trace_get_name(trace); if (!trace_name) { trace_name = writer_component->trace_name_base->str; } @@ -280,13 +280,13 @@ end: static struct fs_writer *insert_new_writer( struct writer_component *writer_component, - struct bt_ctf_trace *trace) + struct bt_trace *trace) { struct bt_ctf_writer *ctf_writer = NULL; - struct bt_ctf_trace *writer_trace = NULL; + struct bt_trace *writer_trace = NULL; char trace_path[PATH_MAX]; enum bt_component_status ret; - struct bt_ctf_stream *stream = NULL; + struct bt_stream *stream = NULL; struct fs_writer *fs_writer = NULL; int nr_stream, i; @@ -337,9 +337,9 @@ struct fs_writer *insert_new_writer( g_direct_equal, NULL, destroy_stream_state_key); /* Set all the existing streams in the unknown state. */ - nr_stream = bt_ctf_trace_get_stream_count(trace); + nr_stream = bt_trace_get_stream_count(trace); for (i = 0; i < nr_stream; i++) { - stream = bt_ctf_trace_get_stream_by_index(trace, i); + stream = bt_trace_get_stream_by_index(trace, i); assert(stream); insert_new_stream_state(writer_component, fs_writer, stream); @@ -347,11 +347,11 @@ struct fs_writer *insert_new_writer( } /* Check if the trace is already static or register a listener. */ - if (bt_ctf_trace_is_static(trace)) { + if (bt_trace_is_static(trace)) { fs_writer->trace_static = 1; fs_writer->static_listener_id = -1; } else { - ret = bt_ctf_trace_add_is_static_listener(trace, + ret = bt_trace_add_is_static_listener(trace, trace_is_static_listener, NULL, fs_writer); assert(ret >= 0); fs_writer->static_listener_id = ret; @@ -375,12 +375,12 @@ end: static struct fs_writer *get_fs_writer(struct writer_component *writer_component, - struct bt_ctf_stream_class *stream_class) + struct bt_stream_class *stream_class) { - struct bt_ctf_trace *trace = NULL; + struct bt_trace *trace = NULL; struct fs_writer *fs_writer; - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); fs_writer = g_hash_table_lookup(writer_component->trace_map, @@ -396,12 +396,12 @@ struct fs_writer *get_fs_writer(struct writer_component *writer_component, static struct fs_writer *get_fs_writer_from_stream( struct writer_component *writer_component, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; struct fs_writer *fs_writer; - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); fs_writer = get_fs_writer(writer_component, stream_class); @@ -411,37 +411,37 @@ struct fs_writer *get_fs_writer_from_stream( } static -struct bt_ctf_stream_class *lookup_stream_class( +struct bt_stream_class *lookup_stream_class( struct writer_component *writer_component, - struct bt_ctf_stream_class *stream_class) + struct bt_stream_class *stream_class) { struct fs_writer *fs_writer = get_fs_writer( writer_component, stream_class); assert(fs_writer); - return (struct bt_ctf_stream_class *) g_hash_table_lookup( + return (struct bt_stream_class *) g_hash_table_lookup( fs_writer->stream_class_map, (gpointer) stream_class); } static -struct bt_ctf_stream *lookup_stream(struct writer_component *writer_component, - struct bt_ctf_stream *stream) +struct bt_stream *lookup_stream(struct writer_component *writer_component, + struct bt_stream *stream) { struct fs_writer *fs_writer = get_fs_writer_from_stream( writer_component, stream); assert(fs_writer); - return (struct bt_ctf_stream *) g_hash_table_lookup( + return (struct bt_stream *) g_hash_table_lookup( fs_writer->stream_map, (gpointer) stream); } static -struct bt_ctf_stream *insert_new_stream( +struct bt_stream *insert_new_stream( struct writer_component *writer_component, struct fs_writer *fs_writer, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_stream *stream) + struct bt_stream_class *stream_class, + struct bt_stream *stream) { - struct bt_ctf_stream *writer_stream = NULL; - struct bt_ctf_stream_class *writer_stream_class = NULL; + struct bt_stream *writer_stream = NULL; + struct bt_stream_class *writer_stream_class = NULL; struct bt_ctf_writer *ctf_writer = bt_get(fs_writer->writer); writer_stream_class = lookup_stream_class(writer_component, @@ -456,8 +456,8 @@ struct bt_ctf_stream *insert_new_stream( } bt_get(writer_stream_class); - writer_stream = bt_ctf_stream_create(writer_stream_class, - bt_ctf_stream_get_name(stream)); + writer_stream = bt_stream_create(writer_stream_class, + bt_stream_get_name(stream)); assert(writer_stream); g_hash_table_insert(fs_writer->stream_map, (gpointer) stream, @@ -474,20 +474,20 @@ end: } static -struct bt_ctf_event_class *get_event_class(struct writer_component *writer_component, - struct bt_ctf_stream_class *writer_stream_class, - struct bt_ctf_event_class *event_class) +struct bt_event_class *get_event_class(struct writer_component *writer_component, + struct bt_stream_class *writer_stream_class, + struct bt_event_class *event_class) { - return bt_ctf_stream_class_get_event_class_by_id(writer_stream_class, - bt_ctf_event_class_get_id(event_class)); + return bt_stream_class_get_event_class_by_id(writer_stream_class, + bt_event_class_get_id(event_class)); } static -struct bt_ctf_stream *get_writer_stream( +struct bt_stream *get_writer_stream( struct writer_component *writer_component, - struct bt_ctf_packet *packet, struct bt_ctf_stream *stream) + struct bt_packet *packet, struct bt_stream *stream) { - struct bt_ctf_stream *writer_stream = NULL; + struct bt_stream *writer_stream = NULL; writer_stream = lookup_stream(writer_component, stream); if (!writer_stream) { @@ -509,7 +509,7 @@ void writer_close(struct writer_component *writer_component, struct fs_writer *fs_writer) { if (fs_writer->static_listener_id >= 0) { - bt_ctf_trace_remove_is_static_listener(fs_writer->trace, + bt_trace_remove_is_static_listener(fs_writer->trace, fs_writer->static_listener_id); } @@ -532,15 +532,15 @@ void writer_close(struct writer_component *writer_component, BT_HIDDEN enum bt_component_status writer_stream_begin( struct writer_component *writer_component, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; struct fs_writer *fs_writer; - struct bt_ctf_stream *writer_stream = NULL; + struct bt_stream *writer_stream = NULL; enum bt_component_status ret = BT_COMPONENT_STATUS_OK; enum fs_writer_stream_state *state; - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); fs_writer = get_fs_writer(writer_component, stream_class); @@ -584,15 +584,15 @@ end: BT_HIDDEN enum bt_component_status writer_stream_end( struct writer_component *writer_component, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; struct fs_writer *fs_writer; - struct bt_ctf_trace *trace = NULL; + struct bt_trace *trace = NULL; enum bt_component_status ret = BT_COMPONENT_STATUS_OK; enum fs_writer_stream_state *state; - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); fs_writer = get_fs_writer(writer_component, stream_class); @@ -635,13 +635,13 @@ end: BT_HIDDEN enum bt_component_status writer_new_packet( struct writer_component *writer_component, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { - struct bt_ctf_stream *stream = NULL, *writer_stream = NULL; + struct bt_stream *stream = NULL, *writer_stream = NULL; enum bt_component_status ret = BT_COMPONENT_STATUS_OK; int int_ret; - stream = bt_ctf_packet_get_stream(packet); + stream = bt_packet_get_stream(packet); assert(stream); writer_stream = get_writer_stream(writer_component, packet, stream); @@ -678,12 +678,12 @@ end: BT_HIDDEN enum bt_component_status writer_close_packet( struct writer_component *writer_component, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { - struct bt_ctf_stream *stream = NULL, *writer_stream = NULL; + struct bt_stream *stream = NULL, *writer_stream = NULL; enum bt_component_status ret; - stream = bt_ctf_packet_get_stream(packet); + stream = bt_packet_get_stream(packet); assert(stream); writer_stream = lookup_stream(writer_component, stream); @@ -695,7 +695,7 @@ enum bt_component_status writer_close_packet( bt_get(writer_stream); - ret = bt_ctf_stream_flush(writer_stream); + ret = bt_stream_flush(writer_stream); if (ret) { BT_LOGE_STR("Failed to flush stream."); goto error; @@ -717,19 +717,19 @@ end: BT_HIDDEN enum bt_component_status writer_output_event( struct writer_component *writer_component, - struct bt_ctf_event *event) + struct bt_event *event) { enum bt_component_status ret; - struct bt_ctf_event_class *event_class = NULL, *writer_event_class = NULL; - struct bt_ctf_stream *stream = NULL, *writer_stream = NULL; - struct bt_ctf_stream_class *stream_class = NULL, *writer_stream_class = NULL; - struct bt_ctf_event *writer_event = NULL; + struct bt_event_class *event_class = NULL, *writer_event_class = NULL; + struct bt_stream *stream = NULL, *writer_stream = NULL; + struct bt_stream_class *stream_class = NULL, *writer_stream_class = NULL; + struct bt_event *writer_event = NULL; int int_ret; - event_class = bt_ctf_event_get_class(event); + event_class = bt_event_get_class(event); assert(event_class); - stream = bt_ctf_event_get_stream(event); + stream = bt_event_get_stream(event); assert(stream); writer_stream = lookup_stream(writer_component, stream); @@ -738,7 +738,7 @@ enum bt_component_status writer_output_event( goto error; } - stream_class = bt_ctf_event_class_get_stream_class(event_class); + stream_class = bt_event_class_get_stream_class(event_class); assert(stream_class); writer_stream_class = lookup_stream_class(writer_component, stream_class); @@ -756,11 +756,11 @@ enum bt_component_status writer_output_event( BT_LOGE_STR("Failed to copy event_class."); goto error; } - int_ret = bt_ctf_stream_class_add_event_class( + int_ret = bt_stream_class_add_event_class( writer_stream_class, writer_event_class); if (int_ret) { BT_LOGE("Failed to add event_class: event_name=\"%s\"", - bt_ctf_event_class_get_name(event_class)); + bt_event_class_get_name(event_class)); goto error; } } @@ -769,14 +769,14 @@ enum bt_component_status writer_output_event( writer_event_class, true); if (!writer_event) { BT_LOGE("Failed to copy event: event_class=\"%s\"", - bt_ctf_event_class_get_name(writer_event_class)); + bt_event_class_get_name(writer_event_class)); goto error; } - int_ret = bt_ctf_stream_append_event(writer_stream, writer_event); + int_ret = bt_stream_append_event(writer_stream, writer_event); if (int_ret < 0) { BT_LOGE("Failed to append event: event_class=\"%s\"", - bt_ctf_event_class_get_name(writer_event_class)); + bt_event_class_get_name(writer_event_class)); goto error; } diff --git a/plugins/ctf/fs-sink/writer.c b/plugins/ctf/fs-sink/writer.c index 01dbc184..fcc61866 100644 --- a/plugins/ctf/fs-sink/writer.c +++ b/plugins/ctf/fs-sink/writer.c @@ -123,7 +123,7 @@ enum bt_component_status handle_notification( switch (bt_notification_get_type(notification)) { case BT_NOTIFICATION_TYPE_PACKET_BEGIN: { - struct bt_ctf_packet *packet = + struct bt_packet *packet = bt_notification_packet_begin_get_packet(notification); if (!packet) { @@ -137,7 +137,7 @@ enum bt_component_status handle_notification( } case BT_NOTIFICATION_TYPE_PACKET_END: { - struct bt_ctf_packet *packet = + struct bt_packet *packet = bt_notification_packet_end_get_packet(notification); if (!packet) { @@ -150,7 +150,7 @@ enum bt_component_status handle_notification( } case BT_NOTIFICATION_TYPE_EVENT: { - struct bt_ctf_event *event = bt_notification_event_get_event( + struct bt_event *event = bt_notification_event_get_event( notification); if (!event) { @@ -166,7 +166,7 @@ enum bt_component_status handle_notification( } case BT_NOTIFICATION_TYPE_STREAM_BEGIN: { - struct bt_ctf_stream *stream = + struct bt_stream *stream = bt_notification_stream_begin_get_stream(notification); if (!stream) { @@ -179,7 +179,7 @@ enum bt_component_status handle_notification( } case BT_NOTIFICATION_TYPE_STREAM_END: { - struct bt_ctf_stream *stream = + struct bt_stream *stream = bt_notification_stream_end_get_stream(notification); if (!stream) { diff --git a/plugins/ctf/fs-sink/writer.h b/plugins/ctf/fs-sink/writer.h index 07e8674a..04e55070 100644 --- a/plugins/ctf/fs-sink/writer.h +++ b/plugins/ctf/fs-sink/writer.h @@ -36,7 +36,7 @@ struct writer_component { GString *trace_name_base; /* For the directory name suffix. */ int trace_id; - /* Map between struct bt_ctf_trace and struct fs_writer. */ + /* Map between struct bt_trace and struct fs_writer. */ GHashTable *trace_map; FILE *err; struct bt_notification_iterator *input_iterator; @@ -59,8 +59,8 @@ enum fs_writer_stream_state { struct fs_writer { struct bt_ctf_writer *writer; - struct bt_ctf_trace *trace; - struct bt_ctf_trace *writer_trace; + struct bt_trace *trace; + struct bt_trace *writer_trace; struct writer_component *writer_component; int static_listener_id; int trace_static; @@ -76,19 +76,19 @@ void writer_close(struct writer_component *writer_component, struct fs_writer *fs_writer); BT_HIDDEN enum bt_component_status writer_output_event(struct writer_component *writer, - struct bt_ctf_event *event); + struct bt_event *event); BT_HIDDEN enum bt_component_status writer_new_packet(struct writer_component *writer, - struct bt_ctf_packet *packet); + struct bt_packet *packet); BT_HIDDEN enum bt_component_status writer_close_packet(struct writer_component *writer, - struct bt_ctf_packet *packet); + struct bt_packet *packet); BT_HIDDEN enum bt_component_status writer_stream_begin(struct writer_component *writer, - struct bt_ctf_stream *stream); + struct bt_stream *stream); BT_HIDDEN enum bt_component_status writer_stream_end(struct writer_component *writer, - struct bt_ctf_stream *stream); + struct bt_stream *stream); BT_HIDDEN enum bt_component_status writer_component_init( diff --git a/plugins/ctf/fs-src/data-stream-file.c b/plugins/ctf/fs-src/data-stream-file.c index ec10a033..f06457e8 100644 --- a/plugins/ctf/fs-src/data-stream-file.c +++ b/plugins/ctf/fs-src/data-stream-file.c @@ -75,11 +75,11 @@ end: } static -enum bt_ctf_notif_iter_medium_status ds_file_mmap_next( +enum bt_notif_iter_medium_status ds_file_mmap_next( struct ctf_fs_ds_file *ds_file) { - enum bt_ctf_notif_iter_medium_status ret = - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK; + enum bt_notif_iter_medium_status ret = + BT_NOTIF_ITER_MEDIUM_STATUS_OK; /* Unmap old region */ if (ds_file->mmap_addr) { @@ -99,7 +99,7 @@ enum bt_ctf_notif_iter_medium_status ds_file_mmap_next( ds_file->mmap_len = MIN(ds_file->file->size - ds_file->mmap_offset, ds_file->mmap_max_len); if (ds_file->mmap_len == 0) { - ret = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF; + ret = BT_NOTIF_ITER_MEDIUM_STATUS_EOF; goto end; } /* Map new region */ @@ -118,18 +118,18 @@ enum bt_ctf_notif_iter_medium_status ds_file_mmap_next( goto end; error: ds_file_munmap(ds_file); - ret = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR; + ret = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR; end: return ret; } static -enum bt_ctf_notif_iter_medium_status medop_request_bytes( +enum bt_notif_iter_medium_status medop_request_bytes( size_t request_sz, uint8_t **buffer_addr, size_t *buffer_sz, void *data) { - enum bt_ctf_notif_iter_medium_status status = - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK; + enum bt_notif_iter_medium_status status = + BT_NOTIF_ITER_MEDIUM_STATUS_OK; struct ctf_fs_ds_file *ds_file = data; if (request_sz == 0) { @@ -142,15 +142,15 @@ enum bt_ctf_notif_iter_medium_status medop_request_bytes( if (ds_file->mmap_offset >= ds_file->file->size) { BT_LOGD("Reached end of file \"%s\" (%p)", ds_file->file->path->str, ds_file->file->fp); - status = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF; + status = BT_NOTIF_ITER_MEDIUM_STATUS_EOF; goto end; } status = ds_file_mmap_next(ds_file); switch (status) { - case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK: + case BT_NOTIF_ITER_MEDIUM_STATUS_OK: break; - case BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF: + case BT_NOTIF_ITER_MEDIUM_STATUS_EOF: goto end; default: BT_LOGE("Cannot memory-map next region of file \"%s\" (%p)", @@ -166,22 +166,22 @@ enum bt_ctf_notif_iter_medium_status medop_request_bytes( goto end; error: - status = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR; + status = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR; end: return status; } static -struct bt_ctf_stream *medop_get_stream( - struct bt_ctf_stream_class *stream_class, uint64_t stream_id, +struct bt_stream *medop_get_stream( + struct bt_stream_class *stream_class, uint64_t stream_id, void *data) { struct ctf_fs_ds_file *ds_file = data; - struct bt_ctf_stream_class *ds_file_stream_class; - struct bt_ctf_stream *stream = NULL; + struct bt_stream_class *ds_file_stream_class; + struct bt_stream *stream = NULL; - ds_file_stream_class = bt_ctf_stream_get_class(ds_file->stream); + ds_file_stream_class = bt_stream_get_class(ds_file->stream); bt_put(ds_file_stream_class); if (stream_class != ds_file_stream_class) { @@ -199,21 +199,21 @@ end: } static -enum bt_ctf_notif_iter_medium_status medop_seek( - enum bt_ctf_notif_iter_seek_whence whence, off_t offset, +enum bt_notif_iter_medium_status medop_seek( + enum bt_notif_iter_seek_whence whence, off_t offset, void *data) { - enum bt_ctf_notif_iter_medium_status ret = - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK; + enum bt_notif_iter_medium_status ret = + BT_NOTIF_ITER_MEDIUM_STATUS_OK; struct ctf_fs_ds_file *ds_file = data; off_t file_size = ds_file->file->size; - if (whence != BT_CTF_NOTIF_ITER_SEEK_WHENCE_SET || + if (whence != BT_NOTIF_ITER_SEEK_WHENCE_SET || offset < 0 || offset > file_size) { BT_LOGE("Invalid medium seek request: whence=%d, offset=%jd, " "file-size=%jd", (int) whence, offset, file_size); - ret = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_INVAL; + ret = BT_NOTIF_ITER_MEDIUM_STATUS_INVAL; goto end; } @@ -232,14 +232,14 @@ enum bt_ctf_notif_iter_medium_status medop_seek( ds_file->mmap_len); unmap_ret = ds_file_munmap(ds_file); if (unmap_ret) { - ret = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR; + ret = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR; goto end; } ds_file->mmap_offset = offset - offset_in_mapping; ds_file->request_offset = offset_in_mapping; ret = ds_file_mmap_next(ds_file); - if (ret != BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK) { + if (ret != BT_NOTIF_ITER_MEDIUM_STATUS_OK) { goto end; } } else { @@ -252,7 +252,7 @@ end: } BT_HIDDEN -struct bt_ctf_notif_iter_medium_ops ctf_fs_ds_file_medops = { +struct bt_notif_iter_medium_ops ctf_fs_ds_file_medops = { .request_bytes = medop_request_bytes, .get_stream = medop_get_stream, .seek = medop_seek, @@ -293,18 +293,18 @@ struct ctf_fs_ds_index_entry *ctf_fs_ds_index_add_new_entry( } static -struct bt_ctf_clock_class *get_field_mapped_clock_class( - struct bt_ctf_field *field) +struct bt_clock_class *get_field_mapped_clock_class( + struct bt_field *field) { - struct bt_ctf_field_type *field_type; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_field_type *field_type; + struct bt_clock_class *clock_class = NULL; - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); if (!field_type) { goto end; } - clock_class = bt_ctf_field_type_integer_get_mapped_clock_class( + clock_class = bt_field_type_integer_get_mapped_clock_class( field_type); if (!clock_class) { goto end; @@ -316,19 +316,19 @@ end: static int get_packet_bounds_from_packet_context( - struct bt_ctf_field *packet_context, - struct bt_ctf_clock_class **_timestamp_begin_cc, - struct bt_ctf_field **_timestamp_begin, - struct bt_ctf_clock_class **_timestamp_end_cc, - struct bt_ctf_field **_timestamp_end) + struct bt_field *packet_context, + struct bt_clock_class **_timestamp_begin_cc, + struct bt_field **_timestamp_begin, + struct bt_clock_class **_timestamp_end_cc, + struct bt_field **_timestamp_end) { int ret = 0; - struct bt_ctf_clock_class *timestamp_begin_cc = NULL; - struct bt_ctf_clock_class *timestamp_end_cc = NULL; - struct bt_ctf_field *timestamp_begin = NULL; - struct bt_ctf_field *timestamp_end = NULL; + struct bt_clock_class *timestamp_begin_cc = NULL; + struct bt_clock_class *timestamp_end_cc = NULL; + struct bt_field *timestamp_begin = NULL; + struct bt_field *timestamp_end = NULL; - timestamp_begin = bt_ctf_field_structure_get_field_by_name( + timestamp_begin = bt_field_structure_get_field_by_name( packet_context, "timestamp_begin"); if (!timestamp_begin) { BT_LOGD_STR("Cannot retrieve timestamp_begin field in packet context."); @@ -341,7 +341,7 @@ int get_packet_bounds_from_packet_context( BT_LOGD_STR("Cannot retrieve the clock mapped to timestamp_begin."); } - timestamp_end = bt_ctf_field_structure_get_field_by_name( + timestamp_end = bt_field_structure_get_field_by_name( packet_context, "timestamp_end"); if (!timestamp_end) { BT_LOGD_STR("Cannot retrieve timestamp_end field in packet context."); @@ -376,10 +376,10 @@ end: static int get_ds_file_packet_bounds_clock_classes(struct ctf_fs_ds_file *ds_file, - struct bt_ctf_clock_class **timestamp_begin_cc, - struct bt_ctf_clock_class **timestamp_end_cc) + struct bt_clock_class **timestamp_begin_cc, + struct bt_clock_class **timestamp_end_cc) { - struct bt_ctf_field *packet_context = NULL; + struct bt_field *packet_context = NULL; int ret = ctf_fs_ds_file_get_packet_header_context_fields(ds_file, NULL, &packet_context); @@ -399,20 +399,20 @@ end: } static -int convert_cycles_to_ns(struct bt_ctf_clock_class *clock_class, +int convert_cycles_to_ns(struct bt_clock_class *clock_class, uint64_t cycles, int64_t *ns) { int ret = 0; - struct bt_ctf_clock_value *clock_value; + struct bt_clock_value *clock_value; assert(ns); - clock_value = bt_ctf_clock_value_create(clock_class, cycles); + clock_value = bt_clock_value_create(clock_class, cycles); if (!clock_value) { ret = -1; goto end; } - ret = bt_ctf_clock_value_get_value_ns_from_epoch(clock_value, ns); + ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ns); if (ret) { goto end; } @@ -440,8 +440,8 @@ struct ctf_fs_ds_index *build_index_from_idx_file( size_t file_index_entry_size; size_t file_entry_count; size_t i; - struct bt_ctf_clock_class *timestamp_begin_cc = NULL; - struct bt_ctf_clock_class *timestamp_end_cc = NULL; + struct bt_clock_class *timestamp_begin_cc = NULL; + struct bt_clock_class *timestamp_end_cc = NULL; BT_LOGD("Building index from .idx file of stream file %s", ds_file->file->path->str); @@ -605,14 +605,14 @@ error: static int init_index_entry(struct ctf_fs_ds_index_entry *entry, - struct bt_ctf_field *packet_context, off_t packet_size, + struct bt_field *packet_context, off_t packet_size, off_t packet_offset) { int ret; - struct bt_ctf_field *timestamp_begin = NULL; - struct bt_ctf_field *timestamp_end = NULL; - struct bt_ctf_clock_class *timestamp_begin_cc = NULL; - struct bt_ctf_clock_class *timestamp_end_cc = NULL; + struct bt_field *timestamp_begin = NULL; + struct bt_field *timestamp_end = NULL; + struct bt_clock_class *timestamp_begin_cc = NULL; + struct bt_clock_class *timestamp_end_cc = NULL; ret = get_packet_bounds_from_packet_context(packet_context, ×tamp_begin_cc, ×tamp_begin, @@ -629,12 +629,12 @@ int init_index_entry(struct ctf_fs_ds_index_entry *entry, assert(packet_size >= 0); entry->packet_size = packet_size; - ret = bt_ctf_field_unsigned_integer_get_value(timestamp_begin, + ret = bt_field_unsigned_integer_get_value(timestamp_begin, &entry->timestamp_begin); if (ret) { goto end; } - ret = bt_ctf_field_unsigned_integer_get_value(timestamp_end, + ret = bt_field_unsigned_integer_get_value(timestamp_end, &entry->timestamp_end); if (ret) { goto end; @@ -670,8 +670,8 @@ struct ctf_fs_ds_index *build_index_from_stream_file( { int ret; struct ctf_fs_ds_index *index = NULL; - enum bt_ctf_notif_iter_status iter_status; - struct bt_ctf_field *packet_context = NULL; + enum bt_notif_iter_status iter_status; + struct bt_field *packet_context = NULL; BT_LOGD("Indexing stream file %s", ds_file->file->path->str); @@ -686,23 +686,23 @@ struct ctf_fs_ds_index *build_index_from_stream_file( off_t current_packet_size, current_packet_size_bytes; struct ctf_fs_ds_index_entry *entry; - iter_status = bt_ctf_notif_iter_get_packet_header_context_fields( + iter_status = bt_notif_iter_get_packet_header_context_fields( ds_file->notif_iter, NULL, &packet_context); - if (iter_status != BT_CTF_NOTIF_ITER_STATUS_OK) { - if (iter_status == BT_CTF_NOTIF_ITER_STATUS_EOF) { + if (iter_status != BT_NOTIF_ITER_STATUS_OK) { + if (iter_status == BT_NOTIF_ITER_STATUS_EOF) { break; } goto error; } current_packet_offset = - bt_ctf_notif_iter_get_current_packet_offset( + bt_notif_iter_get_current_packet_offset( ds_file->notif_iter); if (current_packet_offset < 0) { BT_LOGE_STR("Cannot get the current packet's offset."); goto error; } - current_packet_size = bt_ctf_notif_iter_get_current_packet_size( + current_packet_size = bt_notif_iter_get_current_packet_size( ds_file->notif_iter); if (current_packet_size < 0) { BT_LOGE("Cannot get packet size: packet-offset=%jd", @@ -743,12 +743,12 @@ struct ctf_fs_ds_index *build_index_from_stream_file( goto error; } - iter_status = bt_ctf_notif_iter_seek(ds_file->notif_iter, + iter_status = bt_notif_iter_seek(ds_file->notif_iter, next_packet_offset); BT_PUT(packet_context); - } while (iter_status == BT_CTF_NOTIF_ITER_STATUS_OK); + } while (iter_status == BT_NOTIF_ITER_STATUS_OK); - if (iter_status != BT_CTF_NOTIF_ITER_STATUS_EOF) { + if (iter_status != BT_NOTIF_ITER_STATUS_EOF) { goto error; } end: @@ -763,8 +763,8 @@ error: BT_HIDDEN struct ctf_fs_ds_file *ctf_fs_ds_file_create( struct ctf_fs_trace *ctf_fs_trace, - struct bt_ctf_notif_iter *notif_iter, - struct bt_ctf_stream *stream, const char *path) + struct bt_notif_iter *notif_iter, + struct bt_stream *stream, const char *path) { int ret; const size_t page_size = bt_common_get_page_size(); @@ -788,7 +788,7 @@ struct ctf_fs_ds_file *ctf_fs_ds_file_create( } ds_file->notif_iter = notif_iter; - bt_ctf_notif_iter_set_medops_data(ds_file->notif_iter, ds_file); + bt_notif_iter_set_medops_data(ds_file->notif_iter, ds_file); if (!ds_file->notif_iter) { goto error; } @@ -846,31 +846,31 @@ BT_HIDDEN struct bt_notification_iterator_next_method_return ctf_fs_ds_file_next( struct ctf_fs_ds_file *ds_file) { - enum bt_ctf_notif_iter_status notif_iter_status; + enum bt_notif_iter_status notif_iter_status; struct bt_notification_iterator_next_method_return ret = { .status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR, .notification = NULL, }; - notif_iter_status = bt_ctf_notif_iter_get_next_notification( + notif_iter_status = bt_notif_iter_get_next_notification( ds_file->notif_iter, ds_file->cc_prio_map, &ret.notification); switch (notif_iter_status) { - case BT_CTF_NOTIF_ITER_STATUS_EOF: + case BT_NOTIF_ITER_STATUS_EOF: ret.status = BT_NOTIFICATION_ITERATOR_STATUS_END; break; - case BT_CTF_NOTIF_ITER_STATUS_OK: + case BT_NOTIF_ITER_STATUS_OK: ret.status = BT_NOTIFICATION_ITERATOR_STATUS_OK; break; - case BT_CTF_NOTIF_ITER_STATUS_AGAIN: + case BT_NOTIF_ITER_STATUS_AGAIN: /* * Should not make it this far as this is * medium-specific; there is nothing for the user to do * and it should have been handled upstream. */ abort(); - case BT_CTF_NOTIF_ITER_STATUS_INVAL: - case BT_CTF_NOTIF_ITER_STATUS_ERROR: + case BT_NOTIF_ITER_STATUS_INVAL: + case BT_NOTIF_ITER_STATUS_ERROR: default: ret.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR; break; @@ -882,23 +882,23 @@ struct bt_notification_iterator_next_method_return ctf_fs_ds_file_next( BT_HIDDEN int ctf_fs_ds_file_get_packet_header_context_fields( struct ctf_fs_ds_file *ds_file, - struct bt_ctf_field **packet_header_field, - struct bt_ctf_field **packet_context_field) + struct bt_field **packet_header_field, + struct bt_field **packet_context_field) { - enum bt_ctf_notif_iter_status notif_iter_status; + enum bt_notif_iter_status notif_iter_status; int ret = 0; assert(ds_file); - notif_iter_status = bt_ctf_notif_iter_get_packet_header_context_fields( + notif_iter_status = bt_notif_iter_get_packet_header_context_fields( ds_file->notif_iter, packet_header_field, packet_context_field); switch (notif_iter_status) { - case BT_CTF_NOTIF_ITER_STATUS_EOF: - case BT_CTF_NOTIF_ITER_STATUS_OK: + case BT_NOTIF_ITER_STATUS_EOF: + case BT_NOTIF_ITER_STATUS_OK: break; - case BT_CTF_NOTIF_ITER_STATUS_AGAIN: + case BT_NOTIF_ITER_STATUS_AGAIN: abort(); - case BT_CTF_NOTIF_ITER_STATUS_INVAL: - case BT_CTF_NOTIF_ITER_STATUS_ERROR: + case BT_NOTIF_ITER_STATUS_INVAL: + case BT_NOTIF_ITER_STATUS_ERROR: default: goto error; break; diff --git a/plugins/ctf/fs-src/data-stream-file.h b/plugins/ctf/fs-src/data-stream-file.h index 32027566..093f360b 100644 --- a/plugins/ctf/fs-src/data-stream-file.h +++ b/plugins/ctf/fs-src/data-stream-file.h @@ -89,13 +89,13 @@ struct ctf_fs_ds_file { struct ctf_fs_file *file; /* Owned by this */ - struct bt_ctf_stream *stream; + struct bt_stream *stream; /* Owned by this */ struct bt_clock_class_priority_map *cc_prio_map; /* Weak */ - struct bt_ctf_notif_iter *notif_iter; + struct bt_notif_iter *notif_iter; void *mmap_addr; @@ -123,14 +123,14 @@ struct ctf_fs_ds_file { BT_HIDDEN struct ctf_fs_ds_file *ctf_fs_ds_file_create( struct ctf_fs_trace *ctf_fs_trace, - struct bt_ctf_notif_iter *notif_iter, - struct bt_ctf_stream *stream, const char *path); + struct bt_notif_iter *notif_iter, + struct bt_stream *stream, const char *path); BT_HIDDEN int ctf_fs_ds_file_get_packet_header_context_fields( struct ctf_fs_ds_file *ds_file, - struct bt_ctf_field **packet_header_field, - struct bt_ctf_field **packet_context_field); + struct bt_field **packet_header_field, + struct bt_field **packet_context_field); BT_HIDDEN void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream); @@ -146,6 +146,6 @@ struct ctf_fs_ds_index *ctf_fs_ds_file_build_index( BT_HIDDEN void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index); -extern struct bt_ctf_notif_iter_medium_ops ctf_fs_ds_file_medops; +extern struct bt_notif_iter_medium_ops ctf_fs_ds_file_medops; #endif /* CTF_FS_DS_FILE_H */ diff --git a/plugins/ctf/fs-src/fs.c b/plugins/ctf/fs-src/fs.c index fe978fc2..2dacf97d 100644 --- a/plugins/ctf/fs-src/fs.c +++ b/plugins/ctf/fs-src/fs.c @@ -80,7 +80,7 @@ void ctf_fs_notif_iter_data_destroy( ctf_fs_ds_file_destroy(notif_iter_data->ds_file); if (notif_iter_data->notif_iter) { - bt_ctf_notif_iter_destroy(notif_iter_data->notif_iter); + bt_notif_iter_destroy(notif_iter_data->notif_iter); } g_free(notif_iter_data); @@ -166,7 +166,7 @@ enum bt_notification_iterator_status ctf_fs_iterator_init( goto error; } - notif_iter_data->notif_iter = bt_ctf_notif_iter_create( + notif_iter_data->notif_iter = bt_notif_iter_create( port_data->ds_file_group->ctf_fs_trace->metadata->trace, bt_common_get_page_size() * 8, ctf_fs_ds_file_medops, NULL); @@ -366,9 +366,9 @@ end: static uint64_t get_packet_header_stream_instance_id(struct ctf_fs_trace *ctf_fs_trace, - struct bt_ctf_field *packet_header_field) + struct bt_field *packet_header_field) { - struct bt_ctf_field *stream_instance_id_field = NULL; + struct bt_field *stream_instance_id_field = NULL; uint64_t stream_instance_id = -1ULL; int ret; @@ -376,13 +376,13 @@ uint64_t get_packet_header_stream_instance_id(struct ctf_fs_trace *ctf_fs_trace, goto end; } - stream_instance_id_field = bt_ctf_field_structure_get_field_by_name( + stream_instance_id_field = bt_field_structure_get_field_by_name( packet_header_field, "stream_instance_id"); if (!stream_instance_id_field) { goto end; } - ret = bt_ctf_field_unsigned_integer_get_value(stream_instance_id_field, + ret = bt_field_unsigned_integer_get_value(stream_instance_id_field, &stream_instance_id); if (ret) { stream_instance_id = -1ULL; @@ -396,48 +396,48 @@ end: uint64_t get_packet_context_timestamp_begin_ns( struct ctf_fs_trace *ctf_fs_trace, - struct bt_ctf_field *packet_context_field) + struct bt_field *packet_context_field) { int ret; - struct bt_ctf_field *timestamp_begin_field = NULL; - struct bt_ctf_field_type *timestamp_begin_ft = NULL; + struct bt_field *timestamp_begin_field = NULL; + struct bt_field_type *timestamp_begin_ft = NULL; uint64_t timestamp_begin_raw_value = -1ULL; uint64_t timestamp_begin_ns = -1ULL; int64_t timestamp_begin_ns_signed; - struct bt_ctf_clock_class *timestamp_begin_clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_class *timestamp_begin_clock_class = NULL; + struct bt_clock_value *clock_value = NULL; if (!packet_context_field) { goto end; } - timestamp_begin_field = bt_ctf_field_structure_get_field_by_name( + timestamp_begin_field = bt_field_structure_get_field_by_name( packet_context_field, "timestamp_begin"); if (!timestamp_begin_field) { goto end; } - timestamp_begin_ft = bt_ctf_field_get_type(timestamp_begin_field); + timestamp_begin_ft = bt_field_get_type(timestamp_begin_field); assert(timestamp_begin_ft); timestamp_begin_clock_class = - bt_ctf_field_type_integer_get_mapped_clock_class(timestamp_begin_ft); + bt_field_type_integer_get_mapped_clock_class(timestamp_begin_ft); if (!timestamp_begin_clock_class) { goto end; } - ret = bt_ctf_field_unsigned_integer_get_value(timestamp_begin_field, + ret = bt_field_unsigned_integer_get_value(timestamp_begin_field, ×tamp_begin_raw_value); if (ret) { goto end; } - clock_value = bt_ctf_clock_value_create(timestamp_begin_clock_class, + clock_value = bt_clock_value_create(timestamp_begin_clock_class, timestamp_begin_raw_value); if (!clock_value) { goto end; } - ret = bt_ctf_clock_value_get_value_ns_from_epoch(clock_value, + ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ×tamp_begin_ns_signed); if (ret) { goto end; @@ -514,7 +514,7 @@ void ctf_fs_ds_file_group_destroy(struct ctf_fs_ds_file_group *ds_file_group) static struct ctf_fs_ds_file_group *ctf_fs_ds_file_group_create( struct ctf_fs_trace *ctf_fs_trace, - struct bt_ctf_stream_class *stream_class, + struct bt_stream_class *stream_class, uint64_t stream_instance_id) { struct ctf_fs_ds_file_group *ds_file_group; @@ -607,9 +607,9 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const char *path) { - struct bt_ctf_field *packet_header_field = NULL; - struct bt_ctf_field *packet_context_field = NULL; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_field *packet_header_field = NULL; + struct bt_field *packet_context_field = NULL; + struct bt_stream_class *stream_class = NULL; uint64_t stream_instance_id = -1ULL; uint64_t begin_ns = -1ULL; struct ctf_fs_ds_file_group *ds_file_group = NULL; @@ -618,9 +618,9 @@ int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, size_t i; struct ctf_fs_ds_file *ds_file = NULL; struct ctf_fs_ds_index *index = NULL; - struct bt_ctf_notif_iter *notif_iter = NULL; + struct bt_notif_iter *notif_iter = NULL; - notif_iter = bt_ctf_notif_iter_create(ctf_fs_trace->metadata->trace, + notif_iter = bt_notif_iter_create(ctf_fs_trace->metadata->trace, bt_common_get_page_size() * 8, ctf_fs_ds_file_medops, NULL); if (!notif_iter) { BT_LOGE_STR("Cannot create a CTF notification iterator."); @@ -739,7 +739,7 @@ end: ctf_fs_ds_file_destroy(ds_file); if (notif_iter) { - bt_ctf_notif_iter_destroy(notif_iter); + bt_notif_iter_destroy(notif_iter); } ctf_fs_ds_index_destroy(index); @@ -845,11 +845,11 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace) if (ds_file_group->stream_id == -1ULL) { /* No stream ID */ - ds_file_group->stream = bt_ctf_stream_create( + ds_file_group->stream = bt_stream_create( ds_file_group->stream_class, name->str); } else { /* Specific stream ID */ - ds_file_group->stream = bt_ctf_stream_create_with_id( + ds_file_group->stream = bt_stream_create_with_id( ds_file_group->stream_class, name->str, ds_file_group->stream_id); } @@ -896,13 +896,13 @@ int create_cc_prio_map(struct ctf_fs_trace *ctf_fs_trace) goto end; } - count = bt_ctf_trace_get_clock_class_count( + count = bt_trace_get_clock_class_count( ctf_fs_trace->metadata->trace); assert(count >= 0); for (i = 0; i < count; i++) { - struct bt_ctf_clock_class *clock_class = - bt_ctf_trace_get_clock_class_by_index( + struct bt_clock_class *clock_class = + bt_trace_get_clock_class_by_index( ctf_fs_trace->metadata->trace, i); assert(clock_class); @@ -972,7 +972,7 @@ struct ctf_fs_trace *ctf_fs_trace_create(const char *path, const char *name, * trace needs. There won't be any more. Therefore it is safe to * make this trace static. */ - (void) bt_ctf_trace_set_is_static(ctf_fs_trace->metadata->trace); + (void) bt_trace_set_is_static(ctf_fs_trace->metadata->trace); goto end; diff --git a/plugins/ctf/fs-src/fs.h b/plugins/ctf/fs-src/fs.h index 33b58848..bbac1bb4 100644 --- a/plugins/ctf/fs-src/fs.h +++ b/plugins/ctf/fs-src/fs.h @@ -49,7 +49,7 @@ struct ctf_fs_file { struct ctf_fs_metadata { /* Owned by this */ - struct bt_ctf_trace *trace; + struct bt_trace *trace; /* Owned by this */ char *text; @@ -102,10 +102,10 @@ struct ctf_fs_ds_file_group { GPtrArray *ds_file_infos; /* Owned by this */ - struct bt_ctf_stream_class *stream_class; + struct bt_stream_class *stream_class; /* Owned by this */ - struct bt_ctf_stream *stream; + struct bt_stream *stream; /* Stream (instance) ID; -1ULL means none */ uint64_t stream_id; @@ -130,7 +130,7 @@ struct ctf_fs_notif_iter_data { size_t ds_file_info_index; /* Owned by this */ - struct bt_ctf_notif_iter *notif_iter; + struct bt_notif_iter *notif_iter; }; BT_HIDDEN diff --git a/plugins/ctf/fs-src/query.c b/plugins/ctf/fs-src/query.c index de43ba78..04bf8c5b 100644 --- a/plugins/ctf/fs-src/query.c +++ b/plugins/ctf/fs-src/query.c @@ -228,14 +228,14 @@ end: } static -int add_stream_ids(struct bt_value *info, struct bt_ctf_stream *stream) +int add_stream_ids(struct bt_value *info, struct bt_stream *stream) { int ret = 0; int64_t stream_class_id, stream_instance_id; enum bt_value_status status; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_stream_class *stream_class = NULL; - stream_instance_id = bt_ctf_stream_get_id(stream); + stream_instance_id = bt_stream_get_id(stream); if (stream_instance_id != -1) { status = bt_value_map_insert_integer(info, "id", stream_instance_id); @@ -245,13 +245,13 @@ int add_stream_ids(struct bt_value *info, struct bt_ctf_stream *stream) } } - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); if (!stream_class) { ret = -1; goto end; } - stream_class_id = bt_ctf_stream_class_get_id(stream_class); + stream_class_id = bt_stream_class_get_id(stream_class); if (stream_class_id == -1) { ret = -1; goto end; diff --git a/plugins/ctf/lttng-live/data-stream.c b/plugins/ctf/lttng-live/data-stream.c index 10613c84..7bf4c29e 100644 --- a/plugins/ctf/lttng-live/data-stream.c +++ b/plugins/ctf/lttng-live/data-stream.c @@ -39,12 +39,12 @@ #include "data-stream.h" static -enum bt_ctf_notif_iter_medium_status medop_request_bytes( +enum bt_notif_iter_medium_status medop_request_bytes( size_t request_sz, uint8_t **buffer_addr, size_t *buffer_sz, void *data) { - enum bt_ctf_notif_iter_medium_status status = - BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK; + enum bt_notif_iter_medium_status status = + BT_NOTIF_ITER_MEDIUM_STATUS_OK; struct lttng_live_stream_iterator *stream = data; struct lttng_live_trace *trace = stream->trace; struct lttng_live_session *session = trace->session; @@ -57,7 +57,7 @@ enum bt_ctf_notif_iter_medium_status medop_request_bytes( len_left = stream->base_offset + stream->len - stream->offset; if (!len_left) { stream->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA; - status = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN; + status = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN; return status; } read_len = MIN(request_sz, stream->buflen); @@ -72,26 +72,26 @@ enum bt_ctf_notif_iter_medium_status medop_request_bytes( } static -struct bt_ctf_stream *medop_get_stream( - struct bt_ctf_stream_class *stream_class, +struct bt_stream *medop_get_stream( + struct bt_stream_class *stream_class, uint64_t stream_id, void *data) { struct lttng_live_stream_iterator *lttng_live_stream = data; if (!lttng_live_stream->stream) { int64_t stream_class_id = - bt_ctf_stream_class_get_id(stream_class); + bt_stream_class_get_id(stream_class); BT_LOGD("Creating stream %s (ID: %" PRIu64 ") out of stream class %" PRId64, lttng_live_stream->name, stream_id, stream_class_id); if (stream_id == -1ULL) { /* No stream ID */ - lttng_live_stream->stream = bt_ctf_stream_create( + lttng_live_stream->stream = bt_stream_create( stream_class, lttng_live_stream->name); } else { lttng_live_stream->stream = - bt_ctf_stream_create_with_id(stream_class, + bt_stream_create_with_id(stream_class, lttng_live_stream->name, stream_id); } @@ -105,20 +105,20 @@ struct bt_ctf_stream *medop_get_stream( return lttng_live_stream->stream; } -static struct bt_ctf_notif_iter_medium_ops medops = { +static struct bt_notif_iter_medium_ops medops = { .request_bytes = medop_request_bytes, .get_stream = medop_get_stream, }; BT_HIDDEN -enum bt_ctf_lttng_live_iterator_status lttng_live_lazy_notif_init( +enum bt_lttng_live_iterator_status lttng_live_lazy_notif_init( struct lttng_live_session *session) { struct lttng_live_component *lttng_live = session->lttng_live; struct lttng_live_trace *trace; if (!session->lazy_stream_notif_init) { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + return BT_LTTNG_LIVE_ITERATOR_STATUS_OK; } bt_list_for_each_entry(trace, &session->traces, node) { @@ -128,7 +128,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_lazy_notif_init( if (stream->notif_iter) { continue; } - stream->notif_iter = bt_ctf_notif_iter_create(trace->trace, + stream->notif_iter = bt_notif_iter_create(trace->trace, lttng_live->max_query_size, medops, stream); if (!stream->notif_iter) { @@ -139,10 +139,10 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_lazy_notif_init( session->lazy_stream_notif_init = false; - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + return BT_LTTNG_LIVE_ITERATOR_STATUS_OK; error: - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + return BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; } BT_HIDDEN @@ -170,7 +170,7 @@ struct lttng_live_stream_iterator *lttng_live_stream_iterator_create( stream->last_returned_inactivity_timestamp = INT64_MIN; if (trace->trace) { - stream->notif_iter = bt_ctf_notif_iter_create(trace->trace, + stream->notif_iter = bt_notif_iter_create(trace->trace, lttng_live->max_query_size, medops, stream); if (!stream->notif_iter) { @@ -213,7 +213,7 @@ void lttng_live_stream_iterator_destroy(struct lttng_live_stream_iterator *strea } if (stream->notif_iter) { - bt_ctf_notif_iter_destroy(stream->notif_iter); + bt_notif_iter_destroy(stream->notif_iter); } g_free(stream->buf); BT_PUT(stream->packet_end_notif_queue); diff --git a/plugins/ctf/lttng-live/data-stream.h b/plugins/ctf/lttng-live/data-stream.h index 4ca73c38..f36e787c 100644 --- a/plugins/ctf/lttng-live/data-stream.h +++ b/plugins/ctf/lttng-live/data-stream.h @@ -31,7 +31,7 @@ #include "lttng-live-internal.h" #include "../common/notif-iter/notif-iter.h" -enum bt_ctf_lttng_live_iterator_status lttng_live_lazy_notif_init( +enum bt_lttng_live_iterator_status lttng_live_lazy_notif_init( struct lttng_live_session *session); struct lttng_live_stream_iterator *lttng_live_stream_iterator_create( diff --git a/plugins/ctf/lttng-live/lttng-live-internal.h b/plugins/ctf/lttng-live/lttng-live-internal.h index 486cc5db..f09c623b 100644 --- a/plugins/ctf/lttng-live/lttng-live-internal.h +++ b/plugins/ctf/lttng-live/lttng-live-internal.h @@ -69,7 +69,7 @@ struct lttng_live_stream_iterator_generic { struct lttng_live_stream_iterator { struct lttng_live_stream_iterator_generic p; - struct bt_ctf_stream *stream; + struct bt_stream *stream; struct lttng_live_trace *trace; struct bt_private_port *port; /* weak ref. */ @@ -80,7 +80,7 @@ struct lttng_live_stream_iterator { * Since only a single iterator per viewer connection, we have * only a single notification iterator per stream. */ - struct bt_ctf_notif_iter *notif_iter; + struct bt_notif_iter *notif_iter; uint64_t viewer_stream_id; @@ -138,7 +138,7 @@ struct lttng_live_trace { uint64_t id; /* ctf trace ID within the session. */ - struct bt_ctf_trace *trace; + struct bt_trace *trace; struct lttng_live_metadata *metadata; struct bt_clock_class_priority_map *cc_prio_map; @@ -190,23 +190,23 @@ struct lttng_live_component { struct bt_component *downstream_component; }; -enum bt_ctf_lttng_live_iterator_status { +enum bt_lttng_live_iterator_status { /** Iterator state has progressed. Continue iteration immediately. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE = 3, + BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE = 3, /** No notification available for now. Try again later. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN = 2, + BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN = 2, /** No more CTF_LTTNG_LIVEs to be delivered. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END = 1, + BT_LTTNG_LIVE_ITERATOR_STATUS_END = 1, /** No error, okay. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK = 0, + BT_LTTNG_LIVE_ITERATOR_STATUS_OK = 0, /** Invalid arguments. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_INVAL = -1, + BT_LTTNG_LIVE_ITERATOR_STATUS_INVAL = -1, /** General error. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR = -2, + BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR = -2, /** Out of memory. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_NOMEM = -3, + BT_LTTNG_LIVE_ITERATOR_STATUS_NOMEM = -3, /** Unsupported iterator feature. */ - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED = -4, + BT_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED = -4, }; enum bt_component_status lttng_live_component_init(struct bt_private_component *source, @@ -236,7 +236,7 @@ void lttng_live_iterator_finalize(struct bt_private_connection_private_notificat int lttng_live_create_viewer_session(struct lttng_live_component *lttng_live); int lttng_live_attach_session(struct lttng_live_session *session); int lttng_live_detach_session(struct lttng_live_session *session); -enum bt_ctf_lttng_live_iterator_status lttng_live_get_new_streams( +enum bt_lttng_live_iterator_status lttng_live_get_new_streams( struct lttng_live_session *session); int lttng_live_add_session(struct lttng_live_component *lttng_live, @@ -246,11 +246,11 @@ int lttng_live_add_session(struct lttng_live_component *lttng_live, ssize_t lttng_live_get_one_metadata_packet(struct lttng_live_trace *trace, FILE *fp); -enum bt_ctf_lttng_live_iterator_status lttng_live_get_next_index( +enum bt_lttng_live_iterator_status lttng_live_get_next_index( struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *stream, struct packet_index *index); -enum bt_ctf_notif_iter_medium_status lttng_live_get_stream_bytes( +enum bt_notif_iter_medium_status lttng_live_get_stream_bytes( struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *stream, uint8_t *buf, uint64_t offset, uint64_t req_len, uint64_t *recv_len); diff --git a/plugins/ctf/lttng-live/lttng-live.c b/plugins/ctf/lttng-live/lttng-live.c index 08ece949..72b1b46d 100644 --- a/plugins/ctf/lttng-live/lttng-live.c +++ b/plugins/ctf/lttng-live/lttng-live.c @@ -212,7 +212,7 @@ void lttng_live_destroy_trace(struct bt_object *obj) if (trace->trace) { int retval; - retval = bt_ctf_trace_set_is_static(trace->trace); + retval = bt_trace_set_is_static(trace->trace); assert(!retval); BT_PUT(trace->trace); } @@ -362,7 +362,7 @@ void lttng_live_iterator_finalize(struct bt_private_connection_private_notificat } static -enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_check_stream_state( +enum bt_lttng_live_iterator_status lttng_live_iterator_next_check_stream_state( struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *lttng_live_stream) { @@ -381,7 +381,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_check_stream_sta case LTTNG_LIVE_STREAM_EOF: break; } - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + return BT_LTTNG_LIVE_ITERATOR_STATUS_OK; } /* @@ -393,21 +393,21 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_check_stream_sta * return EOF. */ static -enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_one_no_data_stream( +enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_no_data_stream( struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *lttng_live_stream) { - enum bt_ctf_lttng_live_iterator_status ret = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_lttng_live_iterator_status ret = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; struct packet_index index; enum lttng_live_stream_state orig_state = lttng_live_stream->state; if (lttng_live_stream->trace->new_metadata_needed) { - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; goto end; } if (lttng_live_stream->trace->session->new_streams_needed) { - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; goto end; } if (lttng_live_stream->state != LTTNG_LIVE_STREAM_ACTIVE_NO_DATA @@ -415,7 +415,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_one_no_da goto end; } ret = lttng_live_get_next_index(lttng_live, lttng_live_stream, &index); - if (ret != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (ret != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { goto end; } assert(lttng_live_stream->state != LTTNG_LIVE_STREAM_EOF); @@ -423,10 +423,10 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_one_no_da if (orig_state == LTTNG_LIVE_STREAM_QUIESCENT_NO_DATA && lttng_live_stream->last_returned_inactivity_timestamp == lttng_live_stream->current_inactivity_timestamp) { - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; print_stream_state(lttng_live_stream); } else { - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; } goto end; } @@ -434,7 +434,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_one_no_da lttng_live_stream->offset = index.offset; lttng_live_stream->len = index.packet_size / CHAR_BIT; end: - if (ret == BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (ret == BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { ret = lttng_live_iterator_next_check_stream_state( lttng_live, lttng_live_stream); } @@ -449,29 +449,29 @@ end: * per-stream notifications. */ static -enum bt_ctf_lttng_live_iterator_status lttng_live_get_session( +enum bt_lttng_live_iterator_status lttng_live_get_session( struct lttng_live_component *lttng_live, struct lttng_live_session *session) { - enum bt_ctf_lttng_live_iterator_status status; + enum bt_lttng_live_iterator_status status; struct lttng_live_trace *trace, *t; if (lttng_live_attach_session(session)) { if (lttng_live_is_canceled(lttng_live)) { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + return BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; } else { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + return BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; } } status = lttng_live_get_new_streams(session); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK && - status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK && + status != BT_LTTNG_LIVE_ITERATOR_STATUS_END) { return status; } bt_list_for_each_entry_safe(trace, t, &session->traces, node) { status = lttng_live_metadata_update(trace); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK && - status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK && + status != BT_LTTNG_LIVE_ITERATOR_STATUS_END) { return status; } } @@ -504,11 +504,11 @@ void lttng_live_force_new_streams_and_metadata(struct lttng_live_component *lttn } static -enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_new_streams_and_metadata( +enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_new_streams_and_metadata( struct lttng_live_component *lttng_live) { - enum bt_ctf_lttng_live_iterator_status ret = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_lttng_live_iterator_status ret = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; unsigned int nr_sessions_opened = 0; struct lttng_live_session *session, *s; @@ -527,16 +527,16 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_new_strea * currently ongoing. */ if (bt_list_empty(<tng_live->sessions)) { - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_END; goto end; } bt_list_for_each_entry(session, <tng_live->sessions, node) { ret = lttng_live_get_session(lttng_live, session); switch (ret) { - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK: + case BT_LTTNG_LIVE_ITERATOR_STATUS_OK: break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END: - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + case BT_LTTNG_LIVE_ITERATOR_STATUS_END: + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_OK; break; default: goto end; @@ -546,24 +546,24 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_new_strea } } end: - if (ret == BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK && !nr_sessions_opened) { - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END; + if (ret == BT_LTTNG_LIVE_ITERATOR_STATUS_OK && !nr_sessions_opened) { + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_END; } return ret; } static -enum bt_ctf_lttng_live_iterator_status emit_inactivity_notification( +enum bt_lttng_live_iterator_status emit_inactivity_notification( struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *lttng_live_stream, struct bt_notification **notification, uint64_t timestamp) { - enum bt_ctf_lttng_live_iterator_status ret = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_lttng_live_iterator_status ret = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; struct lttng_live_trace *trace; - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_class *clock_class = NULL; + struct bt_clock_value *clock_value = NULL; struct bt_notification *notif = NULL; int retval; @@ -575,7 +575,7 @@ enum bt_ctf_lttng_live_iterator_status emit_inactivity_notification( if (!clock_class) { goto error; } - clock_value = bt_ctf_clock_value_create(clock_class, timestamp); + clock_value = bt_clock_value_create(clock_class, timestamp); if (!clock_value) { goto error; } @@ -594,30 +594,30 @@ end: return ret; error: - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; bt_put(notif); goto end; } static -enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent_stream( +enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_quiescent_stream( struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *lttng_live_stream, struct bt_notification **notification) { - enum bt_ctf_lttng_live_iterator_status ret = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; + enum bt_lttng_live_iterator_status ret = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; + struct bt_clock_class *clock_class = NULL; + struct bt_clock_value *clock_value = NULL; if (lttng_live_stream->state != LTTNG_LIVE_STREAM_QUIESCENT) { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + return BT_LTTNG_LIVE_ITERATOR_STATUS_OK; } if (lttng_live_stream->current_inactivity_timestamp == lttng_live_stream->last_returned_inactivity_timestamp) { lttng_live_stream->state = LTTNG_LIVE_STREAM_QUIESCENT_NO_DATA; - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; goto end; } @@ -633,42 +633,42 @@ end: } static -enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_data_stream( +enum bt_lttng_live_iterator_status lttng_live_iterator_next_handle_one_active_data_stream( struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *lttng_live_stream, struct bt_notification **notification) { - enum bt_ctf_lttng_live_iterator_status ret = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; - enum bt_ctf_notif_iter_status status; + enum bt_lttng_live_iterator_status ret = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_notif_iter_status status; struct lttng_live_session *session; bt_list_for_each_entry(session, <tng_live->sessions, node) { struct lttng_live_trace *trace; if (session->new_streams_needed) { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + return BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; } bt_list_for_each_entry(trace, &session->traces, node) { if (trace->new_metadata_needed) { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + return BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; } } } if (lttng_live_stream->state != LTTNG_LIVE_STREAM_ACTIVE_DATA) { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + return BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; } if (lttng_live_stream->packet_end_notif_queue) { *notification = lttng_live_stream->packet_end_notif_queue; lttng_live_stream->packet_end_notif_queue = NULL; - status = BT_CTF_NOTIF_ITER_STATUS_OK; + status = BT_NOTIF_ITER_STATUS_OK; } else { - status = bt_ctf_notif_iter_get_next_notification( + status = bt_notif_iter_get_next_notification( lttng_live_stream->notif_iter, lttng_live_stream->trace->cc_prio_map, notification); - if (status == BT_CTF_NOTIF_ITER_STATUS_OK) { + if (status == BT_NOTIF_ITER_STATUS_OK) { /* * Consider empty packets as inactivity. */ @@ -682,25 +682,25 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_iterator_next_handle_one_activ } } switch (status) { - case BT_CTF_NOTIF_ITER_STATUS_EOF: - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END; + case BT_NOTIF_ITER_STATUS_EOF: + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_END; break; - case BT_CTF_NOTIF_ITER_STATUS_OK: - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + case BT_NOTIF_ITER_STATUS_OK: + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_OK; break; - case BT_CTF_NOTIF_ITER_STATUS_AGAIN: + case BT_NOTIF_ITER_STATUS_AGAIN: /* * Continue immediately (end of packet). The next * get_index may return AGAIN to delay the following * attempt. */ - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; break; - case BT_CTF_NOTIF_ITER_STATUS_INVAL: + case BT_NOTIF_ITER_STATUS_INVAL: /* No argument provided by the user, so don't return INVAL. */ - case BT_CTF_NOTIF_ITER_STATUS_ERROR: + case BT_NOTIF_ITER_STATUS_ERROR: default: - ret = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + ret = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; break; } return ret; @@ -759,7 +759,7 @@ struct bt_notification_iterator_next_method_return lttng_live_iterator_next_stre struct bt_private_connection_private_notification_iterator *iterator, struct lttng_live_stream_iterator *stream_iter) { - enum bt_ctf_lttng_live_iterator_status status; + enum bt_lttng_live_iterator_status status; struct bt_notification_iterator_next_method_return next_return; struct lttng_live_component *lttng_live; @@ -768,17 +768,17 @@ retry: print_stream_state(stream_iter); next_return.notification = NULL; status = lttng_live_iterator_next_handle_new_streams_and_metadata(lttng_live); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { goto end; } status = lttng_live_iterator_next_handle_one_no_data_stream( lttng_live, stream_iter); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { goto end; } status = lttng_live_iterator_next_handle_one_quiescent_stream( lttng_live, stream_iter, &next_return.notification); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { assert(next_return.notification == NULL); goto end; } @@ -787,37 +787,37 @@ retry: } status = lttng_live_iterator_next_handle_one_active_data_stream(lttng_live, stream_iter, &next_return.notification); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { assert(next_return.notification == NULL); } end: switch (status) { - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE: + case BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE: print_dbg("continue"); goto retry; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN: + case BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN; print_dbg("again"); break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END: + case BT_LTTNG_LIVE_ITERATOR_STATUS_END: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_END; print_dbg("end"); break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK: + case BT_LTTNG_LIVE_ITERATOR_STATUS_OK: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_OK; print_dbg("ok"); break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_INVAL: + case BT_LTTNG_LIVE_ITERATOR_STATUS_INVAL: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_INVALID; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_NOMEM: + case BT_LTTNG_LIVE_ITERATOR_STATUS_NOMEM: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED: + case BT_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR: + case BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR: default: /* fall-through */ next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR; break; @@ -830,7 +830,7 @@ struct bt_notification_iterator_next_method_return lttng_live_iterator_next_no_s struct bt_private_connection_private_notification_iterator *iterator, struct lttng_live_no_stream_iterator *no_stream_iter) { - enum bt_ctf_lttng_live_iterator_status status; + enum bt_lttng_live_iterator_status status; struct bt_notification_iterator_next_method_return next_return; struct lttng_live_component *lttng_live; @@ -839,34 +839,34 @@ retry: lttng_live_force_new_streams_and_metadata(lttng_live); next_return.notification = NULL; status = lttng_live_iterator_next_handle_new_streams_and_metadata(lttng_live); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { goto end; } if (no_stream_iter->port) { - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; } else { - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_END; } end: switch (status) { - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE: + case BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE: goto retry; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN: + case BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END: + case BT_LTTNG_LIVE_ITERATOR_STATUS_END: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_END; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_INVAL: + case BT_LTTNG_LIVE_ITERATOR_STATUS_INVAL: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_INVALID; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_NOMEM: + case BT_LTTNG_LIVE_ITERATOR_STATUS_NOMEM: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED: + case BT_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED: next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_UNSUPPORTED; break; - case BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR: + case BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR: default: /* fall-through */ next_return.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR; break; diff --git a/plugins/ctf/lttng-live/metadata.c b/plugins/ctf/lttng-live/metadata.c index 3aa2f383..4a3b50b0 100644 --- a/plugins/ctf/lttng-live/metadata.c +++ b/plugins/ctf/lttng-live/metadata.c @@ -54,11 +54,11 @@ struct packet_header { } __attribute__((__packed__)); static -enum bt_ctf_lttng_live_iterator_status lttng_live_update_clock_map( +enum bt_lttng_live_iterator_status lttng_live_update_clock_map( struct lttng_live_trace *trace) { - enum bt_ctf_lttng_live_iterator_status status = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_lttng_live_iterator_status status = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; size_t i; int count, ret; @@ -68,12 +68,12 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_update_clock_map( goto error; } - count = bt_ctf_trace_get_clock_class_count(trace->trace); + count = bt_trace_get_clock_class_count(trace->trace); assert(count >= 0); for (i = 0; i < count; i++) { - struct bt_ctf_clock_class *clock_class = - bt_ctf_trace_get_clock_class_by_index(trace->trace, i); + struct bt_clock_class *clock_class = + bt_trace_get_clock_class_by_index(trace->trace, i); assert(clock_class); ret = bt_clock_class_priority_map_add_clock_class( @@ -87,13 +87,13 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_update_clock_map( goto end; error: - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; end: return status; } BT_HIDDEN -enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update( +enum bt_lttng_live_iterator_status lttng_live_metadata_update( struct lttng_live_trace *trace) { struct lttng_live_session *session = trace->session; @@ -103,16 +103,16 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update( char *metadata_buf = NULL; FILE *fp = NULL; enum ctf_metadata_decoder_status decoder_status; - enum bt_ctf_lttng_live_iterator_status status = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_lttng_live_iterator_status status = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; /* No metadata stream yet. */ if (!metadata) { if (session->new_streams_needed) { - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; } else { session->new_streams_needed = true; - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE; } goto end; } @@ -164,7 +164,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update( } if (errno == EINTR) { if (lttng_live_is_canceled(session->lttng_live)) { - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; goto end; } } @@ -178,7 +178,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update( if (len_read == 0) { if (!trace->trace) { - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; goto end; } trace->new_metadata_needed = false; @@ -199,12 +199,12 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update( trace->trace = ctf_metadata_decoder_get_trace(metadata->decoder); trace->new_metadata_needed = false; status = lttng_live_update_clock_map(trace); - if (status != BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK) { + if (status != BT_LTTNG_LIVE_ITERATOR_STATUS_OK) { goto end; } break; case CTF_METADATA_DECODER_STATUS_INCOMPLETE: - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; break; case CTF_METADATA_DECODER_STATUS_ERROR: case CTF_METADATA_DECODER_STATUS_INVAL_VERSION: @@ -214,7 +214,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update( goto end; error: - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; end: if (fp) { int closeret; diff --git a/plugins/ctf/lttng-live/metadata.h b/plugins/ctf/lttng-live/metadata.h index 4ce171df..2a4b9ded 100644 --- a/plugins/ctf/lttng-live/metadata.h +++ b/plugins/ctf/lttng-live/metadata.h @@ -33,7 +33,7 @@ int lttng_live_metadata_create_stream(struct lttng_live_session *session, uint64_t ctf_trace_id, uint64_t stream_id, const char *trace_name); -enum bt_ctf_lttng_live_iterator_status lttng_live_metadata_update( +enum bt_lttng_live_iterator_status lttng_live_metadata_update( struct lttng_live_trace *trace); void lttng_live_metadata_fini(struct lttng_live_trace *trace); diff --git a/plugins/ctf/lttng-live/viewer-connection.c b/plugins/ctf/lttng-live/viewer-connection.c index 55bc6bb0..e66bd1e8 100644 --- a/plugins/ctf/lttng-live/viewer-connection.c +++ b/plugins/ctf/lttng-live/viewer-connection.c @@ -1078,7 +1078,7 @@ void lttng_index_to_packet_index(struct lttng_viewer_index *lindex, } BT_HIDDEN -enum bt_ctf_lttng_live_iterator_status lttng_live_get_next_index(struct lttng_live_component *lttng_live, +enum bt_lttng_live_iterator_status lttng_live_get_next_index(struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *stream, struct packet_index *index) { @@ -1087,8 +1087,8 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_get_next_index(struct lttng_li ssize_t ret_len; struct lttng_viewer_index rp; uint32_t flags, status; - enum bt_ctf_lttng_live_iterator_status retstatus = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_lttng_live_iterator_status retstatus = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; struct bt_live_viewer_connection *viewer_connection = lttng_live->viewer_connection; struct lttng_live_trace *trace = stream->trace; @@ -1178,14 +1178,14 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_get_next_index(struct lttng_li case LTTNG_VIEWER_INDEX_RETRY: BT_LOGD("get_next_index: retry"); memset(index, 0, sizeof(struct packet_index)); - retstatus = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + retstatus = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; stream->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA; goto end; case LTTNG_VIEWER_INDEX_HUP: BT_LOGD("get_next_index: stream hung up"); memset(index, 0, sizeof(struct packet_index)); index->offset = EOF; - retstatus = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END; + retstatus = BT_LTTNG_LIVE_ITERATOR_STATUS_END; stream->state = LTTNG_LIVE_STREAM_EOF; break; case LTTNG_VIEWER_INDEX_ERR: @@ -1204,19 +1204,19 @@ end: error: if (lttng_live_is_canceled(lttng_live)) { - retstatus = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + retstatus = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; } else { - retstatus = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + retstatus = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; } return retstatus; } BT_HIDDEN -enum bt_ctf_notif_iter_medium_status lttng_live_get_stream_bytes(struct lttng_live_component *lttng_live, +enum bt_notif_iter_medium_status lttng_live_get_stream_bytes(struct lttng_live_component *lttng_live, struct lttng_live_stream_iterator *stream, uint8_t *buf, uint64_t offset, uint64_t req_len, uint64_t *recv_len) { - enum bt_ctf_notif_iter_medium_status retstatus = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK; + enum bt_notif_iter_medium_status retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_OK; struct lttng_viewer_cmd cmd; struct lttng_viewer_get_packet rq; struct lttng_viewer_trace_packet rp; @@ -1278,7 +1278,7 @@ enum bt_ctf_notif_iter_medium_status lttng_live_get_stream_bytes(struct lttng_li case LTTNG_VIEWER_GET_PACKET_RETRY: /* Unimplemented by relay daemon */ BT_LOGD("get_data_packet: retry"); - retstatus = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN; + retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN; goto end; case LTTNG_VIEWER_GET_PACKET_ERR: if (flags & LTTNG_VIEWER_FLAG_NEW_METADATA) { @@ -1291,13 +1291,13 @@ enum bt_ctf_notif_iter_medium_status lttng_live_get_stream_bytes(struct lttng_li } if (flags & (LTTNG_VIEWER_FLAG_NEW_METADATA | LTTNG_VIEWER_FLAG_NEW_STREAM)) { - retstatus = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN; + retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN; goto end; } BT_LOGE("get_data_packet: error"); goto error; case LTTNG_VIEWER_GET_PACKET_EOF: - retstatus = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF; + retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_EOF; goto end; default: BT_LOGE("get_data_packet: unknown"); @@ -1324,9 +1324,9 @@ end: error: if (lttng_live_is_canceled(lttng_live)) { - retstatus = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN; + retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN; } else { - retstatus = BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR; + retstatus = BT_NOTIF_ITER_MEDIUM_STATUS_ERROR; } return retstatus; } @@ -1335,11 +1335,11 @@ error: * Request new streams for a session. */ BT_HIDDEN -enum bt_ctf_lttng_live_iterator_status lttng_live_get_new_streams( +enum bt_lttng_live_iterator_status lttng_live_get_new_streams( struct lttng_live_session *session) { - enum bt_ctf_lttng_live_iterator_status status = - BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + enum bt_lttng_live_iterator_status status = + BT_LTTNG_LIVE_ITERATOR_STATUS_OK; struct lttng_viewer_cmd cmd; struct lttng_viewer_new_streams_request rq; struct lttng_viewer_new_streams_response rp; @@ -1350,7 +1350,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_get_new_streams( uint32_t streams_count; if (!session->new_streams_needed) { - return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK; + return BT_LTTNG_LIVE_ITERATOR_STATUS_OK; } cmd.cmd = htobe32(LTTNG_VIEWER_GET_NEW_STREAMS); @@ -1397,7 +1397,7 @@ enum bt_ctf_lttng_live_iterator_status lttng_live_get_new_streams( case LTTNG_VIEWER_NEW_STREAMS_HUP: session->new_streams_needed = false; session->closed = true; - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_END; goto end; case LTTNG_VIEWER_NEW_STREAMS_ERR: BT_LOGE("get_new_streams error"); @@ -1415,9 +1415,9 @@ end: error: if (lttng_live_is_canceled(lttng_live)) { - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN; } else { - status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR; + status = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR; } return status; } diff --git a/plugins/libctfcopytrace/clock-fields.c b/plugins/libctfcopytrace/clock-fields.c index 78560f0e..4e465827 100644 --- a/plugins/libctfcopytrace/clock-fields.c +++ b/plugins/libctfcopytrace/clock-fields.c @@ -36,70 +36,70 @@ #include "clock-fields.h" static -int find_update_struct_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class); +int find_update_struct_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class); static -int find_update_array_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class); +int find_update_array_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class); static -int find_update_enum_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class); +int find_update_enum_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class); static -int find_update_sequence_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class); +int find_update_sequence_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class); static -int find_update_variant_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class); +int find_update_variant_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class); static int copy_find_clock_int_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field); + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field); static int copy_find_clock_struct_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field); + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field); static int copy_find_clock_array_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field); + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field); static int copy_find_clock_sequence_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field); + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field); static -int copy_find_clock_variant_field(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event *writer_event, struct bt_ctf_field *field, - struct bt_ctf_field_type *type, struct bt_ctf_field *copy_field); +int copy_find_clock_variant_field(FILE *err, struct bt_event *event, + struct bt_event *writer_event, struct bt_field *field, + struct bt_field_type *type, struct bt_field *copy_field); static -int copy_find_clock_enum_field(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event *writer_event, struct bt_ctf_field *field, - struct bt_ctf_field_type *type, struct bt_ctf_field *copy_field); +int copy_find_clock_enum_field(FILE *err, struct bt_event *event, + struct bt_event *writer_event, struct bt_field *field, + struct bt_field_type *type, struct bt_field *copy_field); static -int update_header_clock_int_field_type(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class) +int update_header_clock_int_field_type(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class) { - struct bt_ctf_clock_class *clock = NULL; + struct bt_clock_class *clock = NULL; int ret; - clock = bt_ctf_field_type_integer_get_mapped_clock_class(type); + clock = bt_field_type_integer_get_mapped_clock_class(type); if (!clock) { return 0; } BT_PUT(clock); - ret = bt_ctf_field_type_integer_set_size(type, 64); + ret = bt_field_type_integer_set_size(type, 64); if (ret) { BT_LOGE_STR("Failed to set integer size to 64."); goto end; } - ret = bt_ctf_field_type_integer_set_mapped_clock_class(type, + ret = bt_field_type_integer_set_mapped_clock_class(type, writer_clock_class); if (ret) { BT_LOGE_STR("Failed to map integer to clock_class."); @@ -111,28 +111,28 @@ end: } static -int find_update_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class) +int find_update_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class) { int ret; - switch (bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: + switch (bt_field_type_get_type_id(type)) { + case BT_FIELD_TYPE_ID_INTEGER: return update_header_clock_int_field_type(err, type, writer_clock_class); - case BT_CTF_FIELD_TYPE_ID_STRUCT: + case BT_FIELD_TYPE_ID_STRUCT: return find_update_struct_clock_fields(err, type, writer_clock_class); - case BT_CTF_FIELD_TYPE_ID_ARRAY: + case BT_FIELD_TYPE_ID_ARRAY: return find_update_array_clock_fields(err, type, writer_clock_class); - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_SEQUENCE: return find_update_sequence_clock_fields(err, type, writer_clock_class); - case BT_CTF_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_VARIANT: return find_update_variant_clock_fields(err, type, writer_clock_class); - case BT_CTF_FIELD_TYPE_ID_ENUM: + case BT_FIELD_TYPE_ID_ENUM: return find_update_enum_clock_fields(err, type, writer_clock_class); break; @@ -146,17 +146,17 @@ int find_update_clock_fields(FILE *err, struct bt_ctf_field_type *type, } static -int find_update_variant_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class) +int find_update_variant_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class) { int count, i, ret; - struct bt_ctf_field_type *entry_type = NULL; + struct bt_field_type *entry_type = NULL; - count = bt_ctf_field_type_variant_get_field_count(type); + count = bt_field_type_variant_get_field_count(type); for (i = 0; i < count; i++) { const char *entry_name; - ret = bt_ctf_field_type_variant_get_field(type, + ret = bt_field_type_variant_get_field_by_index(type, &entry_name, &entry_type, i); if (ret) { BT_LOGE_STR("Failed to get variant field."); @@ -183,17 +183,17 @@ end: } static -int find_update_struct_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class) +int find_update_struct_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class) { int count, i, ret; - struct bt_ctf_field_type *entry_type = NULL; + struct bt_field_type *entry_type = NULL; - count = bt_ctf_field_type_structure_get_field_count(type); + count = bt_field_type_structure_get_field_count(type); for (i = 0; i < count; i++) { const char *entry_name; - ret = bt_ctf_field_type_structure_get_field(type, + ret = bt_field_type_structure_get_field_by_index(type, &entry_name, &entry_type, i); if (ret) { BT_LOGE_STR("Failed to get struct field."); @@ -219,13 +219,13 @@ end: } static -int find_update_sequence_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class) +int find_update_sequence_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class) { int ret; - struct bt_ctf_field_type *entry_type = NULL; + struct bt_field_type *entry_type = NULL; - entry_type = bt_ctf_field_type_sequence_get_element_type(type); + entry_type = bt_field_type_sequence_get_element_type(type); assert(entry_type); ret = find_update_clock_fields(err, entry_type, writer_clock_class); @@ -245,13 +245,13 @@ end: } static -int find_update_array_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class) +int find_update_array_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class) { int ret = 0; - struct bt_ctf_field_type *entry_type = NULL; + struct bt_field_type *entry_type = NULL; - entry_type = bt_ctf_field_type_array_get_element_type(type); + entry_type = bt_field_type_array_get_element_type(type); assert(entry_type); ret = find_update_clock_fields(err, entry_type, writer_clock_class); @@ -267,13 +267,13 @@ end: } static -int find_update_enum_clock_fields(FILE *err, struct bt_ctf_field_type *type, - struct bt_ctf_clock_class *writer_clock_class) +int find_update_enum_clock_fields(FILE *err, struct bt_field_type *type, + struct bt_clock_class *writer_clock_class) { int ret; - struct bt_ctf_field_type *entry_type = NULL; + struct bt_field_type *entry_type = NULL; - entry_type = bt_ctf_field_type_enumeration_get_container_type(type); + entry_type = bt_field_type_enumeration_get_container_type(type); assert(entry_type); ret = find_update_clock_fields(err, entry_type, writer_clock_class); @@ -293,27 +293,27 @@ end: } BT_HIDDEN -struct bt_ctf_field_type *override_header_type(FILE *err, - struct bt_ctf_field_type *type, - struct bt_ctf_trace *writer_trace) +struct bt_field_type *override_header_type(FILE *err, + struct bt_field_type *type, + struct bt_trace *writer_trace) { - struct bt_ctf_field_type *new_type = NULL; - struct bt_ctf_clock_class *writer_clock_class = NULL; + struct bt_field_type *new_type = NULL; + struct bt_clock_class *writer_clock_class = NULL; int ret; /* FIXME multi-clock? */ - writer_clock_class = bt_ctf_trace_get_clock_class_by_index(writer_trace, 0); + writer_clock_class = bt_trace_get_clock_class_by_index(writer_trace, 0); assert(writer_clock_class); - new_type = bt_ctf_field_type_copy(type); + new_type = bt_field_type_copy(type); if (!new_type) { BT_LOGE_STR("Failed to copy field type."); goto error; } - if (bt_ctf_field_type_get_type_id(new_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (bt_field_type_get_type_id(new_type) != BT_FIELD_TYPE_ID_STRUCT) { BT_LOGE("Expected header field type to be struct: type=%d", - bt_ctf_field_type_get_type_id(new_type)); + bt_field_type_get_type_id(new_type)); goto error; } @@ -334,20 +334,20 @@ end: } static -int copy_float_field(FILE *err, struct bt_ctf_field *field, - struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field) +int copy_float_field(FILE *err, struct bt_field *field, + struct bt_field_type *type, + struct bt_field *copy_field) { double value; int ret; - ret = bt_ctf_field_floating_point_get_value(field, &value); + ret = bt_field_floating_point_get_value(field, &value); if (ret) { BT_LOGE_STR("Failed to get value."); goto error; } - ret = bt_ctf_field_floating_point_set_value(copy_field, value); + ret = bt_field_floating_point_set_value(copy_field, value); if (ret) { ret = -1; BT_LOGE_STR("Failed to set floating point value."); @@ -364,20 +364,20 @@ end: } static -int copy_string_field(FILE *err, struct bt_ctf_field *field, - struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field) +int copy_string_field(FILE *err, struct bt_field *field, + struct bt_field_type *type, + struct bt_field *copy_field) { const char *value; int ret; - value = bt_ctf_field_string_get_value(field); + value = bt_field_string_get_value(field); if (!value) { BT_LOGE_STR("Failed to get value."); goto error; } - ret = bt_ctf_field_string_set_value(copy_field, value); + ret = bt_field_string_set_value(copy_field, value); if (ret) { ret = -1; BT_LOGE_STR("Failed to set string value."); @@ -394,50 +394,50 @@ end: } BT_HIDDEN -int copy_override_field(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event *writer_event, struct bt_ctf_field *field, - struct bt_ctf_field *copy_field) +int copy_override_field(FILE *err, struct bt_event *event, + struct bt_event *writer_event, struct bt_field *field, + struct bt_field *copy_field) { - struct bt_ctf_field_type *type = NULL; + struct bt_field_type *type = NULL; int ret = 0; - type = bt_ctf_field_get_type(field); + type = bt_field_get_type(field); assert(type); - switch (bt_ctf_field_type_get_type_id(type)) { - case BT_CTF_FIELD_TYPE_ID_INTEGER: + switch (bt_field_type_get_type_id(type)) { + case BT_FIELD_TYPE_ID_INTEGER: ret = copy_find_clock_int_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_FIELD_TYPE_ID_STRUCT: + case BT_FIELD_TYPE_ID_STRUCT: ret = copy_find_clock_struct_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_FIELD_TYPE_ID_FLOAT: + case BT_FIELD_TYPE_ID_FLOAT: ret = copy_float_field(err, field, type, copy_field); break; - case BT_CTF_FIELD_TYPE_ID_ENUM: + case BT_FIELD_TYPE_ID_ENUM: ret = copy_find_clock_enum_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_FIELD_TYPE_ID_STRING: + case BT_FIELD_TYPE_ID_STRING: ret = copy_string_field(err, field, type, copy_field); break; - case BT_CTF_FIELD_TYPE_ID_ARRAY: + case BT_FIELD_TYPE_ID_ARRAY: ret = copy_find_clock_array_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_FIELD_TYPE_ID_SEQUENCE: + case BT_FIELD_TYPE_ID_SEQUENCE: ret = copy_find_clock_sequence_field(err, event, writer_event, field, type, copy_field); break; - case BT_CTF_FIELD_TYPE_ID_VARIANT: + case BT_FIELD_TYPE_ID_VARIANT: ret = copy_find_clock_variant_field(err, event, writer_event, field, type, copy_field); break; /* No default, we want to catch missing field types. */ - case BT_CTF_FIELD_TYPE_ID_UNKNOWN: - case BT_CTF_NR_TYPE_IDS: + case BT_FIELD_TYPE_ID_UNKNOWN: + case BT_FIELD_TYPE_ID_NR: break; } @@ -447,17 +447,17 @@ int copy_override_field(FILE *err, struct bt_ctf_event *event, } static -int copy_find_clock_enum_field(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event *writer_event, struct bt_ctf_field *field, - struct bt_ctf_field_type *type, struct bt_ctf_field *copy_field) +int copy_find_clock_enum_field(FILE *err, struct bt_event *event, + struct bt_event *writer_event, struct bt_field *field, + struct bt_field_type *type, struct bt_field *copy_field) { int ret; - struct bt_ctf_field *container = NULL, *copy_container = NULL; + struct bt_field *container = NULL, *copy_container = NULL; - container = bt_ctf_field_enumeration_get_container(field); + container = bt_field_enumeration_get_container(field); assert(container); - copy_container = bt_ctf_field_enumeration_get_container(copy_field); + copy_container = bt_field_enumeration_get_container(copy_field); assert(copy_container); ret = copy_override_field(err, event, writer_event, container, @@ -480,24 +480,24 @@ end: } static -int copy_find_clock_variant_field(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event *writer_event, struct bt_ctf_field *field, - struct bt_ctf_field_type *type, struct bt_ctf_field *copy_field) +int copy_find_clock_variant_field(FILE *err, struct bt_event *event, + struct bt_event *writer_event, struct bt_field *field, + struct bt_field_type *type, struct bt_field *copy_field) { int ret; - struct bt_ctf_field *tag = NULL; - struct bt_ctf_field *variant_field = NULL, *copy_variant_field = NULL; + struct bt_field *tag = NULL; + struct bt_field *variant_field = NULL, *copy_variant_field = NULL; - tag = bt_ctf_field_variant_get_tag(field); + tag = bt_field_variant_get_tag(field); assert(tag); - variant_field = bt_ctf_field_variant_get_field(field, tag); + variant_field = bt_field_variant_get_field(field, tag); if (!variant_field) { BT_LOGE_STR("Failed to get variant field."); goto error; } - copy_variant_field = bt_ctf_field_variant_get_field(copy_field, tag); + copy_variant_field = bt_field_variant_get_field(copy_field, tag); assert(copy_variant_field); ret = copy_override_field(err, event, writer_event, variant_field, @@ -521,25 +521,25 @@ end: static int copy_find_clock_sequence_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field) + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field) { int ret; uint64_t i, count; - struct bt_ctf_field *length_field = NULL; - struct bt_ctf_field *entry_field = NULL, *entry_copy = NULL; + struct bt_field *length_field = NULL; + struct bt_field *entry_field = NULL, *entry_copy = NULL; - length_field = bt_ctf_field_sequence_get_length(field); + length_field = bt_field_sequence_get_length(field); assert(length_field); - ret = bt_ctf_field_unsigned_integer_get_value(length_field, &count); + ret = bt_field_unsigned_integer_get_value(length_field, &count); if (ret) { BT_LOGE("Failed to get value."); goto error; } - ret = bt_ctf_field_sequence_set_length(copy_field, length_field); + ret = bt_field_sequence_set_length(copy_field, length_field); if (ret) { BT_LOGE_STR("Failed to set sequence length."); goto error; @@ -547,13 +547,13 @@ int copy_find_clock_sequence_field(FILE *err, BT_PUT(length_field); for (i = 0; i < count; i++) { - entry_field = bt_ctf_field_sequence_get_field(field, i); + entry_field = bt_field_sequence_get_field(field, i); if (!entry_field) { BT_LOGE_STR("Failed to get sequence field."); goto error; } - entry_copy = bt_ctf_field_sequence_get_field(copy_field, i); + entry_copy = bt_field_sequence_get_field(copy_field, i); assert(entry_copy); ret = copy_override_field(err, event, writer_event, entry_field, @@ -580,23 +580,23 @@ end: static int copy_find_clock_array_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field) + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field) { int ret, count, i; - struct bt_ctf_field *entry_field = NULL, *entry_copy = NULL; + struct bt_field *entry_field = NULL, *entry_copy = NULL; - count = bt_ctf_field_type_array_get_length(type); + count = bt_field_type_array_get_length(type); for (i = 0; i < count; i++) { - entry_field = bt_ctf_field_array_get_field(field, i); + entry_field = bt_field_array_get_field(field, i); if (!entry_field) { ret = -1; BT_LOGE_STR("Failed to get array field."); goto error; } - entry_copy = bt_ctf_field_array_get_field(copy_field, i); + entry_copy = bt_field_array_get_field(copy_field, i); assert(entry_copy); ret = copy_override_field(err, event, writer_event, entry_field, @@ -623,32 +623,32 @@ end: static int copy_find_clock_struct_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field) + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field) { int count, i, ret; - struct bt_ctf_field_type *entry_type = NULL; - struct bt_ctf_field *entry_field = NULL, *entry_copy = NULL; + struct bt_field_type *entry_type = NULL; + struct bt_field *entry_field = NULL, *entry_copy = NULL; - count = bt_ctf_field_type_structure_get_field_count(type); + count = bt_field_type_structure_get_field_count(type); for (i = 0; i < count; i++) { const char *entry_name; - entry_field = bt_ctf_field_structure_get_field_by_index(field, i); + entry_field = bt_field_structure_get_field_by_index(field, i); if (!entry_field) { BT_LOGE_STR("Failed to get struct field."); goto error; } - ret = bt_ctf_field_type_structure_get_field(type, &entry_name, + ret = bt_field_type_structure_get_field_by_index(type, &entry_name, &entry_type, i); if (ret) { BT_LOGE_STR("Failed to get struct field."); goto error; } - entry_copy = bt_ctf_field_structure_get_field_by_index(copy_field, i); + entry_copy = bt_field_structure_get_field_by_index(copy_field, i); assert(entry_copy); ret = copy_override_field(err, event, writer_event, entry_field, @@ -675,36 +675,36 @@ end: } static -int set_int_value(FILE *err, struct bt_ctf_field *field, - struct bt_ctf_field *copy_field, - struct bt_ctf_field_type *type) +int set_int_value(FILE *err, struct bt_field *field, + struct bt_field *copy_field, + struct bt_field_type *type) { uint64_t uvalue; int64_t value; int ret; - if (bt_ctf_field_type_integer_get_signed(type)) { - ret = bt_ctf_field_signed_integer_get_value(field, &value); + if (bt_field_type_integer_is_signed(type)) { + ret = bt_field_signed_integer_get_value(field, &value); if (ret) { BT_LOGE("Failed to get value."); goto error; } - ret = bt_ctf_field_signed_integer_set_value(copy_field, value); + ret = bt_field_signed_integer_set_value(copy_field, value); if (ret) { ret = -1; BT_LOGE_STR("Failed to set signed integer value."); goto end; } } else { - ret = bt_ctf_field_unsigned_integer_get_value(field, + ret = bt_field_unsigned_integer_get_value(field, &uvalue); if (ret) { BT_LOGE("Failed to get value."); goto error; } - ret = bt_ctf_field_unsigned_integer_set_value(copy_field, uvalue); + ret = bt_field_unsigned_integer_set_value(copy_field, uvalue); if (ret) { ret = -1; BT_LOGE_STR("Failed to set unsigned integer value."); @@ -720,33 +720,33 @@ end: return ret; } -struct bt_ctf_clock_class *stream_class_get_clock_class(FILE *err, - struct bt_ctf_stream_class *stream_class) +struct bt_clock_class *stream_class_get_clock_class(FILE *err, + struct bt_stream_class *stream_class) { - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_trace *trace = NULL; + struct bt_clock_class *clock_class = NULL; - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); /* FIXME multi-clock? */ - clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0); + clock_class = bt_trace_get_clock_class_by_index(trace, 0); bt_put(trace); return clock_class; } -struct bt_ctf_clock_class *event_get_clock_class(FILE *err, struct bt_ctf_event *event) +struct bt_clock_class *event_get_clock_class(FILE *err, struct bt_event *event) { - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_event_class *event_class = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_clock_class *clock_class = NULL; - event_class = bt_ctf_event_get_class(event); + event_class = bt_event_get_class(event); assert(event_class); - stream_class = bt_ctf_event_class_get_stream_class(event_class); + stream_class = bt_event_class_get_stream_class(event_class); BT_PUT(event_class); assert(stream_class); @@ -758,32 +758,32 @@ struct bt_ctf_clock_class *event_get_clock_class(FILE *err, struct bt_ctf_event static int copy_find_clock_int_field(FILE *err, - struct bt_ctf_event *event, struct bt_ctf_event *writer_event, - struct bt_ctf_field *field, struct bt_ctf_field_type *type, - struct bt_ctf_field *copy_field) + struct bt_event *event, struct bt_event *writer_event, + struct bt_field *field, struct bt_field_type *type, + struct bt_field *copy_field) { - struct bt_ctf_clock_class *clock_class = NULL, *writer_clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL, *writer_clock_value = NULL; + struct bt_clock_class *clock_class = NULL, *writer_clock_class = NULL; + struct bt_clock_value *clock_value = NULL, *writer_clock_value = NULL; uint64_t value; int ret; - clock_class = bt_ctf_field_type_integer_get_mapped_clock_class(type); + clock_class = bt_field_type_integer_get_mapped_clock_class(type); if (!clock_class) { return set_int_value(err, field, copy_field, type); } - clock_value = bt_ctf_event_get_clock_value(event, clock_class); + clock_value = bt_event_get_clock_value(event, clock_class); BT_PUT(clock_class); assert(clock_value); - ret = bt_ctf_clock_value_get_value(clock_value, &value); + ret = bt_clock_value_get_value(clock_value, &value); BT_PUT(clock_value); if (ret) { BT_LOGE("Failed to get clock value."); goto error; } - ret = bt_ctf_field_unsigned_integer_set_value(copy_field, value); + ret = bt_field_unsigned_integer_set_value(copy_field, value); if (ret) { BT_LOGE_STR("Failed to set unsigned integer value."); goto error; @@ -792,14 +792,14 @@ int copy_find_clock_int_field(FILE *err, writer_clock_class = event_get_clock_class(err, writer_event); assert(writer_clock_class); - writer_clock_value = bt_ctf_clock_value_create(writer_clock_class, value); + writer_clock_value = bt_clock_value_create(writer_clock_class, value); BT_PUT(writer_clock_class); if (!writer_clock_value) { BT_LOGE_STR("Failed to create clock value."); goto error; } - ret = bt_ctf_event_set_clock_value(writer_event, writer_clock_value); + ret = bt_event_set_clock_value(writer_event, writer_clock_value); BT_PUT(writer_clock_value); if (ret) { BT_LOGE_STR("Failed to set clock value."); diff --git a/plugins/libctfcopytrace/clock-fields.h b/plugins/libctfcopytrace/clock-fields.h index bb028359..54dcb9af 100644 --- a/plugins/libctfcopytrace/clock-fields.h +++ b/plugins/libctfcopytrace/clock-fields.h @@ -36,22 +36,22 @@ extern "C" { #endif BT_HIDDEN -struct bt_ctf_field_type *override_header_type(FILE *err, - struct bt_ctf_field_type *type, - struct bt_ctf_trace *writer_trace); +struct bt_field_type *override_header_type(FILE *err, + struct bt_field_type *type, + struct bt_trace *writer_trace); BT_HIDDEN -int copy_override_field(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event *writer_event, struct bt_ctf_field *field, - struct bt_ctf_field *copy_field); +int copy_override_field(FILE *err, struct bt_event *event, + struct bt_event *writer_event, struct bt_field *field, + struct bt_field *copy_field); BT_HIDDEN -struct bt_ctf_clock_class *stream_class_get_clock_class(FILE *err, - struct bt_ctf_stream_class *stream_class); +struct bt_clock_class *stream_class_get_clock_class(FILE *err, + struct bt_stream_class *stream_class); BT_HIDDEN -struct bt_ctf_clock_class *event_get_clock_class(FILE *err, - struct bt_ctf_event *event); +struct bt_clock_class *event_get_clock_class(FILE *err, + struct bt_event *event); #ifdef __cplusplus } diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index 6debd71c..156c4868 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -36,57 +36,57 @@ #include "clock-fields.h" BT_HIDDEN -struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err, - struct bt_ctf_clock_class *clock_class) +struct bt_clock_class *ctf_copy_clock_class(FILE *err, + struct bt_clock_class *clock_class) { int64_t offset, offset_s; int int_ret; uint64_t u64_ret; const char *name, *description; - struct bt_ctf_clock_class *writer_clock_class = NULL; + struct bt_clock_class *writer_clock_class = NULL; assert(err && clock_class); - name = bt_ctf_clock_class_get_name(clock_class); + name = bt_clock_class_get_name(clock_class); assert(name); - writer_clock_class = bt_ctf_clock_class_create(name, - bt_ctf_clock_class_get_frequency(clock_class)); + writer_clock_class = bt_clock_class_create(name, + bt_clock_class_get_frequency(clock_class)); if (!writer_clock_class) { BT_LOGE_STR("Failed to create clock class."); goto end; } - description = bt_ctf_clock_class_get_description(clock_class); + description = bt_clock_class_get_description(clock_class); if (description) { - int_ret = bt_ctf_clock_class_set_description(writer_clock_class, + int_ret = bt_clock_class_set_description(writer_clock_class, description); assert(!int_ret); } - u64_ret = bt_ctf_clock_class_get_precision(clock_class); + u64_ret = bt_clock_class_get_precision(clock_class); assert(u64_ret != -1ULL); - int_ret = bt_ctf_clock_class_set_precision(writer_clock_class, + int_ret = bt_clock_class_set_precision(writer_clock_class, u64_ret); assert(!int_ret); - int_ret = bt_ctf_clock_class_get_offset_s(clock_class, &offset_s); + int_ret = bt_clock_class_get_offset_s(clock_class, &offset_s); assert(!int_ret); - int_ret = bt_ctf_clock_class_set_offset_s(writer_clock_class, offset_s); + int_ret = bt_clock_class_set_offset_s(writer_clock_class, offset_s); assert(!int_ret); - int_ret = bt_ctf_clock_class_get_offset_cycles(clock_class, &offset); + int_ret = bt_clock_class_get_offset_cycles(clock_class, &offset); assert(!int_ret); - int_ret = bt_ctf_clock_class_set_offset_cycles(writer_clock_class, offset); + int_ret = bt_clock_class_set_offset_cycles(writer_clock_class, offset); assert(!int_ret); - int_ret = bt_ctf_clock_class_is_absolute(clock_class); + int_ret = bt_clock_class_is_absolute(clock_class); assert(int_ret >= 0); - int_ret = bt_ctf_clock_class_set_is_absolute(writer_clock_class, int_ret); + int_ret = bt_clock_class_set_is_absolute(writer_clock_class, int_ret); assert(!int_ret); end: @@ -95,19 +95,19 @@ end: BT_HIDDEN enum bt_component_status ctf_copy_clock_classes(FILE *err, - struct bt_ctf_trace *writer_trace, - struct bt_ctf_stream_class *writer_stream_class, - struct bt_ctf_trace *trace) + struct bt_trace *writer_trace, + struct bt_stream_class *writer_stream_class, + struct bt_trace *trace) { enum bt_component_status ret; int int_ret, clock_class_count, i; - clock_class_count = bt_ctf_trace_get_clock_class_count(trace); + clock_class_count = bt_trace_get_clock_class_count(trace); for (i = 0; i < clock_class_count; i++) { - struct bt_ctf_clock_class *writer_clock_class; - struct bt_ctf_clock_class *clock_class = - bt_ctf_trace_get_clock_class_by_index(trace, i); + struct bt_clock_class *writer_clock_class; + struct bt_clock_class *clock_class = + bt_trace_get_clock_class_by_index(trace, i); assert(clock_class); @@ -119,7 +119,7 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err, goto end; } - int_ret = bt_ctf_trace_add_clock_class(writer_trace, writer_clock_class); + int_ret = bt_trace_add_clock_class(writer_trace, writer_clock_class); if (int_ret != 0) { BT_PUT(writer_clock_class); BT_LOGE_STR("Failed to add clock class."); @@ -140,46 +140,46 @@ end: } BT_HIDDEN -struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, - struct bt_ctf_event_class *event_class) +struct bt_event_class *ctf_copy_event_class(FILE *err, + struct bt_event_class *event_class) { - struct bt_ctf_event_class *writer_event_class = NULL; - struct bt_ctf_field_type *context, *payload_type; + struct bt_event_class *writer_event_class = NULL; + struct bt_field_type *context, *payload_type; const char *name; int ret; int64_t id; - enum bt_ctf_event_class_log_level log_level; + enum bt_event_class_log_level log_level; const char *emf_uri; - name = bt_ctf_event_class_get_name(event_class); + name = bt_event_class_get_name(event_class); - writer_event_class = bt_ctf_event_class_create(name); + writer_event_class = bt_event_class_create(name); assert(writer_event_class); - id = bt_ctf_event_class_get_id(event_class); + id = bt_event_class_get_id(event_class); assert(id >= 0); - ret = bt_ctf_event_class_set_id(writer_event_class, id); + ret = bt_event_class_set_id(writer_event_class, id); if (ret) { BT_LOGE_STR("Failed to set event_class id."); goto error; } - log_level = bt_ctf_event_class_get_log_level(event_class); + log_level = bt_event_class_get_log_level(event_class); if (log_level < 0) { BT_LOGE_STR("Failed to get log_level."); goto error; } - ret = bt_ctf_event_class_set_log_level(writer_event_class, log_level); + ret = bt_event_class_set_log_level(writer_event_class, log_level); if (ret) { BT_LOGE_STR("Failed to set log_level."); goto error; } - emf_uri = bt_ctf_event_class_get_emf_uri(event_class); + emf_uri = bt_event_class_get_emf_uri(event_class); if (emf_uri) { - ret = bt_ctf_event_class_set_emf_uri(writer_event_class, + ret = bt_event_class_set_emf_uri(writer_event_class, emf_uri); if (ret) { BT_LOGE_STR("Failed to set emf uri."); @@ -187,9 +187,9 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, } } - payload_type = bt_ctf_event_class_get_payload_type(event_class); + payload_type = bt_event_class_get_payload_type(event_class); if (payload_type) { - ret = bt_ctf_event_class_set_payload_type(writer_event_class, + ret = bt_event_class_set_payload_type(writer_event_class, payload_type); if (ret < 0) { BT_LOGE_STR("Failed to set payload type."); @@ -198,9 +198,9 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, BT_PUT(payload_type); } - context = bt_ctf_event_class_get_context_type(event_class); + context = bt_event_class_get_context_type(event_class); if (context) { - ret = bt_ctf_event_class_set_context_type( + ret = bt_event_class_set_context_type( writer_event_class, context); BT_PUT(context); if (ret < 0) { @@ -219,25 +219,25 @@ end: BT_HIDDEN enum bt_component_status ctf_copy_event_classes(FILE *err, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_stream_class *writer_stream_class) + struct bt_stream_class *stream_class, + struct bt_stream_class *writer_stream_class) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_event_class *event_class = NULL, *writer_event_class = NULL; + struct bt_event_class *event_class = NULL, *writer_event_class = NULL; int count, i; - count = bt_ctf_stream_class_get_event_class_count(stream_class); + count = bt_stream_class_get_event_class_count(stream_class); assert(count >= 0); for (i = 0; i < count; i++) { int int_ret; - event_class = bt_ctf_stream_class_get_event_class_by_index( + event_class = bt_stream_class_get_event_class_by_index( stream_class, i); assert(event_class); - if (i < bt_ctf_stream_class_get_event_class_count(writer_stream_class)) { - writer_event_class = bt_ctf_stream_class_get_event_class_by_index( + if (i < bt_stream_class_get_event_class_count(writer_stream_class)) { + writer_event_class = bt_stream_class_get_event_class_by_index( writer_stream_class, i); if (writer_event_class) { /* @@ -259,7 +259,7 @@ enum bt_component_status ctf_copy_event_classes(FILE *err, goto error; } - int_ret = bt_ctf_stream_class_add_event_class(writer_stream_class, + int_ret = bt_stream_class_add_event_class(writer_stream_class, writer_event_class); if (int_ret < 0) { BT_LOGE_STR("Failed to add event class."); @@ -280,22 +280,22 @@ end: } BT_HIDDEN -struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_trace *writer_trace, +struct bt_stream_class *ctf_copy_stream_class(FILE *err, + struct bt_stream_class *stream_class, + struct bt_trace *writer_trace, bool override_ts64) { - struct bt_ctf_field_type *type = NULL; - struct bt_ctf_stream_class *writer_stream_class = NULL; + struct bt_field_type *type = NULL; + struct bt_stream_class *writer_stream_class = NULL; int ret_int; - const char *name = bt_ctf_stream_class_get_name(stream_class); + const char *name = bt_stream_class_get_name(stream_class); - writer_stream_class = bt_ctf_stream_class_create_empty(name); + writer_stream_class = bt_stream_class_create_empty(name); assert(writer_stream_class); - type = bt_ctf_stream_class_get_packet_context_type(stream_class); + type = bt_stream_class_get_packet_context_type(stream_class); if (type) { - ret_int = bt_ctf_stream_class_set_packet_context_type( + ret_int = bt_stream_class_set_packet_context_type( writer_stream_class, type); if (ret_int < 0) { BT_LOGE_STR("Failed to set packet_context type."); @@ -304,12 +304,12 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, BT_PUT(type); } - type = bt_ctf_stream_class_get_event_header_type(stream_class); + type = bt_stream_class_get_event_header_type(stream_class); if (type) { - ret_int = bt_ctf_trace_get_clock_class_count(writer_trace); + ret_int = bt_trace_get_clock_class_count(writer_trace); assert(ret_int >= 0); if (override_ts64 && ret_int > 0) { - struct bt_ctf_field_type *new_event_header_type; + struct bt_field_type *new_event_header_type; new_event_header_type = override_header_type(err, type, writer_trace); @@ -317,7 +317,7 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, BT_LOGE_STR("Failed to override header type."); goto error; } - ret_int = bt_ctf_stream_class_set_event_header_type( + ret_int = bt_stream_class_set_event_header_type( writer_stream_class, new_event_header_type); BT_PUT(new_event_header_type); if (ret_int < 0) { @@ -325,7 +325,7 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, goto error; } } else { - ret_int = bt_ctf_stream_class_set_event_header_type( + ret_int = bt_stream_class_set_event_header_type( writer_stream_class, type); if (ret_int < 0) { BT_LOGE_STR("Failed to set event_header type."); @@ -335,9 +335,9 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, BT_PUT(type); } - type = bt_ctf_stream_class_get_event_context_type(stream_class); + type = bt_stream_class_get_event_context_type(stream_class); if (type) { - ret_int = bt_ctf_stream_class_set_event_context_type( + ret_int = bt_stream_class_set_event_context_type( writer_stream_class, type); if (ret_int < 0) { BT_LOGE_STR("Failed to set event_contexttype."); @@ -356,24 +356,24 @@ end: } BT_HIDDEN -int ctf_stream_copy_packet_header(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream) +int ctf_stream_copy_packet_header(FILE *err, struct bt_packet *packet, + struct bt_stream *writer_stream) { - struct bt_ctf_field *packet_header = NULL, *writer_packet_header = NULL; + struct bt_field *packet_header = NULL, *writer_packet_header = NULL; int ret = 0; - packet_header = bt_ctf_packet_get_header(packet); + packet_header = bt_packet_get_header(packet); if (!packet_header) { goto end; } - writer_packet_header = bt_ctf_field_copy(packet_header); + writer_packet_header = bt_field_copy(packet_header); if (!writer_packet_header) { BT_LOGE_STR("Failed to copy field from stream packet header."); goto error; } - ret = bt_ctf_stream_set_packet_header(writer_stream, + ret = bt_stream_set_packet_header(writer_stream, writer_packet_header); if (ret) { BT_LOGE_STR("Failed to set stream packet header."); @@ -391,24 +391,24 @@ end: } BT_HIDDEN -int ctf_packet_copy_header(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_packet *writer_packet) +int ctf_packet_copy_header(FILE *err, struct bt_packet *packet, + struct bt_packet *writer_packet) { - struct bt_ctf_field *packet_header = NULL, *writer_packet_header = NULL; + struct bt_field *packet_header = NULL, *writer_packet_header = NULL; int ret = 0; - packet_header = bt_ctf_packet_get_header(packet); + packet_header = bt_packet_get_header(packet); if (!packet_header) { goto end; } - writer_packet_header = bt_ctf_field_copy(packet_header); + writer_packet_header = bt_field_copy(packet_header); if (!writer_packet_header) { BT_LOGE_STR("Failed to copy field from packet header."); goto error; } - ret = bt_ctf_packet_set_header(writer_packet, writer_packet_header); + ret = bt_packet_set_header(writer_packet, writer_packet_header); if (ret) { BT_LOGE_STR("Failed to set packet header."); goto error; @@ -425,24 +425,24 @@ end: } BT_HIDDEN -int ctf_stream_copy_packet_context(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream) +int ctf_stream_copy_packet_context(FILE *err, struct bt_packet *packet, + struct bt_stream *writer_stream) { - struct bt_ctf_field *packet_context = NULL, *writer_packet_context = NULL; + struct bt_field *packet_context = NULL, *writer_packet_context = NULL; int ret = 0; - packet_context = bt_ctf_packet_get_context(packet); + packet_context = bt_packet_get_context(packet); if (!packet_context) { goto end; } - writer_packet_context = bt_ctf_field_copy(packet_context); + writer_packet_context = bt_field_copy(packet_context); if (!writer_packet_context) { BT_LOGE_STR("Failed to copy field from stream packet context."); goto error; } - ret = bt_ctf_stream_set_packet_context(writer_stream, + ret = bt_stream_set_packet_context(writer_stream, writer_packet_context); if (ret) { BT_LOGE_STR("Failed to set stream packet context."); @@ -460,25 +460,25 @@ end: } BT_HIDDEN -int ctf_packet_copy_context(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream, - struct bt_ctf_packet *writer_packet) +int ctf_packet_copy_context(FILE *err, struct bt_packet *packet, + struct bt_stream *writer_stream, + struct bt_packet *writer_packet) { - struct bt_ctf_field *packet_context = NULL, *writer_packet_context = NULL; + struct bt_field *packet_context = NULL, *writer_packet_context = NULL; int ret = 0; - packet_context = bt_ctf_packet_get_context(packet); + packet_context = bt_packet_get_context(packet); if (!packet_context) { goto end; } - writer_packet_context = bt_ctf_field_copy(packet_context); + writer_packet_context = bt_field_copy(packet_context); if (!writer_packet_context) { BT_LOGE_STR("Failed to copy field from packet context."); goto error; } - ret = bt_ctf_packet_set_context(writer_packet, writer_packet_context); + ret = bt_packet_set_context(writer_packet, writer_packet_context); if (ret) { BT_LOGE_STR("Failed to set packet context."); goto error; @@ -495,16 +495,16 @@ end: } BT_HIDDEN -int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event_class *writer_event_class, - struct bt_ctf_event *writer_event, - struct bt_ctf_field *event_header) +int ctf_copy_event_header(FILE *err, struct bt_event *event, + struct bt_event_class *writer_event_class, + struct bt_event *writer_event, + struct bt_field *event_header) { - struct bt_ctf_clock_class *clock_class = NULL, *writer_clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL, *writer_clock_value = NULL; + struct bt_clock_class *clock_class = NULL, *writer_clock_class = NULL; + struct bt_clock_value *clock_value = NULL, *writer_clock_value = NULL; int ret; - struct bt_ctf_field *writer_event_header = NULL; + struct bt_field *writer_event_header = NULL; uint64_t value; clock_class = event_get_clock_class(err, event); @@ -513,11 +513,11 @@ int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event, goto error; } - clock_value = bt_ctf_event_get_clock_value(event, clock_class); + clock_value = bt_event_get_clock_value(event, clock_class); BT_PUT(clock_class); assert(clock_value); - ret = bt_ctf_clock_value_get_value(clock_value, &value); + ret = bt_clock_value_get_value(clock_value, &value); BT_PUT(clock_value); if (ret) { BT_LOGE_STR("Failed to get clock value."); @@ -530,27 +530,27 @@ int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event, goto error; } - writer_clock_value = bt_ctf_clock_value_create(writer_clock_class, value); + writer_clock_value = bt_clock_value_create(writer_clock_class, value); BT_PUT(writer_clock_class); if (!writer_clock_value) { BT_LOGE_STR("Failed to create clock value."); goto error; } - ret = bt_ctf_event_set_clock_value(writer_event, writer_clock_value); + ret = bt_event_set_clock_value(writer_event, writer_clock_value); BT_PUT(writer_clock_value); if (ret) { BT_LOGE_STR("Failed to set clock value."); goto error; } - writer_event_header = bt_ctf_field_copy(event_header); + writer_event_header = bt_field_copy(event_header); if (!writer_event_header) { BT_LOGE_STR("Failed to copy event_header."); goto end; } - ret = bt_ctf_event_set_header(writer_event, writer_event_header); + ret = bt_event_set_header(writer_event, writer_event_header); BT_PUT(writer_event_header); if (ret < 0) { BT_LOGE_STR("Failed to set event_header."); @@ -568,16 +568,16 @@ end: } static -struct bt_ctf_trace *event_class_get_trace(FILE *err, - struct bt_ctf_event_class *event_class) +struct bt_trace *event_class_get_trace(FILE *err, + struct bt_event_class *event_class) { - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_stream_class *stream_class = NULL; + struct bt_trace *trace = NULL; + struct bt_stream_class *stream_class = NULL; - stream_class = bt_ctf_event_class_get_stream_class(event_class); + stream_class = bt_event_class_get_stream_class(event_class); assert(stream_class); - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); bt_put(stream_class); @@ -585,16 +585,16 @@ struct bt_ctf_trace *event_class_get_trace(FILE *err, } BT_HIDDEN -struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event_class *writer_event_class, +struct bt_event *ctf_copy_event(FILE *err, struct bt_event *event, + struct bt_event_class *writer_event_class, bool override_ts64) { - struct bt_ctf_event *writer_event = NULL; - struct bt_ctf_field *field = NULL, *copy_field = NULL; - struct bt_ctf_trace *writer_trace = NULL; + struct bt_event *writer_event = NULL; + struct bt_field *field = NULL, *copy_field = NULL; + struct bt_trace *writer_trace = NULL; int ret; - writer_event = bt_ctf_event_create(writer_event_class); + writer_event = bt_event_create(writer_event_class); if (!writer_event) { BT_LOGE_STR("Failed to create event."); goto error; @@ -606,18 +606,18 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, goto error; } - field = bt_ctf_event_get_header(event); + field = bt_event_get_header(event); if (field) { /* * If override_ts64, we override all integer fields mapped to a * clock to a uint64_t field type, otherwise, we just copy it as * is. */ - ret = bt_ctf_trace_get_clock_class_count(writer_trace); + ret = bt_trace_get_clock_class_count(writer_trace); assert(ret >= 0); if (override_ts64 && ret > 0) { - copy_field = bt_ctf_event_get_header(writer_event); + copy_field = bt_event_get_header(writer_event); assert(copy_field); ret = copy_override_field(err, event, writer_event, field, @@ -639,14 +639,14 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, } /* Optional field, so it can fail silently. */ - field = bt_ctf_event_get_stream_event_context(event); + field = bt_event_get_stream_event_context(event); if (field) { - copy_field = bt_ctf_field_copy(field); + copy_field = bt_field_copy(field); if (!copy_field) { BT_LOGE_STR("Failed to copy field."); goto error; } - ret = bt_ctf_event_set_stream_event_context(writer_event, + ret = bt_event_set_stream_event_context(writer_event, copy_field); if (ret < 0) { BT_LOGE_STR("Failed to set stream_event_context."); @@ -657,14 +657,14 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, } /* Optional field, so it can fail silently. */ - field = bt_ctf_event_get_event_context(event); + field = bt_event_get_event_context(event); if (field) { - copy_field = bt_ctf_field_copy(field); + copy_field = bt_field_copy(field); if (!copy_field) { BT_LOGE_STR("Failed to copy field."); goto error; } - ret = bt_ctf_event_set_event_context(writer_event, copy_field); + ret = bt_event_set_event_context(writer_event, copy_field); if (ret < 0) { BT_LOGE_STR("Failed to set event_context."); goto error; @@ -673,14 +673,14 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, BT_PUT(copy_field); } - field = bt_ctf_event_get_event_payload(event); + field = bt_event_get_event_payload(event); if (field) { - copy_field = bt_ctf_field_copy(field); + copy_field = bt_field_copy(field); if (!copy_field) { BT_LOGE_STR("Failed to copy field."); goto error; } - ret = bt_ctf_event_set_event_payload(writer_event, copy_field); + ret = bt_event_set_event_payload(writer_event, copy_field); if (ret < 0) { BT_LOGE_STR("Failed to set event_payload."); goto error; @@ -701,31 +701,31 @@ end: } BT_HIDDEN -enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, - struct bt_ctf_trace *writer_trace) +enum bt_component_status ctf_copy_trace(FILE *err, struct bt_trace *trace, + struct bt_trace *writer_trace) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; int field_count, i, int_ret; - struct bt_ctf_field_type *header_type = NULL; - enum bt_ctf_byte_order order; + struct bt_field_type *header_type = NULL; + enum bt_byte_order order; const char *trace_name; const unsigned char *trace_uuid; - field_count = bt_ctf_trace_get_environment_field_count(trace); + field_count = bt_trace_get_environment_field_count(trace); for (i = 0; i < field_count; i++) { int ret_int; const char *name; struct bt_value *value = NULL; - name = bt_ctf_trace_get_environment_field_name_by_index( + name = bt_trace_get_environment_field_name_by_index( trace, i); assert(name); - value = bt_ctf_trace_get_environment_field_value_by_index( + value = bt_trace_get_environment_field_value_by_index( trace, i); assert(value); - ret_int = bt_ctf_trace_set_environment_field(writer_trace, + ret_int = bt_trace_set_environment_field(writer_trace, name, value); BT_PUT(value); if (ret_int < 0) { @@ -736,8 +736,8 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, } } - order = bt_ctf_trace_get_native_byte_order(trace); - assert(order != BT_CTF_BYTE_ORDER_UNKNOWN); + order = bt_trace_get_native_byte_order(trace); + assert(order != BT_BYTE_ORDER_UNKNOWN); /* * Only explicitly set the writer trace's native byte order if @@ -745,8 +745,8 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, * the CTF writer object chooses, which is the machine's native * byte order. */ - if (order != BT_CTF_BYTE_ORDER_UNSPECIFIED) { - ret = bt_ctf_trace_set_native_byte_order(writer_trace, order); + if (order != BT_BYTE_ORDER_UNSPECIFIED) { + ret = bt_trace_set_native_byte_order(writer_trace, order); if (ret) { BT_LOGE_STR("Failed to set native byte order."); ret = BT_COMPONENT_STATUS_ERROR; @@ -754,9 +754,9 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, } } - header_type = bt_ctf_trace_get_packet_header_type(trace); + header_type = bt_trace_get_packet_header_type(trace); if (header_type) { - int_ret = bt_ctf_trace_set_packet_header_type(writer_trace, header_type); + int_ret = bt_trace_set_packet_header_type(writer_trace, header_type); BT_PUT(header_type); if (int_ret < 0) { BT_LOGE_STR("Failed to set packet header type."); @@ -765,9 +765,9 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, } } - trace_name = bt_ctf_trace_get_name(trace); + trace_name = bt_trace_get_name(trace); if (trace_name) { - int_ret = bt_ctf_trace_set_name(writer_trace, trace_name); + int_ret = bt_trace_set_name(writer_trace, trace_name); if (int_ret < 0) { BT_LOGE_STR("Failed to set trace name."); ret = BT_COMPONENT_STATUS_ERROR; @@ -775,9 +775,9 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, } } - trace_uuid = bt_ctf_trace_get_uuid(trace); + trace_uuid = bt_trace_get_uuid(trace); if (trace_uuid) { - int_ret = bt_ctf_trace_set_uuid(writer_trace, trace_uuid); + int_ret = bt_trace_set_uuid(writer_trace, trace_uuid); if (int_ret < 0) { BT_LOGE_STR("Failed to set trace UUID."); ret = BT_COMPONENT_STATUS_ERROR; diff --git a/plugins/libctfcopytrace/ctfcopytrace.h b/plugins/libctfcopytrace/ctfcopytrace.h index 9a103e91..ce7587de 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.h +++ b/plugins/libctfcopytrace/ctfcopytrace.h @@ -40,8 +40,8 @@ extern "C" { * * Returns NULL on error. */ -struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err, - struct bt_ctf_clock_class *clock_class); +struct bt_clock_class *ctf_copy_clock_class(FILE *err, + struct bt_clock_class *clock_class); /* * Copy all the clock classes from the input trace and add them to the writer @@ -52,9 +52,9 @@ struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err, */ BT_HIDDEN enum bt_component_status ctf_copy_clock_classes(FILE *err, - struct bt_ctf_trace *writer_trace, - struct bt_ctf_stream_class *writer_stream_class, - struct bt_ctf_trace *trace); + struct bt_trace *writer_trace, + struct bt_stream_class *writer_stream_class, + struct bt_trace *trace); /* * Create a copy of the event class passed in paramater. @@ -62,8 +62,8 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err, * Returns NULL on error. */ BT_HIDDEN -struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, - struct bt_ctf_event_class *event_class); +struct bt_event_class *ctf_copy_event_class(FILE *err, + struct bt_event_class *event_class); /* * Copy all the event classes from the input stream class and add them to the @@ -74,8 +74,8 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, */ BT_HIDDEN enum bt_component_status ctf_copy_event_classes(FILE *err, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_stream_class *writer_stream_class); + struct bt_stream_class *stream_class, + struct bt_stream_class *writer_stream_class); /* * Create a copy of the stream class passed in parameter. @@ -83,9 +83,9 @@ enum bt_component_status ctf_copy_event_classes(FILE *err, * Returns NULL or error. */ BT_HIDDEN -struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_trace *writer_trace, +struct bt_stream_class *ctf_copy_stream_class(FILE *err, + struct bt_stream_class *stream_class, + struct bt_trace *writer_trace, bool override_ts64); /* @@ -97,9 +97,9 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, */ BT_HIDDEN enum bt_component_status ctf_copy_packet_context_field(FILE *err, - struct bt_ctf_field *field, const char *field_name, - struct bt_ctf_field *writer_packet_context, - struct bt_ctf_field_type *writer_packet_context_type); + struct bt_field *field, const char *field_name, + struct bt_field *writer_packet_context, + struct bt_field_type *writer_packet_context_type); /* @@ -109,8 +109,8 @@ enum bt_component_status ctf_copy_packet_context_field(FILE *err, * Returns 0 on success or -1 on error. */ BT_HIDDEN -int ctf_stream_copy_packet_header(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream); +int ctf_stream_copy_packet_header(FILE *err, struct bt_packet *packet, + struct bt_stream *writer_stream); /* * Copy the packet_header from the packet passed in parameter and assign it @@ -119,8 +119,8 @@ int ctf_stream_copy_packet_header(FILE *err, struct bt_ctf_packet *packet, * Returns 0 on success or -1 on error. */ BT_HIDDEN -int ctf_packet_copy_header(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_packet *writer_packet); +int ctf_packet_copy_header(FILE *err, struct bt_packet *packet, + struct bt_packet *writer_packet); /* * Copy all the field values of the packet context from the packet passed in @@ -129,8 +129,8 @@ int ctf_packet_copy_header(FILE *err, struct bt_ctf_packet *packet, * Returns 0 on success or -1 on error. */ BT_HIDDEN -int ctf_stream_copy_packet_context(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream); +int ctf_stream_copy_packet_context(FILE *err, struct bt_packet *packet, + struct bt_stream *writer_stream); /* * Copy all the field values of the packet context from the packet passed in @@ -139,9 +139,9 @@ int ctf_stream_copy_packet_context(FILE *err, struct bt_ctf_packet *packet, * Returns 0 on success or -1 on error. */ BT_HIDDEN -int ctf_packet_copy_context(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream, - struct bt_ctf_packet *writer_packet); +int ctf_packet_copy_context(FILE *err, struct bt_packet *packet, + struct bt_stream *writer_stream, + struct bt_packet *writer_packet); /* * Create and return a copy of the event passed in parameter. The caller has to @@ -150,8 +150,8 @@ int ctf_packet_copy_context(FILE *err, struct bt_ctf_packet *packet, * Returns NULL on error. */ BT_HIDDEN -struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event_class *writer_event_class, +struct bt_event *ctf_copy_event(FILE *err, struct bt_event *event, + struct bt_event_class *writer_event_class, bool override_ts64); /* @@ -160,10 +160,10 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, * Returns 0 on success, -1 on error. */ BT_HIDDEN -int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event_class *writer_event_class, - struct bt_ctf_event *writer_event, - struct bt_ctf_field *event_header); +int ctf_copy_event_header(FILE *err, struct bt_event *event, + struct bt_event_class *writer_event_class, + struct bt_event *writer_event, + struct bt_field *event_header); /* * Copy the environment and the packet header from the input trace to the @@ -173,8 +173,8 @@ int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event, * error. */ BT_HIDDEN -enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, - struct bt_ctf_trace *writer_trace); +enum bt_component_status ctf_copy_trace(FILE *err, struct bt_trace *trace, + struct bt_trace *writer_trace); #ifdef __cplusplus } diff --git a/plugins/lttng-utils/copy.c b/plugins/lttng-utils/copy.c index a2ab8bd5..12e3d89c 100644 --- a/plugins/lttng-utils/copy.c +++ b/plugins/lttng-utils/copy.c @@ -37,25 +37,25 @@ #include "debug-info.h" static -struct bt_ctf_stream *insert_new_stream( +struct bt_stream *insert_new_stream( struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream, + struct bt_stream *stream, struct debug_info_trace *di_trace); static -void unref_stream(struct bt_ctf_stream *stream) +void unref_stream(struct bt_stream *stream) { bt_put(stream); } static -void unref_packet(struct bt_ctf_packet *packet) +void unref_packet(struct bt_packet *packet) { bt_put(packet); } static -void unref_stream_class(struct bt_ctf_stream_class *stream_class) +void unref_stream_class(struct bt_stream_class *stream_class) { bt_put(stream_class); } @@ -73,25 +73,25 @@ void destroy_stream_state_key(gpointer key) } static -struct bt_ctf_field *get_payload_field(FILE *err, - struct bt_ctf_event *event, const char *field_name) +struct bt_field *get_payload_field(FILE *err, + struct bt_event *event, const char *field_name) { - struct bt_ctf_field *field = NULL, *payload = NULL; - struct bt_ctf_field_type *payload_type = NULL; + struct bt_field *field = NULL, *payload = NULL; + struct bt_field_type *payload_type = NULL; - payload = bt_ctf_event_get_payload(event, NULL); + payload = bt_event_get_payload(event, NULL); assert(payload); - payload_type = bt_ctf_field_get_type(payload); + payload_type = bt_field_get_type(payload); assert(payload_type); - if (bt_ctf_field_type_get_type_id(payload_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (bt_field_type_get_type_id(payload_type) != BT_FIELD_TYPE_ID_STRUCT) { BT_LOGE("Wrong type, expected struct: field-name=\"%s\"", field_name); goto end; } - field = bt_ctf_field_structure_get_field(payload, field_name); + field = bt_field_structure_get_field_by_name(payload, field_name); end: bt_put(payload_type); @@ -100,27 +100,27 @@ end: } static -struct bt_ctf_field *get_stream_event_context_field(FILE *err, - struct bt_ctf_event *event, const char *field_name) +struct bt_field *get_stream_event_context_field(FILE *err, + struct bt_event *event, const char *field_name) { - struct bt_ctf_field *field = NULL, *sec = NULL; - struct bt_ctf_field_type *sec_type = NULL; + struct bt_field *field = NULL, *sec = NULL; + struct bt_field_type *sec_type = NULL; - sec = bt_ctf_event_get_stream_event_context(event); + sec = bt_event_get_stream_event_context(event); if (!sec) { goto end; } - sec_type = bt_ctf_field_get_type(sec); + sec_type = bt_field_get_type(sec); assert(sec_type); - if (bt_ctf_field_type_get_type_id(sec_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { + if (bt_field_type_get_type_id(sec_type) != BT_FIELD_TYPE_ID_STRUCT) { BT_LOGE("Wrong type, expected struct, field-name=\"%s\"", field_name); goto end; } - field = bt_ctf_field_structure_get_field(sec, field_name); + field = bt_field_structure_get_field_by_name(sec, field_name); end: bt_put(sec_type); @@ -130,22 +130,22 @@ end: BT_HIDDEN int get_stream_event_context_unsigned_int_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, uint64_t *value) { int ret; - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field *field = NULL; + struct bt_field_type *field_type = NULL; field = get_stream_event_context_field(err, event, field_name); if (!field) { goto error; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field_type) != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGE("Wrong type, expected integer: field-name=\"%s\"", field_name); goto error; @@ -157,7 +157,7 @@ int get_stream_event_context_unsigned_int_field_value(FILE *err, goto error; } - ret = bt_ctf_field_unsigned_integer_get_value(field, value); + ret = bt_field_unsigned_integer_get_value(field, value); if (ret) { BT_LOGE("Failed to get value: field-name=\"%s\"", field_name); @@ -174,11 +174,11 @@ end: } BT_HIDDEN -int get_stream_event_context_int_field_value(FILE *err, struct bt_ctf_event *event, +int get_stream_event_context_int_field_value(FILE *err, struct bt_event *event, const char *field_name, int64_t *value) { - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field *field = NULL; + struct bt_field_type *field_type = NULL; int ret; field = get_stream_event_context_field(err, event, field_name); @@ -186,10 +186,10 @@ int get_stream_event_context_int_field_value(FILE *err, struct bt_ctf_event *eve goto error; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field_type) != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGE("Wrong type, expected integer: field-name=\"%s\"", field_name); goto error; } @@ -200,7 +200,7 @@ int get_stream_event_context_int_field_value(FILE *err, struct bt_ctf_event *eve goto error; } - ret = bt_ctf_field_signed_integer_get_value(field, value); + ret = bt_field_signed_integer_get_value(field, value); goto end; error: @@ -213,11 +213,11 @@ end: BT_HIDDEN int get_payload_unsigned_int_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, uint64_t *value) { - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field *field = NULL; + struct bt_field_type *field_type = NULL; int ret; field = get_payload_field(err, event, field_name); @@ -226,10 +226,10 @@ int get_payload_unsigned_int_field_value(FILE *err, goto error; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field_type) != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGE("Wrong type, expected integer: field-name=\"%s\"", field_name); goto error; @@ -241,7 +241,7 @@ int get_payload_unsigned_int_field_value(FILE *err, goto error; } - ret = bt_ctf_field_unsigned_integer_get_value(field, value); + ret = bt_field_unsigned_integer_get_value(field, value); if (ret) { BT_LOGE("Failed to get value: field-name=\"%s\"", field_name); @@ -258,11 +258,11 @@ end: } BT_HIDDEN -int get_payload_int_field_value(FILE *err, struct bt_ctf_event *event, +int get_payload_int_field_value(FILE *err, struct bt_event *event, const char *field_name, int64_t *value) { - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field *field = NULL; + struct bt_field_type *field_type = NULL; int ret; field = get_payload_field(err, event, field_name); @@ -271,10 +271,10 @@ int get_payload_int_field_value(FILE *err, struct bt_ctf_event *event, goto error; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field_type) != BT_FIELD_TYPE_ID_INTEGER) { BT_LOGE("Wrong type, expected integer: field-name=\"%s\"", field_name); goto error; } @@ -285,7 +285,7 @@ int get_payload_int_field_value(FILE *err, struct bt_ctf_event *event, goto error; } - ret = bt_ctf_field_signed_integer_get_value(field, value); + ret = bt_field_signed_integer_get_value(field, value); if (ret) { BT_LOGE("Failed to get value: field-name=\"%s\"", field_name); @@ -303,11 +303,11 @@ end: BT_HIDDEN int get_payload_string_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, const char **value) { - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field *field = NULL; + struct bt_field_type *field_type = NULL; int ret; /* @@ -318,16 +318,16 @@ int get_payload_string_field_value(FILE *err, goto error; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_STRING) { + if (bt_field_type_get_type_id(field_type) != BT_FIELD_TYPE_ID_STRING) { BT_LOGE("Wrong type, expected string: field-name=\"%s\"", field_name); goto error; } - *value = bt_ctf_field_string_get_value(field); + *value = bt_field_string_get_value(field); if (!*value) { BT_LOGE("Failed to get value: field-name=\"%s\"", field_name); @@ -347,12 +347,12 @@ end: BT_HIDDEN int get_payload_build_id_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, uint8_t **build_id, uint64_t *build_id_len) { - struct bt_ctf_field *field = NULL, *seq_len = NULL; - struct bt_ctf_field_type *field_type = NULL; - struct bt_ctf_field *seq_field = NULL; + struct bt_field *field = NULL, *seq_len = NULL; + struct bt_field_type *field_type = NULL; + struct bt_field *seq_field = NULL; uint64_t i; int ret; @@ -364,19 +364,19 @@ int get_payload_build_id_field_value(FILE *err, goto error; } - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); assert(field_type); - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_SEQUENCE) { + if (bt_field_type_get_type_id(field_type) != BT_FIELD_TYPE_ID_SEQUENCE) { BT_LOGE("Wrong type, expected sequence: field-name=\"%s\"", field_name); goto error; } BT_PUT(field_type); - seq_len = bt_ctf_field_sequence_get_length(field); + seq_len = bt_field_sequence_get_length(field); assert(seq_len); - ret = bt_ctf_field_unsigned_integer_get_value(seq_len, build_id_len); + ret = bt_field_unsigned_integer_get_value(seq_len, build_id_len); if (ret) { BT_LOGE("Failed to get value: field-name=\"%s\"", field_name); @@ -393,14 +393,14 @@ int get_payload_build_id_field_value(FILE *err, for (i = 0; i < *build_id_len; i++) { uint64_t tmp; - seq_field = bt_ctf_field_sequence_get_field(field, i); + seq_field = bt_field_sequence_get_field(field, i); if (!seq_field) { BT_LOGE("Failed to get field in sequence: sequence-name=\"%s\", index=%" PRIu64, field_name, i); goto error; } - ret = bt_ctf_field_unsigned_integer_get_value(seq_field, &tmp); + ret = bt_field_unsigned_integer_get_value(seq_field, &tmp); if (ret) { BT_LOGE("Failed to get value: field-name=\"%s\"", field_name); @@ -424,7 +424,7 @@ end: static struct debug_info *lookup_trace_debug_info(struct debug_info_iterator *debug_it, - struct bt_ctf_trace *writer_trace, + struct bt_trace *writer_trace, struct debug_info_trace *di_trace) { return (struct debug_info *) g_hash_table_lookup( @@ -434,7 +434,7 @@ struct debug_info *lookup_trace_debug_info(struct debug_info_iterator *debug_it, static struct debug_info *insert_new_debug_info(struct debug_info_iterator *debug_it, - struct bt_ctf_trace *writer_trace, + struct bt_trace *writer_trace, struct debug_info_trace *di_trace) { struct debug_info *debug_info = NULL; @@ -442,7 +442,7 @@ struct debug_info *insert_new_debug_info(struct debug_info_iterator *debug_it, const char *str_value; enum bt_value_status ret; - field = bt_ctf_trace_get_environment_field_value_by_name(writer_trace, + field = bt_trace_get_environment_field_value_by_name(writer_trace, "domain"); /* No domain field, no debug info */ if (!field) { @@ -458,7 +458,7 @@ struct debug_info *insert_new_debug_info(struct debug_info_iterator *debug_it, BT_PUT(field); /* No tracer_name, no debug info */ - field = bt_ctf_trace_get_environment_field_value_by_name(writer_trace, + field = bt_trace_get_environment_field_value_by_name(writer_trace, "tracer_name"); /* No tracer_name, no debug info */ if (!field) { @@ -489,7 +489,7 @@ end: static struct debug_info *get_trace_debug_info(struct debug_info_iterator *debug_it, - struct bt_ctf_trace *writer_trace, + struct bt_trace *writer_trace, struct debug_info_trace *di_trace) { struct debug_info *debug_info; @@ -507,7 +507,7 @@ end: static struct debug_info_trace *lookup_trace(struct debug_info_iterator *debug_it, - struct bt_ctf_trace *trace) + struct bt_trace *trace) { return (struct debug_info_trace *) g_hash_table_lookup( debug_it->trace_map, @@ -517,7 +517,7 @@ struct debug_info_trace *lookup_trace(struct debug_info_iterator *debug_it, static enum debug_info_stream_state *insert_new_stream_state( struct debug_info_iterator *debug_it, - struct debug_info_trace *di_trace, struct bt_ctf_stream *stream) + struct debug_info_trace *di_trace, struct bt_stream *stream) { enum debug_info_stream_state *v = NULL; @@ -556,7 +556,7 @@ void debug_info_close_trace(struct debug_info_iterator *debug_it, struct debug_info_trace *di_trace) { if (di_trace->static_listener_id >= 0) { - bt_ctf_trace_remove_is_static_listener(di_trace->trace, + bt_trace_remove_is_static_listener(di_trace->trace, di_trace->static_listener_id); } @@ -588,18 +588,18 @@ void debug_info_close_trace(struct debug_info_iterator *debug_it, static int sync_event_classes(struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream, - struct bt_ctf_stream *writer_stream) + struct bt_stream *stream, + struct bt_stream *writer_stream) { int int_ret; - struct bt_ctf_stream_class *stream_class = NULL, + struct bt_stream_class *stream_class = NULL, *writer_stream_class = NULL; enum bt_component_status ret; - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); - writer_stream_class = bt_ctf_stream_get_class(writer_stream); + writer_stream_class = bt_stream_get_class(writer_stream); assert(writer_stream_class); ret = ctf_copy_event_classes(debug_it->err, stream_class, @@ -621,24 +621,24 @@ end: } static -void trace_is_static_listener(struct bt_ctf_trace *trace, void *data) +void trace_is_static_listener(struct bt_trace *trace, void *data) { struct debug_info_trace *di_trace = data; int trace_completed = 1, ret, nr_stream, i; - struct bt_ctf_stream *stream = NULL, *writer_stream = NULL; - struct bt_ctf_trace *writer_trace = di_trace->writer_trace; + struct bt_stream *stream = NULL, *writer_stream = NULL; + struct bt_trace *writer_trace = di_trace->writer_trace; /* * When the trace becomes static, make sure that we have all * the event classes in our stream_class copies before setting it * static as well. */ - nr_stream = bt_ctf_trace_get_stream_count(trace); + nr_stream = bt_trace_get_stream_count(trace); for (i = 0; i < nr_stream; i++) { - stream = bt_ctf_trace_get_stream_by_index(trace, i); + stream = bt_trace_get_stream_by_index(trace, i); assert(stream); - writer_stream = bt_ctf_trace_get_stream_by_index(writer_trace, i); + writer_stream = bt_trace_get_stream_by_index(writer_trace, i); assert(writer_stream); ret = sync_event_classes(di_trace->debug_it, stream, writer_stream); @@ -650,7 +650,7 @@ void trace_is_static_listener(struct bt_ctf_trace *trace, void *data) BT_PUT(writer_stream); } - bt_ctf_trace_set_is_static(di_trace->writer_trace); + bt_trace_set_is_static(di_trace->writer_trace); di_trace->trace_static = 1; g_hash_table_foreach(di_trace->stream_states, @@ -668,24 +668,24 @@ error: static struct debug_info_trace *insert_new_trace(struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream) { - struct bt_ctf_trace *writer_trace = NULL; + struct bt_stream *stream) { + struct bt_trace *writer_trace = NULL; struct debug_info_trace *di_trace = NULL; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_stream *writer_stream = NULL; + struct bt_trace *trace = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_stream *writer_stream = NULL; int ret, nr_stream, i; - writer_trace = bt_ctf_trace_create(); + writer_trace = bt_trace_create(); if (!writer_trace) { BT_LOGE_STR("Failed to create a new trace."); goto error; } - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); ret = ctf_copy_trace(debug_it->err, trace, writer_trace); @@ -717,9 +717,9 @@ struct debug_info_trace *insert_new_trace(struct debug_info_iterator *debug_it, g_hash_table_insert(debug_it->trace_map, (gpointer) trace, di_trace); /* Set all the existing streams in the unknown state. */ - nr_stream = bt_ctf_trace_get_stream_count(trace); + nr_stream = bt_trace_get_stream_count(trace); for (i = 0; i < nr_stream; i++) { - stream = bt_ctf_trace_get_stream_by_index(trace, i); + stream = bt_trace_get_stream_by_index(trace, i); assert(stream); insert_new_stream_state(debug_it, di_trace, stream); @@ -739,12 +739,12 @@ struct debug_info_trace *insert_new_trace(struct debug_info_iterator *debug_it, } /* Check if the trace is already static or register a listener. */ - if (bt_ctf_trace_is_static(trace)) { + if (bt_trace_is_static(trace)) { di_trace->trace_static = 1; di_trace->static_listener_id = -1; - bt_ctf_trace_set_is_static(writer_trace); + bt_trace_set_is_static(writer_trace); } else { - ret = bt_ctf_trace_add_is_static_listener(trace, + ret = bt_trace_add_is_static_listener(trace, trace_is_static_listener, NULL, di_trace); assert(ret >= 0); di_trace->static_listener_id = ret; @@ -766,25 +766,25 @@ end: } static -struct bt_ctf_packet *lookup_packet(struct debug_info_iterator *debug_it, - struct bt_ctf_packet *packet, +struct bt_packet *lookup_packet(struct debug_info_iterator *debug_it, + struct bt_packet *packet, struct debug_info_trace *di_trace) { - return (struct bt_ctf_packet *) g_hash_table_lookup( + return (struct bt_packet *) g_hash_table_lookup( di_trace->packet_map, (gpointer) packet); } static -struct bt_ctf_packet *insert_new_packet(struct debug_info_iterator *debug_it, - struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream, +struct bt_packet *insert_new_packet(struct debug_info_iterator *debug_it, + struct bt_packet *packet, + struct bt_stream *writer_stream, struct debug_info_trace *di_trace) { - struct bt_ctf_packet *writer_packet; + struct bt_packet *writer_packet; int ret; - writer_packet = bt_ctf_packet_create(writer_stream); + writer_packet = bt_packet_create(writer_stream); if (!writer_packet) { BT_LOGE_STR("Failed to create new packet."); goto error; @@ -808,15 +808,15 @@ end: static int add_debug_info_fields(FILE *err, - struct bt_ctf_field_type *writer_event_context_type, + struct bt_field_type *writer_event_context_type, struct debug_info_component *component) { - struct bt_ctf_field_type *ip_field = NULL, *debug_field_type = NULL, + struct bt_field_type *ip_field = NULL, *debug_field_type = NULL, *bin_field_type = NULL, *func_field_type = NULL, *src_field_type = NULL; int ret = 0; - ip_field = bt_ctf_field_type_structure_get_field_type_by_name( + ip_field = bt_field_type_structure_get_field_type_by_name( writer_event_context_type, "_ip"); /* No ip field, so no debug info. */ if (!ip_field) { @@ -824,7 +824,7 @@ int add_debug_info_fields(FILE *err, } BT_PUT(ip_field); - debug_field_type = bt_ctf_field_type_structure_get_field_type_by_name( + debug_field_type = bt_field_type_structure_get_field_type_by_name( writer_event_context_type, component->arg_debug_info_field_name); /* Already existing debug_info field, no need to add it. */ @@ -832,52 +832,52 @@ int add_debug_info_fields(FILE *err, goto end; } - debug_field_type = bt_ctf_field_type_structure_create(); + debug_field_type = bt_field_type_structure_create(); if (!debug_field_type) { BT_LOGE_STR("Failed to create debug_info structure."); goto error; } - bin_field_type = bt_ctf_field_type_string_create(); + bin_field_type = bt_field_type_string_create(); if (!bin_field_type) { BT_LOGE_STR("Failed to create string for field=bin."); goto error; } - func_field_type = bt_ctf_field_type_string_create(); + func_field_type = bt_field_type_string_create(); if (!func_field_type) { BT_LOGE_STR("Failed to create string for field=func."); goto error; } - src_field_type = bt_ctf_field_type_string_create(); + src_field_type = bt_field_type_string_create(); if (!src_field_type) { BT_LOGE_STR("Failed to create string for field=src."); goto error; } - ret = bt_ctf_field_type_structure_add_field(debug_field_type, + ret = bt_field_type_structure_add_field(debug_field_type, bin_field_type, "bin"); if (ret) { BT_LOGE_STR("Failed to add a field to debug_info struct: field=bin."); goto error; } - ret = bt_ctf_field_type_structure_add_field(debug_field_type, + ret = bt_field_type_structure_add_field(debug_field_type, func_field_type, "func"); if (ret) { BT_LOGE_STR("Failed to add a field to debug_info struct: field=func."); goto error; } - ret = bt_ctf_field_type_structure_add_field(debug_field_type, + ret = bt_field_type_structure_add_field(debug_field_type, src_field_type, "src"); if (ret) { BT_LOGE_STR("Failed to add a field to debug_info struct: field=src."); goto error; } - ret = bt_ctf_field_type_structure_add_field(writer_event_context_type, + ret = bt_field_type_structure_add_field(writer_event_context_type, debug_field_type, component->arg_debug_info_field_name); if (ret) { BT_LOGE_STR("Failed to add debug_info field to event_context."); @@ -900,25 +900,25 @@ end: static int create_debug_info_event_context_type(FILE *err, - struct bt_ctf_field_type *event_context_type, - struct bt_ctf_field_type *writer_event_context_type, + struct bt_field_type *event_context_type, + struct bt_field_type *writer_event_context_type, struct debug_info_component *component) { int ret, nr_fields, i; - nr_fields = bt_ctf_field_type_structure_get_field_count(event_context_type); + nr_fields = bt_field_type_structure_get_field_count(event_context_type); for (i = 0; i < nr_fields; i++) { - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *field_type = NULL; const char *field_name; - if (bt_ctf_field_type_structure_get_field(event_context_type, + if (bt_field_type_structure_get_field_by_index(event_context_type, &field_name, &field_type, i) < 0) { BT_LOGE("Failed to get a field from the event-context: field-name=\"%s\"", field_name); goto error; } - ret = bt_ctf_field_type_structure_add_field(writer_event_context_type, + ret = bt_field_type_structure_add_field(writer_event_context_type, field_type, field_name); BT_PUT(field_type); if (ret) { @@ -939,26 +939,26 @@ end: } static -struct bt_ctf_stream_class *copy_stream_class_debug_info(FILE *err, - struct bt_ctf_stream_class *stream_class, - struct bt_ctf_trace *writer_trace, +struct bt_stream_class *copy_stream_class_debug_info(FILE *err, + struct bt_stream_class *stream_class, + struct bt_trace *writer_trace, struct debug_info_component *component) { - struct bt_ctf_field_type *type = NULL; - struct bt_ctf_stream_class *writer_stream_class = NULL; - struct bt_ctf_field_type *writer_event_context_type = NULL; + struct bt_field_type *type = NULL; + struct bt_stream_class *writer_stream_class = NULL; + struct bt_field_type *writer_event_context_type = NULL; int ret_int; - const char *name = bt_ctf_stream_class_get_name(stream_class); + const char *name = bt_stream_class_get_name(stream_class); - writer_stream_class = bt_ctf_stream_class_create_empty(name); + writer_stream_class = bt_stream_class_create_empty(name); if (!writer_stream_class) { BT_LOGE_STR("Failed to create empty stream class."); goto error; } - type = bt_ctf_stream_class_get_packet_context_type(stream_class); + type = bt_stream_class_get_packet_context_type(stream_class); if (type) { - ret_int = bt_ctf_stream_class_set_packet_context_type( + ret_int = bt_stream_class_set_packet_context_type( writer_stream_class, type); if (ret_int < 0) { BT_LOGE_STR("Failed to set packet_context type."); @@ -967,9 +967,9 @@ struct bt_ctf_stream_class *copy_stream_class_debug_info(FILE *err, BT_PUT(type); } - type = bt_ctf_stream_class_get_event_header_type(stream_class); + type = bt_stream_class_get_event_header_type(stream_class); if (type) { - ret_int = bt_ctf_stream_class_set_event_header_type( + ret_int = bt_stream_class_set_event_header_type( writer_stream_class, type); if (ret_int < 0) { BT_LOGE_STR("Failed to set event_header type."); @@ -978,9 +978,9 @@ struct bt_ctf_stream_class *copy_stream_class_debug_info(FILE *err, BT_PUT(type); } - type = bt_ctf_stream_class_get_event_context_type(stream_class); + type = bt_stream_class_get_event_context_type(stream_class); if (type) { - writer_event_context_type = bt_ctf_field_type_structure_create(); + writer_event_context_type = bt_field_type_structure_create(); if (!writer_event_context_type) { BT_LOGE_STR("Failed to create writer_event_context struct type."); goto error; @@ -993,7 +993,7 @@ struct bt_ctf_stream_class *copy_stream_class_debug_info(FILE *err, } BT_PUT(type); - ret_int = bt_ctf_stream_class_set_event_context_type( + ret_int = bt_stream_class_set_event_context_type( writer_stream_class, writer_event_context_type); if (ret_int < 0) { BT_LOGE_STR("Failed to set event_context type."); @@ -1018,30 +1018,30 @@ end: * to update the integers mapping to a clock. */ static -int add_clock_classes(FILE *err, struct bt_ctf_trace *writer_trace, - struct bt_ctf_stream_class *writer_stream_class, - struct bt_ctf_trace *trace) +int add_clock_classes(FILE *err, struct bt_trace *writer_trace, + struct bt_stream_class *writer_stream_class, + struct bt_trace *trace) { int ret, clock_class_count, i; - clock_class_count = bt_ctf_trace_get_clock_class_count(trace); + clock_class_count = bt_trace_get_clock_class_count(trace); for (i = 0; i < clock_class_count; i++) { - struct bt_ctf_clock_class *clock_class = - bt_ctf_trace_get_clock_class_by_index(trace, i); - struct bt_ctf_clock_class *existing_clock_class = NULL; + struct bt_clock_class *clock_class = + bt_trace_get_clock_class_by_index(trace, i); + struct bt_clock_class *existing_clock_class = NULL; assert(clock_class); - existing_clock_class = bt_ctf_trace_get_clock_class_by_name( - writer_trace, bt_ctf_clock_class_get_name(clock_class)); + existing_clock_class = bt_trace_get_clock_class_by_name( + writer_trace, bt_clock_class_get_name(clock_class)); bt_put(existing_clock_class); if (existing_clock_class) { bt_put(clock_class); continue; } - ret = bt_ctf_trace_add_clock_class(writer_trace, clock_class); + ret = bt_trace_add_clock_class(writer_trace, clock_class); BT_PUT(clock_class); if (ret != 0) { BT_LOGE_STR("Failed to add clock_class."); @@ -1060,17 +1060,17 @@ end: } static -struct bt_ctf_stream_class *insert_new_stream_class( +struct bt_stream_class *insert_new_stream_class( struct debug_info_iterator *debug_it, - struct bt_ctf_stream_class *stream_class) + struct bt_stream_class *stream_class) { - struct bt_ctf_stream_class *writer_stream_class = NULL; - struct bt_ctf_trace *trace, *writer_trace = NULL; + struct bt_stream_class *writer_stream_class = NULL; + struct bt_trace *trace, *writer_trace = NULL; struct debug_info_trace *di_trace; enum bt_component_status ret; int int_ret; - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); di_trace = lookup_trace(debug_it, trace); @@ -1089,7 +1089,7 @@ struct bt_ctf_stream_class *insert_new_stream_class( goto error; } - int_ret = bt_ctf_trace_add_stream_class(writer_trace, writer_stream_class); + int_ret = bt_trace_add_stream_class(writer_trace, writer_stream_class); if (int_ret) { BT_LOGE_STR("Failed to add stream class."); goto error; @@ -1116,17 +1116,17 @@ end: } static -struct bt_ctf_stream *insert_new_stream( +struct bt_stream *insert_new_stream( struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream, + struct bt_stream *stream, struct debug_info_trace *di_trace) { - struct bt_ctf_stream *writer_stream = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_stream_class *writer_stream_class = NULL; + struct bt_stream *writer_stream = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_stream_class *writer_stream_class = NULL; int64_t id; - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); writer_stream_class = g_hash_table_lookup( @@ -1143,14 +1143,14 @@ struct bt_ctf_stream *insert_new_stream( } bt_get(writer_stream_class); - id = bt_ctf_stream_get_id(stream); + id = bt_stream_get_id(stream); if (id < 0) { - writer_stream = bt_ctf_stream_create(writer_stream_class, - bt_ctf_stream_get_name(stream)); + writer_stream = bt_stream_create(writer_stream_class, + bt_stream_get_name(stream)); } else { - writer_stream = bt_ctf_stream_create_with_id( + writer_stream = bt_stream_create_with_id( writer_stream_class, - bt_ctf_stream_get_name(stream), id); + bt_stream_get_name(stream), id); } if (!writer_stream) { @@ -1172,36 +1172,36 @@ end: } static -struct bt_ctf_stream *lookup_stream(struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream, +struct bt_stream *lookup_stream(struct debug_info_iterator *debug_it, + struct bt_stream *stream, struct debug_info_trace *di_trace) { - return (struct bt_ctf_stream *) g_hash_table_lookup( + return (struct bt_stream *) g_hash_table_lookup( di_trace->stream_map, (gpointer) stream); } static -struct bt_ctf_event_class *get_event_class(struct debug_info_iterator *debug_it, - struct bt_ctf_stream_class *writer_stream_class, - struct bt_ctf_event_class *event_class) +struct bt_event_class *get_event_class(struct debug_info_iterator *debug_it, + struct bt_stream_class *writer_stream_class, + struct bt_event_class *event_class) { - return bt_ctf_stream_class_get_event_class_by_id(writer_stream_class, - bt_ctf_event_class_get_id(event_class)); + return bt_stream_class_get_event_class_by_id(writer_stream_class, + bt_event_class_get_id(event_class)); } static struct debug_info_trace *lookup_di_trace_from_stream( struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_trace *trace = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_trace *trace = NULL; struct debug_info_trace *di_trace = NULL; - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); di_trace = (struct debug_info_trace *) g_hash_table_lookup( @@ -1213,15 +1213,15 @@ struct debug_info_trace *lookup_di_trace_from_stream( } static -struct bt_ctf_stream *get_writer_stream( +struct bt_stream *get_writer_stream( struct debug_info_iterator *debug_it, - struct bt_ctf_packet *packet, struct bt_ctf_stream *stream) + struct bt_packet *packet, struct bt_stream *stream) { - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_stream *writer_stream = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_stream *writer_stream = NULL; struct debug_info_trace *di_trace = NULL; - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); di_trace = lookup_di_trace_from_stream(debug_it, stream); @@ -1247,17 +1247,17 @@ end: } BT_HIDDEN -struct bt_ctf_packet *debug_info_new_packet( +struct bt_packet *debug_info_new_packet( struct debug_info_iterator *debug_it, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { - struct bt_ctf_stream *stream = NULL, *writer_stream = NULL; - struct bt_ctf_packet *writer_packet = NULL; - struct bt_ctf_field *packet_context = NULL; + struct bt_stream *stream = NULL, *writer_stream = NULL; + struct bt_packet *writer_packet = NULL; + struct bt_field *packet_context = NULL; struct debug_info_trace *di_trace; int int_ret; - stream = bt_ctf_packet_get_stream(packet); + stream = bt_packet_get_stream(packet); assert(stream); writer_stream = get_writer_stream(debug_it, packet, stream); @@ -1289,7 +1289,7 @@ struct bt_ctf_packet *debug_info_new_packet( goto error; } - packet_context = bt_ctf_packet_get_context(packet); + packet_context = bt_packet_get_context(packet); if (packet_context) { int_ret = ctf_packet_copy_context(debug_it->err, packet, writer_stream, writer_packet); @@ -1313,15 +1313,15 @@ end: } BT_HIDDEN -struct bt_ctf_packet *debug_info_close_packet( +struct bt_packet *debug_info_close_packet( struct debug_info_iterator *debug_it, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { - struct bt_ctf_packet *writer_packet = NULL; - struct bt_ctf_stream *stream = NULL; + struct bt_packet *writer_packet = NULL; + struct bt_stream *stream = NULL; struct debug_info_trace *di_trace; - stream = bt_ctf_packet_get_stream(packet); + stream = bt_packet_get_stream(packet); assert(stream); di_trace = lookup_di_trace_from_stream(debug_it, stream); @@ -1344,11 +1344,11 @@ end: } BT_HIDDEN -struct bt_ctf_stream *debug_info_stream_begin( +struct bt_stream *debug_info_stream_begin( struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream) + struct bt_stream *stream) { - struct bt_ctf_stream *writer_stream = NULL; + struct bt_stream *writer_stream = NULL; enum debug_info_stream_state *state; struct debug_info_trace *di_trace = NULL; @@ -1396,10 +1396,10 @@ end: } BT_HIDDEN -struct bt_ctf_stream *debug_info_stream_end(struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream) +struct bt_stream *debug_info_stream_end(struct debug_info_iterator *debug_it, + struct bt_stream *stream) { - struct bt_ctf_stream *writer_stream = NULL; + struct bt_stream *writer_stream = NULL; struct debug_info_trace *di_trace = NULL; enum debug_info_stream_state *state; @@ -1452,7 +1452,7 @@ end: static struct debug_info_source *lookup_debug_info(FILE *err, - struct bt_ctf_event *event, + struct bt_event *event, struct debug_info *debug_info) { int64_t vpid; @@ -1480,23 +1480,23 @@ end: } static -int set_debug_info_field(FILE *err, struct bt_ctf_field *debug_field, +int set_debug_info_field(FILE *err, struct bt_field *debug_field, struct debug_info_source *dbg_info_src, struct debug_info_component *component) { int i, nr_fields, ret = 0; - struct bt_ctf_field_type *debug_field_type = NULL; - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field_type *debug_field_type = NULL; + struct bt_field *field = NULL; + struct bt_field_type *field_type = NULL; - debug_field_type = bt_ctf_field_get_type(debug_field); + debug_field_type = bt_field_get_type(debug_field); assert(debug_field_type); - nr_fields = bt_ctf_field_type_structure_get_field_count(debug_field_type); + nr_fields = bt_field_type_structure_get_field_count(debug_field_type); for (i = 0; i < nr_fields; i++) { const char *field_name; - if (bt_ctf_field_type_structure_get_field(debug_field_type, + if (bt_field_type_structure_get_field_by_index(debug_field_type, &field_name, &field_type, i) < 0) { BT_LOGE("Failed to get field from debug_info struct: field-name=\"%s\"", field_name); @@ -1504,7 +1504,7 @@ int set_debug_info_field(FILE *err, struct bt_ctf_field *debug_field, } BT_PUT(field_type); - field = bt_ctf_field_structure_get_field_by_index(debug_field, i); + field = bt_field_structure_get_field_by_index(debug_field, i); if (!strcmp(field_name, "bin")) { if (dbg_info_src && dbg_info_src->bin_path) { GString *tmp = g_string_new(NULL); @@ -1518,17 +1518,17 @@ int set_debug_info_field(FILE *err, struct bt_ctf_field *debug_field, dbg_info_src->short_bin_path, dbg_info_src->bin_loc); } - ret = bt_ctf_field_string_set_value(field, tmp->str); + ret = bt_field_string_set_value(field, tmp->str); g_string_free(tmp, true); } else { - ret = bt_ctf_field_string_set_value(field, ""); + ret = bt_field_string_set_value(field, ""); } } else if (!strcmp(field_name, "func")) { if (dbg_info_src && dbg_info_src->func) { - ret = bt_ctf_field_string_set_value(field, + ret = bt_field_string_set_value(field, dbg_info_src->func); } else { - ret = bt_ctf_field_string_set_value(field, ""); + ret = bt_field_string_set_value(field, ""); } } else if (!strcmp(field_name, "src")) { if (dbg_info_src && dbg_info_src->src_path) { @@ -1543,10 +1543,10 @@ int set_debug_info_field(FILE *err, struct bt_ctf_field *debug_field, dbg_info_src->short_src_path, dbg_info_src->line_no); } - ret = bt_ctf_field_string_set_value(field, tmp->str); + ret = bt_field_string_set_value(field, tmp->str); g_string_free(tmp, true); } else { - ret = bt_ctf_field_string_set_value(field, ""); + ret = bt_field_string_set_value(field, ""); } } BT_PUT(field); @@ -1570,45 +1570,45 @@ end: static int copy_set_debug_info_stream_event_context(FILE *err, - struct bt_ctf_field *event_context, - struct bt_ctf_event *event, - struct bt_ctf_event *writer_event, + struct bt_field *event_context, + struct bt_event *event, + struct bt_event *writer_event, struct debug_info *debug_info, struct debug_info_component *component) { - struct bt_ctf_field_type *writer_event_context_type = NULL, + struct bt_field_type *writer_event_context_type = NULL, *event_context_type = NULL; - struct bt_ctf_field *writer_event_context = NULL; - struct bt_ctf_field *field = NULL, *copy_field = NULL, *debug_field = NULL; - struct bt_ctf_field_type *field_type = NULL; + struct bt_field *writer_event_context = NULL; + struct bt_field *field = NULL, *copy_field = NULL, *debug_field = NULL; + struct bt_field_type *field_type = NULL; struct debug_info_source *dbg_info_src; int ret, nr_fields, i; - writer_event_context = bt_ctf_event_get_stream_event_context(writer_event); + writer_event_context = bt_event_get_stream_event_context(writer_event); assert(writer_event_context); - writer_event_context_type = bt_ctf_field_get_type(writer_event_context); + writer_event_context_type = bt_field_get_type(writer_event_context); assert(writer_event_context_type); - event_context_type = bt_ctf_field_get_type(event_context); + event_context_type = bt_field_get_type(event_context); assert(event_context_type); /* * If it is not a structure, we did not modify it to add the debug info * fields, so just assign it as is. */ - if (bt_ctf_field_type_get_type_id(writer_event_context_type) != BT_CTF_FIELD_TYPE_ID_STRUCT) { - ret = bt_ctf_event_set_event_context(writer_event, event_context); + if (bt_field_type_get_type_id(writer_event_context_type) != BT_FIELD_TYPE_ID_STRUCT) { + ret = bt_event_set_event_context(writer_event, event_context); goto end; } dbg_info_src = lookup_debug_info(err, event, debug_info); - nr_fields = bt_ctf_field_type_structure_get_field_count(writer_event_context_type); + nr_fields = bt_field_type_structure_get_field_count(writer_event_context_type); for (i = 0; i < nr_fields; i++) { const char *field_name; - if (bt_ctf_field_type_structure_get_field(writer_event_context_type, + if (bt_field_type_structure_get_field_by_index(writer_event_context_type, &field_name, &field_type, i) < 0) { BT_LOGE("Failed to get field from event-context: field-name=\"%s\"", field_name); @@ -1618,8 +1618,8 @@ int copy_set_debug_info_stream_event_context(FILE *err, /* * Prevent illegal access in the event_context. */ - if (i < bt_ctf_field_type_structure_get_field_count(event_context_type)) { - field = bt_ctf_field_structure_get_field_by_index(event_context, i); + if (i < bt_field_type_structure_get_field_count(event_context_type)) { + field = bt_field_structure_get_field_by_index(event_context, i); } /* * The debug_info field, only exists in the writer event or @@ -1627,7 +1627,7 @@ int copy_set_debug_info_stream_event_context(FILE *err, */ if (!strcmp(field_name, component->arg_debug_info_field_name) && !field) { - debug_field = bt_ctf_field_structure_get_field_by_index( + debug_field = bt_field_structure_get_field_by_index( writer_event_context, i); assert(debug_field); @@ -1639,14 +1639,14 @@ int copy_set_debug_info_stream_event_context(FILE *err, } BT_PUT(debug_field); } else { - copy_field = bt_ctf_field_copy(field); + copy_field = bt_field_copy(field); if (!copy_field) { BT_LOGE("Failed to copy field: field-name=\"%s\"", field_name); goto error; } - ret = bt_ctf_field_structure_set_field_by_name( + ret = bt_field_structure_set_field_by_name( writer_event_context, field_name, copy_field); if (ret) { @@ -1677,22 +1677,22 @@ end: } static -struct bt_ctf_clock_class *stream_class_get_clock_class(FILE *err, - struct bt_ctf_stream_class *stream_class) +struct bt_clock_class *stream_class_get_clock_class(FILE *err, + struct bt_stream_class *stream_class) { - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_trace *trace = NULL; + struct bt_clock_class *clock_class = NULL; - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); - if (!bt_ctf_trace_get_clock_class_count(trace)) { + if (!bt_trace_get_clock_class_count(trace)) { /* No clock. */ goto end; } /* FIXME multi-clock? */ - clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0); + clock_class = bt_trace_get_clock_class_by_index(trace, 0); bt_put(trace); @@ -1701,16 +1701,16 @@ end: } static -struct bt_ctf_clock_class *event_get_clock_class(FILE *err, struct bt_ctf_event *event) +struct bt_clock_class *event_get_clock_class(FILE *err, struct bt_event *event) { - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_event_class *event_class = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_clock_class *clock_class = NULL; - event_class = bt_ctf_event_get_class(event); + event_class = bt_event_get_class(event); assert(event_class); - stream_class = bt_ctf_event_class_get_stream_class(event_class); + stream_class = bt_event_class_get_stream_class(event_class); assert(stream_class); clock_class = stream_class_get_clock_class(err, stream_class); @@ -1723,11 +1723,11 @@ end: } static -int set_event_clock_value(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event *writer_event) +int set_event_clock_value(FILE *err, struct bt_event *event, + struct bt_event *writer_event) { - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_class *clock_class = NULL; + struct bt_clock_value *clock_value = NULL; int ret = 0; clock_class = event_get_clock_class(err, event); @@ -1736,7 +1736,7 @@ int set_event_clock_value(FILE *err, struct bt_ctf_event *event, goto end; } - clock_value = bt_ctf_event_get_clock_value(event, clock_class); + clock_value = bt_event_get_clock_value(event, clock_class); if (!clock_value) { ret = 0; goto end; @@ -1746,7 +1746,7 @@ int set_event_clock_value(FILE *err, struct bt_ctf_event *event, * We share the same clocks, so we can assign the clock value to the * writer event. */ - ret = bt_ctf_event_set_clock_value(writer_event, clock_value); + ret = bt_event_set_clock_value(writer_event, clock_value); if (ret) { BT_LOGE_STR("Failed to set clock value."); goto error; @@ -1764,16 +1764,16 @@ end: } static -struct bt_ctf_event *debug_info_copy_event(FILE *err, struct bt_ctf_event *event, - struct bt_ctf_event_class *writer_event_class, +struct bt_event *debug_info_copy_event(FILE *err, struct bt_event *event, + struct bt_event_class *writer_event_class, struct debug_info *debug_info, struct debug_info_component *component) { - struct bt_ctf_event *writer_event = NULL; - struct bt_ctf_field *field = NULL, *copy_field = NULL; + struct bt_event *writer_event = NULL; + struct bt_field *field = NULL, *copy_field = NULL; int ret; - writer_event = bt_ctf_event_create(writer_event_class); + writer_event = bt_event_create(writer_event_class); if (!writer_event) { BT_LOGE_STR("Failed to create new event."); goto error; @@ -1786,7 +1786,7 @@ struct bt_ctf_event *debug_info_copy_event(FILE *err, struct bt_ctf_event *event } /* Optional field, so it can fail silently. */ - field = bt_ctf_event_get_header(event); + field = bt_event_get_header(event); if (field) { ret = ctf_copy_event_header(err, event, writer_event_class, writer_event, field); @@ -1798,7 +1798,7 @@ struct bt_ctf_event *debug_info_copy_event(FILE *err, struct bt_ctf_event *event } /* Optional field, so it can fail silently. */ - field = bt_ctf_event_get_stream_event_context(event); + field = bt_event_get_stream_event_context(event); if (field) { ret = copy_set_debug_info_stream_event_context(err, field, event, writer_event, debug_info, @@ -1811,14 +1811,14 @@ struct bt_ctf_event *debug_info_copy_event(FILE *err, struct bt_ctf_event *event } /* Optional field, so it can fail silently. */ - field = bt_ctf_event_get_event_context(event); + field = bt_event_get_event_context(event); if (field) { - copy_field = bt_ctf_field_copy(field); + copy_field = bt_field_copy(field); if (!copy_field) { BT_LOGE_STR("Failed to copy field."); goto error; } - ret = bt_ctf_event_set_event_context(writer_event, copy_field); + ret = bt_event_set_event_context(writer_event, copy_field); if (ret < 0) { BT_LOGE_STR("Failed to set event_context."); goto error; @@ -1827,12 +1827,12 @@ struct bt_ctf_event *debug_info_copy_event(FILE *err, struct bt_ctf_event *event BT_PUT(field); } - field = bt_ctf_event_get_event_payload(event); + field = bt_event_get_event_payload(event); assert(field); - copy_field = bt_ctf_field_copy(field); + copy_field = bt_field_copy(field); if (copy_field) { - ret = bt_ctf_event_set_event_payload(writer_event, copy_field); + ret = bt_event_set_event_payload(writer_event, copy_field); if (ret < 0) { BT_LOGE_STR("Failed to set event payload."); goto error; @@ -1852,27 +1852,27 @@ end: } BT_HIDDEN -struct bt_ctf_event *debug_info_output_event( +struct bt_event *debug_info_output_event( struct debug_info_iterator *debug_it, - struct bt_ctf_event *event) + struct bt_event *event) { - struct bt_ctf_event_class *event_class = NULL, *writer_event_class = NULL; - struct bt_ctf_stream_class *stream_class = NULL, *writer_stream_class = NULL; - struct bt_ctf_event *writer_event = NULL; - struct bt_ctf_packet *packet = NULL, *writer_packet = NULL; - struct bt_ctf_trace *writer_trace = NULL; - struct bt_ctf_stream *stream = NULL; + struct bt_event_class *event_class = NULL, *writer_event_class = NULL; + struct bt_stream_class *stream_class = NULL, *writer_stream_class = NULL; + struct bt_event *writer_event = NULL; + struct bt_packet *packet = NULL, *writer_packet = NULL; + struct bt_trace *writer_trace = NULL; + struct bt_stream *stream = NULL; struct debug_info_trace *di_trace; struct debug_info *debug_info; int int_ret; - event_class = bt_ctf_event_get_class(event); + event_class = bt_event_get_class(event); assert(event_class); - stream_class = bt_ctf_event_class_get_stream_class(event_class); + stream_class = bt_event_class_get_stream_class(event_class); assert(stream_class); - stream = bt_ctf_event_get_stream(event); + stream = bt_event_get_stream(event); assert(stream); di_trace = lookup_di_trace_from_stream(debug_it, stream); @@ -1899,7 +1899,7 @@ struct bt_ctf_event *debug_info_output_event( BT_LOGE_STR("Failed to copy event_class."); goto error; } - int_ret = bt_ctf_stream_class_add_event_class( + int_ret = bt_stream_class_add_event_class( writer_stream_class, writer_event_class); if (int_ret) { BT_LOGE_STR("Failed to add event_class."); @@ -1907,7 +1907,7 @@ struct bt_ctf_event *debug_info_output_event( } } - writer_trace = bt_ctf_stream_class_get_trace(writer_stream_class); + writer_trace = bt_stream_class_get_trace(writer_stream_class); assert(writer_trace); debug_info = get_trace_debug_info(debug_it, writer_trace, di_trace); @@ -1920,11 +1920,11 @@ struct bt_ctf_event *debug_info_output_event( debug_it->debug_info_component); if (!writer_event) { BT_LOGE("Failed to copy event: event-class-name=\"%s\"", - bt_ctf_event_class_get_name(writer_event_class)); + bt_event_class_get_name(writer_event_class)); goto error; } - packet = bt_ctf_event_get_packet(event); + packet = bt_event_get_packet(event); assert(packet); writer_packet = lookup_packet(debug_it, packet, di_trace); @@ -1934,10 +1934,10 @@ struct bt_ctf_event *debug_info_output_event( } bt_get(writer_packet); - int_ret = bt_ctf_event_set_packet(writer_event, writer_packet); + int_ret = bt_event_set_packet(writer_event, writer_packet); if (int_ret < 0) { BT_LOGE("Failed to append event to event-class-name=\"%s\"", - bt_ctf_event_class_get_name(writer_event_class)); + bt_event_class_get_name(writer_event_class)); goto error; } diff --git a/plugins/lttng-utils/copy.h b/plugins/lttng-utils/copy.h index 48c07636..77588779 100644 --- a/plugins/lttng-utils/copy.h +++ b/plugins/lttng-utils/copy.h @@ -32,43 +32,43 @@ #include BT_HIDDEN -struct bt_ctf_event *debug_info_output_event(struct debug_info_iterator *debug_it, - struct bt_ctf_event *event); +struct bt_event *debug_info_output_event(struct debug_info_iterator *debug_it, + struct bt_event *event); BT_HIDDEN -struct bt_ctf_packet *debug_info_new_packet(struct debug_info_iterator *debug_it, - struct bt_ctf_packet *packet); +struct bt_packet *debug_info_new_packet(struct debug_info_iterator *debug_it, + struct bt_packet *packet); BT_HIDDEN -struct bt_ctf_packet *debug_info_close_packet(struct debug_info_iterator *debug_it, - struct bt_ctf_packet *packet); +struct bt_packet *debug_info_close_packet(struct debug_info_iterator *debug_it, + struct bt_packet *packet); BT_HIDDEN -struct bt_ctf_stream *debug_info_stream_begin( +struct bt_stream *debug_info_stream_begin( struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream); + struct bt_stream *stream); BT_HIDDEN -struct bt_ctf_stream *debug_info_stream_end(struct debug_info_iterator *debug_it, - struct bt_ctf_stream *stream); +struct bt_stream *debug_info_stream_end(struct debug_info_iterator *debug_it, + struct bt_stream *stream); BT_HIDDEN int get_stream_event_context_unsigned_int_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, uint64_t *value); BT_HIDDEN -int get_stream_event_context_int_field_value(FILE *err, struct bt_ctf_event *event, +int get_stream_event_context_int_field_value(FILE *err, struct bt_event *event, const char *field_name, int64_t *value); BT_HIDDEN int get_payload_unsigned_int_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, uint64_t *value); BT_HIDDEN -int get_payload_int_field_value(FILE *err, struct bt_ctf_event *event, +int get_payload_int_field_value(FILE *err, struct bt_event *event, const char *field_name, int64_t *value); BT_HIDDEN int get_payload_string_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, const char **value); BT_HIDDEN int get_payload_build_id_field_value(FILE *err, - struct bt_ctf_event *event, const char *field_name, + struct bt_event *event, const char *field_name, uint8_t **build_id, uint64_t *build_id_len); #endif /* BABELTRACE_PLUGIN_TRIMMER_COPY_H */ diff --git a/plugins/lttng-utils/debug-info.c b/plugins/lttng-utils/debug-info.c index ffc7761c..09e6c010 100644 --- a/plugins/lttng-utils/debug-info.c +++ b/plugins/lttng-utils/debug-info.c @@ -373,7 +373,7 @@ end: static void handle_statedump_build_id_event(FILE *err, struct debug_info *debug_info, - struct bt_ctf_event *event) + struct bt_event *event) { struct proc_debug_info_sources *proc_dbg_info_src; struct bin_info *bin = NULL; @@ -437,7 +437,7 @@ end: static void handle_statedump_debug_link_event(FILE *err, struct debug_info *debug_info, - struct bt_ctf_event *event) + struct bt_event *event) { struct proc_debug_info_sources *proc_dbg_info_src; struct bin_info *bin = NULL; @@ -502,7 +502,7 @@ end: static void handle_bin_info_event(FILE *err, struct debug_info *debug_info, - struct bt_ctf_event *event, bool has_pic_field) + struct bt_event *event, bool has_pic_field) { struct proc_debug_info_sources *proc_dbg_info_src; struct bin_info *bin; @@ -605,21 +605,21 @@ end: static inline void handle_statedump_bin_info_event(FILE *err, struct debug_info *debug_info, - struct bt_ctf_event *event) + struct bt_event *event) { handle_bin_info_event(err, debug_info, event, true); } static inline void handle_lib_load_event(FILE *err, struct debug_info *debug_info, - struct bt_ctf_event *event) + struct bt_event *event) { handle_bin_info_event(err, debug_info, event, false); } static inline void handle_lib_unload_event(FILE *err, struct debug_info *debug_info, - struct bt_ctf_event *event) + struct bt_event *event) { struct proc_debug_info_sources *proc_dbg_info_src; uint64_t baddr; @@ -656,7 +656,7 @@ end: static void handle_statedump_start(FILE *err, struct debug_info *debug_info, - struct bt_ctf_event *event) + struct bt_event *event) { struct proc_debug_info_sources *proc_dbg_info_src; int64_t vpid; @@ -682,21 +682,21 @@ end: } BT_HIDDEN -void debug_info_handle_event(FILE *err, struct bt_ctf_event *event, +void debug_info_handle_event(FILE *err, struct bt_event *event, struct debug_info *debug_info) { - struct bt_ctf_event_class *event_class; + struct bt_event_class *event_class; const char *event_name; GQuark q_event_name; if (!debug_info || !event) { goto end; } - event_class = bt_ctf_event_get_class(event); + event_class = bt_event_get_class(event); if (!event_class) { goto end; } - event_name = bt_ctf_event_class_get_name(event_class); + event_name = bt_event_class_get_name(event_class); if (!event_name) { goto end_put_class; } diff --git a/plugins/lttng-utils/debug-info.h b/plugins/lttng-utils/debug-info.h index f1b6df2d..754a239b 100644 --- a/plugins/lttng-utils/debug-info.h +++ b/plugins/lttng-utils/debug-info.h @@ -54,7 +54,7 @@ struct debug_info_component { struct debug_info_iterator { struct debug_info_component *debug_info_component; - /* Map between struct bt_ctf_trace and struct bt_ctf_writer. */ + /* Map between struct bt_trace and struct bt_writer. */ GHashTable *trace_map; /* Input iterators associated with this output iterator. */ GPtrArray *input_iterator_group; @@ -64,8 +64,8 @@ struct debug_info_iterator { }; struct debug_info_trace { - struct bt_ctf_trace *trace; - struct bt_ctf_trace *writer_trace; + struct bt_trace *trace; + struct bt_trace *writer_trace; struct debug_info_component *debug_info_component; struct debug_info_iterator *debug_it; int static_listener_id; @@ -110,7 +110,7 @@ struct debug_info_source *debug_info_query(struct debug_info *debug_info, int64_t vpid, uint64_t ip); BT_HIDDEN -void debug_info_handle_event(FILE *err, struct bt_ctf_event *event, +void debug_info_handle_event(FILE *err, struct bt_event *event, struct debug_info *debug_info); BT_HIDDEN diff --git a/plugins/lttng-utils/plugin.c b/plugins/lttng-utils/plugin.c index 35538436..d12f5d5a 100644 --- a/plugins/lttng-utils/plugin.c +++ b/plugins/lttng-utils/plugin.c @@ -114,9 +114,9 @@ struct bt_notification *handle_notification(FILE *err, switch (bt_notification_get_type(notification)) { case BT_NOTIFICATION_TYPE_PACKET_BEGIN: { - struct bt_ctf_packet *packet = + struct bt_packet *packet = bt_notification_packet_begin_get_packet(notification); - struct bt_ctf_packet *writer_packet; + struct bt_packet *writer_packet; if (!packet) { goto end; @@ -133,9 +133,9 @@ struct bt_notification *handle_notification(FILE *err, } case BT_NOTIFICATION_TYPE_PACKET_END: { - struct bt_ctf_packet *packet = + struct bt_packet *packet = bt_notification_packet_end_get_packet(notification); - struct bt_ctf_packet *writer_packet; + struct bt_packet *writer_packet; if (!packet) { goto end; @@ -152,9 +152,9 @@ struct bt_notification *handle_notification(FILE *err, } case BT_NOTIFICATION_TYPE_EVENT: { - struct bt_ctf_event *event = bt_notification_event_get_event( + struct bt_event *event = bt_notification_event_get_event( notification); - struct bt_ctf_event *writer_event; + struct bt_event *writer_event; struct bt_clock_class_priority_map *cc_prio_map = bt_notification_event_get_clock_class_priority_map( notification); @@ -174,9 +174,9 @@ struct bt_notification *handle_notification(FILE *err, } case BT_NOTIFICATION_TYPE_STREAM_BEGIN: { - struct bt_ctf_stream *stream = + struct bt_stream *stream = bt_notification_stream_begin_get_stream(notification); - struct bt_ctf_stream *writer_stream; + struct bt_stream *writer_stream; if (!stream) { goto end; @@ -193,9 +193,9 @@ struct bt_notification *handle_notification(FILE *err, } case BT_NOTIFICATION_TYPE_STREAM_END: { - struct bt_ctf_stream *stream = + struct bt_stream *stream = bt_notification_stream_end_get_stream(notification); - struct bt_ctf_stream *writer_stream; + struct bt_stream *writer_stream; if (!stream) { goto end; diff --git a/plugins/text/dmesg/dmesg.c b/plugins/text/dmesg/dmesg.c index a17f969e..f1a4324f 100644 --- a/plugins/text/dmesg/dmesg.c +++ b/plugins/text/dmesg/dmesg.c @@ -56,35 +56,35 @@ struct dmesg_component { bt_bool no_timestamp; } params; - struct bt_ctf_trace *trace; - struct bt_ctf_stream_class *stream_class; - struct bt_ctf_event_class *event_class; - struct bt_ctf_stream *stream; - struct bt_ctf_packet *packet; - struct bt_ctf_clock_class *clock_class; + struct bt_trace *trace; + struct bt_stream_class *stream_class; + struct bt_event_class *event_class; + struct bt_stream *stream; + struct bt_packet *packet; + struct bt_clock_class *clock_class; struct bt_clock_class_priority_map *cc_prio_map; }; static -struct bt_ctf_field_type *create_packet_header_ft(void) +struct bt_field_type *create_packet_header_ft(void) { - struct bt_ctf_field_type *root_ft = NULL; - struct bt_ctf_field_type *ft = NULL; + struct bt_field_type *root_ft = NULL; + struct bt_field_type *ft = NULL; int ret; - root_ft = bt_ctf_field_type_structure_create(); + root_ft = bt_field_type_structure_create(); if (!root_ft) { BT_LOGE_STR("Cannot create an empty structure field type object."); goto error; } - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); if (!ft) { BT_LOGE_STR("Cannot create an integer field type object."); goto error; } - ret = bt_ctf_field_type_structure_add_field(root_ft, ft, "magic"); + ret = bt_field_type_structure_add_field(root_ft, ft, "magic"); if (ret) { BT_LOGE("Cannot add `magic` field type to structure field type: " "ret=%d", ret); @@ -92,7 +92,7 @@ struct bt_ctf_field_type *create_packet_header_ft(void) } BT_PUT(ft); - ft = bt_ctf_field_type_integer_create(8); + ft = bt_field_type_integer_create(8); if (!ft) { BT_LOGE_STR("Cannot create an integer field type object."); goto error; @@ -109,25 +109,25 @@ end: } static -struct bt_ctf_field_type *create_packet_context_ft(void) +struct bt_field_type *create_packet_context_ft(void) { - struct bt_ctf_field_type *root_ft = NULL; - struct bt_ctf_field_type *ft = NULL; + struct bt_field_type *root_ft = NULL; + struct bt_field_type *ft = NULL; int ret; - root_ft = bt_ctf_field_type_structure_create(); + root_ft = bt_field_type_structure_create(); if (!root_ft) { BT_LOGE_STR("Cannot create an empty structure field type object."); goto error; } - ft = bt_ctf_field_type_integer_create(64); + ft = bt_field_type_integer_create(64); if (!ft) { BT_LOGE_STR("Cannot create an integer field type object."); goto error; } - ret = bt_ctf_field_type_structure_add_field(root_ft, + ret = bt_field_type_structure_add_field(root_ft, ft, "content_size"); if (ret) { BT_LOGE("Cannot add `content_size` field type to structure field type: " @@ -136,13 +136,13 @@ struct bt_ctf_field_type *create_packet_context_ft(void) } BT_PUT(ft); - ft = bt_ctf_field_type_integer_create(64); + ft = bt_field_type_integer_create(64); if (!ft) { BT_LOGE_STR("Cannot create an integer field type object."); goto error; } - ret = bt_ctf_field_type_structure_add_field(root_ft, + ret = bt_field_type_structure_add_field(root_ft, ft, "packet_size"); if (ret) { BT_LOGE("Cannot add `packet_size` field type to structure field type: " @@ -161,33 +161,33 @@ end: } static -struct bt_ctf_field_type *create_event_header_ft( - struct bt_ctf_clock_class *clock_class) +struct bt_field_type *create_event_header_ft( + struct bt_clock_class *clock_class) { - struct bt_ctf_field_type *root_ft = NULL; - struct bt_ctf_field_type *ft = NULL; + struct bt_field_type *root_ft = NULL; + struct bt_field_type *ft = NULL; int ret; - root_ft = bt_ctf_field_type_structure_create(); + root_ft = bt_field_type_structure_create(); if (!root_ft) { BT_LOGE_STR("Cannot create an empty structure field type object."); goto error; } - ft = bt_ctf_field_type_integer_create(64); + ft = bt_field_type_integer_create(64); if (!ft) { BT_LOGE_STR("Cannot create an integer field type object."); goto error; } - ret = bt_ctf_field_type_integer_set_mapped_clock_class(ft, clock_class); + ret = bt_field_type_integer_set_mapped_clock_class(ft, clock_class); if (ret) { BT_LOGE("Cannot map integer field type to clock class: " "ret=%d", ret); goto error; } - ret = bt_ctf_field_type_structure_add_field(root_ft, + ret = bt_field_type_structure_add_field(root_ft, ft, "timestamp"); if (ret) { BT_LOGE("Cannot add `timestamp` field type to structure field type: " @@ -206,25 +206,25 @@ end: } static -struct bt_ctf_field_type *create_event_payload_ft(void) +struct bt_field_type *create_event_payload_ft(void) { - struct bt_ctf_field_type *root_ft = NULL; - struct bt_ctf_field_type *ft = NULL; + struct bt_field_type *root_ft = NULL; + struct bt_field_type *ft = NULL; int ret; - root_ft = bt_ctf_field_type_structure_create(); + root_ft = bt_field_type_structure_create(); if (!root_ft) { BT_LOGE_STR("Cannot create an empty structure field type object."); goto error; } - ft = bt_ctf_field_type_string_create(); + ft = bt_field_type_string_create(); if (!ft) { BT_LOGE_STR("Cannot create a string field type object."); goto error; } - ret = bt_ctf_field_type_structure_add_field(root_ft, + ret = bt_field_type_structure_add_field(root_ft, ft, "str"); if (ret) { BT_LOGE("Cannot add `str` field type to structure field type: " @@ -243,20 +243,20 @@ end: } static -struct bt_ctf_clock_class *create_clock_class(void) +struct bt_clock_class *create_clock_class(void) { - return bt_ctf_clock_class_create("the_clock", 1000000000); + return bt_clock_class_create("the_clock", 1000000000); } static int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) { - struct bt_ctf_field_type *ft = NULL; + struct bt_field_type *ft = NULL; const char *trace_name = NULL; gchar *basename = NULL; int ret = 0; - dmesg_comp->trace = bt_ctf_trace_create(); + dmesg_comp->trace = bt_trace_create(); if (!dmesg_comp->trace) { BT_LOGE_STR("Cannot create an empty trace object."); goto error; @@ -268,7 +268,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) goto error; } - ret = bt_ctf_trace_set_packet_header_type(dmesg_comp->trace, ft); + ret = bt_trace_set_packet_header_type(dmesg_comp->trace, ft); if (ret) { BT_LOGE_STR("Cannot set trace's packet header field type."); goto error; @@ -287,14 +287,14 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) } if (trace_name) { - ret = bt_ctf_trace_set_name(dmesg_comp->trace, trace_name); + ret = bt_trace_set_name(dmesg_comp->trace, trace_name); if (ret) { BT_LOGE("Cannot set trace's name: name=\"%s\"", trace_name); goto error; } } - dmesg_comp->stream_class = bt_ctf_stream_class_create_empty(NULL); + dmesg_comp->stream_class = bt_stream_class_create_empty(NULL); if (!dmesg_comp->stream_class) { BT_LOGE_STR("Cannot create an empty stream class object."); goto error; @@ -307,7 +307,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) goto error; } - ret = bt_ctf_stream_class_set_packet_context_type( + ret = bt_stream_class_set_packet_context_type( dmesg_comp->stream_class, ft); if (ret) { BT_LOGE_STR("Cannot set stream class's packet context field type."); @@ -327,7 +327,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) goto error; } - ret = bt_ctf_trace_add_clock_class(dmesg_comp->trace, + ret = bt_trace_add_clock_class(dmesg_comp->trace, dmesg_comp->clock_class); if (ret) { BT_LOGE_STR("Cannot add clock class to trace."); @@ -348,7 +348,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) goto error; } - ret = bt_ctf_stream_class_set_event_header_type( + ret = bt_stream_class_set_event_header_type( dmesg_comp->stream_class, ft); if (ret) { BT_LOGE_STR("Cannot set stream class's event header field type."); @@ -356,7 +356,7 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) } } - dmesg_comp->event_class = bt_ctf_event_class_create("string"); + dmesg_comp->event_class = bt_event_class_create("string"); if (!dmesg_comp->event_class) { BT_LOGE_STR("Cannot create an empty event class object."); goto error; @@ -369,20 +369,20 @@ int create_meta(struct dmesg_component *dmesg_comp, bool has_ts) goto error; } - ret = bt_ctf_event_class_set_payload_type(dmesg_comp->event_class, ft); + ret = bt_event_class_set_payload_type(dmesg_comp->event_class, ft); if (ret) { BT_LOGE_STR("Cannot set event class's event payload field type."); goto error; } - ret = bt_ctf_stream_class_add_event_class(dmesg_comp->stream_class, + ret = bt_stream_class_add_event_class(dmesg_comp->stream_class, dmesg_comp->event_class); if (ret) { BT_LOGE("Cannot add event class to stream class: ret=%d", ret); goto error; } - ret = bt_ctf_trace_add_stream_class(dmesg_comp->trace, + ret = bt_trace_add_stream_class(dmesg_comp->trace, dmesg_comp->stream_class); if (ret) { BT_LOGE("Cannot add event class to stream class: ret=%d", ret); @@ -481,25 +481,25 @@ end: } static -struct bt_ctf_field *create_packet_header_field(struct bt_ctf_field_type *ft) +struct bt_field *create_packet_header_field(struct bt_field_type *ft) { - struct bt_ctf_field *ph = NULL; - struct bt_ctf_field *magic = NULL; + struct bt_field *ph = NULL; + struct bt_field *magic = NULL; int ret; - ph = bt_ctf_field_create(ft); + ph = bt_field_create(ft); if (!ph) { BT_LOGE_STR("Cannot create field object."); goto error; } - magic = bt_ctf_field_structure_get_field_by_name(ph, "magic"); + magic = bt_field_structure_get_field_by_name(ph, "magic"); if (!magic) { BT_LOGE_STR("Cannot get `magic` field from structure field."); goto error; } - ret = bt_ctf_field_unsigned_integer_set_value(magic, 0xc1fc1fc1); + ret = bt_field_unsigned_integer_set_value(magic, 0xc1fc1fc1); if (ret) { BT_LOGE_STR("Cannot set integer field's value."); goto error; @@ -516,38 +516,38 @@ end: } static -struct bt_ctf_field *create_packet_context_field(struct bt_ctf_field_type *ft) +struct bt_field *create_packet_context_field(struct bt_field_type *ft) { - struct bt_ctf_field *pc = NULL; - struct bt_ctf_field *field = NULL; + struct bt_field *pc = NULL; + struct bt_field *field = NULL; int ret; - pc = bt_ctf_field_create(ft); + pc = bt_field_create(ft); if (!pc) { BT_LOGE_STR("Cannot create field object."); goto error; } - field = bt_ctf_field_structure_get_field_by_name(pc, "content_size"); + field = bt_field_structure_get_field_by_name(pc, "content_size"); if (!field) { BT_LOGE_STR("Cannot get `content_size` field from structure field."); goto error; } - ret = bt_ctf_field_unsigned_integer_set_value(field, 0); + ret = bt_field_unsigned_integer_set_value(field, 0); if (ret) { BT_LOGE_STR("Cannot set integer field's value."); goto error; } bt_put(field); - field = bt_ctf_field_structure_get_field_by_name(pc, "packet_size"); + field = bt_field_structure_get_field_by_name(pc, "packet_size"); if (!field) { BT_LOGE_STR("Cannot get `packet_size` field from structure field."); goto error; } - ret = bt_ctf_field_unsigned_integer_set_value(field, 0); + ret = bt_field_unsigned_integer_set_value(field, 0); if (ret) { BT_LOGE_STR("Cannot set integer field's value."); goto error; @@ -567,23 +567,23 @@ static int create_packet_and_stream(struct dmesg_component *dmesg_comp) { int ret = 0; - struct bt_ctf_field_type *ft = NULL; - struct bt_ctf_field *field = NULL; + struct bt_field_type *ft = NULL; + struct bt_field *field = NULL; - dmesg_comp->stream = bt_ctf_stream_create(dmesg_comp->stream_class, + dmesg_comp->stream = bt_stream_create(dmesg_comp->stream_class, NULL); if (!dmesg_comp->stream) { BT_LOGE_STR("Cannot create stream object."); goto error; } - dmesg_comp->packet = bt_ctf_packet_create(dmesg_comp->stream); + dmesg_comp->packet = bt_packet_create(dmesg_comp->stream); if (!dmesg_comp->packet) { BT_LOGE_STR("Cannot create packet object."); goto error; } - ft = bt_ctf_trace_get_packet_header_type(dmesg_comp->trace); + ft = bt_trace_get_packet_header_type(dmesg_comp->trace); assert(ft); field = create_packet_header_field(ft); if (!field) { @@ -591,7 +591,7 @@ int create_packet_and_stream(struct dmesg_component *dmesg_comp) goto error; } - ret = bt_ctf_packet_set_header(dmesg_comp->packet, field); + ret = bt_packet_set_header(dmesg_comp->packet, field); if (ret) { BT_LOGE_STR("Cannot set packet's header field."); goto error; @@ -599,7 +599,7 @@ int create_packet_and_stream(struct dmesg_component *dmesg_comp) bt_put(ft); bt_put(field); - ft = bt_ctf_stream_class_get_packet_context_type( + ft = bt_stream_class_get_packet_context_type( dmesg_comp->stream_class); assert(ft); field = create_packet_context_field(ft); @@ -608,13 +608,13 @@ int create_packet_and_stream(struct dmesg_component *dmesg_comp) goto error; } - ret = bt_ctf_packet_set_context(dmesg_comp->packet, field); + ret = bt_packet_set_context(dmesg_comp->packet, field); if (ret) { BT_LOGE_STR("Cannot set packet's context field."); goto error; } - ret = bt_ctf_trace_set_is_static(dmesg_comp->trace); + ret = bt_trace_set_is_static(dmesg_comp->trace); if (ret) { BT_LOGE_STR("Cannot make trace static."); goto error; @@ -759,17 +759,17 @@ static int create_event_header_from_line( struct dmesg_component *dmesg_comp, const char *line, const char **new_start, - struct bt_ctf_field **user_field, - struct bt_ctf_clock_value **user_clock_value) + struct bt_field **user_field, + struct bt_clock_value **user_clock_value) { bool has_timestamp = false; unsigned long sec, usec, msec; unsigned int year, mon, mday, hour, min; uint64_t ts = 0; - struct bt_ctf_clock_value *clock_value = NULL; - struct bt_ctf_field_type *ft = NULL; - struct bt_ctf_field *eh_field = NULL; - struct bt_ctf_field *ts_field = NULL; + struct bt_clock_value *clock_value = NULL; + struct bt_field_type *ft = NULL; + struct bt_field *eh_field = NULL; + struct bt_field *ts_field = NULL; int ret = 0; assert(user_clock_value); @@ -837,30 +837,30 @@ skip_ts: } if (dmesg_comp->clock_class) { - clock_value = bt_ctf_clock_value_create(dmesg_comp->clock_class, + clock_value = bt_clock_value_create(dmesg_comp->clock_class, ts); if (!clock_value) { BT_LOGE_STR("Cannot create clock value object."); goto error; } - ft = bt_ctf_stream_class_get_event_header_type( + ft = bt_stream_class_get_event_header_type( dmesg_comp->stream_class); assert(ft); - eh_field = bt_ctf_field_create(ft); + eh_field = bt_field_create(ft); if (!eh_field) { BT_LOGE_STR("Cannot create event header field object."); goto error; } - ts_field = bt_ctf_field_structure_get_field_by_name(eh_field, + ts_field = bt_field_structure_get_field_by_name(eh_field, "timestamp"); if (!ts_field) { BT_LOGE_STR("Cannot get `timestamp` field from structure field."); goto error; } - ret = bt_ctf_field_unsigned_integer_set_value(ts_field, ts); + ret = bt_field_unsigned_integer_set_value(ts_field, ts); if (ret) { BT_LOGE_STR("Cannot set integer field's value."); goto error; @@ -888,24 +888,24 @@ end: static int create_event_payload_from_line( struct dmesg_component *dmesg_comp, - const char *line, struct bt_ctf_field **user_field) + const char *line, struct bt_field **user_field) { - struct bt_ctf_field_type *ft = NULL; - struct bt_ctf_field *ep_field = NULL; - struct bt_ctf_field *str_field = NULL; + struct bt_field_type *ft = NULL; + struct bt_field *ep_field = NULL; + struct bt_field *str_field = NULL; size_t len; int ret; assert(user_field); - ft = bt_ctf_event_class_get_payload_type(dmesg_comp->event_class); + ft = bt_event_class_get_payload_type(dmesg_comp->event_class); assert(ft); - ep_field = bt_ctf_field_create(ft); + ep_field = bt_field_create(ft); if (!ep_field) { BT_LOGE_STR("Cannot create event payload field object."); goto error; } - str_field = bt_ctf_field_structure_get_field_by_name(ep_field, "str"); + str_field = bt_field_structure_get_field_by_name(ep_field, "str"); if (!str_field) { BT_LOGE_STR("Cannot get `timestamp` field from structure field."); goto error; @@ -917,7 +917,7 @@ int create_event_payload_from_line( len--; } - ret = bt_ctf_field_string_append_len(str_field, line, len); + ret = bt_field_string_append_len(str_field, line, len); if (ret) { BT_LOGE("Cannot append value to string field object: " "len=%zu", len); @@ -942,10 +942,10 @@ static struct bt_notification *create_notif_from_line( struct dmesg_component *dmesg_comp, const char *line) { - struct bt_ctf_field *eh_field = NULL; - struct bt_ctf_field *ep_field = NULL; - struct bt_ctf_clock_value *clock_value = NULL; - struct bt_ctf_event *event = NULL; + struct bt_field *eh_field = NULL; + struct bt_field *ep_field = NULL; + struct bt_clock_value *clock_value = NULL; + struct bt_event *event = NULL; struct bt_notification *notif = NULL; const char *new_start; int ret; @@ -967,34 +967,34 @@ struct bt_notification *create_notif_from_line( } assert(ep_field); - event = bt_ctf_event_create(dmesg_comp->event_class); + event = bt_event_create(dmesg_comp->event_class); if (!event) { BT_LOGE_STR("Cannot create event object."); goto error; } - ret = bt_ctf_event_set_packet(event, dmesg_comp->packet); + ret = bt_event_set_packet(event, dmesg_comp->packet); if (ret) { BT_LOGE_STR("Cannot set event's packet."); goto error; } if (eh_field) { - ret = bt_ctf_event_set_header(event, eh_field); + ret = bt_event_set_header(event, eh_field); if (ret) { BT_LOGE_STR("Cannot set event's header field."); goto error; } } - ret = bt_ctf_event_set_event_payload(event, ep_field); + ret = bt_event_set_event_payload(event, ep_field); if (ret) { BT_LOGE_STR("Cannot set event's payload field."); goto error; } if (clock_value) { - ret = bt_ctf_event_set_clock_value(event, clock_value); + ret = bt_event_set_clock_value(event, clock_value); if (ret) { BT_LOGE_STR("Cannot set event's clock value."); goto error; diff --git a/plugins/text/pretty/print.c b/plugins/text/pretty/print.c index 6972ed5d..e13b2bc6 100644 --- a/plugins/text/pretty/print.c +++ b/plugins/text/pretty/print.c @@ -54,7 +54,7 @@ struct timestamp { static enum bt_component_status print_field(struct pretty_component *pretty, - struct bt_ctf_field *field, bool print_names, + struct bt_field *field, bool print_names, GQuark *filters_fields, int filter_array_len); static @@ -81,20 +81,20 @@ void print_field_name_equal(struct pretty_component *pretty, const char *name) static void print_timestamp_cycles(struct pretty_component *pretty, - struct bt_ctf_clock_class *clock_class, - struct bt_ctf_event *event) + struct bt_clock_class *clock_class, + struct bt_event *event) { int ret; - struct bt_ctf_clock_value *clock_value; + struct bt_clock_value *clock_value; uint64_t cycles; - clock_value = bt_ctf_event_get_clock_value(event, clock_class); + clock_value = bt_event_get_clock_value(event, clock_class); if (!clock_value) { g_string_append(pretty->string, "????????????????????"); return; } - ret = bt_ctf_clock_value_get_value(clock_value, &cycles); + ret = bt_clock_value_get_value(clock_value, &cycles); bt_put(clock_value); if (ret) { // TODO: log, this is unexpected @@ -112,7 +112,7 @@ void print_timestamp_cycles(struct pretty_component *pretty, static void print_timestamp_wall(struct pretty_component *pretty, - struct bt_ctf_clock_value *clock_value) + struct bt_clock_value *clock_value) { int ret; int64_t ts_nsec = 0; /* add configurable offset */ @@ -125,7 +125,7 @@ void print_timestamp_wall(struct pretty_component *pretty, return; } - ret = bt_ctf_clock_value_get_value_ns_from_epoch(clock_value, &ts_nsec); + ret = bt_clock_value_get_value_ns_from_epoch(clock_value, &ts_nsec); if (ret) { // TODO: log, this is unexpected g_string_append(pretty->string, "Error"); @@ -227,29 +227,29 @@ end: static enum bt_component_status print_event_timestamp(struct pretty_component *pretty, - struct bt_ctf_event *event, + struct bt_event *event, struct bt_clock_class_priority_map *cc_prio_map, bool *start_line) { bool print_names = pretty->options.print_header_field_names; enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_stream *stream = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_clock_class *clock_class = NULL; + struct bt_stream *stream = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_trace *trace = NULL; + struct bt_clock_class *clock_class = NULL; - stream = bt_ctf_event_get_stream(event); + stream = bt_event_get_stream(event); if (!stream) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); if (!stream_class) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); if (!trace) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -279,8 +279,8 @@ enum bt_component_status print_event_timestamp(struct pretty_component *pretty, if (pretty->options.print_timestamp_cycles) { print_timestamp_cycles(pretty, clock_class, event); } else { - struct bt_ctf_clock_value *clock_value = - bt_ctf_event_get_clock_value(event, clock_class); + struct bt_clock_value *clock_value = + bt_event_get_clock_value(event, clock_class); print_timestamp_wall(pretty, clock_value); bt_put(clock_value); @@ -337,27 +337,27 @@ end: static enum bt_component_status print_event_header(struct pretty_component *pretty, - struct bt_ctf_event *event, + struct bt_event *event, struct bt_clock_class_priority_map *cc_prio_map) { bool print_names = pretty->options.print_header_field_names; enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_trace *trace_class = NULL; + struct bt_event_class *event_class = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_trace *trace_class = NULL; int dom_print = 0; - event_class = bt_ctf_event_get_class(event); + event_class = bt_event_get_class(event); if (!event_class) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - stream_class = bt_ctf_event_class_get_stream_class(event_class); + stream_class = bt_event_class_get_stream_class(event_class); if (!stream_class) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - trace_class = bt_ctf_stream_class_get_trace(stream_class); + trace_class = bt_stream_class_get_trace(stream_class); if (!trace_class) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -370,7 +370,7 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, if (pretty->options.print_trace_field) { const char *name; - name = bt_ctf_trace_get_name(trace_class); + name = bt_trace_get_name(trace_class); if (name) { if (!pretty->start_line) { g_string_append(pretty->string, ", "); @@ -389,7 +389,7 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, if (pretty->options.print_trace_hostname_field) { struct bt_value *hostname_str; - hostname_str = bt_ctf_trace_get_environment_field_value_by_name(trace_class, + hostname_str = bt_trace_get_environment_field_value_by_name(trace_class, "hostname"); if (hostname_str) { const char *str; @@ -411,7 +411,7 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, if (pretty->options.print_trace_domain_field) { struct bt_value *domain_str; - domain_str = bt_ctf_trace_get_environment_field_value_by_name(trace_class, + domain_str = bt_trace_get_environment_field_value_by_name(trace_class, "domain"); if (domain_str) { const char *str; @@ -435,7 +435,7 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, if (pretty->options.print_trace_procname_field) { struct bt_value *procname_str; - procname_str = bt_ctf_trace_get_environment_field_value_by_name(trace_class, + procname_str = bt_trace_get_environment_field_value_by_name(trace_class, "procname"); if (procname_str) { const char *str; @@ -459,7 +459,7 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, if (pretty->options.print_trace_vpid_field) { struct bt_value *vpid_value; - vpid_value = bt_ctf_trace_get_environment_field_value_by_name(trace_class, + vpid_value = bt_trace_get_environment_field_value_by_name(trace_class, "vpid"); if (vpid_value) { int64_t value; @@ -482,28 +482,28 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, } if (pretty->options.print_loglevel_field) { static const char *log_level_names[] = { - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_EMERGENCY ] = "TRACE_EMERG", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_ALERT ] = "TRACE_ALERT", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_CRITICAL ] = "TRACE_CRIT", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_ERROR ] = "TRACE_ERR", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_WARNING ] = "TRACE_WARNING", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_NOTICE ] = "TRACE_NOTICE", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO ] = "TRACE_INFO", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM ] = "TRACE_DEBUG_SYSTEM", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM ] = "TRACE_DEBUG_PROGRAM", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS ] = "TRACE_DEBUG_PROCESS", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE ] = "TRACE_DEBUG_MODULE", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT ] = "TRACE_DEBUG_UNIT", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION ] = "TRACE_DEBUG_FUNCTION", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE ] = "TRACE_DEBUG_LINE", - [ BT_CTF_EVENT_CLASS_LOG_LEVEL_DEBUG ] = "TRACE_DEBUG", + [ BT_EVENT_CLASS_LOG_LEVEL_EMERGENCY ] = "TRACE_EMERG", + [ BT_EVENT_CLASS_LOG_LEVEL_ALERT ] = "TRACE_ALERT", + [ BT_EVENT_CLASS_LOG_LEVEL_CRITICAL ] = "TRACE_CRIT", + [ BT_EVENT_CLASS_LOG_LEVEL_ERROR ] = "TRACE_ERR", + [ BT_EVENT_CLASS_LOG_LEVEL_WARNING ] = "TRACE_WARNING", + [ BT_EVENT_CLASS_LOG_LEVEL_NOTICE ] = "TRACE_NOTICE", + [ BT_EVENT_CLASS_LOG_LEVEL_INFO ] = "TRACE_INFO", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_SYSTEM ] = "TRACE_DEBUG_SYSTEM", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROGRAM ] = "TRACE_DEBUG_PROGRAM", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_PROCESS ] = "TRACE_DEBUG_PROCESS", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_MODULE ] = "TRACE_DEBUG_MODULE", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_UNIT ] = "TRACE_DEBUG_UNIT", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_FUNCTION ] = "TRACE_DEBUG_FUNCTION", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG_LINE ] = "TRACE_DEBUG_LINE", + [ BT_EVENT_CLASS_LOG_LEVEL_DEBUG ] = "TRACE_DEBUG", }; - enum bt_ctf_event_class_log_level log_level; + enum bt_event_class_log_level log_level; const char *log_level_str = NULL; - log_level = bt_ctf_event_class_get_log_level(event_class); - assert(log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN); - if (log_level != BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) { + log_level = bt_event_class_get_log_level(event_class); + assert(log_level != BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN); + if (log_level != BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED) { log_level_str = log_level_names[log_level]; } @@ -526,7 +526,7 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, if (pretty->options.print_emf_field) { const char *uri_str; - uri_str = bt_ctf_event_class_get_emf_uri(event_class); + uri_str = bt_event_class_get_emf_uri(event_class); if (uri_str) { if (!pretty->start_line) { g_string_append(pretty->string, ", "); @@ -554,7 +554,7 @@ enum bt_component_status print_event_header(struct pretty_component *pretty, if (pretty->use_colors) { g_string_append(pretty->string, COLOR_EVENT_NAME); } - g_string_append(pretty->string, bt_ctf_event_class_get_name(event_class)); + g_string_append(pretty->string, bt_event_class_get_name(event_class)); if (pretty->use_colors) { g_string_append(pretty->string, COLOR_RST); } @@ -572,12 +572,12 @@ end: static enum bt_component_status print_integer(struct pretty_component *pretty, - struct bt_ctf_field *field) + struct bt_field *field) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field_type *field_type = NULL; - enum bt_ctf_integer_base base; - enum bt_ctf_string_encoding encoding; + struct bt_field_type *field_type = NULL; + enum bt_integer_base base; + enum bt_string_encoding encoding; int signedness; union { uint64_t u; @@ -585,7 +585,7 @@ enum bt_component_status print_integer(struct pretty_component *pretty, } v; bool rst_color = false; - field_type = bt_ctf_field_get_type(field); + field_type = bt_field_get_type(field); if (!field_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -596,25 +596,25 @@ enum bt_component_status print_integer(struct pretty_component *pretty, goto end; } if (!signedness) { - if (bt_ctf_field_unsigned_integer_get_value(field, &v.u) < 0) { + if (bt_field_unsigned_integer_get_value(field, &v.u) < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } } else { - if (bt_ctf_field_signed_integer_get_value(field, &v.s) < 0) { + if (bt_field_signed_integer_get_value(field, &v.s) < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } } - encoding = bt_ctf_field_type_integer_get_encoding(field_type); + encoding = bt_field_type_integer_get_encoding(field_type); switch (encoding) { - case BT_CTF_STRING_ENCODING_UTF8: - case BT_CTF_STRING_ENCODING_ASCII: + case BT_STRING_ENCODING_UTF8: + case BT_STRING_ENCODING_ASCII: g_string_append_c(pretty->tmp_string, (int) v.u); goto end; - case BT_CTF_STRING_ENCODING_NONE: - case BT_CTF_STRING_ENCODING_UNKNOWN: + case BT_STRING_ENCODING_NONE: + case BT_STRING_ENCODING_UNKNOWN: break; default: ret = BT_COMPONENT_STATUS_ERROR; @@ -626,13 +626,13 @@ enum bt_component_status print_integer(struct pretty_component *pretty, rst_color = true; } - base = bt_ctf_field_type_integer_get_base(field_type); + base = bt_field_type_integer_get_base(field_type); switch (base) { - case BT_CTF_INTEGER_BASE_BINARY: + case BT_INTEGER_BASE_BINARY: { int bitnr, len; - len = bt_ctf_field_type_integer_get_size(field_type); + len = bt_field_type_integer_get_size(field_type); if (len < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -645,12 +645,12 @@ enum bt_component_status print_integer(struct pretty_component *pretty, } break; } - case BT_CTF_INTEGER_BASE_OCTAL: + case BT_INTEGER_BASE_OCTAL: { if (signedness) { int len; - len = bt_ctf_field_type_integer_get_size(field_type); + len = bt_field_type_integer_get_size(field_type); if (len < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -668,19 +668,19 @@ enum bt_component_status print_integer(struct pretty_component *pretty, g_string_append_printf(pretty->string, "0%" PRIo64, v.u); break; } - case BT_CTF_INTEGER_BASE_DECIMAL: - case BT_CTF_INTEGER_BASE_UNSPECIFIED: + case BT_INTEGER_BASE_DECIMAL: + case BT_INTEGER_BASE_UNSPECIFIED: if (!signedness) { g_string_append_printf(pretty->string, "%" PRIu64, v.u); } else { g_string_append_printf(pretty->string, "%" PRId64, v.s); } break; - case BT_CTF_INTEGER_BASE_HEXADECIMAL: + case BT_INTEGER_BASE_HEXADECIMAL: { int len; - len = bt_ctf_field_type_integer_get_size(field_type); + len = bt_field_type_integer_get_size(field_type); if (len < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -777,27 +777,27 @@ void print_escape_string(struct pretty_component *pretty, const char *str) static enum bt_component_status print_enum(struct pretty_component *pretty, - struct bt_ctf_field *field) + struct bt_field *field) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *container_field = NULL; - struct bt_ctf_field_type *enumeration_field_type = NULL; - struct bt_ctf_field_type *container_field_type = NULL; - struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; + struct bt_field *container_field = NULL; + struct bt_field_type *enumeration_field_type = NULL; + struct bt_field_type *container_field_type = NULL; + struct bt_field_type_enumeration_mapping_iterator *iter = NULL; int nr_mappings = 0; int is_signed; - enumeration_field_type = bt_ctf_field_get_type(field); + enumeration_field_type = bt_field_get_type(field); if (!enumeration_field_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - container_field = bt_ctf_field_enumeration_get_container(field); + container_field = bt_field_enumeration_get_container(field); if (!container_field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - container_field_type = bt_ctf_field_get_type(container_field); + container_field_type = bt_field_get_type(container_field); if (!container_field_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -810,26 +810,26 @@ enum bt_component_status print_enum(struct pretty_component *pretty, if (is_signed) { int64_t value; - if (bt_ctf_field_signed_integer_get_value(container_field, + if (bt_field_signed_integer_get_value(container_field, &value)) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - iter = bt_ctf_field_type_enumeration_find_mappings_by_signed_value( + iter = bt_field_type_enumeration_find_mappings_by_signed_value( enumeration_field_type, value); } else { uint64_t value; - if (bt_ctf_field_unsigned_integer_get_value(container_field, + if (bt_field_unsigned_integer_get_value(container_field, &value)) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value( + iter = bt_field_type_enumeration_find_mappings_by_unsigned_value( enumeration_field_type, value); } g_string_append(pretty->string, "( "); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); if (ret) { if (pretty->use_colors) { g_string_append(pretty->string, COLOR_UNKNOWN); @@ -843,7 +843,7 @@ enum bt_component_status print_enum(struct pretty_component *pretty, for (;;) { const char *mapping_name; - if (bt_ctf_field_type_enumeration_mapping_iterator_get_signed( + if (bt_field_type_enumeration_mapping_iterator_get_signed( iter, &mapping_name, NULL, NULL) < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -857,7 +857,7 @@ enum bt_component_status print_enum(struct pretty_component *pretty, if (pretty->use_colors) { g_string_append(pretty->string, COLOR_RST); } - if (bt_ctf_field_type_enumeration_mapping_iterator_next(iter) < 0) { + if (bt_field_type_enumeration_mapping_iterator_next(iter) < 0) { break; } } @@ -897,22 +897,22 @@ int filter_field_name(struct pretty_component *pretty, const char *field_name, static enum bt_component_status print_struct_field(struct pretty_component *pretty, - struct bt_ctf_field *_struct, - struct bt_ctf_field_type *struct_type, + struct bt_field *_struct, + struct bt_field_type *struct_type, int i, bool print_names, int *nr_printed_fields, GQuark *filter_fields, int filter_array_len) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; const char *field_name; - struct bt_ctf_field *field = NULL; - struct bt_ctf_field_type *field_type = NULL;; + struct bt_field *field = NULL; + struct bt_field_type *field_type = NULL;; - field = bt_ctf_field_structure_get_field_by_index(_struct, i); + field = bt_field_structure_get_field_by_index(_struct, i); if (!field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - if (bt_ctf_field_type_structure_get_field(struct_type, + if (bt_field_type_structure_get_field_by_index(struct_type, &field_name, &field_type, i) < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -942,19 +942,19 @@ end: static enum bt_component_status print_struct(struct pretty_component *pretty, - struct bt_ctf_field *_struct, bool print_names, + struct bt_field *_struct, bool print_names, GQuark *filter_fields, int filter_array_len) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field_type *struct_type = NULL; + struct bt_field_type *struct_type = NULL; int nr_fields, i, nr_printed_fields; - struct_type = bt_ctf_field_get_type(_struct); + struct_type = bt_field_get_type(_struct); if (!struct_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - nr_fields = bt_ctf_field_type_structure_get_field_count(struct_type); + nr_fields = bt_field_type_structure_get_field_count(struct_type); if (nr_fields < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -979,11 +979,11 @@ end: static enum bt_component_status print_array_field(struct pretty_component *pretty, - struct bt_ctf_field *array, uint64_t i, + struct bt_field *array, uint64_t i, bool is_string, bool print_names) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *field = NULL; + struct bt_field *field = NULL; if (!is_string) { if (i != 0) { @@ -995,7 +995,7 @@ enum bt_component_status print_array_field(struct pretty_component *pretty, g_string_append_printf(pretty->string, "[%" PRIu64 "] = ", i); } } - field = bt_ctf_field_array_get_field(array, i); + field = bt_field_array_get_field(array, i); if (!field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -1008,44 +1008,44 @@ end: static enum bt_component_status print_array(struct pretty_component *pretty, - struct bt_ctf_field *array, bool print_names) + struct bt_field *array, bool print_names) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field_type *array_type = NULL, *field_type = NULL; - enum bt_ctf_field_type_id type_id; + struct bt_field_type *array_type = NULL, *field_type = NULL; + enum bt_field_type_id type_id; int64_t len; uint64_t i; bool is_string = false; - array_type = bt_ctf_field_get_type(array); + array_type = bt_field_get_type(array); if (!array_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - field_type = bt_ctf_field_type_array_get_element_type(array_type); + field_type = bt_field_type_array_get_element_type(array_type); if (!field_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - len = bt_ctf_field_type_array_get_length(array_type); + len = bt_field_type_array_get_length(array_type); if (len < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - type_id = bt_ctf_field_type_get_type_id(field_type); - if (type_id == BT_CTF_FIELD_TYPE_ID_INTEGER) { - enum bt_ctf_string_encoding encoding; + type_id = bt_field_type_get_type_id(field_type); + if (type_id == BT_FIELD_TYPE_ID_INTEGER) { + enum bt_string_encoding encoding; - encoding = bt_ctf_field_type_integer_get_encoding(field_type); - if (encoding == BT_CTF_STRING_ENCODING_UTF8 - || encoding == BT_CTF_STRING_ENCODING_ASCII) { + encoding = bt_field_type_integer_get_encoding(field_type); + if (encoding == BT_STRING_ENCODING_UTF8 + || encoding == BT_STRING_ENCODING_ASCII) { int integer_len, integer_alignment; - integer_len = bt_ctf_field_type_integer_get_size(field_type); + integer_len = bt_field_type_integer_get_size(field_type); if (integer_len < 0) { return BT_COMPONENT_STATUS_ERROR; } - integer_alignment = bt_ctf_field_type_get_alignment(field_type); + integer_alignment = bt_field_type_get_alignment(field_type); if (integer_alignment < 0) { return BT_COMPONENT_STATUS_ERROR; } @@ -1090,11 +1090,11 @@ end: static enum bt_component_status print_sequence_field(struct pretty_component *pretty, - struct bt_ctf_field *seq, uint64_t i, + struct bt_field *seq, uint64_t i, bool is_string, bool print_names) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *field = NULL; + struct bt_field *field = NULL; if (!is_string) { if (i != 0) { @@ -1106,7 +1106,7 @@ enum bt_component_status print_sequence_field(struct pretty_component *pretty, g_string_append_printf(pretty->string, "[%" PRIu64 "] = ", i); } } - field = bt_ctf_field_sequence_get_field(seq, i); + field = bt_field_sequence_get_field(seq, i); if (!field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -1119,50 +1119,50 @@ end: static enum bt_component_status print_sequence(struct pretty_component *pretty, - struct bt_ctf_field *seq, bool print_names) + struct bt_field *seq, bool print_names) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field_type *seq_type = NULL, *field_type = NULL; - struct bt_ctf_field *length_field = NULL; - enum bt_ctf_field_type_id type_id; + struct bt_field_type *seq_type = NULL, *field_type = NULL; + struct bt_field *length_field = NULL; + enum bt_field_type_id type_id; uint64_t len; uint64_t i; bool is_string = false; - seq_type = bt_ctf_field_get_type(seq); + seq_type = bt_field_get_type(seq); if (!seq_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - length_field = bt_ctf_field_sequence_get_length(seq); + length_field = bt_field_sequence_get_length(seq); if (!length_field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - if (bt_ctf_field_unsigned_integer_get_value(length_field, &len) < 0) { + if (bt_field_unsigned_integer_get_value(length_field, &len) < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - field_type = bt_ctf_field_type_sequence_get_element_type(seq_type); + field_type = bt_field_type_sequence_get_element_type(seq_type); if (!field_type) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - type_id = bt_ctf_field_type_get_type_id(field_type); - if (type_id == BT_CTF_FIELD_TYPE_ID_INTEGER) { - enum bt_ctf_string_encoding encoding; + type_id = bt_field_type_get_type_id(field_type); + if (type_id == BT_FIELD_TYPE_ID_INTEGER) { + enum bt_string_encoding encoding; - encoding = bt_ctf_field_type_integer_get_encoding(field_type); - if (encoding == BT_CTF_STRING_ENCODING_UTF8 - || encoding == BT_CTF_STRING_ENCODING_ASCII) { + encoding = bt_field_type_integer_get_encoding(field_type); + if (encoding == BT_STRING_ENCODING_UTF8 + || encoding == BT_STRING_ENCODING_ASCII) { int integer_len, integer_alignment; - integer_len = bt_ctf_field_type_integer_get_size(field_type); + integer_len = bt_field_type_integer_get_size(field_type); if (integer_len < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - integer_alignment = bt_ctf_field_type_get_alignment(field_type); + integer_alignment = bt_field_type_get_alignment(field_type); if (integer_alignment < 0) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -1210,12 +1210,12 @@ end: static enum bt_component_status print_variant(struct pretty_component *pretty, - struct bt_ctf_field *variant, bool print_names) + struct bt_field *variant, bool print_names) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *field = NULL; + struct bt_field *field = NULL; - field = bt_ctf_field_variant_get_current_field(variant); + field = bt_field_variant_get_current_field(variant); if (!field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; @@ -1224,18 +1224,18 @@ enum bt_component_status print_variant(struct pretty_component *pretty, pretty->depth++; if (print_names) { int iter_ret; - struct bt_ctf_field *tag_field = NULL; + struct bt_field *tag_field = NULL; const char *tag_choice; - struct bt_ctf_field_type_enumeration_mapping_iterator *iter; + struct bt_field_type_enumeration_mapping_iterator *iter; - tag_field = bt_ctf_field_variant_get_tag(variant); + tag_field = bt_field_variant_get_tag(variant); if (!tag_field) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - iter = bt_ctf_field_enumeration_get_mappings(tag_field); - iter_ret = bt_ctf_field_type_enumeration_mapping_iterator_next( + iter = bt_field_enumeration_get_mappings(tag_field); + iter_ret = bt_field_type_enumeration_mapping_iterator_next( iter); if (!iter || ret) { bt_put(tag_field); @@ -1244,7 +1244,7 @@ enum bt_component_status print_variant(struct pretty_component *pretty, } iter_ret = - bt_ctf_field_type_enumeration_mapping_iterator_get_signed( + bt_field_type_enumeration_mapping_iterator_get_signed( iter, &tag_choice, NULL, NULL); if (iter_ret) { bt_put(iter); @@ -1269,12 +1269,12 @@ end: static enum bt_component_status print_field(struct pretty_component *pretty, - struct bt_ctf_field *field, bool print_names, + struct bt_field *field, bool print_names, GQuark *filter_fields, int filter_array_len) { - enum bt_ctf_field_type_id type_id; + enum bt_field_type_id type_id; - type_id = bt_ctf_field_get_type_id(field); + type_id = bt_field_get_type_id(field); switch (type_id) { case CTF_TYPE_INTEGER: return print_integer(pretty, field); @@ -1282,7 +1282,7 @@ enum bt_component_status print_field(struct pretty_component *pretty, { double v; - if (bt_ctf_field_floating_point_get_value(field, &v)) { + if (bt_field_floating_point_get_value(field, &v)) { return BT_COMPONENT_STATUS_ERROR; } if (pretty->use_colors) { @@ -1300,7 +1300,7 @@ enum bt_component_status print_field(struct pretty_component *pretty, { const char *str; - str = bt_ctf_field_string_get_value(field); + str = bt_field_string_get_value(field); if (!str) { return BT_COMPONENT_STATUS_ERROR; } @@ -1332,18 +1332,18 @@ enum bt_component_status print_field(struct pretty_component *pretty, static enum bt_component_status print_stream_packet_context(struct pretty_component *pretty, - struct bt_ctf_event *event) + struct bt_event *event) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_packet *packet = NULL; - struct bt_ctf_field *main_field = NULL; + struct bt_packet *packet = NULL; + struct bt_field *main_field = NULL; - packet = bt_ctf_event_get_packet(event); + packet = bt_event_get_packet(event); if (!packet) { ret = BT_COMPONENT_STATUS_ERROR; goto end; } - main_field = bt_ctf_packet_get_context(packet); + main_field = bt_packet_get_context(packet); if (!main_field) { goto end; } @@ -1366,12 +1366,12 @@ end: static enum bt_component_status print_event_header_raw(struct pretty_component *pretty, - struct bt_ctf_event *event) + struct bt_event *event) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *main_field = NULL; + struct bt_field *main_field = NULL; - main_field = bt_ctf_event_get_header(event); + main_field = bt_event_get_header(event); if (!main_field) { goto end; } @@ -1391,12 +1391,12 @@ end: static enum bt_component_status print_stream_event_context(struct pretty_component *pretty, - struct bt_ctf_event *event) + struct bt_event *event) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *main_field = NULL; + struct bt_field *main_field = NULL; - main_field = bt_ctf_event_get_stream_event_context(event); + main_field = bt_event_get_stream_event_context(event); if (!main_field) { goto end; } @@ -1416,12 +1416,12 @@ end: static enum bt_component_status print_event_context(struct pretty_component *pretty, - struct bt_ctf_event *event) + struct bt_event *event) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *main_field = NULL; + struct bt_field *main_field = NULL; - main_field = bt_ctf_event_get_event_context(event); + main_field = bt_event_get_event_context(event); if (!main_field) { goto end; } @@ -1441,12 +1441,12 @@ end: static enum bt_component_status print_event_payload(struct pretty_component *pretty, - struct bt_ctf_event *event) + struct bt_event *event) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_field *main_field = NULL; + struct bt_field *main_field = NULL; - main_field = bt_ctf_event_get_event_payload(event); + main_field = bt_event_get_event_payload(event); if (!main_field) { goto end; } @@ -1486,7 +1486,7 @@ enum bt_component_status pretty_print_event(struct pretty_component *pretty, struct bt_notification *event_notif) { enum bt_component_status ret; - struct bt_ctf_event *event = + struct bt_event *event = bt_notification_event_get_event(event_notif); struct bt_clock_class_priority_map *cc_prio_map = bt_notification_event_get_clock_class_priority_map(event_notif); @@ -1545,9 +1545,9 @@ enum bt_component_status pretty_print_discarded_elements( struct bt_notification *notif) { enum bt_component_status ret = BT_COMPONENT_STATUS_OK; - struct bt_ctf_stream *stream = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_trace *trace = NULL; + struct bt_stream *stream = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_trace *trace = NULL; const char *stream_name; const char *trace_name; const unsigned char *trace_uuid; @@ -1555,7 +1555,7 @@ enum bt_component_status pretty_print_discarded_elements( int64_t stream_id; bool is_discarded_events; int64_t count; - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_value *clock_value = NULL; /* Stream name */ switch (bt_notification_get_type(notif)) { @@ -1574,26 +1574,26 @@ enum bt_component_status pretty_print_discarded_elements( } assert(stream); - stream_name = bt_ctf_stream_get_name(stream); + stream_name = bt_stream_get_name(stream); /* Stream class ID */ - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); - stream_class_id = bt_ctf_stream_class_get_id(stream_class); + stream_class_id = bt_stream_class_get_id(stream_class); /* Stream ID */ - stream_id = bt_ctf_stream_get_id(stream); + stream_id = bt_stream_get_id(stream); /* Trace path */ - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); - trace_name = bt_ctf_trace_get_name(trace); + trace_name = bt_trace_get_name(trace); if (!trace_name) { trace_name = "(unknown)"; } /* Trace UUID */ - trace_uuid = bt_ctf_trace_get_uuid(trace); + trace_uuid = bt_trace_get_uuid(trace); /* * Print to standard error stream to remain backward compatible diff --git a/plugins/utils/muxer/muxer.c b/plugins/utils/muxer/muxer.c index efecf6c9..a99f1e27 100644 --- a/plugins/utils/muxer/muxer.c +++ b/plugins/utils/muxer/muxer.c @@ -592,9 +592,9 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, int64_t *ts_ns) { struct bt_clock_class_priority_map *cc_prio_map = NULL; - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; - struct bt_ctf_event *event = NULL; + struct bt_clock_class *clock_class = NULL; + struct bt_clock_value *clock_value = NULL; + struct bt_event *event = NULL; int ret = 0; const unsigned char *cc_uuid; const char *cc_name; @@ -653,8 +653,8 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, goto error; } - cc_uuid = bt_ctf_clock_class_get_uuid(clock_class); - cc_name = bt_ctf_clock_class_get_name(clock_class); + cc_uuid = bt_clock_class_get_uuid(clock_class); + cc_name = bt_clock_class_get_name(clock_class); if (muxer_notif_iter->clock_class_expectation == MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ANY) { @@ -665,7 +665,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, * the iterator without a true * `assume-absolute-clock-classes` parameter. */ - if (bt_ctf_clock_class_is_absolute(clock_class)) { + if (bt_clock_class_is_absolute(clock_class)) { /* Expect absolute clock classes */ muxer_notif_iter->clock_class_expectation = MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE; @@ -693,7 +693,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, if (!muxer_comp->assume_absolute_clock_classes) { switch (muxer_notif_iter->clock_class_expectation) { case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE: - if (!bt_ctf_clock_class_is_absolute(clock_class)) { + if (!bt_clock_class_is_absolute(clock_class)) { BT_LOGE("Expecting an absolute clock class, " "but got a non-absolute one: " "clock-class-addr=%p, clock-class-name=\"%s\"", @@ -702,7 +702,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, } break; case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID: - if (bt_ctf_clock_class_is_absolute(clock_class)) { + if (bt_clock_class_is_absolute(clock_class)) { BT_LOGE("Expecting a non-absolute clock class with no UUID, " "but got an absolute one: " "clock-class-addr=%p, clock-class-name=\"%s\"", @@ -736,7 +736,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, } break; case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID: - if (bt_ctf_clock_class_is_absolute(clock_class)) { + if (bt_clock_class_is_absolute(clock_class)) { BT_LOGE("Expecting a non-absolute clock class with a specific UUID, " "but got an absolute one: " "clock-class-addr=%p, clock-class-name=\"%s\"", @@ -808,7 +808,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, case BT_NOTIFICATION_TYPE_EVENT: event = bt_notification_event_get_event(notif); assert(event); - clock_value = bt_ctf_event_get_clock_value(event, + clock_value = bt_event_get_clock_value(event, clock_class); break; case BT_NOTIFICATION_TYPE_INACTIVITY: @@ -828,7 +828,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp, goto error; } - ret = bt_ctf_clock_value_get_value_ns_from_epoch(clock_value, ts_ns); + ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ts_ns); if (ret) { BT_LOGE("Cannot get nanoseconds from Epoch of clock value: " "clock-value-addr=%p", clock_value); diff --git a/plugins/utils/trimmer/copy.c b/plugins/utils/trimmer/copy.c index e7156efb..8b48e754 100644 --- a/plugins/utils/trimmer/copy.c +++ b/plugins/utils/trimmer/copy.c @@ -36,24 +36,24 @@ #include "iterator.h" static -struct bt_ctf_packet *lookup_packet(struct trimmer_iterator *trim_it, - struct bt_ctf_packet *packet) +struct bt_packet *lookup_packet(struct trimmer_iterator *trim_it, + struct bt_packet *packet) { - return (struct bt_ctf_packet *) g_hash_table_lookup( + return (struct bt_packet *) g_hash_table_lookup( trim_it->packet_map, (gpointer) packet); } static -struct bt_ctf_packet *insert_new_packet(struct trimmer_iterator *trim_it, - struct bt_ctf_packet *packet, - struct bt_ctf_stream *stream) +struct bt_packet *insert_new_packet(struct trimmer_iterator *trim_it, + struct bt_packet *packet, + struct bt_stream *stream) { - struct bt_ctf_packet *writer_packet = NULL; + struct bt_packet *writer_packet = NULL; int ret; BT_LOGD_STR("Inserting a new packet."); - writer_packet = bt_ctf_packet_create(stream); + writer_packet = bt_packet_create(stream); if (!writer_packet) { BT_LOGE_STR("Failed to create a new packet."); goto error; @@ -77,37 +77,37 @@ end: BT_HIDDEN enum bt_component_status update_packet_context_field(FILE *err, - struct bt_ctf_packet *writer_packet, + struct bt_packet *writer_packet, const char *name, int64_t value) { enum bt_component_status ret; - struct bt_ctf_field *packet_context = NULL, *writer_packet_context = NULL; - struct bt_ctf_field_type *struct_type = NULL, *field_type = NULL; - struct bt_ctf_field *field = NULL, *writer_field = NULL; + struct bt_field *packet_context = NULL, *writer_packet_context = NULL; + struct bt_field_type *struct_type = NULL, *field_type = NULL; + struct bt_field *field = NULL, *writer_field = NULL; int nr_fields, i, int_ret; BT_LOGD("Updating packet context field: name=%s", name); - packet_context = bt_ctf_packet_get_context(writer_packet); + packet_context = bt_packet_get_context(writer_packet); assert(packet_context); - struct_type = bt_ctf_field_get_type(packet_context); + struct_type = bt_field_get_type(packet_context); assert(struct_type); - writer_packet_context = bt_ctf_packet_get_context(writer_packet); + writer_packet_context = bt_packet_get_context(writer_packet); assert(writer_packet_context); - nr_fields = bt_ctf_field_type_structure_get_field_count(struct_type); + nr_fields = bt_field_type_structure_get_field_count(struct_type); for (i = 0; i < nr_fields; i++) { const char *field_name; - field = bt_ctf_field_structure_get_field_by_index( + field = bt_field_structure_get_field_by_index( packet_context, i); if (!field) { BT_LOGE("Failed to get field in packet-context: field-name=\"%s\"", name); goto error; } - if (bt_ctf_field_type_structure_get_field(struct_type, + if (bt_field_type_structure_get_field_by_index(struct_type, &field_name, &field_type, i) < 0) { BT_LOGE("Failed to get field: field-name=\"%s\"", field_name); @@ -118,18 +118,18 @@ enum bt_component_status update_packet_context_field(FILE *err, BT_PUT(field); continue; } - if (bt_ctf_field_type_get_type_id(field_type) != - BT_CTF_FIELD_TYPE_ID_INTEGER) { + if (bt_field_type_get_type_id(field_type) != + BT_FIELD_TYPE_ID_INTEGER) { BT_LOGE("Expecting an integer for this field: field-name=\"%s\"", name); goto error; } - writer_field = bt_ctf_field_structure_get_field(writer_packet_context, + writer_field = bt_field_structure_get_field_by_name(writer_packet_context, field_name); assert(writer_field); - int_ret = bt_ctf_field_unsigned_integer_set_value(writer_field, value); + int_ret = bt_field_unsigned_integer_set_value(writer_field, value); assert(int_ret == 0); BT_PUT(writer_field); @@ -152,15 +152,15 @@ end: } BT_HIDDEN -struct bt_ctf_packet *trimmer_new_packet( +struct bt_packet *trimmer_new_packet( struct trimmer_iterator *trim_it, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { - struct bt_ctf_stream *stream = NULL; - struct bt_ctf_packet *writer_packet = NULL; + struct bt_stream *stream = NULL; + struct bt_packet *writer_packet = NULL; int int_ret; - stream = bt_ctf_packet_get_stream(packet); + stream = bt_packet_get_stream(packet); assert(stream); /* @@ -197,11 +197,11 @@ end: } BT_HIDDEN -struct bt_ctf_packet *trimmer_close_packet( +struct bt_packet *trimmer_close_packet( struct trimmer_iterator *trim_it, - struct bt_ctf_packet *packet) + struct bt_packet *packet) { - struct bt_ctf_packet *writer_packet = NULL; + struct bt_packet *writer_packet = NULL; writer_packet = lookup_packet(trim_it, packet); if (!writer_packet) { @@ -216,30 +216,30 @@ end: } BT_HIDDEN -struct bt_ctf_event *trimmer_output_event( +struct bt_event *trimmer_output_event( struct trimmer_iterator *trim_it, - struct bt_ctf_event *event) + struct bt_event *event) { - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_event *writer_event = NULL; - struct bt_ctf_packet *packet = NULL, *writer_packet = NULL; + struct bt_event_class *event_class = NULL; + struct bt_event *writer_event = NULL; + struct bt_packet *packet = NULL, *writer_packet = NULL; const char *event_name; int int_ret; - event_class = bt_ctf_event_get_class(event); + event_class = bt_event_get_class(event); assert(event_class); - event_name = bt_ctf_event_class_get_name(event_class); + event_name = bt_event_class_get_name(event_class); writer_event = ctf_copy_event(trim_it->err, event, event_class, false); if (!writer_event) { BT_LOGE("Failed to copy event: event-class-name=\"%s\", event-name=\"%s\"", - bt_ctf_event_class_get_name(event_class), + bt_event_class_get_name(event_class), event_name); goto error; } - packet = bt_ctf_event_get_packet(event); + packet = bt_event_get_packet(event); assert(packet); writer_packet = lookup_packet(trim_it, packet); @@ -249,10 +249,10 @@ struct bt_ctf_event *trimmer_output_event( } bt_get(writer_packet); - int_ret = bt_ctf_event_set_packet(writer_event, writer_packet); + int_ret = bt_event_set_packet(writer_event, writer_packet); if (int_ret < 0) { BT_LOGE("Failed to append event: event-class-name=\"%s\", event-name=\"%s\"", - bt_ctf_event_class_get_name(event_class), + bt_event_class_get_name(event_class), event_name); goto error; } diff --git a/plugins/utils/trimmer/copy.h b/plugins/utils/trimmer/copy.h index 3a034031..0ee0899f 100644 --- a/plugins/utils/trimmer/copy.h +++ b/plugins/utils/trimmer/copy.h @@ -32,17 +32,17 @@ #include BT_HIDDEN -struct bt_ctf_event *trimmer_output_event(struct trimmer_iterator *trim_it, - struct bt_ctf_event *event); +struct bt_event *trimmer_output_event(struct trimmer_iterator *trim_it, + struct bt_event *event); BT_HIDDEN -struct bt_ctf_packet *trimmer_new_packet(struct trimmer_iterator *trim_it, - struct bt_ctf_packet *packet); +struct bt_packet *trimmer_new_packet(struct trimmer_iterator *trim_it, + struct bt_packet *packet); BT_HIDDEN -struct bt_ctf_packet *trimmer_close_packet(struct trimmer_iterator *trim_it, - struct bt_ctf_packet *packet); +struct bt_packet *trimmer_close_packet(struct trimmer_iterator *trim_it, + struct bt_packet *packet); BT_HIDDEN enum bt_component_status update_packet_context_field(FILE *err, - struct bt_ctf_packet *writer_packet, + struct bt_packet *writer_packet, const char *name, int64_t value); #endif /* BABELTRACE_PLUGIN_TRIMMER_COPY_H */ diff --git a/plugins/utils/trimmer/iterator.c b/plugins/utils/trimmer/iterator.c index f7094c90..4c8702b6 100644 --- a/plugins/utils/trimmer/iterator.c +++ b/plugins/utils/trimmer/iterator.c @@ -42,7 +42,7 @@ static gboolean close_packets(gpointer key, gpointer value, gpointer user_data) { - struct bt_ctf_packet *writer_packet = value; + struct bt_packet *writer_packet = value; bt_put(writer_packet); return TRUE; @@ -189,13 +189,13 @@ struct bt_notification *evaluate_event_notification( { int64_t ts; int clock_ret; - struct bt_ctf_event *event = NULL, *writer_event; + struct bt_event *event = NULL, *writer_event; bool in_range = true; - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_trace *trace = NULL; - struct bt_ctf_stream *stream = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_clock_class *clock_class = NULL; + struct bt_trace *trace = NULL; + struct bt_stream *stream = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_clock_value *clock_value = NULL; bool lazy_update = false; struct bt_notification *new_notification = NULL; struct bt_clock_class_priority_map *cc_prio_map; @@ -211,28 +211,28 @@ struct bt_notification *evaluate_event_notification( assert(new_notification); bt_put(cc_prio_map); - stream = bt_ctf_event_get_stream(event); + stream = bt_event_get_stream(event); assert(stream); - stream_class = bt_ctf_stream_get_class(stream); + stream_class = bt_stream_get_class(stream); assert(stream_class); - trace = bt_ctf_stream_class_get_trace(stream_class); + trace = bt_stream_class_get_trace(stream_class); assert(trace); /* FIXME multi-clock? */ - clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0); + clock_class = bt_trace_get_clock_class_by_index(trace, 0); if (!clock_class) { goto end; } - clock_value = bt_ctf_event_get_clock_value(event, clock_class); + clock_value = bt_event_get_clock_value(event, clock_class); if (!clock_value) { BT_LOGE_STR("Failed to retrieve clock value."); goto error; } - clock_ret = bt_ctf_clock_value_get_value_ns_from_epoch( + clock_ret = bt_clock_value_get_value_ns_from_epoch( clock_value, &ts); if (clock_ret) { BT_LOGE_STR("Failed to retrieve clock value timestamp."); @@ -275,18 +275,18 @@ end: } static -int ns_from_integer_field(struct bt_ctf_field *integer, int64_t *ns) +int ns_from_integer_field(struct bt_field *integer, int64_t *ns) { int ret = 0; int is_signed; uint64_t raw_clock_value; - struct bt_ctf_field_type *integer_type = NULL; - struct bt_ctf_clock_class *clock_class = NULL; - struct bt_ctf_clock_value *clock_value = NULL; + struct bt_field_type *integer_type = NULL; + struct bt_clock_class *clock_class = NULL; + struct bt_clock_value *clock_value = NULL; - integer_type = bt_ctf_field_get_type(integer); + integer_type = bt_field_get_type(integer); assert(integer_type); - clock_class = bt_ctf_field_type_integer_get_mapped_clock_class( + clock_class = bt_field_type_integer_get_mapped_clock_class( integer_type); if (!clock_class) { ret = -1; @@ -295,7 +295,7 @@ int ns_from_integer_field(struct bt_ctf_field *integer, int64_t *ns) is_signed = bt_ctf_field_type_integer_get_signed(integer_type); if (!is_signed) { - ret = bt_ctf_field_unsigned_integer_get_value(integer, + ret = bt_field_unsigned_integer_get_value(integer, &raw_clock_value); if (ret) { goto end; @@ -306,12 +306,12 @@ int ns_from_integer_field(struct bt_ctf_field *integer, int64_t *ns) goto end; } - clock_value = bt_ctf_clock_value_create(clock_class, raw_clock_value); + clock_value = bt_clock_value_create(clock_class, raw_clock_value); if (!clock_value) { goto end; } - ret = bt_ctf_clock_value_get_value_ns_from_epoch(clock_value, ns); + ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ns); end: bt_put(integer_type); bt_put(clock_class); @@ -336,39 +336,39 @@ static uint64_t ns_from_value(uint64_t frequency, uint64_t value) * timestamp minus the offset. */ static -int64_t get_raw_timestamp(struct bt_ctf_packet *writer_packet, +int64_t get_raw_timestamp(struct bt_packet *writer_packet, int64_t timestamp) { - struct bt_ctf_clock_class *writer_clock_class; + struct bt_clock_class *writer_clock_class; int64_t sec_offset, cycles_offset, ns; - struct bt_ctf_trace *writer_trace; - struct bt_ctf_stream *writer_stream; - struct bt_ctf_stream_class *writer_stream_class; + struct bt_trace *writer_trace; + struct bt_stream *writer_stream; + struct bt_stream_class *writer_stream_class; int ret; uint64_t freq; - writer_stream = bt_ctf_packet_get_stream(writer_packet); + writer_stream = bt_packet_get_stream(writer_packet); assert(writer_stream); - writer_stream_class = bt_ctf_stream_get_class(writer_stream); + writer_stream_class = bt_stream_get_class(writer_stream); assert(writer_stream_class); - writer_trace = bt_ctf_stream_class_get_trace(writer_stream_class); + writer_trace = bt_stream_class_get_trace(writer_stream_class); assert(writer_trace); /* FIXME multi-clock? */ - writer_clock_class = bt_ctf_trace_get_clock_class_by_index( + writer_clock_class = bt_trace_get_clock_class_by_index( writer_trace, 0); assert(writer_clock_class); - ret = bt_ctf_clock_class_get_offset_s(writer_clock_class, &sec_offset); + ret = bt_clock_class_get_offset_s(writer_clock_class, &sec_offset); assert(!ret); ns = sec_offset * NSEC_PER_SEC; - freq = bt_ctf_clock_class_get_frequency(writer_clock_class); + freq = bt_clock_class_get_frequency(writer_clock_class); assert(freq != -1ULL); - ret = bt_ctf_clock_class_get_offset_cycles(writer_clock_class, &cycles_offset); + ret = bt_clock_class_get_offset_cycles(writer_clock_class, &cycles_offset); assert(!ret); ns += ns_from_value(freq, cycles_offset); @@ -390,8 +390,8 @@ struct bt_notification *evaluate_packet_notification( { int64_t begin_ns, pkt_begin_ns, end_ns, pkt_end_ns; bool in_range = true; - struct bt_ctf_packet *packet = NULL, *writer_packet = NULL; - struct bt_ctf_field *packet_context = NULL, + struct bt_packet *packet = NULL, *writer_packet = NULL; + struct bt_field *packet_context = NULL, *timestamp_begin = NULL, *timestamp_end = NULL; struct bt_notification *new_notification = NULL; @@ -415,23 +415,23 @@ struct bt_notification *evaluate_packet_notification( goto end; } - packet_context = bt_ctf_packet_get_context(writer_packet); + packet_context = bt_packet_get_context(writer_packet); if (!packet_context) { goto end_no_notif; } - if (!bt_ctf_field_is_structure(packet_context)) { + if (!bt_field_is_structure(packet_context)) { goto end_no_notif; } - timestamp_begin = bt_ctf_field_structure_get_field( + timestamp_begin = bt_field_structure_get_field_by_name( packet_context, "timestamp_begin"); - if (!timestamp_begin || !bt_ctf_field_is_integer(timestamp_begin)) { + if (!timestamp_begin || !bt_field_is_integer(timestamp_begin)) { goto end_no_notif; } - timestamp_end = bt_ctf_field_structure_get_field( + timestamp_end = bt_field_structure_get_field_by_name( packet_context, "timestamp_end"); - if (!timestamp_end || !bt_ctf_field_is_integer(timestamp_end)) { + if (!timestamp_end || !bt_field_is_integer(timestamp_end)) { goto end_no_notif; } @@ -512,7 +512,7 @@ struct bt_notification *evaluate_stream_notification( struct bt_notification *notification, struct trimmer_iterator *trim_it) { - struct bt_ctf_stream *stream; + struct bt_stream *stream; stream = bt_notification_stream_end_get_stream(notification); assert(stream); diff --git a/tests/lib/test_bt_ctf_field_type_validation.c b/tests/lib/test_bt_ctf_field_type_validation.c index ad92e801..71225bfd 100644 --- a/tests/lib/test_bt_ctf_field_type_validation.c +++ b/tests/lib/test_bt_ctf_field_type_validation.c @@ -1,5 +1,5 @@ /* - * test_bt_ctf_field_type_validation.c + * test_bt_field_type_validation.c * * Babeltrace CTF IR field type validation test * @@ -34,7 +34,7 @@ #include "tap/tap.h" static -struct bt_ctf_field_type *get_good_packet_header_type(void) +struct bt_field_type *get_good_packet_header_type(void) { /* Generated by bt-ctfirtg using the following input: @@ -111,117 +111,117 @@ struct bt_ctf_field_type *get_good_packet_header_type(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_magic = NULL; - struct bt_ctf_field_type *root_uuid = NULL; - struct bt_ctf_field_type *root_uuid_elem = NULL; - struct bt_ctf_field_type *root_stream_id = NULL; - struct bt_ctf_field_type *root_iron = NULL; - struct bt_ctf_field_type *root_iron_listen = NULL; - struct bt_ctf_field_type *root_iron_dust = NULL; - struct bt_ctf_field_type *root_iron_parallel = NULL; - struct bt_ctf_field_type *root_iron_parallel_int = NULL; - struct bt_ctf_field_type *root_iron_fire = NULL; - struct bt_ctf_field_type *root_iron_fire_word = NULL; - struct bt_ctf_field_type *root_iron_fire_rabbit = NULL; - struct bt_ctf_field_type *root_iron_fire_keen = NULL; - struct bt_ctf_field_type *root_iron_fire_keen_elem = NULL; - struct bt_ctf_field_type *root_iron_fire_keen_elem_RED = NULL; - struct bt_ctf_field_type *root_iron_fire_keen_elem_BLUE = NULL; - struct bt_ctf_field_type *root_iron_fire_keen_elem_BLUE_elem = NULL; - struct bt_ctf_field_type *root_iron_fire_keen_elem_YELLOW = NULL; - struct bt_ctf_field_type *root_iron_report = NULL; - struct bt_ctf_field_type *root_iron_report_elem = NULL; - struct bt_ctf_field_type *root_iron_group = NULL; - struct bt_ctf_field_type *root_iron_group_elem = NULL; - struct bt_ctf_field_type *root_serious = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_magic = NULL; + struct bt_field_type *root_uuid = NULL; + struct bt_field_type *root_uuid_elem = NULL; + struct bt_field_type *root_stream_id = NULL; + struct bt_field_type *root_iron = NULL; + struct bt_field_type *root_iron_listen = NULL; + struct bt_field_type *root_iron_dust = NULL; + struct bt_field_type *root_iron_parallel = NULL; + struct bt_field_type *root_iron_parallel_int = NULL; + struct bt_field_type *root_iron_fire = NULL; + struct bt_field_type *root_iron_fire_word = NULL; + struct bt_field_type *root_iron_fire_rabbit = NULL; + struct bt_field_type *root_iron_fire_keen = NULL; + struct bt_field_type *root_iron_fire_keen_elem = NULL; + struct bt_field_type *root_iron_fire_keen_elem_RED = NULL; + struct bt_field_type *root_iron_fire_keen_elem_BLUE = NULL; + struct bt_field_type *root_iron_fire_keen_elem_BLUE_elem = NULL; + struct bt_field_type *root_iron_fire_keen_elem_YELLOW = NULL; + struct bt_field_type *root_iron_report = NULL; + struct bt_field_type *root_iron_report_elem = NULL; + struct bt_field_type *root_iron_group = NULL; + struct bt_field_type *root_iron_group_elem = NULL; + struct bt_field_type *root_serious = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_magic = bt_ctf_field_type_integer_create(32); + root_magic = bt_field_type_integer_create(32); assert(root_magic); ret = bt_ctf_field_type_integer_set_signed(root_magic, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_magic, 10); + ret = bt_field_type_integer_set_base(root_magic, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_magic, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_magic, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_magic, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_magic, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_magic, 8); + ret = bt_field_type_set_alignment(root_magic, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_magic, "magic"); + ret = bt_field_type_structure_add_field(root, root_magic, "magic"); assert(ret == 0); - root_uuid_elem = bt_ctf_field_type_integer_create(8); + root_uuid_elem = bt_field_type_integer_create(8); assert(root_uuid_elem); ret = bt_ctf_field_type_integer_set_signed(root_uuid_elem, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_uuid_elem, 10); + ret = bt_field_type_integer_set_base(root_uuid_elem, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_uuid_elem, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_uuid_elem, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_uuid_elem, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_uuid_elem, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_uuid_elem, 8); + ret = bt_field_type_set_alignment(root_uuid_elem, 8); assert(ret == 0); - root_uuid = bt_ctf_field_type_array_create(root_uuid_elem, 16); + root_uuid = bt_field_type_array_create(root_uuid_elem, 16); assert(root_uuid); - ret = bt_ctf_field_type_structure_add_field(root, root_uuid, "uuid"); + ret = bt_field_type_structure_add_field(root, root_uuid, "uuid"); assert(ret == 0); - root_stream_id = bt_ctf_field_type_integer_create(32); + root_stream_id = bt_field_type_integer_create(32); assert(root_stream_id); ret = bt_ctf_field_type_integer_set_signed(root_stream_id, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_stream_id, 10); + ret = bt_field_type_integer_set_base(root_stream_id, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_stream_id, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_stream_id, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_stream_id, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_stream_id, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_stream_id, 8); + ret = bt_field_type_set_alignment(root_stream_id, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_stream_id, "stream_id"); + ret = bt_field_type_structure_add_field(root, root_stream_id, "stream_id"); assert(ret == 0); - root_iron = bt_ctf_field_type_structure_create(); + root_iron = bt_field_type_structure_create(); assert(root_iron); - ret = bt_ctf_field_type_set_alignment(root_iron, 8); + ret = bt_field_type_set_alignment(root_iron, 8); assert(ret == 0); - root_iron_listen = bt_ctf_field_type_string_create(); + root_iron_listen = bt_field_type_string_create(); assert(root_iron_listen); - ret = bt_ctf_field_type_string_set_encoding(root_iron_listen, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_iron_listen, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_iron, root_iron_listen, "listen"); + ret = bt_field_type_structure_add_field(root_iron, root_iron_listen, "listen"); assert(ret == 0); - root_iron_dust = bt_ctf_field_type_integer_create(23); + root_iron_dust = bt_field_type_integer_create(23); assert(root_iron_dust); ret = bt_ctf_field_type_integer_set_signed(root_iron_dust, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_iron_dust, 10); + ret = bt_field_type_integer_set_base(root_iron_dust, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_iron_dust, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_iron_dust, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_iron_dust, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_iron_dust, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_iron_dust, 1); + ret = bt_field_type_set_alignment(root_iron_dust, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_iron, root_iron_dust, "dust"); + ret = bt_field_type_structure_add_field(root_iron, root_iron_dust, "dust"); assert(ret == 0); - root_iron_parallel_int = bt_ctf_field_type_integer_create(10); + root_iron_parallel_int = bt_field_type_integer_create(10); assert(root_iron_parallel_int); ret = bt_ctf_field_type_integer_set_signed(root_iron_parallel_int, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_iron_parallel_int, 10); + ret = bt_field_type_integer_set_base(root_iron_parallel_int, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_iron_parallel_int, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_iron_parallel_int, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_iron_parallel_int, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_iron_parallel_int, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_iron_parallel_int, 1); + ret = bt_field_type_set_alignment(root_iron_parallel_int, 1); assert(ret == 0); - root_iron_parallel = bt_ctf_field_type_enumeration_create(root_iron_parallel_int); + root_iron_parallel = bt_field_type_enumeration_create(root_iron_parallel_int); assert(root_iron_parallel); ret = bt_ctf_field_type_enumeration_add_mapping(root_iron_parallel, "RED", 0, 0); assert(ret == 0); @@ -229,99 +229,99 @@ struct bt_ctf_field_type *get_good_packet_header_type(void) assert(ret == 0); ret = bt_ctf_field_type_enumeration_add_mapping(root_iron_parallel, "YELLOW", 2, 2); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_iron, root_iron_parallel, "parallel"); + ret = bt_field_type_structure_add_field(root_iron, root_iron_parallel, "parallel"); assert(ret == 0); - root_iron_fire = bt_ctf_field_type_structure_create(); + root_iron_fire = bt_field_type_structure_create(); assert(root_iron_fire); - ret = bt_ctf_field_type_set_alignment(root_iron_fire, 8); + ret = bt_field_type_set_alignment(root_iron_fire, 8); assert(ret == 0); - root_iron_fire_word = bt_ctf_field_type_integer_create(17); + root_iron_fire_word = bt_field_type_integer_create(17); assert(root_iron_fire_word); ret = bt_ctf_field_type_integer_set_signed(root_iron_fire_word, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_iron_fire_word, 10); + ret = bt_field_type_integer_set_base(root_iron_fire_word, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_iron_fire_word, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_iron_fire_word, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_iron_fire_word, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_iron_fire_word, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_iron_fire_word, 1); + ret = bt_field_type_set_alignment(root_iron_fire_word, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_iron_fire, root_iron_fire_word, "word"); + ret = bt_field_type_structure_add_field(root_iron_fire, root_iron_fire_word, "word"); assert(ret == 0); - root_iron_fire_rabbit = bt_ctf_field_type_string_create(); + root_iron_fire_rabbit = bt_field_type_string_create(); assert(root_iron_fire_rabbit); - ret = bt_ctf_field_type_string_set_encoding(root_iron_fire_rabbit, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_iron_fire_rabbit, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_iron_fire, root_iron_fire_rabbit, "rabbit"); + ret = bt_field_type_structure_add_field(root_iron_fire, root_iron_fire_rabbit, "rabbit"); assert(ret == 0); - root_iron_fire_keen_elem = bt_ctf_field_type_variant_create(NULL, "iron.parallel"); + root_iron_fire_keen_elem = bt_field_type_variant_create(NULL, "iron.parallel"); assert(root_iron_fire_keen_elem); - root_iron_fire_keen_elem_RED = bt_ctf_field_type_string_create(); + root_iron_fire_keen_elem_RED = bt_field_type_string_create(); assert(root_iron_fire_keen_elem_RED); - ret = bt_ctf_field_type_string_set_encoding(root_iron_fire_keen_elem_RED, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_iron_fire_keen_elem_RED, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_variant_add_field(root_iron_fire_keen_elem, root_iron_fire_keen_elem_RED, "RED"); + ret = bt_field_type_variant_add_field(root_iron_fire_keen_elem, root_iron_fire_keen_elem_RED, "RED"); assert(ret == 0); - root_iron_fire_keen_elem_BLUE_elem = bt_ctf_field_type_integer_create(5); + root_iron_fire_keen_elem_BLUE_elem = bt_field_type_integer_create(5); assert(root_iron_fire_keen_elem_BLUE_elem); ret = bt_ctf_field_type_integer_set_signed(root_iron_fire_keen_elem_BLUE_elem, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_iron_fire_keen_elem_BLUE_elem, 10); + ret = bt_field_type_integer_set_base(root_iron_fire_keen_elem_BLUE_elem, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_iron_fire_keen_elem_BLUE_elem, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_iron_fire_keen_elem_BLUE_elem, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_iron_fire_keen_elem_BLUE_elem, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_iron_fire_keen_elem_BLUE_elem, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_iron_fire_keen_elem_BLUE_elem, 1); + ret = bt_field_type_set_alignment(root_iron_fire_keen_elem_BLUE_elem, 1); assert(ret == 0); - root_iron_fire_keen_elem_BLUE = bt_ctf_field_type_sequence_create(root_iron_fire_keen_elem_BLUE_elem, "magic"); + root_iron_fire_keen_elem_BLUE = bt_field_type_sequence_create(root_iron_fire_keen_elem_BLUE_elem, "magic"); assert(root_iron_fire_keen_elem_BLUE); - ret = bt_ctf_field_type_variant_add_field(root_iron_fire_keen_elem, root_iron_fire_keen_elem_BLUE, "BLUE"); + ret = bt_field_type_variant_add_field(root_iron_fire_keen_elem, root_iron_fire_keen_elem_BLUE, "BLUE"); assert(ret == 0); - root_iron_fire_keen_elem_YELLOW = bt_ctf_field_type_structure_create(); + root_iron_fire_keen_elem_YELLOW = bt_field_type_structure_create(); assert(root_iron_fire_keen_elem_YELLOW); - ret = bt_ctf_field_type_set_alignment(root_iron_fire_keen_elem_YELLOW, 1); + ret = bt_field_type_set_alignment(root_iron_fire_keen_elem_YELLOW, 1); assert(ret == 0); - ret = bt_ctf_field_type_variant_add_field(root_iron_fire_keen_elem, root_iron_fire_keen_elem_YELLOW, "YELLOW"); + ret = bt_field_type_variant_add_field(root_iron_fire_keen_elem, root_iron_fire_keen_elem_YELLOW, "YELLOW"); assert(ret == 0); - root_iron_fire_keen = bt_ctf_field_type_sequence_create(root_iron_fire_keen_elem, "word"); + root_iron_fire_keen = bt_field_type_sequence_create(root_iron_fire_keen_elem, "word"); assert(root_iron_fire_keen); - ret = bt_ctf_field_type_structure_add_field(root_iron_fire, root_iron_fire_keen, "keen"); + ret = bt_field_type_structure_add_field(root_iron_fire, root_iron_fire_keen, "keen"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_iron, root_iron_fire, "fire"); + ret = bt_field_type_structure_add_field(root_iron, root_iron_fire, "fire"); assert(ret == 0); - root_iron_report_elem = bt_ctf_field_type_string_create(); + root_iron_report_elem = bt_field_type_string_create(); assert(root_iron_report_elem); - ret = bt_ctf_field_type_string_set_encoding(root_iron_report_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_iron_report_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_iron_report = bt_ctf_field_type_sequence_create(root_iron_report_elem, "trace.packet.header.iron.dust"); + root_iron_report = bt_field_type_sequence_create(root_iron_report_elem, "trace.packet.header.iron.dust"); assert(root_iron_report); - ret = bt_ctf_field_type_structure_add_field(root_iron, root_iron_report, "report"); + ret = bt_field_type_structure_add_field(root_iron, root_iron_report, "report"); assert(ret == 0); - root_iron_group_elem = bt_ctf_field_type_string_create(); + root_iron_group_elem = bt_field_type_string_create(); assert(root_iron_group_elem); - ret = bt_ctf_field_type_string_set_encoding(root_iron_group_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_iron_group_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_iron_group = bt_ctf_field_type_sequence_create(root_iron_group_elem, "trace.packet.header.stream_id"); + root_iron_group = bt_field_type_sequence_create(root_iron_group_elem, "trace.packet.header.stream_id"); assert(root_iron_group); - ret = bt_ctf_field_type_structure_add_field(root_iron, root_iron_group, "group"); + ret = bt_field_type_structure_add_field(root_iron, root_iron_group, "group"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_iron, "iron"); + ret = bt_field_type_structure_add_field(root, root_iron, "iron"); assert(ret == 0); - root_serious = bt_ctf_field_type_integer_create(1); + root_serious = bt_field_type_integer_create(1); assert(root_serious); ret = bt_ctf_field_type_integer_set_signed(root_serious, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_serious, 10); + ret = bt_field_type_integer_set_base(root_serious, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_serious, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_serious, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_serious, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_serious, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_serious, 1); + ret = bt_field_type_set_alignment(root_serious, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_serious, "serious"); + ret = bt_field_type_structure_add_field(root, root_serious, "serious"); assert(ret == 0); BT_PUT(root_magic); @@ -352,7 +352,7 @@ struct bt_ctf_field_type *get_good_packet_header_type(void) } static -struct bt_ctf_field_type *get_good_packet_context_type(void) +struct bt_field_type *get_good_packet_context_type(void) { /* Generated by bt-ctfirtg using the following input: @@ -420,186 +420,186 @@ struct bt_ctf_field_type *get_good_packet_context_type(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_placid = NULL; - struct bt_ctf_field_type *root_meow = NULL; - struct bt_ctf_field_type *root_serious = NULL; - struct bt_ctf_field_type *root_naive = NULL; - struct bt_ctf_field_type *root_naive_elem = NULL; - struct bt_ctf_field_type *root_naive_elem_elem = NULL; - struct bt_ctf_field_type *root_clover = NULL; - struct bt_ctf_field_type *root_clover_oval = NULL; - struct bt_ctf_field_type *root_clover_whole = NULL; - struct bt_ctf_field_type *root_clover_whole_BLUE = NULL; - struct bt_ctf_field_type *root_clover_whole_BLUE_elem = NULL; - struct bt_ctf_field_type *root_clover_whole_RED = NULL; - struct bt_ctf_field_type *root_clover_whole_YELLOW = NULL; - struct bt_ctf_field_type *root_clover_egg = NULL; - struct bt_ctf_field_type *root_clover_egg_elem = NULL; - struct bt_ctf_field_type *root_clover_square = NULL; - struct bt_ctf_field_type *root_clover_square_int = NULL; - struct bt_ctf_field_type *root_clover_useful = NULL; - struct bt_ctf_field_type *root_clover_useful_elem = NULL; - struct bt_ctf_field_type *root_tart = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_placid = NULL; + struct bt_field_type *root_meow = NULL; + struct bt_field_type *root_serious = NULL; + struct bt_field_type *root_naive = NULL; + struct bt_field_type *root_naive_elem = NULL; + struct bt_field_type *root_naive_elem_elem = NULL; + struct bt_field_type *root_clover = NULL; + struct bt_field_type *root_clover_oval = NULL; + struct bt_field_type *root_clover_whole = NULL; + struct bt_field_type *root_clover_whole_BLUE = NULL; + struct bt_field_type *root_clover_whole_BLUE_elem = NULL; + struct bt_field_type *root_clover_whole_RED = NULL; + struct bt_field_type *root_clover_whole_YELLOW = NULL; + struct bt_field_type *root_clover_egg = NULL; + struct bt_field_type *root_clover_egg_elem = NULL; + struct bt_field_type *root_clover_square = NULL; + struct bt_field_type *root_clover_square_int = NULL; + struct bt_field_type *root_clover_useful = NULL; + struct bt_field_type *root_clover_useful_elem = NULL; + struct bt_field_type *root_tart = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_placid = bt_ctf_field_type_integer_create(32); + root_placid = bt_field_type_integer_create(32); assert(root_placid); ret = bt_ctf_field_type_integer_set_signed(root_placid, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_placid, 10); + ret = bt_field_type_integer_set_base(root_placid, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_placid, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_placid, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_placid, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_placid, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_placid, 8); + ret = bt_field_type_set_alignment(root_placid, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_placid, "placid"); + ret = bt_field_type_structure_add_field(root, root_placid, "placid"); assert(ret == 0); - root_meow = bt_ctf_field_type_string_create(); + root_meow = bt_field_type_string_create(); assert(root_meow); - ret = bt_ctf_field_type_string_set_encoding(root_meow, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_meow, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_meow, "meow"); + ret = bt_field_type_structure_add_field(root, root_meow, "meow"); assert(ret == 0); - root_serious = bt_ctf_field_type_integer_create(11); + root_serious = bt_field_type_integer_create(11); assert(root_serious); ret = bt_ctf_field_type_integer_set_signed(root_serious, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_serious, 10); + ret = bt_field_type_integer_set_base(root_serious, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_serious, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_serious, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_serious, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_serious, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_serious, 1); + ret = bt_field_type_set_alignment(root_serious, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_serious, "serious"); + ret = bt_field_type_structure_add_field(root, root_serious, "serious"); assert(ret == 0); - root_naive_elem_elem = bt_ctf_field_type_string_create(); + root_naive_elem_elem = bt_field_type_string_create(); assert(root_naive_elem_elem); - ret = bt_ctf_field_type_string_set_encoding(root_naive_elem_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_naive_elem_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_naive_elem = bt_ctf_field_type_sequence_create(root_naive_elem_elem, "placid"); + root_naive_elem = bt_field_type_sequence_create(root_naive_elem_elem, "placid"); assert(root_naive_elem); - root_naive = bt_ctf_field_type_array_create(root_naive_elem, 17); + root_naive = bt_field_type_array_create(root_naive_elem, 17); assert(root_naive); - ret = bt_ctf_field_type_structure_add_field(root, root_naive, "naive"); + ret = bt_field_type_structure_add_field(root, root_naive, "naive"); assert(ret == 0); - root_clover = bt_ctf_field_type_structure_create(); + root_clover = bt_field_type_structure_create(); assert(root_clover); - ret = bt_ctf_field_type_set_alignment(root_clover, 1); + ret = bt_field_type_set_alignment(root_clover, 1); assert(ret == 0); - root_clover_oval = bt_ctf_field_type_integer_create(17); + root_clover_oval = bt_field_type_integer_create(17); assert(root_clover_oval); ret = bt_ctf_field_type_integer_set_signed(root_clover_oval, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_clover_oval, 10); + ret = bt_field_type_integer_set_base(root_clover_oval, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_clover_oval, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_clover_oval, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_clover_oval, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_clover_oval, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_clover_oval, 1); + ret = bt_field_type_set_alignment(root_clover_oval, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_clover, root_clover_oval, "oval"); + ret = bt_field_type_structure_add_field(root_clover, root_clover_oval, "oval"); assert(ret == 0); - root_clover_whole = bt_ctf_field_type_variant_create(NULL, "iron.parallel"); + root_clover_whole = bt_field_type_variant_create(NULL, "iron.parallel"); assert(root_clover_whole); - root_clover_whole_BLUE_elem = bt_ctf_field_type_string_create(); + root_clover_whole_BLUE_elem = bt_field_type_string_create(); assert(root_clover_whole_BLUE_elem); - ret = bt_ctf_field_type_string_set_encoding(root_clover_whole_BLUE_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_clover_whole_BLUE_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_clover_whole_BLUE = bt_ctf_field_type_sequence_create(root_clover_whole_BLUE_elem, "trace.packet.header.iron.fire.word"); + root_clover_whole_BLUE = bt_field_type_sequence_create(root_clover_whole_BLUE_elem, "trace.packet.header.iron.fire.word"); assert(root_clover_whole_BLUE); - ret = bt_ctf_field_type_variant_add_field(root_clover_whole, root_clover_whole_BLUE, "BLUE"); + ret = bt_field_type_variant_add_field(root_clover_whole, root_clover_whole_BLUE, "BLUE"); assert(ret == 0); - root_clover_whole_RED = bt_ctf_field_type_integer_create(44); + root_clover_whole_RED = bt_field_type_integer_create(44); assert(root_clover_whole_RED); ret = bt_ctf_field_type_integer_set_signed(root_clover_whole_RED, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_clover_whole_RED, 10); + ret = bt_field_type_integer_set_base(root_clover_whole_RED, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_clover_whole_RED, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_clover_whole_RED, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_clover_whole_RED, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_clover_whole_RED, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_clover_whole_RED, 1); + ret = bt_field_type_set_alignment(root_clover_whole_RED, 1); assert(ret == 0); - ret = bt_ctf_field_type_variant_add_field(root_clover_whole, root_clover_whole_RED, "RED"); + ret = bt_field_type_variant_add_field(root_clover_whole, root_clover_whole_RED, "RED"); assert(ret == 0); - root_clover_whole_YELLOW = bt_ctf_field_type_string_create(); + root_clover_whole_YELLOW = bt_field_type_string_create(); assert(root_clover_whole_YELLOW); - ret = bt_ctf_field_type_string_set_encoding(root_clover_whole_YELLOW, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_clover_whole_YELLOW, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_variant_add_field(root_clover_whole, root_clover_whole_YELLOW, "YELLOW"); + ret = bt_field_type_variant_add_field(root_clover_whole, root_clover_whole_YELLOW, "YELLOW"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_clover, root_clover_whole, "whole"); + ret = bt_field_type_structure_add_field(root_clover, root_clover_whole, "whole"); assert(ret == 0); - root_clover_egg_elem = bt_ctf_field_type_integer_create(55); + root_clover_egg_elem = bt_field_type_integer_create(55); assert(root_clover_egg_elem); ret = bt_ctf_field_type_integer_set_signed(root_clover_egg_elem, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_clover_egg_elem, 10); + ret = bt_field_type_integer_set_base(root_clover_egg_elem, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_clover_egg_elem, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_clover_egg_elem, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_clover_egg_elem, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_clover_egg_elem, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_clover_egg_elem, 1); + ret = bt_field_type_set_alignment(root_clover_egg_elem, 1); assert(ret == 0); - root_clover_egg = bt_ctf_field_type_sequence_create(root_clover_egg_elem, "stream.packet.context.clover.oval"); + root_clover_egg = bt_field_type_sequence_create(root_clover_egg_elem, "stream.packet.context.clover.oval"); assert(root_clover_egg); - ret = bt_ctf_field_type_structure_add_field(root_clover, root_clover_egg, "egg"); + ret = bt_field_type_structure_add_field(root_clover, root_clover_egg, "egg"); assert(ret == 0); - root_clover_square_int = bt_ctf_field_type_integer_create(12); + root_clover_square_int = bt_field_type_integer_create(12); assert(root_clover_square_int); ret = bt_ctf_field_type_integer_set_signed(root_clover_square_int, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_clover_square_int, 10); + ret = bt_field_type_integer_set_base(root_clover_square_int, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_clover_square_int, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_clover_square_int, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_clover_square_int, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_clover_square_int, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_clover_square_int, 1); + ret = bt_field_type_set_alignment(root_clover_square_int, 1); assert(ret == 0); - root_clover_square = bt_ctf_field_type_enumeration_create(root_clover_square_int); + root_clover_square = bt_field_type_enumeration_create(root_clover_square_int); assert(root_clover_square); ret = bt_ctf_field_type_enumeration_add_mapping(root_clover_square, "YOUNG", 0, 0); assert(ret == 0); ret = bt_ctf_field_type_enumeration_add_mapping(root_clover_square, "OLD", 1, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_clover, root_clover_square, "square"); + ret = bt_field_type_structure_add_field(root_clover, root_clover_square, "square"); assert(ret == 0); - root_clover_useful_elem = bt_ctf_field_type_integer_create(2); + root_clover_useful_elem = bt_field_type_integer_create(2); assert(root_clover_useful_elem); ret = bt_ctf_field_type_integer_set_signed(root_clover_useful_elem, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_clover_useful_elem, 10); + ret = bt_field_type_integer_set_base(root_clover_useful_elem, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_clover_useful_elem, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_clover_useful_elem, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_clover_useful_elem, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_clover_useful_elem, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_clover_useful_elem, 1); + ret = bt_field_type_set_alignment(root_clover_useful_elem, 1); assert(ret == 0); - root_clover_useful = bt_ctf_field_type_sequence_create(root_clover_useful_elem, "serious"); + root_clover_useful = bt_field_type_sequence_create(root_clover_useful_elem, "serious"); assert(root_clover_useful); - ret = bt_ctf_field_type_structure_add_field(root_clover, root_clover_useful, "useful"); + ret = bt_field_type_structure_add_field(root_clover, root_clover_useful, "useful"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_clover, "clover"); + ret = bt_field_type_structure_add_field(root, root_clover, "clover"); assert(ret == 0); - root_tart = bt_ctf_field_type_string_create(); + root_tart = bt_field_type_string_create(); assert(root_tart); - ret = bt_ctf_field_type_string_set_encoding(root_tart, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_tart, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_tart, "tart"); + ret = bt_field_type_structure_add_field(root, root_tart, "tart"); assert(ret == 0); BT_PUT(root_placid); @@ -628,7 +628,7 @@ struct bt_ctf_field_type *get_good_packet_context_type(void) static -struct bt_ctf_field_type *get_good_event_header_type(void) +struct bt_field_type *get_good_event_header_type(void) { /* Generated by bt-ctfirtg using the following input: @@ -677,134 +677,134 @@ struct bt_ctf_field_type *get_good_event_header_type(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_id = NULL; - struct bt_ctf_field_type *root_timestamp = NULL; - struct bt_ctf_field_type *root_action = NULL; - struct bt_ctf_field_type *root_action_special = NULL; - struct bt_ctf_field_type *root_action_lucky = NULL; - struct bt_ctf_field_type *root_action_lucky_elem = NULL; - struct bt_ctf_field_type *root_action_dream = NULL; - struct bt_ctf_field_type *root_action_grandiose = NULL; - struct bt_ctf_field_type *root_action_grandiose_elem = NULL; - struct bt_ctf_field_type *root_stiff = NULL; - struct bt_ctf_field_type *root_stiff_elem = NULL; - struct bt_ctf_field_type *root_fruit = NULL; - struct bt_ctf_field_type *root_fruit_apple = NULL; - struct bt_ctf_field_type *root_fruit_apple_elem = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_id = NULL; + struct bt_field_type *root_timestamp = NULL; + struct bt_field_type *root_action = NULL; + struct bt_field_type *root_action_special = NULL; + struct bt_field_type *root_action_lucky = NULL; + struct bt_field_type *root_action_lucky_elem = NULL; + struct bt_field_type *root_action_dream = NULL; + struct bt_field_type *root_action_grandiose = NULL; + struct bt_field_type *root_action_grandiose_elem = NULL; + struct bt_field_type *root_stiff = NULL; + struct bt_field_type *root_stiff_elem = NULL; + struct bt_field_type *root_fruit = NULL; + struct bt_field_type *root_fruit_apple = NULL; + struct bt_field_type *root_fruit_apple_elem = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_id = bt_ctf_field_type_integer_create(17); + root_id = bt_field_type_integer_create(17); assert(root_id); ret = bt_ctf_field_type_integer_set_signed(root_id, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_id, 10); + ret = bt_field_type_integer_set_base(root_id, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_id, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_id, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_id, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_id, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_id, 1); + ret = bt_field_type_set_alignment(root_id, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_id, "id"); + ret = bt_field_type_structure_add_field(root, root_id, "id"); assert(ret == 0); - root_timestamp = bt_ctf_field_type_integer_create(64); + root_timestamp = bt_field_type_integer_create(64); assert(root_timestamp); ret = bt_ctf_field_type_integer_set_signed(root_timestamp, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_timestamp, 10); + ret = bt_field_type_integer_set_base(root_timestamp, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_timestamp, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_timestamp, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_timestamp, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_timestamp, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_timestamp, 8); + ret = bt_field_type_set_alignment(root_timestamp, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_timestamp, "timestamp"); + ret = bt_field_type_structure_add_field(root, root_timestamp, "timestamp"); assert(ret == 0); - root_action = bt_ctf_field_type_structure_create(); + root_action = bt_field_type_structure_create(); assert(root_action); - ret = bt_ctf_field_type_set_alignment(root_action, 8); + ret = bt_field_type_set_alignment(root_action, 8); assert(ret == 0); - root_action_special = bt_ctf_field_type_integer_create(17); + root_action_special = bt_field_type_integer_create(17); assert(root_action_special); ret = bt_ctf_field_type_integer_set_signed(root_action_special, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_action_special, 10); + ret = bt_field_type_integer_set_base(root_action_special, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_action_special, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_action_special, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_action_special, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_action_special, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_action_special, 1); + ret = bt_field_type_set_alignment(root_action_special, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_action, root_action_special, "special"); + ret = bt_field_type_structure_add_field(root_action, root_action_special, "special"); assert(ret == 0); - root_action_lucky_elem = bt_ctf_field_type_string_create(); + root_action_lucky_elem = bt_field_type_string_create(); assert(root_action_lucky_elem); - ret = bt_ctf_field_type_string_set_encoding(root_action_lucky_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_action_lucky_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_action_lucky = bt_ctf_field_type_sequence_create(root_action_lucky_elem, "stream.packet.context.placid"); + root_action_lucky = bt_field_type_sequence_create(root_action_lucky_elem, "stream.packet.context.placid"); assert(root_action_lucky); - ret = bt_ctf_field_type_structure_add_field(root_action, root_action_lucky, "lucky"); + ret = bt_field_type_structure_add_field(root_action, root_action_lucky, "lucky"); assert(ret == 0); - root_action_dream = bt_ctf_field_type_string_create(); + root_action_dream = bt_field_type_string_create(); assert(root_action_dream); - ret = bt_ctf_field_type_string_set_encoding(root_action_dream, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_action_dream, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_action, root_action_dream, "dream"); + ret = bt_field_type_structure_add_field(root_action, root_action_dream, "dream"); assert(ret == 0); - root_action_grandiose_elem = bt_ctf_field_type_integer_create(3); + root_action_grandiose_elem = bt_field_type_integer_create(3); assert(root_action_grandiose_elem); ret = bt_ctf_field_type_integer_set_signed(root_action_grandiose_elem, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_action_grandiose_elem, 10); + ret = bt_field_type_integer_set_base(root_action_grandiose_elem, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_action_grandiose_elem, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_action_grandiose_elem, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_action_grandiose_elem, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_action_grandiose_elem, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_action_grandiose_elem, 1); + ret = bt_field_type_set_alignment(root_action_grandiose_elem, 1); assert(ret == 0); - root_action_grandiose = bt_ctf_field_type_sequence_create(root_action_grandiose_elem, "trace.packet.header.serious"); + root_action_grandiose = bt_field_type_sequence_create(root_action_grandiose_elem, "trace.packet.header.serious"); assert(root_action_grandiose); - ret = bt_ctf_field_type_structure_add_field(root_action, root_action_grandiose, "grandiose"); + ret = bt_field_type_structure_add_field(root_action, root_action_grandiose, "grandiose"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_action, "action"); + ret = bt_field_type_structure_add_field(root, root_action, "action"); assert(ret == 0); - root_stiff_elem = bt_ctf_field_type_string_create(); + root_stiff_elem = bt_field_type_string_create(); assert(root_stiff_elem); - ret = bt_ctf_field_type_string_set_encoding(root_stiff_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_stiff_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_stiff = bt_ctf_field_type_sequence_create(root_stiff_elem, "clover.whole.RED"); + root_stiff = bt_field_type_sequence_create(root_stiff_elem, "clover.whole.RED"); assert(root_stiff); - ret = bt_ctf_field_type_structure_add_field(root, root_stiff, "stiff"); + ret = bt_field_type_structure_add_field(root, root_stiff, "stiff"); assert(ret == 0); - root_fruit = bt_ctf_field_type_structure_create(); + root_fruit = bt_field_type_structure_create(); assert(root_fruit); - ret = bt_ctf_field_type_set_alignment(root_fruit, 1); + ret = bt_field_type_set_alignment(root_fruit, 1); assert(ret == 0); - root_fruit_apple_elem = bt_ctf_field_type_integer_create(5); + root_fruit_apple_elem = bt_field_type_integer_create(5); assert(root_fruit_apple_elem); ret = bt_ctf_field_type_integer_set_signed(root_fruit_apple_elem, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_fruit_apple_elem, 10); + ret = bt_field_type_integer_set_base(root_fruit_apple_elem, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_fruit_apple_elem, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_fruit_apple_elem, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_fruit_apple_elem, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_fruit_apple_elem, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_fruit_apple_elem, 1); + ret = bt_field_type_set_alignment(root_fruit_apple_elem, 1); assert(ret == 0); - root_fruit_apple = bt_ctf_field_type_sequence_create(root_fruit_apple_elem, "action.special"); + root_fruit_apple = bt_field_type_sequence_create(root_fruit_apple_elem, "action.special"); assert(root_fruit_apple); - ret = bt_ctf_field_type_structure_add_field(root_fruit, root_fruit_apple, "apple"); + ret = bt_field_type_structure_add_field(root_fruit, root_fruit_apple, "apple"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_fruit, "fruit"); + ret = bt_field_type_structure_add_field(root, root_fruit, "fruit"); assert(ret == 0); BT_PUT(root_id); @@ -826,7 +826,7 @@ struct bt_ctf_field_type *get_good_event_header_type(void) } static -struct bt_ctf_field_type *get_good_stream_event_context_type(void) +struct bt_field_type *get_good_stream_event_context_type(void) { /* Generated by bt-ctfirtg using the following input: @@ -874,110 +874,110 @@ struct bt_ctf_field_type *get_good_stream_event_context_type(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_face = NULL; - struct bt_ctf_field_type *root_face_branch = NULL; - struct bt_ctf_field_type *root_face_branch_elem = NULL; - struct bt_ctf_field_type *root_face_income = NULL; - struct bt_ctf_field_type *root_face_income_elem = NULL; - struct bt_ctf_field_type *root_face_magic = NULL; - struct bt_ctf_field_type *root_face_lucky = NULL; - struct bt_ctf_field_type *root_face_lucky_elem = NULL; - struct bt_ctf_field_type *root_cats = NULL; - struct bt_ctf_field_type *root_dream = NULL; - struct bt_ctf_field_type *root_dream_elem = NULL; - struct bt_ctf_field_type *root_dream_elem_elem = NULL; - struct bt_ctf_field_type *root_dream_elem_elem_elem = NULL; - struct bt_ctf_field_type *root_stream_id = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_face = NULL; + struct bt_field_type *root_face_branch = NULL; + struct bt_field_type *root_face_branch_elem = NULL; + struct bt_field_type *root_face_income = NULL; + struct bt_field_type *root_face_income_elem = NULL; + struct bt_field_type *root_face_magic = NULL; + struct bt_field_type *root_face_lucky = NULL; + struct bt_field_type *root_face_lucky_elem = NULL; + struct bt_field_type *root_cats = NULL; + struct bt_field_type *root_dream = NULL; + struct bt_field_type *root_dream_elem = NULL; + struct bt_field_type *root_dream_elem_elem = NULL; + struct bt_field_type *root_dream_elem_elem_elem = NULL; + struct bt_field_type *root_stream_id = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_face = bt_ctf_field_type_structure_create(); + root_face = bt_field_type_structure_create(); assert(root_face); - ret = bt_ctf_field_type_set_alignment(root_face, 8); + ret = bt_field_type_set_alignment(root_face, 8); assert(ret == 0); - root_face_branch_elem = bt_ctf_field_type_string_create(); + root_face_branch_elem = bt_field_type_string_create(); assert(root_face_branch_elem); - ret = bt_ctf_field_type_string_set_encoding(root_face_branch_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_face_branch_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_face_branch = bt_ctf_field_type_sequence_create(root_face_branch_elem, "serious"); + root_face_branch = bt_field_type_sequence_create(root_face_branch_elem, "serious"); assert(root_face_branch); - ret = bt_ctf_field_type_structure_add_field(root_face, root_face_branch, "branch"); + ret = bt_field_type_structure_add_field(root_face, root_face_branch, "branch"); assert(ret == 0); - root_face_income_elem = bt_ctf_field_type_string_create(); + root_face_income_elem = bt_field_type_string_create(); assert(root_face_income_elem); - ret = bt_ctf_field_type_string_set_encoding(root_face_income_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_face_income_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_face_income = bt_ctf_field_type_sequence_create(root_face_income_elem, "magic"); + root_face_income = bt_field_type_sequence_create(root_face_income_elem, "magic"); assert(root_face_income); - ret = bt_ctf_field_type_structure_add_field(root_face, root_face_income, "income"); + ret = bt_field_type_structure_add_field(root_face, root_face_income, "income"); assert(ret == 0); - root_face_magic = bt_ctf_field_type_integer_create(23); + root_face_magic = bt_field_type_integer_create(23); assert(root_face_magic); ret = bt_ctf_field_type_integer_set_signed(root_face_magic, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_face_magic, 10); + ret = bt_field_type_integer_set_base(root_face_magic, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_face_magic, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_face_magic, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_face_magic, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_face_magic, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_face_magic, 1); + ret = bt_field_type_set_alignment(root_face_magic, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_face, root_face_magic, "magic"); + ret = bt_field_type_structure_add_field(root_face, root_face_magic, "magic"); assert(ret == 0); - root_face_lucky_elem = bt_ctf_field_type_string_create(); + root_face_lucky_elem = bt_field_type_string_create(); assert(root_face_lucky_elem); - ret = bt_ctf_field_type_string_set_encoding(root_face_lucky_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_face_lucky_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_face_lucky = bt_ctf_field_type_sequence_create(root_face_lucky_elem, "magic"); + root_face_lucky = bt_field_type_sequence_create(root_face_lucky_elem, "magic"); assert(root_face_lucky); - ret = bt_ctf_field_type_structure_add_field(root_face, root_face_lucky, "lucky"); + ret = bt_field_type_structure_add_field(root_face, root_face_lucky, "lucky"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_face, "face"); + ret = bt_field_type_structure_add_field(root, root_face, "face"); assert(ret == 0); - root_cats = bt_ctf_field_type_integer_create(5); + root_cats = bt_field_type_integer_create(5); assert(root_cats); ret = bt_ctf_field_type_integer_set_signed(root_cats, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_cats, 10); + ret = bt_field_type_integer_set_base(root_cats, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_cats, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_cats, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_cats, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_cats, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_cats, 1); + ret = bt_field_type_set_alignment(root_cats, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_cats, "cats"); + ret = bt_field_type_structure_add_field(root, root_cats, "cats"); assert(ret == 0); - root_dream_elem_elem_elem = bt_ctf_field_type_string_create(); + root_dream_elem_elem_elem = bt_field_type_string_create(); assert(root_dream_elem_elem_elem); - ret = bt_ctf_field_type_string_set_encoding(root_dream_elem_elem_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_dream_elem_elem_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_dream_elem_elem = bt_ctf_field_type_sequence_create(root_dream_elem_elem_elem, "stream.event.context.face.magic"); + root_dream_elem_elem = bt_field_type_sequence_create(root_dream_elem_elem_elem, "stream.event.context.face.magic"); assert(root_dream_elem_elem); - root_dream_elem = bt_ctf_field_type_sequence_create(root_dream_elem_elem, "trace.packet.header.iron.dust"); + root_dream_elem = bt_field_type_sequence_create(root_dream_elem_elem, "trace.packet.header.iron.dust"); assert(root_dream_elem); - root_dream = bt_ctf_field_type_sequence_create(root_dream_elem, "stream.packet.context.placid"); + root_dream = bt_field_type_sequence_create(root_dream_elem, "stream.packet.context.placid"); assert(root_dream); - ret = bt_ctf_field_type_structure_add_field(root, root_dream, "dream"); + ret = bt_field_type_structure_add_field(root, root_dream, "dream"); assert(ret == 0); - root_stream_id = bt_ctf_field_type_integer_create(9); + root_stream_id = bt_field_type_integer_create(9); assert(root_stream_id); ret = bt_ctf_field_type_integer_set_signed(root_stream_id, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_stream_id, 10); + ret = bt_field_type_integer_set_base(root_stream_id, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_stream_id, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_stream_id, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_stream_id, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_stream_id, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_stream_id, 1); + ret = bt_field_type_set_alignment(root_stream_id, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_stream_id, "stream_id"); + ret = bt_field_type_structure_add_field(root, root_stream_id, "stream_id"); assert(ret == 0); BT_PUT(root_face); @@ -999,7 +999,7 @@ struct bt_ctf_field_type *get_good_stream_event_context_type(void) } static -struct bt_ctf_field_type *get_good_event_context_type(void) +struct bt_field_type *get_good_event_context_type(void) { /* Generated by bt-ctfirtg using the following input: @@ -1079,181 +1079,181 @@ struct bt_ctf_field_type *get_good_event_context_type(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_film = NULL; - struct bt_ctf_field_type *root_berry = NULL; - struct bt_ctf_field_type *root_berry_pine = NULL; - struct bt_ctf_field_type *root_berry_pine_elem = NULL; - struct bt_ctf_field_type *root_berry_porter = NULL; - struct bt_ctf_field_type *root_berry_porter_elem = NULL; - struct bt_ctf_field_type *root_berry_mice = NULL; - struct bt_ctf_field_type *root_berry_mice_elem = NULL; - struct bt_ctf_field_type *root_berry_third = NULL; - struct bt_ctf_field_type *root_berry_guard = NULL; - struct bt_ctf_field_type *root_berry_guard_elem = NULL; - struct bt_ctf_field_type *root_berry_one = NULL; - struct bt_ctf_field_type *root_berry_one_elem = NULL; - struct bt_ctf_field_type *root_cats = NULL; - struct bt_ctf_field_type *root_loud = NULL; - struct bt_ctf_field_type *root_loud_toys = NULL; - struct bt_ctf_field_type *root_loud_toys_elem = NULL; - struct bt_ctf_field_type *root_loud_spoon = NULL; - struct bt_ctf_field_type *root_loud_spoon_elem = NULL; - struct bt_ctf_field_type *root_loud_turkey = NULL; - struct bt_ctf_field_type *root_loud_turkey_elem = NULL; - struct bt_ctf_field_type *root_loud_inform = NULL; - struct bt_ctf_field_type *root_loud_inform_elem = NULL; - struct bt_ctf_field_type *root_loud_odd = NULL; - struct bt_ctf_field_type *root_loud_odd_elem = NULL; - struct bt_ctf_field_type *root_loud_amuck = NULL; - struct bt_ctf_field_type *root_loud_amuck_elem = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_film = NULL; + struct bt_field_type *root_berry = NULL; + struct bt_field_type *root_berry_pine = NULL; + struct bt_field_type *root_berry_pine_elem = NULL; + struct bt_field_type *root_berry_porter = NULL; + struct bt_field_type *root_berry_porter_elem = NULL; + struct bt_field_type *root_berry_mice = NULL; + struct bt_field_type *root_berry_mice_elem = NULL; + struct bt_field_type *root_berry_third = NULL; + struct bt_field_type *root_berry_guard = NULL; + struct bt_field_type *root_berry_guard_elem = NULL; + struct bt_field_type *root_berry_one = NULL; + struct bt_field_type *root_berry_one_elem = NULL; + struct bt_field_type *root_cats = NULL; + struct bt_field_type *root_loud = NULL; + struct bt_field_type *root_loud_toys = NULL; + struct bt_field_type *root_loud_toys_elem = NULL; + struct bt_field_type *root_loud_spoon = NULL; + struct bt_field_type *root_loud_spoon_elem = NULL; + struct bt_field_type *root_loud_turkey = NULL; + struct bt_field_type *root_loud_turkey_elem = NULL; + struct bt_field_type *root_loud_inform = NULL; + struct bt_field_type *root_loud_inform_elem = NULL; + struct bt_field_type *root_loud_odd = NULL; + struct bt_field_type *root_loud_odd_elem = NULL; + struct bt_field_type *root_loud_amuck = NULL; + struct bt_field_type *root_loud_amuck_elem = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_film = bt_ctf_field_type_integer_create(19); + root_film = bt_field_type_integer_create(19); assert(root_film); ret = bt_ctf_field_type_integer_set_signed(root_film, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_film, 10); + ret = bt_field_type_integer_set_base(root_film, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_film, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_film, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_film, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_film, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_film, 1); + ret = bt_field_type_set_alignment(root_film, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_film, "film"); + ret = bt_field_type_structure_add_field(root, root_film, "film"); assert(ret == 0); - root_berry = bt_ctf_field_type_structure_create(); + root_berry = bt_field_type_structure_create(); assert(root_berry); - ret = bt_ctf_field_type_set_alignment(root_berry, 8); + ret = bt_field_type_set_alignment(root_berry, 8); assert(ret == 0); - root_berry_pine_elem = bt_ctf_field_type_string_create(); + root_berry_pine_elem = bt_field_type_string_create(); assert(root_berry_pine_elem); - ret = bt_ctf_field_type_string_set_encoding(root_berry_pine_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_berry_pine_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_berry_pine = bt_ctf_field_type_sequence_create(root_berry_pine_elem, "stream_id"); + root_berry_pine = bt_field_type_sequence_create(root_berry_pine_elem, "stream_id"); assert(root_berry_pine); - ret = bt_ctf_field_type_structure_add_field(root_berry, root_berry_pine, "pine"); + ret = bt_field_type_structure_add_field(root_berry, root_berry_pine, "pine"); assert(ret == 0); - root_berry_porter_elem = bt_ctf_field_type_string_create(); + root_berry_porter_elem = bt_field_type_string_create(); assert(root_berry_porter_elem); - ret = bt_ctf_field_type_string_set_encoding(root_berry_porter_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_berry_porter_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_berry_porter = bt_ctf_field_type_sequence_create(root_berry_porter_elem, "face.magic"); + root_berry_porter = bt_field_type_sequence_create(root_berry_porter_elem, "face.magic"); assert(root_berry_porter); - ret = bt_ctf_field_type_structure_add_field(root_berry, root_berry_porter, "porter"); + ret = bt_field_type_structure_add_field(root_berry, root_berry_porter, "porter"); assert(ret == 0); - root_berry_mice_elem = bt_ctf_field_type_string_create(); + root_berry_mice_elem = bt_field_type_string_create(); assert(root_berry_mice_elem); - ret = bt_ctf_field_type_string_set_encoding(root_berry_mice_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_berry_mice_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_berry_mice = bt_ctf_field_type_sequence_create(root_berry_mice_elem, "action.special"); + root_berry_mice = bt_field_type_sequence_create(root_berry_mice_elem, "action.special"); assert(root_berry_mice); - ret = bt_ctf_field_type_structure_add_field(root_berry, root_berry_mice, "mice"); + ret = bt_field_type_structure_add_field(root_berry, root_berry_mice, "mice"); assert(ret == 0); - root_berry_third = bt_ctf_field_type_integer_create(18); + root_berry_third = bt_field_type_integer_create(18); assert(root_berry_third); ret = bt_ctf_field_type_integer_set_signed(root_berry_third, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_berry_third, 10); + ret = bt_field_type_integer_set_base(root_berry_third, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_berry_third, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_berry_third, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_berry_third, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_berry_third, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_berry_third, 1); + ret = bt_field_type_set_alignment(root_berry_third, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root_berry, root_berry_third, "third"); + ret = bt_field_type_structure_add_field(root_berry, root_berry_third, "third"); assert(ret == 0); - root_berry_guard_elem = bt_ctf_field_type_string_create(); + root_berry_guard_elem = bt_field_type_string_create(); assert(root_berry_guard_elem); - ret = bt_ctf_field_type_string_set_encoding(root_berry_guard_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_berry_guard_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_berry_guard = bt_ctf_field_type_sequence_create(root_berry_guard_elem, "clover.oval"); + root_berry_guard = bt_field_type_sequence_create(root_berry_guard_elem, "clover.oval"); assert(root_berry_guard); - ret = bt_ctf_field_type_structure_add_field(root_berry, root_berry_guard, "guard"); + ret = bt_field_type_structure_add_field(root_berry, root_berry_guard, "guard"); assert(ret == 0); - root_berry_one_elem = bt_ctf_field_type_string_create(); + root_berry_one_elem = bt_field_type_string_create(); assert(root_berry_one_elem); - ret = bt_ctf_field_type_string_set_encoding(root_berry_one_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_berry_one_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_berry_one = bt_ctf_field_type_sequence_create(root_berry_one_elem, "iron.fire.word"); + root_berry_one = bt_field_type_sequence_create(root_berry_one_elem, "iron.fire.word"); assert(root_berry_one); - ret = bt_ctf_field_type_structure_add_field(root_berry, root_berry_one, "one"); + ret = bt_field_type_structure_add_field(root_berry, root_berry_one, "one"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_berry, "berry"); + ret = bt_field_type_structure_add_field(root, root_berry, "berry"); assert(ret == 0); - root_cats = bt_ctf_field_type_integer_create(55); + root_cats = bt_field_type_integer_create(55); assert(root_cats); ret = bt_ctf_field_type_integer_set_signed(root_cats, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_cats, 10); + ret = bt_field_type_integer_set_base(root_cats, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_cats, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_cats, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_cats, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_cats, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_cats, 1); + ret = bt_field_type_set_alignment(root_cats, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_cats, "cats"); + ret = bt_field_type_structure_add_field(root, root_cats, "cats"); assert(ret == 0); - root_loud = bt_ctf_field_type_structure_create(); + root_loud = bt_field_type_structure_create(); assert(root_loud); - ret = bt_ctf_field_type_set_alignment(root_loud, 8); + ret = bt_field_type_set_alignment(root_loud, 8); assert(ret == 0); - root_loud_toys_elem = bt_ctf_field_type_string_create(); + root_loud_toys_elem = bt_field_type_string_create(); assert(root_loud_toys_elem); - ret = bt_ctf_field_type_string_set_encoding(root_loud_toys_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_loud_toys_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_loud_toys = bt_ctf_field_type_sequence_create(root_loud_toys_elem, "trace.packet.header.iron.fire.word"); + root_loud_toys = bt_field_type_sequence_create(root_loud_toys_elem, "trace.packet.header.iron.fire.word"); assert(root_loud_toys); - ret = bt_ctf_field_type_structure_add_field(root_loud, root_loud_toys, "toys"); + ret = bt_field_type_structure_add_field(root_loud, root_loud_toys, "toys"); assert(ret == 0); - root_loud_spoon_elem = bt_ctf_field_type_string_create(); + root_loud_spoon_elem = bt_field_type_string_create(); assert(root_loud_spoon_elem); - ret = bt_ctf_field_type_string_set_encoding(root_loud_spoon_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_loud_spoon_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_loud_spoon = bt_ctf_field_type_sequence_create(root_loud_spoon_elem, "stream.packet.context.clover.oval"); + root_loud_spoon = bt_field_type_sequence_create(root_loud_spoon_elem, "stream.packet.context.clover.oval"); assert(root_loud_spoon); - ret = bt_ctf_field_type_structure_add_field(root_loud, root_loud_spoon, "spoon"); + ret = bt_field_type_structure_add_field(root_loud, root_loud_spoon, "spoon"); assert(ret == 0); - root_loud_turkey_elem = bt_ctf_field_type_string_create(); + root_loud_turkey_elem = bt_field_type_string_create(); assert(root_loud_turkey_elem); - ret = bt_ctf_field_type_string_set_encoding(root_loud_turkey_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_loud_turkey_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_loud_turkey = bt_ctf_field_type_sequence_create(root_loud_turkey_elem, "stream.event.header.action.special"); + root_loud_turkey = bt_field_type_sequence_create(root_loud_turkey_elem, "stream.event.header.action.special"); assert(root_loud_turkey); - ret = bt_ctf_field_type_structure_add_field(root_loud, root_loud_turkey, "turkey"); + ret = bt_field_type_structure_add_field(root_loud, root_loud_turkey, "turkey"); assert(ret == 0); - root_loud_inform_elem = bt_ctf_field_type_string_create(); + root_loud_inform_elem = bt_field_type_string_create(); assert(root_loud_inform_elem); - ret = bt_ctf_field_type_string_set_encoding(root_loud_inform_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_loud_inform_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_loud_inform = bt_ctf_field_type_sequence_create(root_loud_inform_elem, "stream.event.context.face.magic"); + root_loud_inform = bt_field_type_sequence_create(root_loud_inform_elem, "stream.event.context.face.magic"); assert(root_loud_inform); - ret = bt_ctf_field_type_structure_add_field(root_loud, root_loud_inform, "inform"); + ret = bt_field_type_structure_add_field(root_loud, root_loud_inform, "inform"); assert(ret == 0); - root_loud_odd_elem = bt_ctf_field_type_string_create(); + root_loud_odd_elem = bt_field_type_string_create(); assert(root_loud_odd_elem); - ret = bt_ctf_field_type_string_set_encoding(root_loud_odd_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_loud_odd_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_loud_odd = bt_ctf_field_type_sequence_create(root_loud_odd_elem, "berry.third"); + root_loud_odd = bt_field_type_sequence_create(root_loud_odd_elem, "berry.third"); assert(root_loud_odd); - ret = bt_ctf_field_type_structure_add_field(root_loud, root_loud_odd, "odd"); + ret = bt_field_type_structure_add_field(root_loud, root_loud_odd, "odd"); assert(ret == 0); - root_loud_amuck_elem = bt_ctf_field_type_string_create(); + root_loud_amuck_elem = bt_field_type_string_create(); assert(root_loud_amuck_elem); - ret = bt_ctf_field_type_string_set_encoding(root_loud_amuck_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_loud_amuck_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_loud_amuck = bt_ctf_field_type_sequence_create(root_loud_amuck_elem, "event.context.film"); + root_loud_amuck = bt_field_type_sequence_create(root_loud_amuck_elem, "event.context.film"); assert(root_loud_amuck); - ret = bt_ctf_field_type_structure_add_field(root_loud, root_loud_amuck, "amuck"); + ret = bt_field_type_structure_add_field(root_loud, root_loud_amuck, "amuck"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_loud, "loud"); + ret = bt_field_type_structure_add_field(root, root_loud, "loud"); assert(ret == 0); BT_PUT(root_film); @@ -1288,7 +1288,7 @@ struct bt_ctf_field_type *get_good_event_context_type(void) } static -struct bt_ctf_field_type *get_good_event_payload_type(void) +struct bt_field_type *get_good_event_payload_type(void) { /* Generated by bt-ctfirtg using the following input: @@ -1377,161 +1377,161 @@ struct bt_ctf_field_type *get_good_event_payload_type(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_splendid = NULL; - struct bt_ctf_field_type *root_relative = NULL; - struct bt_ctf_field_type *root_relative_equal = NULL; - struct bt_ctf_field_type *root_relative_equal_elem = NULL; - struct bt_ctf_field_type *root_relative_amuck = NULL; - struct bt_ctf_field_type *root_relative_amuck_elem = NULL; - struct bt_ctf_field_type *root_relative_push = NULL; - struct bt_ctf_field_type *root_relative_push_elem = NULL; - struct bt_ctf_field_type *root_relative_brick = NULL; - struct bt_ctf_field_type *root_relative_brick_elem = NULL; - struct bt_ctf_field_type *root_relative_crush = NULL; - struct bt_ctf_field_type *root_relative_crush_elem = NULL; - struct bt_ctf_field_type *root_relative_canvas = NULL; - struct bt_ctf_field_type *root_relative_canvas_elem = NULL; - struct bt_ctf_field_type *root_absolute = NULL; - struct bt_ctf_field_type *root_absolute_equal = NULL; - struct bt_ctf_field_type *root_absolute_equal_elem = NULL; - struct bt_ctf_field_type *root_absolute_amuck = NULL; - struct bt_ctf_field_type *root_absolute_amuck_elem = NULL; - struct bt_ctf_field_type *root_absolute_push = NULL; - struct bt_ctf_field_type *root_absolute_push_elem = NULL; - struct bt_ctf_field_type *root_absolute_brick = NULL; - struct bt_ctf_field_type *root_absolute_brick_elem = NULL; - struct bt_ctf_field_type *root_absolute_crush = NULL; - struct bt_ctf_field_type *root_absolute_crush_elem = NULL; - struct bt_ctf_field_type *root_absolute_canvas = NULL; - struct bt_ctf_field_type *root_absolute_canvas_elem = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_splendid = NULL; + struct bt_field_type *root_relative = NULL; + struct bt_field_type *root_relative_equal = NULL; + struct bt_field_type *root_relative_equal_elem = NULL; + struct bt_field_type *root_relative_amuck = NULL; + struct bt_field_type *root_relative_amuck_elem = NULL; + struct bt_field_type *root_relative_push = NULL; + struct bt_field_type *root_relative_push_elem = NULL; + struct bt_field_type *root_relative_brick = NULL; + struct bt_field_type *root_relative_brick_elem = NULL; + struct bt_field_type *root_relative_crush = NULL; + struct bt_field_type *root_relative_crush_elem = NULL; + struct bt_field_type *root_relative_canvas = NULL; + struct bt_field_type *root_relative_canvas_elem = NULL; + struct bt_field_type *root_absolute = NULL; + struct bt_field_type *root_absolute_equal = NULL; + struct bt_field_type *root_absolute_equal_elem = NULL; + struct bt_field_type *root_absolute_amuck = NULL; + struct bt_field_type *root_absolute_amuck_elem = NULL; + struct bt_field_type *root_absolute_push = NULL; + struct bt_field_type *root_absolute_push_elem = NULL; + struct bt_field_type *root_absolute_brick = NULL; + struct bt_field_type *root_absolute_brick_elem = NULL; + struct bt_field_type *root_absolute_crush = NULL; + struct bt_field_type *root_absolute_crush_elem = NULL; + struct bt_field_type *root_absolute_canvas = NULL; + struct bt_field_type *root_absolute_canvas_elem = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_splendid = bt_ctf_field_type_integer_create(12); + root_splendid = bt_field_type_integer_create(12); assert(root_splendid); ret = bt_ctf_field_type_integer_set_signed(root_splendid, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_splendid, 10); + ret = bt_field_type_integer_set_base(root_splendid, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_splendid, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_splendid, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_splendid, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_splendid, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_splendid, 1); + ret = bt_field_type_set_alignment(root_splendid, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_splendid, "splendid"); + ret = bt_field_type_structure_add_field(root, root_splendid, "splendid"); assert(ret == 0); - root_relative = bt_ctf_field_type_structure_create(); + root_relative = bt_field_type_structure_create(); assert(root_relative); - ret = bt_ctf_field_type_set_alignment(root_relative, 8); + ret = bt_field_type_set_alignment(root_relative, 8); assert(ret == 0); - root_relative_equal_elem = bt_ctf_field_type_string_create(); + root_relative_equal_elem = bt_field_type_string_create(); assert(root_relative_equal_elem); - ret = bt_ctf_field_type_string_set_encoding(root_relative_equal_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_relative_equal_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_relative_equal = bt_ctf_field_type_sequence_create(root_relative_equal_elem, "splendid"); + root_relative_equal = bt_field_type_sequence_create(root_relative_equal_elem, "splendid"); assert(root_relative_equal); - ret = bt_ctf_field_type_structure_add_field(root_relative, root_relative_equal, "equal"); + ret = bt_field_type_structure_add_field(root_relative, root_relative_equal, "equal"); assert(ret == 0); - root_relative_amuck_elem = bt_ctf_field_type_string_create(); + root_relative_amuck_elem = bt_field_type_string_create(); assert(root_relative_amuck_elem); - ret = bt_ctf_field_type_string_set_encoding(root_relative_amuck_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_relative_amuck_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_relative_amuck = bt_ctf_field_type_sequence_create(root_relative_amuck_elem, "id"); + root_relative_amuck = bt_field_type_sequence_create(root_relative_amuck_elem, "id"); assert(root_relative_amuck); - ret = bt_ctf_field_type_structure_add_field(root_relative, root_relative_amuck, "amuck"); + ret = bt_field_type_structure_add_field(root_relative, root_relative_amuck, "amuck"); assert(ret == 0); - root_relative_push_elem = bt_ctf_field_type_string_create(); + root_relative_push_elem = bt_field_type_string_create(); assert(root_relative_push_elem); - ret = bt_ctf_field_type_string_set_encoding(root_relative_push_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_relative_push_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_relative_push = bt_ctf_field_type_sequence_create(root_relative_push_elem, "berry.third"); + root_relative_push = bt_field_type_sequence_create(root_relative_push_elem, "berry.third"); assert(root_relative_push); - ret = bt_ctf_field_type_structure_add_field(root_relative, root_relative_push, "push"); + ret = bt_field_type_structure_add_field(root_relative, root_relative_push, "push"); assert(ret == 0); - root_relative_brick_elem = bt_ctf_field_type_string_create(); + root_relative_brick_elem = bt_field_type_string_create(); assert(root_relative_brick_elem); - ret = bt_ctf_field_type_string_set_encoding(root_relative_brick_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_relative_brick_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_relative_brick = bt_ctf_field_type_sequence_create(root_relative_brick_elem, "face.magic"); + root_relative_brick = bt_field_type_sequence_create(root_relative_brick_elem, "face.magic"); assert(root_relative_brick); - ret = bt_ctf_field_type_structure_add_field(root_relative, root_relative_brick, "brick"); + ret = bt_field_type_structure_add_field(root_relative, root_relative_brick, "brick"); assert(ret == 0); - root_relative_crush_elem = bt_ctf_field_type_string_create(); + root_relative_crush_elem = bt_field_type_string_create(); assert(root_relative_crush_elem); - ret = bt_ctf_field_type_string_set_encoding(root_relative_crush_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_relative_crush_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_relative_crush = bt_ctf_field_type_sequence_create(root_relative_crush_elem, "serious"); + root_relative_crush = bt_field_type_sequence_create(root_relative_crush_elem, "serious"); assert(root_relative_crush); - ret = bt_ctf_field_type_structure_add_field(root_relative, root_relative_crush, "crush"); + ret = bt_field_type_structure_add_field(root_relative, root_relative_crush, "crush"); assert(ret == 0); - root_relative_canvas_elem = bt_ctf_field_type_string_create(); + root_relative_canvas_elem = bt_field_type_string_create(); assert(root_relative_canvas_elem); - ret = bt_ctf_field_type_string_set_encoding(root_relative_canvas_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_relative_canvas_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_relative_canvas = bt_ctf_field_type_sequence_create(root_relative_canvas_elem, "iron.dust"); + root_relative_canvas = bt_field_type_sequence_create(root_relative_canvas_elem, "iron.dust"); assert(root_relative_canvas); - ret = bt_ctf_field_type_structure_add_field(root_relative, root_relative_canvas, "canvas"); + ret = bt_field_type_structure_add_field(root_relative, root_relative_canvas, "canvas"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_relative, "relative"); + ret = bt_field_type_structure_add_field(root, root_relative, "relative"); assert(ret == 0); - root_absolute = bt_ctf_field_type_structure_create(); + root_absolute = bt_field_type_structure_create(); assert(root_absolute); - ret = bt_ctf_field_type_set_alignment(root_absolute, 8); + ret = bt_field_type_set_alignment(root_absolute, 8); assert(ret == 0); - root_absolute_equal_elem = bt_ctf_field_type_string_create(); + root_absolute_equal_elem = bt_field_type_string_create(); assert(root_absolute_equal_elem); - ret = bt_ctf_field_type_string_set_encoding(root_absolute_equal_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_absolute_equal_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_absolute_equal = bt_ctf_field_type_sequence_create(root_absolute_equal_elem, "event.fields.splendid"); + root_absolute_equal = bt_field_type_sequence_create(root_absolute_equal_elem, "event.fields.splendid"); assert(root_absolute_equal); - ret = bt_ctf_field_type_structure_add_field(root_absolute, root_absolute_equal, "equal"); + ret = bt_field_type_structure_add_field(root_absolute, root_absolute_equal, "equal"); assert(ret == 0); - root_absolute_amuck_elem = bt_ctf_field_type_string_create(); + root_absolute_amuck_elem = bt_field_type_string_create(); assert(root_absolute_amuck_elem); - ret = bt_ctf_field_type_string_set_encoding(root_absolute_amuck_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_absolute_amuck_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_absolute_amuck = bt_ctf_field_type_sequence_create(root_absolute_amuck_elem, "stream.event.header.id"); + root_absolute_amuck = bt_field_type_sequence_create(root_absolute_amuck_elem, "stream.event.header.id"); assert(root_absolute_amuck); - ret = bt_ctf_field_type_structure_add_field(root_absolute, root_absolute_amuck, "amuck"); + ret = bt_field_type_structure_add_field(root_absolute, root_absolute_amuck, "amuck"); assert(ret == 0); - root_absolute_push_elem = bt_ctf_field_type_string_create(); + root_absolute_push_elem = bt_field_type_string_create(); assert(root_absolute_push_elem); - ret = bt_ctf_field_type_string_set_encoding(root_absolute_push_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_absolute_push_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_absolute_push = bt_ctf_field_type_sequence_create(root_absolute_push_elem, "event.context.berry.third"); + root_absolute_push = bt_field_type_sequence_create(root_absolute_push_elem, "event.context.berry.third"); assert(root_absolute_push); - ret = bt_ctf_field_type_structure_add_field(root_absolute, root_absolute_push, "push"); + ret = bt_field_type_structure_add_field(root_absolute, root_absolute_push, "push"); assert(ret == 0); - root_absolute_brick_elem = bt_ctf_field_type_string_create(); + root_absolute_brick_elem = bt_field_type_string_create(); assert(root_absolute_brick_elem); - ret = bt_ctf_field_type_string_set_encoding(root_absolute_brick_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_absolute_brick_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_absolute_brick = bt_ctf_field_type_sequence_create(root_absolute_brick_elem, "stream.event.context.face.magic"); + root_absolute_brick = bt_field_type_sequence_create(root_absolute_brick_elem, "stream.event.context.face.magic"); assert(root_absolute_brick); - ret = bt_ctf_field_type_structure_add_field(root_absolute, root_absolute_brick, "brick"); + ret = bt_field_type_structure_add_field(root_absolute, root_absolute_brick, "brick"); assert(ret == 0); - root_absolute_crush_elem = bt_ctf_field_type_string_create(); + root_absolute_crush_elem = bt_field_type_string_create(); assert(root_absolute_crush_elem); - ret = bt_ctf_field_type_string_set_encoding(root_absolute_crush_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_absolute_crush_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_absolute_crush = bt_ctf_field_type_sequence_create(root_absolute_crush_elem, "stream.packet.context.serious"); + root_absolute_crush = bt_field_type_sequence_create(root_absolute_crush_elem, "stream.packet.context.serious"); assert(root_absolute_crush); - ret = bt_ctf_field_type_structure_add_field(root_absolute, root_absolute_crush, "crush"); + ret = bt_field_type_structure_add_field(root_absolute, root_absolute_crush, "crush"); assert(ret == 0); - root_absolute_canvas_elem = bt_ctf_field_type_string_create(); + root_absolute_canvas_elem = bt_field_type_string_create(); assert(root_absolute_canvas_elem); - ret = bt_ctf_field_type_string_set_encoding(root_absolute_canvas_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_absolute_canvas_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_absolute_canvas = bt_ctf_field_type_sequence_create(root_absolute_canvas_elem, "trace.packet.header.iron.dust"); + root_absolute_canvas = bt_field_type_sequence_create(root_absolute_canvas_elem, "trace.packet.header.iron.dust"); assert(root_absolute_canvas); - ret = bt_ctf_field_type_structure_add_field(root_absolute, root_absolute_canvas, "canvas"); + ret = bt_field_type_structure_add_field(root_absolute, root_absolute_canvas, "canvas"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_absolute, "absolute"); + ret = bt_field_type_structure_add_field(root, root_absolute, "absolute"); assert(ret == 0); BT_PUT(root_splendid); @@ -1566,32 +1566,32 @@ struct bt_ctf_field_type *get_good_event_payload_type(void) } static -struct bt_ctf_field_type *get_child_ft(struct bt_ctf_field_type *parent_ft, +struct bt_field_type *get_child_ft(struct bt_field_type *parent_ft, const char *name) { - struct bt_ctf_field_type *ft = NULL; + struct bt_field_type *ft = NULL; - switch (bt_ctf_field_type_get_type_id(parent_ft)) { + switch (bt_field_type_get_type_id(parent_ft)) { case CTF_TYPE_STRUCT: - ft = bt_ctf_field_type_structure_get_field_type_by_name( + ft = bt_field_type_structure_get_field_type_by_name( parent_ft, name); break; case CTF_TYPE_VARIANT: - ft = bt_ctf_field_type_variant_get_field_type_by_name( + ft = bt_field_type_variant_get_field_type_by_name( parent_ft, name); break; case CTF_TYPE_ARRAY: - ft = bt_ctf_field_type_array_get_element_type(parent_ft); + ft = bt_field_type_array_get_element_type(parent_ft); break; case CTF_TYPE_SEQUENCE: - ft = bt_ctf_field_type_sequence_get_element_type(parent_ft); + ft = bt_field_type_sequence_get_element_type(parent_ft); break; case CTF_TYPE_ENUM: - ft = bt_ctf_field_type_enumeration_get_container_type( + ft = bt_field_type_enumeration_get_container_type( parent_ft); break; @@ -1605,10 +1605,10 @@ struct bt_ctf_field_type *get_child_ft(struct bt_ctf_field_type *parent_ft, } static -struct bt_ctf_field_type *get_ft(struct bt_ctf_field_type *root_ft, ...) +struct bt_field_type *get_ft(struct bt_field_type *root_ft, ...) { - struct bt_ctf_field_type *child_ft = NULL; - struct bt_ctf_field_type *ft = root_ft; + struct bt_field_type *child_ft = NULL; + struct bt_field_type *ft = root_ft; va_list ap; va_start(ap, root_ft); @@ -1640,23 +1640,23 @@ end: #define FIELD_PATH_END -2 static -int validate_field_path(struct bt_ctf_field_type *field_type, int int_root, ...) +int validate_field_path(struct bt_field_type *field_type, int int_root, ...) { - enum bt_ctf_scope root = int_root; + enum bt_scope root = int_root; int ret = 0; int len; int expected_index; int actual_index; int i = 0; - struct bt_ctf_field_path *field_path = NULL; + struct bt_field_path *field_path = NULL; va_list ap; va_start(ap, int_root); - if (bt_ctf_field_type_is_sequence(field_type)) { - field_path = bt_ctf_field_type_sequence_get_length_field_path( + if (bt_field_type_is_sequence(field_type)) { + field_path = bt_field_type_sequence_get_length_field_path( field_type); - } else if (bt_ctf_field_type_is_variant(field_type)) { - field_path = bt_ctf_field_type_variant_get_tag_field_path( + } else if (bt_field_type_is_variant(field_type)) { + field_path = bt_field_type_variant_get_tag_field_path( field_type); } @@ -1665,12 +1665,12 @@ int validate_field_path(struct bt_ctf_field_type *field_type, int int_root, ...) goto end; } - if (bt_ctf_field_path_get_root_scope(field_path) != root) { + if (bt_field_path_get_root_scope(field_path) != root) { ret = -1; goto end; } - len = bt_ctf_field_path_get_index_count(field_path); + len = bt_field_path_get_index_count(field_path); while (true) { expected_index = va_arg(ap, int); @@ -1683,7 +1683,7 @@ int validate_field_path(struct bt_ctf_field_type *field_type, int int_root, ...) break; } - actual_index = bt_ctf_field_path_get_index(field_path, i); + actual_index = bt_field_path_get_index(field_path, i); if (actual_index == INT_MIN) { ret = -1; @@ -1705,41 +1705,41 @@ end: } static -void validate_test_pass(struct bt_ctf_trace *trace) +void validate_test_pass(struct bt_trace *trace) { - struct bt_ctf_stream_class *sc; - struct bt_ctf_event_class *ec; - struct bt_ctf_field_type *ph; - struct bt_ctf_field_type *pc; - struct bt_ctf_field_type *eh; - struct bt_ctf_field_type *sec; - struct bt_ctf_field_type *ectx; - struct bt_ctf_field_type *ep; - struct bt_ctf_field_type *ft_src = NULL; - struct bt_ctf_field_type *ft_target = NULL; - struct bt_ctf_field_type *ft_tag = NULL; - - sc = bt_ctf_trace_get_stream_class_by_index(trace, 0); + struct bt_stream_class *sc; + struct bt_event_class *ec; + struct bt_field_type *ph; + struct bt_field_type *pc; + struct bt_field_type *eh; + struct bt_field_type *sec; + struct bt_field_type *ectx; + struct bt_field_type *ep; + struct bt_field_type *ft_src = NULL; + struct bt_field_type *ft_target = NULL; + struct bt_field_type *ft_tag = NULL; + + sc = bt_trace_get_stream_class_by_index(trace, 0); assert(sc); - ec = bt_ctf_stream_class_get_event_class_by_index(sc, 0); + ec = bt_stream_class_get_event_class_by_index(sc, 0); assert(ec); - ph = bt_ctf_trace_get_packet_header_type(trace); + ph = bt_trace_get_packet_header_type(trace); ok(ph, "Trace packet header still exists after successful validation"); - pc = bt_ctf_stream_class_get_packet_context_type(sc); + pc = bt_stream_class_get_packet_context_type(sc); ok(pc, "Stream packet context still exists after successful validation"); - eh = bt_ctf_stream_class_get_event_header_type(sc); + eh = bt_stream_class_get_event_header_type(sc); ok(eh, "Stream event header still exists after successful validation"); - sec = bt_ctf_stream_class_get_event_context_type(sc); + sec = bt_stream_class_get_event_context_type(sc); ok(sec, "Stream event context still exists after successful validation"); - ectx = bt_ctf_event_class_get_context_type(ec); + ectx = bt_event_class_get_context_type(ec); ok(ectx, "Event context still exists after successful validation"); - ep = bt_ctf_event_class_get_payload_type(ec); + ep = bt_event_class_get_payload_type(ec); ok(ep, "Event payload still exists after successful validation"); /* trace.packet.header.iron.fire.keen */ ft_src = get_ft(ph, "iron", "fire", "keen", NULL); - ok(!validate_field_path(ft_src, BT_CTF_SCOPE_TRACE_PACKET_HEADER, + ok(!validate_field_path(ft_src, BT_SCOPE_TRACE_PACKET_HEADER, 3, 3, 0, FIELD_PATH_END), "trace.packet.header.iron.fire.keen has the correct field path"); BT_PUT(ft_src); @@ -1747,10 +1747,10 @@ void validate_test_pass(struct bt_ctf_trace *trace) /* trace.packet.header.iron.fire.keen.[element] */ ft_src = get_ft(ph, "iron", "fire", "keen", "", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 2, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 2, FIELD_PATH_END), "trace.packet.header.iron.fire.keen.[element] has the correct field path"); ft_target = get_ft(ph, "iron", "parallel", NULL); - ft_tag = bt_ctf_field_type_variant_get_tag_type(ft_src); + ft_tag = bt_field_type_variant_get_tag_type(ft_src); ok(ft_tag == ft_target, "trace.packet.header.iron.fire.keen.[element] has the correct tag type"); BT_PUT(ft_src); @@ -1760,38 +1760,38 @@ void validate_test_pass(struct bt_ctf_trace *trace) /* trace.packet.header.iron.fire.keen.[element].BLUE */ ft_src = get_ft(ph, "iron", "fire", "keen", "", "BLUE", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 0, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 0, FIELD_PATH_END), "trace.packet.header.iron.fire.keen.[element].BLUE has the correct field path"); BT_PUT(ft_src); /* trace.packet.header.iron.report */ ft_src = get_ft(ph, "iron", "report", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), "trace.packet.header.iron.report has the correct field path"); BT_PUT(ft_src); /* trace.packet.header.iron.group */ ft_src = get_ft(ph, "iron", "group", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 2, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 2, FIELD_PATH_END), "trace.packet.header.iron.group has the correct field path"); BT_PUT(ft_src); /* stream.packet.context.naive.[element] */ ft_src = get_ft(pc, "naive", "", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 0, FIELD_PATH_END), "stream.packet.context.naive.[element] has the correct field path"); BT_PUT(ft_src); /* stream.packet.context.clover.whole */ ft_src = get_ft(pc, "clover", "whole", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 2, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 2, FIELD_PATH_END), "stream.packet.context.clover.whole has the correct field path"); ft_target = get_ft(ph, "iron", "parallel", NULL); - ft_tag = bt_ctf_field_type_variant_get_tag_type(ft_src); + ft_tag = bt_field_type_variant_get_tag_type(ft_src); ok(ft_tag == ft_target, "stream.packet.context.clover.whole has the correct tag type"); BT_PUT(ft_src); @@ -1801,245 +1801,245 @@ void validate_test_pass(struct bt_ctf_trace *trace) /* stream.packet.context.clover.whole.BLUE */ ft_src = get_ft(pc, "clover", "whole", "BLUE", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 3, 0, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 3, 0, FIELD_PATH_END), "stream.packet.context.clover.whole.BLUE has the correct field path"); BT_PUT(ft_src); /* stream.packet.context.clover.egg */ ft_src = get_ft(pc, "clover", "egg", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 4, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 4, 0, FIELD_PATH_END), "stream.packet.context.clover.egg has the correct field path"); BT_PUT(ft_src); /* stream.packet.context.clover.useful */ ft_src = get_ft(pc, "clover", "useful", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), "stream.packet.context.clover.useful has the correct field path"); BT_PUT(ft_src); /* stream.event.header.action.lucky */ ft_src = get_ft(eh, "action", "lucky", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 0, FIELD_PATH_END), "stream.event.header.action.lucky has the correct field path"); BT_PUT(ft_src); /* stream.event.header.stiff */ ft_src = get_ft(eh, "stiff", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 4, 1, 1, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 4, 1, 1, FIELD_PATH_END), "stream.event.header.stiff has the correct field path"); BT_PUT(ft_src); /* stream.event.header.fruit.apple */ ft_src = get_ft(eh, "fruit", "apple", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_HEADER, 2, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_HEADER, 2, 0, FIELD_PATH_END), "stream.event.header.fruit.apple has the correct field path"); BT_PUT(ft_src); /* stream.event.context.face.branch */ ft_src = get_ft(sec, "face", "branch", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), "stream.event.context.face.branch has the correct field path"); BT_PUT(ft_src); /* stream.event.context.face.income */ ft_src = get_ft(sec, "face", "income", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 0, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 0, FIELD_PATH_END), "stream.event.context.face.income has the correct field path"); BT_PUT(ft_src); /* stream.event.context.face.lucky */ ft_src = get_ft(sec, "face", "lucky", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), "stream.event.context.face.lucky has the correct field path"); BT_PUT(ft_src); /* stream.event.context.dream */ ft_src = get_ft(sec, "dream", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 0, FIELD_PATH_END), "stream.event.context.dream has the correct field path"); BT_PUT(ft_src); /* stream.event.context.dream.[element] */ ft_src = get_ft(sec, "dream", "", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), "stream.event.context.dream.[element] has the correct field path"); BT_PUT(ft_src); /* stream.event.context.dream.[element].[element] */ ft_src = get_ft(sec, "dream", "", "", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), "stream.event.context.dream.[element].[element] has the correct field path"); BT_PUT(ft_src); /* event.context.berry.porter */ ft_src = get_ft(ectx, "berry", "porter", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), "event.context.berry.porter has the correct field path"); BT_PUT(ft_src); /* event.context.berry.porter */ ft_src = get_ft(ectx, "berry", "porter", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), "event.context.berry.porter has the correct field path"); BT_PUT(ft_src); /* event.context.berry.mice */ ft_src = get_ft(ectx, "berry", "mice", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_HEADER, 2, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_HEADER, 2, 0, FIELD_PATH_END), "event.context.berry.mice has the correct field path"); BT_PUT(ft_src); /* event.context.berry.guard */ ft_src = get_ft(ectx, "berry", "guard", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 4, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 4, 0, FIELD_PATH_END), "event.context.berry.guard has the correct field path"); BT_PUT(ft_src); /* event.context.berry.one */ ft_src = get_ft(ectx, "berry", "one", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 3, 0, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 3, 0, FIELD_PATH_END), "event.context.berry.one has the correct field path"); BT_PUT(ft_src); /* event.context.loud.toys */ ft_src = get_ft(ectx, "loud", "toys", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 3, 0, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 3, 0, FIELD_PATH_END), "event.context.loud.toys has the correct field path"); BT_PUT(ft_src); /* event.context.loud.spoon */ ft_src = get_ft(ectx, "loud", "spoon", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 4, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 4, 0, FIELD_PATH_END), "event.context.loud.spoon has the correct field path"); BT_PUT(ft_src); /* event.context.loud.turkey */ ft_src = get_ft(ectx, "loud", "turkey", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_HEADER, 2, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_HEADER, 2, 0, FIELD_PATH_END), "event.context.loud.turkey has the correct field path"); BT_PUT(ft_src); /* event.context.loud.inform */ ft_src = get_ft(ectx, "loud", "inform", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), "event.context.loud.inform has the correct field path"); BT_PUT(ft_src); /* event.context.loud.odd */ ft_src = get_ft(ectx, "loud", "odd", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_EVENT_CONTEXT, 1, 3, FIELD_PATH_END), + BT_SCOPE_EVENT_CONTEXT, 1, 3, FIELD_PATH_END), "event.context.loud.odd has the correct field path"); BT_PUT(ft_src); /* event.context.loud.amuck */ ft_src = get_ft(ectx, "loud", "amuck", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_EVENT_CONTEXT, 0, FIELD_PATH_END), + BT_SCOPE_EVENT_CONTEXT, 0, FIELD_PATH_END), "event.context.loud.amuck has the correct field path"); BT_PUT(ft_src); /* event.fields.relative.equal */ ft_src = get_ft(ep, "relative", "equal", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_EVENT_FIELDS, 0, FIELD_PATH_END), + BT_SCOPE_EVENT_FIELDS, 0, FIELD_PATH_END), "event.fields.relative.equal has the correct field path"); BT_PUT(ft_src); /* event.fields.relative.amuck */ ft_src = get_ft(ep, "relative", "amuck", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_HEADER, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_HEADER, 0, FIELD_PATH_END), "event.fields.relative.amuck has the correct field path"); BT_PUT(ft_src); /* event.fields.relative.push */ ft_src = get_ft(ep, "relative", "push", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_EVENT_CONTEXT, 1, 3, FIELD_PATH_END), + BT_SCOPE_EVENT_CONTEXT, 1, 3, FIELD_PATH_END), "event.fields.relative.push has the correct field path"); BT_PUT(ft_src); /* event.fields.relative.brick */ ft_src = get_ft(ep, "relative", "brick", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), "event.fields.relative.brick has the correct field path"); BT_PUT(ft_src); /* event.fields.relative.crush */ ft_src = get_ft(ep, "relative", "crush", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), "event.fields.relative.crush has the correct field path"); BT_PUT(ft_src); /* event.fields.relative.canvas */ ft_src = get_ft(ep, "relative", "canvas", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), "event.fields.relative.canvas has the correct field path"); BT_PUT(ft_src); /* event.fields.absolute.equal */ ft_src = get_ft(ep, "absolute", "equal", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_EVENT_FIELDS, 0, FIELD_PATH_END), + BT_SCOPE_EVENT_FIELDS, 0, FIELD_PATH_END), "event.fields.absolute.equal has the correct field path"); BT_PUT(ft_src); /* event.fields.absolute.amuck */ ft_src = get_ft(ep, "absolute", "amuck", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_HEADER, 0, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_HEADER, 0, FIELD_PATH_END), "event.fields.absolute.amuck has the correct field path"); BT_PUT(ft_src); /* event.fields.absolute.push */ ft_src = get_ft(ep, "absolute", "push", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_EVENT_CONTEXT, 1, 3, FIELD_PATH_END), + BT_SCOPE_EVENT_CONTEXT, 1, 3, FIELD_PATH_END), "event.fields.absolute.push has the correct field path"); BT_PUT(ft_src); /* event.fields.absolute.brick */ ft_src = get_ft(ep, "absolute", "brick", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_EVENT_CONTEXT, 0, 2, FIELD_PATH_END), "event.fields.absolute.brick has the correct field path"); BT_PUT(ft_src); /* event.fields.absolute.crush */ ft_src = get_ft(ep, "absolute", "crush", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), + BT_SCOPE_STREAM_PACKET_CONTEXT, 2, FIELD_PATH_END), "event.fields.absolute.crush has the correct field path"); BT_PUT(ft_src); /* event.fields.absolute.canvas */ ft_src = get_ft(ep, "absolute", "canvas", NULL); ok(!validate_field_path(ft_src, - BT_CTF_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), + BT_SCOPE_TRACE_PACKET_HEADER, 3, 1, FIELD_PATH_END), "event.fields.absolute.canvas has the correct field path"); BT_PUT(ft_src); @@ -2059,21 +2059,21 @@ static void test_pass(void) { int ret; - struct bt_ctf_trace *trace; - struct bt_ctf_stream_class *sc; - struct bt_ctf_event_class *ec; - struct bt_ctf_field_type *ph; - struct bt_ctf_field_type *pc; - struct bt_ctf_field_type *eh; - struct bt_ctf_field_type *sec; - struct bt_ctf_field_type *ectx; - struct bt_ctf_field_type *ep; - - trace = bt_ctf_trace_create(); + struct bt_trace *trace; + struct bt_stream_class *sc; + struct bt_event_class *ec; + struct bt_field_type *ph; + struct bt_field_type *pc; + struct bt_field_type *eh; + struct bt_field_type *sec; + struct bt_field_type *ectx; + struct bt_field_type *ep; + + trace = bt_trace_create(); assert(trace); - sc = bt_ctf_stream_class_create("nice_piece_of_stream_class"); + sc = bt_stream_class_create("nice_piece_of_stream_class"); assert(sc); - ec = bt_ctf_event_class_create("oh_what_an_event_class"); + ec = bt_event_class_create("oh_what_an_event_class"); assert(ec); ph = get_good_packet_header_type(); @@ -2089,24 +2089,24 @@ void test_pass(void) ep = get_good_event_payload_type(); assert(ep); - ret = bt_ctf_trace_set_packet_header_type(trace, ph); + ret = bt_trace_set_packet_header_type(trace, ph); assert(ret == 0); - ret = bt_ctf_stream_class_set_packet_context_type(sc, pc); + ret = bt_stream_class_set_packet_context_type(sc, pc); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_header_type(sc, eh); + ret = bt_stream_class_set_event_header_type(sc, eh); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_context_type(sc, sec); + ret = bt_stream_class_set_event_context_type(sc, sec); assert(ret == 0); - ret = bt_ctf_event_class_set_context_type(ec, ectx); + ret = bt_event_class_set_context_type(ec, ectx); assert(ret == 0); - ret = bt_ctf_event_class_set_payload_type(ec, ep); + ret = bt_event_class_set_payload_type(ec, ep); assert(ret == 0); - ret = bt_ctf_stream_class_add_event_class(sc, ec); + ret = bt_stream_class_add_event_class(sc, ec); assert(ret == 0); /* Validation happens here */ - ret = bt_ctf_trace_add_stream_class(trace, sc); + ret = bt_trace_add_stream_class(trace, sc); ok(ret == 0, "Valid type system is considered valid"); validate_test_pass(trace); @@ -2123,34 +2123,34 @@ void test_pass(void) } static -struct bt_ctf_event *create_event_with_context_and_payload( - struct bt_ctf_field_type *ectx, struct bt_ctf_field_type *ep) +struct bt_event *create_event_with_context_and_payload( + struct bt_field_type *ectx, struct bt_field_type *ep) { int ret; - struct bt_ctf_stream_class *sc; - struct bt_ctf_event_class *ec; - struct bt_ctf_event *event; + struct bt_stream_class *sc; + struct bt_event_class *ec; + struct bt_event *event; - sc = bt_ctf_stream_class_create("sc"); + sc = bt_stream_class_create("sc"); assert(sc); - ec = bt_ctf_event_class_create("ec"); + ec = bt_event_class_create("ec"); assert(ec); if (ectx) { - ret = bt_ctf_event_class_set_context_type(ec, ectx); + ret = bt_event_class_set_context_type(ec, ectx); assert(ret == 0); } if (ep) { - ret = bt_ctf_event_class_set_payload_type(ec, ep); + ret = bt_event_class_set_payload_type(ec, ep); assert(ret == 0); } - ret = bt_ctf_stream_class_add_event_class(sc, ec); + ret = bt_stream_class_add_event_class(sc, ec); assert(ret == 0); /* Validation happens here */ - event = bt_ctf_event_create(ec); + event = bt_event_create(ec); BT_PUT(ec); BT_PUT(sc); @@ -2160,7 +2160,7 @@ struct bt_ctf_event *create_event_with_context_and_payload( static -struct bt_ctf_field_type *test_fail_unavailable_root_get_event_payload(void) +struct bt_field_type *test_fail_unavailable_root_get_event_payload(void) { /* Generated by bt-ctfirtg using the following input: @@ -2180,44 +2180,44 @@ struct bt_ctf_field_type *test_fail_unavailable_root_get_event_payload(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_b = NULL; - struct bt_ctf_field_type *root_b_elem = NULL; - struct bt_ctf_field_type *root_c = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_b = NULL; + struct bt_field_type *root_b_elem = NULL; + struct bt_field_type *root_c = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a = bt_ctf_field_type_integer_create(32); + root_a = bt_field_type_integer_create(32); assert(root_a); ret = bt_ctf_field_type_integer_set_signed(root_a, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_a, 10); + ret = bt_field_type_integer_set_base(root_a, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_a, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_a, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_a, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_a, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_a, 8); + ret = bt_field_type_set_alignment(root_a, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_b_elem = bt_ctf_field_type_string_create(); + root_b_elem = bt_field_type_string_create(); assert(root_b_elem); - ret = bt_ctf_field_type_string_set_encoding(root_b_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_b_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_b = bt_ctf_field_type_sequence_create(root_b_elem, "stream.event.context.lol"); + root_b = bt_field_type_sequence_create(root_b_elem, "stream.event.context.lol"); assert(root_b); - ret = bt_ctf_field_type_structure_add_field(root, root_b, "b"); + ret = bt_field_type_structure_add_field(root, root_b, "b"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); BT_PUT(root_a); @@ -2231,8 +2231,8 @@ struct bt_ctf_field_type *test_fail_unavailable_root_get_event_payload(void) static void test_fail_unavailable_root(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_unavailable_root_get_event_payload(); assert(ep); @@ -2244,7 +2244,7 @@ void test_fail_unavailable_root(void) } static -struct bt_ctf_field_type *test_fail_target_is_root_get_event_payload(void) +struct bt_field_type *test_fail_target_is_root_get_event_payload(void) { /* Generated by bt-ctfirtg using the following input: @@ -2264,44 +2264,44 @@ struct bt_ctf_field_type *test_fail_target_is_root_get_event_payload(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_b = NULL; - struct bt_ctf_field_type *root_b_elem = NULL; - struct bt_ctf_field_type *root_c = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_b = NULL; + struct bt_field_type *root_b_elem = NULL; + struct bt_field_type *root_c = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a = bt_ctf_field_type_integer_create(32); + root_a = bt_field_type_integer_create(32); assert(root_a); ret = bt_ctf_field_type_integer_set_signed(root_a, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_a, 10); + ret = bt_field_type_integer_set_base(root_a, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_a, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_a, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_a, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_a, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_a, 8); + ret = bt_field_type_set_alignment(root_a, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_b_elem = bt_ctf_field_type_string_create(); + root_b_elem = bt_field_type_string_create(); assert(root_b_elem); - ret = bt_ctf_field_type_string_set_encoding(root_b_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_b_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_b = bt_ctf_field_type_sequence_create(root_b_elem, "event.fields"); + root_b = bt_field_type_sequence_create(root_b_elem, "event.fields"); assert(root_b); - ret = bt_ctf_field_type_structure_add_field(root, root_b, "b"); + ret = bt_field_type_structure_add_field(root, root_b, "b"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); BT_PUT(root_a); @@ -2315,8 +2315,8 @@ struct bt_ctf_field_type *test_fail_target_is_root_get_event_payload(void) static void test_fail_target_is_root(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_target_is_root_get_event_payload(); assert(ep); @@ -2328,7 +2328,7 @@ void test_fail_target_is_root(void) } static -struct bt_ctf_field_type *test_fail_target_is_after_source_get_ep(void) +struct bt_field_type *test_fail_target_is_after_source_get_ep(void) { /* Generated by bt-ctfirtg using the following input: @@ -2351,59 +2351,59 @@ struct bt_ctf_field_type *test_fail_target_is_after_source_get_ep(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_b = NULL; - struct bt_ctf_field_type *root_b_elem = NULL; - struct bt_ctf_field_type *root_c = NULL; - struct bt_ctf_field_type *root_d = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_b = NULL; + struct bt_field_type *root_b_elem = NULL; + struct bt_field_type *root_c = NULL; + struct bt_field_type *root_d = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a = bt_ctf_field_type_integer_create(32); + root_a = bt_field_type_integer_create(32); assert(root_a); ret = bt_ctf_field_type_integer_set_signed(root_a, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_a, 10); + ret = bt_field_type_integer_set_base(root_a, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_a, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_a, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_a, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_a, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_a, 8); + ret = bt_field_type_set_alignment(root_a, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_b_elem = bt_ctf_field_type_string_create(); + root_b_elem = bt_field_type_string_create(); assert(root_b_elem); - ret = bt_ctf_field_type_string_set_encoding(root_b_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_b_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_b = bt_ctf_field_type_sequence_create(root_b_elem, "d"); + root_b = bt_field_type_sequence_create(root_b_elem, "d"); assert(root_b); - ret = bt_ctf_field_type_structure_add_field(root, root_b, "b"); + ret = bt_field_type_structure_add_field(root, root_b, "b"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); - root_d = bt_ctf_field_type_integer_create(17); + root_d = bt_field_type_integer_create(17); assert(root_d); ret = bt_ctf_field_type_integer_set_signed(root_d, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_d, 10); + ret = bt_field_type_integer_set_base(root_d, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_d, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_d, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_d, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_d, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_d, 1); + ret = bt_field_type_set_alignment(root_d, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_d, "d"); + ret = bt_field_type_structure_add_field(root, root_d, "d"); assert(ret == 0); BT_PUT(root_a); @@ -2418,8 +2418,8 @@ struct bt_ctf_field_type *test_fail_target_is_after_source_get_ep(void) static void test_fail_target_is_after_source(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_target_is_after_source_get_ep(); assert(ep); @@ -2431,7 +2431,7 @@ void test_fail_target_is_after_source(void) } static -struct bt_ctf_field_type *test_fail_target_is_ancestor_of_source_get_ep(void) +struct bt_field_type *test_fail_target_is_ancestor_of_source_get_ep(void) { /* Generated by bt-ctfirtg using the following input: @@ -2457,66 +2457,66 @@ struct bt_ctf_field_type *test_fail_target_is_ancestor_of_source_get_ep(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_z = NULL; - struct bt_ctf_field_type *root_z_b = NULL; - struct bt_ctf_field_type *root_z_b_elem = NULL; - struct bt_ctf_field_type *root_c = NULL; - struct bt_ctf_field_type *root_d = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_z = NULL; + struct bt_field_type *root_z_b = NULL; + struct bt_field_type *root_z_b_elem = NULL; + struct bt_field_type *root_c = NULL; + struct bt_field_type *root_d = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a = bt_ctf_field_type_integer_create(32); + root_a = bt_field_type_integer_create(32); assert(root_a); ret = bt_ctf_field_type_integer_set_signed(root_a, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_a, 10); + ret = bt_field_type_integer_set_base(root_a, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_a, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_a, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_a, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_a, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_a, 8); + ret = bt_field_type_set_alignment(root_a, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_z = bt_ctf_field_type_structure_create(); + root_z = bt_field_type_structure_create(); assert(root_z); - ret = bt_ctf_field_type_set_alignment(root_z, 8); + ret = bt_field_type_set_alignment(root_z, 8); assert(ret == 0); - root_z_b_elem = bt_ctf_field_type_string_create(); + root_z_b_elem = bt_field_type_string_create(); assert(root_z_b_elem); - ret = bt_ctf_field_type_string_set_encoding(root_z_b_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_z_b_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_z_b = bt_ctf_field_type_sequence_create(root_z_b_elem, "z"); + root_z_b = bt_field_type_sequence_create(root_z_b_elem, "z"); assert(root_z_b); - ret = bt_ctf_field_type_structure_add_field(root_z, root_z_b, "b"); + ret = bt_field_type_structure_add_field(root_z, root_z_b, "b"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_z, "z"); + ret = bt_field_type_structure_add_field(root, root_z, "z"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); - root_d = bt_ctf_field_type_integer_create(17); + root_d = bt_field_type_integer_create(17); assert(root_d); ret = bt_ctf_field_type_integer_set_signed(root_d, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_d, 10); + ret = bt_field_type_integer_set_base(root_d, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_d, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_d, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_d, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_d, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_d, 1); + ret = bt_field_type_set_alignment(root_d, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_d, "d"); + ret = bt_field_type_structure_add_field(root, root_d, "d"); assert(ret == 0); BT_PUT(root_a); @@ -2532,8 +2532,8 @@ struct bt_ctf_field_type *test_fail_target_is_ancestor_of_source_get_ep(void) static void test_fail_target_is_ancestor_of_source(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_target_is_ancestor_of_source_get_ep(); assert(ep); @@ -2545,7 +2545,7 @@ void test_fail_target_is_ancestor_of_source(void) } static -struct bt_ctf_field_type *test_fail_target_is_source_get_event_payload(void) +struct bt_field_type *test_fail_target_is_source_get_event_payload(void) { /* Generated by bt-ctfirtg using the following input: @@ -2568,59 +2568,59 @@ struct bt_ctf_field_type *test_fail_target_is_source_get_event_payload(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_b = NULL; - struct bt_ctf_field_type *root_b_elem = NULL; - struct bt_ctf_field_type *root_c = NULL; - struct bt_ctf_field_type *root_d = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_b = NULL; + struct bt_field_type *root_b_elem = NULL; + struct bt_field_type *root_c = NULL; + struct bt_field_type *root_d = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a = bt_ctf_field_type_integer_create(32); + root_a = bt_field_type_integer_create(32); assert(root_a); ret = bt_ctf_field_type_integer_set_signed(root_a, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_a, 10); + ret = bt_field_type_integer_set_base(root_a, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_a, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_a, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_a, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_a, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_a, 8); + ret = bt_field_type_set_alignment(root_a, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_b_elem = bt_ctf_field_type_string_create(); + root_b_elem = bt_field_type_string_create(); assert(root_b_elem); - ret = bt_ctf_field_type_string_set_encoding(root_b_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_b_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_b = bt_ctf_field_type_sequence_create(root_b_elem, "event.fields.b"); + root_b = bt_field_type_sequence_create(root_b_elem, "event.fields.b"); assert(root_b); - ret = bt_ctf_field_type_structure_add_field(root, root_b, "b"); + ret = bt_field_type_structure_add_field(root, root_b, "b"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); - root_d = bt_ctf_field_type_integer_create(17); + root_d = bt_field_type_integer_create(17); assert(root_d); ret = bt_ctf_field_type_integer_set_signed(root_d, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_d, 10); + ret = bt_field_type_integer_set_base(root_d, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_d, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_d, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_d, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_d, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_d, 1); + ret = bt_field_type_set_alignment(root_d, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_d, "d"); + ret = bt_field_type_structure_add_field(root, root_d, "d"); assert(ret == 0); BT_PUT(root_a); @@ -2635,8 +2635,8 @@ struct bt_ctf_field_type *test_fail_target_is_source_get_event_payload(void) static void test_fail_target_is_source(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_target_is_source_get_event_payload(); assert(ep); @@ -2648,7 +2648,7 @@ void test_fail_target_is_source(void) } static -struct bt_ctf_field_type *test_fail_variant_tag_is_not_enum_get_ep(void) +struct bt_field_type *test_fail_variant_tag_is_not_enum_get_ep(void) { /* Generated by bt-ctfirtg using the following input: @@ -2672,61 +2672,61 @@ struct bt_ctf_field_type *test_fail_variant_tag_is_not_enum_get_ep(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_b = NULL; - struct bt_ctf_field_type *root_b_HELLO = NULL; - struct bt_ctf_field_type *root_c = NULL; - struct bt_ctf_field_type *root_d = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_b = NULL; + struct bt_field_type *root_b_HELLO = NULL; + struct bt_field_type *root_c = NULL; + struct bt_field_type *root_d = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a = bt_ctf_field_type_integer_create(32); + root_a = bt_field_type_integer_create(32); assert(root_a); ret = bt_ctf_field_type_integer_set_signed(root_a, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_a, 10); + ret = bt_field_type_integer_set_base(root_a, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_a, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_a, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_a, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_a, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_a, 8); + ret = bt_field_type_set_alignment(root_a, 8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_b = bt_ctf_field_type_variant_create(NULL, "a"); + root_b = bt_field_type_variant_create(NULL, "a"); assert(root_b); - root_b_HELLO = bt_ctf_field_type_string_create(); + root_b_HELLO = bt_field_type_string_create(); assert(root_b_HELLO); - ret = bt_ctf_field_type_string_set_encoding(root_b_HELLO, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_b_HELLO, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_variant_add_field(root_b, root_b_HELLO, "HELLO"); + ret = bt_field_type_variant_add_field(root_b, root_b_HELLO, "HELLO"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_b, "b"); + ret = bt_field_type_structure_add_field(root, root_b, "b"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); - root_d = bt_ctf_field_type_integer_create(17); + root_d = bt_field_type_integer_create(17); assert(root_d); ret = bt_ctf_field_type_integer_set_signed(root_d, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_d, 10); + ret = bt_field_type_integer_set_base(root_d, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_d, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_d, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_d, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_d, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_d, 1); + ret = bt_field_type_set_alignment(root_d, 1); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_d, "d"); + ret = bt_field_type_structure_add_field(root, root_d, "d"); assert(ret == 0); BT_PUT(root_a); @@ -2741,8 +2741,8 @@ struct bt_ctf_field_type *test_fail_variant_tag_is_not_enum_get_ep(void) static void test_fail_variant_tag_is_not_enum(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_variant_tag_is_not_enum_get_ep(); assert(ep); @@ -2754,7 +2754,7 @@ void test_fail_variant_tag_is_not_enum(void) } static -struct bt_ctf_field_type *test_fail_variant_tag_mismatch_mappings_get_ep(void) +struct bt_field_type *test_fail_variant_tag_mismatch_mappings_get_ep(void) { /* Generated by bt-ctfirtg using the following input: @@ -2784,32 +2784,32 @@ struct bt_ctf_field_type *test_fail_variant_tag_mismatch_mappings_get_ep(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_a_int = NULL; - struct bt_ctf_field_type *root_b = NULL; - struct bt_ctf_field_type *root_b_GLASS = NULL; - struct bt_ctf_field_type *root_b_OF = NULL; - struct bt_ctf_field_type *root_c = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_a_int = NULL; + struct bt_field_type *root_b = NULL; + struct bt_field_type *root_b_GLASS = NULL; + struct bt_field_type *root_b_OF = NULL; + struct bt_field_type *root_c = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a_int = bt_ctf_field_type_integer_create(16); + root_a_int = bt_field_type_integer_create(16); assert(root_a_int); ret = bt_ctf_field_type_integer_set_signed(root_a_int, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_a_int, 10); + ret = bt_field_type_integer_set_base(root_a_int, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_a_int, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_a_int, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_a_int, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_a_int, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_a_int, 8); + ret = bt_field_type_set_alignment(root_a_int, 8); assert(ret == 0); - root_a = bt_ctf_field_type_enumeration_create(root_a_int); + root_a = bt_field_type_enumeration_create(root_a_int); assert(root_a); ret = bt_ctf_field_type_enumeration_add_mapping(root_a, "GLASS", 0, 0); assert(ret == 0); @@ -2817,37 +2817,37 @@ struct bt_ctf_field_type *test_fail_variant_tag_mismatch_mappings_get_ep(void) assert(ret == 0); ret = bt_ctf_field_type_enumeration_add_mapping(root_a, "WATER", 2, 2); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_b = bt_ctf_field_type_variant_create(NULL, "a"); + root_b = bt_field_type_variant_create(NULL, "a"); assert(root_b); - root_b_GLASS = bt_ctf_field_type_string_create(); + root_b_GLASS = bt_field_type_string_create(); assert(root_b_GLASS); - ret = bt_ctf_field_type_string_set_encoding(root_b_GLASS, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_b_GLASS, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_variant_add_field(root_b, root_b_GLASS, "GLASS"); + ret = bt_field_type_variant_add_field(root_b, root_b_GLASS, "GLASS"); assert(ret == 0); - root_b_OF = bt_ctf_field_type_integer_create(2); + root_b_OF = bt_field_type_integer_create(2); assert(root_b_OF); ret = bt_ctf_field_type_integer_set_signed(root_b_OF, 0); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_base(root_b_OF, 10); + ret = bt_field_type_integer_set_base(root_b_OF, 10); assert(ret == 0); - ret = bt_ctf_field_type_integer_set_encoding(root_b_OF, BT_CTF_STRING_ENCODING_NONE); + ret = bt_field_type_integer_set_encoding(root_b_OF, BT_STRING_ENCODING_NONE); assert(ret == 0); - ret = bt_ctf_field_type_set_byte_order(root_b_OF, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_field_type_set_byte_order(root_b_OF, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_field_type_set_alignment(root_b_OF, 1); + ret = bt_field_type_set_alignment(root_b_OF, 1); assert(ret == 0); - ret = bt_ctf_field_type_variant_add_field(root_b, root_b_OF, "OF"); + ret = bt_field_type_variant_add_field(root_b, root_b_OF, "OF"); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_b, "b"); + ret = bt_field_type_structure_add_field(root, root_b, "b"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); BT_PUT(root_a); @@ -2863,8 +2863,8 @@ struct bt_ctf_field_type *test_fail_variant_tag_mismatch_mappings_get_ep(void) static void test_fail_variant_tag_mismatch_mappings(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_variant_tag_mismatch_mappings_get_ep(); assert(ep); @@ -2876,7 +2876,7 @@ void test_fail_variant_tag_mismatch_mappings(void) } static -struct bt_ctf_field_type *test_fail_sequence_tag_is_not_int_get_ep(void) +struct bt_field_type *test_fail_sequence_tag_is_not_int_get_ep(void) { /* Generated by bt-ctfirtg using the following input: @@ -2895,36 +2895,36 @@ struct bt_ctf_field_type *test_fail_sequence_tag_is_not_int_get_ep(void) */ - struct bt_ctf_field_type *root = NULL; - struct bt_ctf_field_type *root_a = NULL; - struct bt_ctf_field_type *root_b = NULL; - struct bt_ctf_field_type *root_b_elem = NULL; - struct bt_ctf_field_type *root_c = NULL; + struct bt_field_type *root = NULL; + struct bt_field_type *root_a = NULL; + struct bt_field_type *root_b = NULL; + struct bt_field_type *root_b_elem = NULL; + struct bt_field_type *root_c = NULL; int ret; - root = bt_ctf_field_type_structure_create(); + root = bt_field_type_structure_create(); assert(root); - ret = bt_ctf_field_type_set_alignment(root, 8); + ret = bt_field_type_set_alignment(root, 8); assert(ret == 0); - root_a = bt_ctf_field_type_string_create(); + root_a = bt_field_type_string_create(); assert(root_a); - ret = bt_ctf_field_type_string_set_encoding(root_a, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_a, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_a, "a"); + ret = bt_field_type_structure_add_field(root, root_a, "a"); assert(ret == 0); - root_b_elem = bt_ctf_field_type_string_create(); + root_b_elem = bt_field_type_string_create(); assert(root_b_elem); - ret = bt_ctf_field_type_string_set_encoding(root_b_elem, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_b_elem, BT_STRING_ENCODING_UTF8); assert(ret == 0); - root_b = bt_ctf_field_type_sequence_create(root_b_elem, "a"); + root_b = bt_field_type_sequence_create(root_b_elem, "a"); assert(root_b); - ret = bt_ctf_field_type_structure_add_field(root, root_b, "b"); + ret = bt_field_type_structure_add_field(root, root_b, "b"); assert(ret == 0); - root_c = bt_ctf_field_type_string_create(); + root_c = bt_field_type_string_create(); assert(root_c); - ret = bt_ctf_field_type_string_set_encoding(root_c, BT_CTF_STRING_ENCODING_UTF8); + ret = bt_field_type_string_set_encoding(root_c, BT_STRING_ENCODING_UTF8); assert(ret == 0); - ret = bt_ctf_field_type_structure_add_field(root, root_c, "c"); + ret = bt_field_type_structure_add_field(root, root_c, "c"); assert(ret == 0); BT_PUT(root_a); @@ -2938,8 +2938,8 @@ struct bt_ctf_field_type *test_fail_sequence_tag_is_not_int_get_ep(void) static void test_fail_sequence_tag_is_not_int(void) { - struct bt_ctf_field_type *ep; - struct bt_ctf_event *event; + struct bt_field_type *ep; + struct bt_event *event; ep = test_fail_sequence_tag_is_not_int_get_ep(); assert(ep); diff --git a/tests/lib/test_bt_notification_iterator.c b/tests/lib/test_bt_notification_iterator.c index 1cb09f1a..90f4dff3 100644 --- a/tests/lib/test_bt_notification_iterator.c +++ b/tests/lib/test_bt_notification_iterator.c @@ -91,22 +91,22 @@ enum test_event_type { struct test_event { enum test_event_type type; - struct bt_ctf_stream *stream; - struct bt_ctf_packet *packet; + struct bt_stream *stream; + struct bt_packet *packet; }; static bool debug = false; static enum test current_test; static GArray *test_events; static struct bt_clock_class_priority_map *src_empty_cc_prio_map; -static struct bt_ctf_stream_class *src_stream_class; -static struct bt_ctf_event_class *src_event_class; -static struct bt_ctf_stream *src_stream1; -static struct bt_ctf_stream *src_stream2; -static struct bt_ctf_packet *src_stream1_packet1; -static struct bt_ctf_packet *src_stream1_packet2; -static struct bt_ctf_packet *src_stream2_packet1; -static struct bt_ctf_packet *src_stream2_packet2; +static struct bt_stream_class *src_stream_class; +static struct bt_event_class *src_event_class; +static struct bt_stream *src_stream1; +static struct bt_stream *src_stream2; +static struct bt_packet *src_stream1_packet1; +static struct bt_packet *src_stream1_packet2; +static struct bt_packet *src_stream2_packet1; +static struct bt_packet *src_stream2_packet2; enum { SEQ_END = -1, @@ -395,56 +395,56 @@ static void init_static_data(void) { int ret; - struct bt_ctf_trace *trace; - struct bt_ctf_field_type *empty_struct_ft; + struct bt_trace *trace; + struct bt_field_type *empty_struct_ft; /* Test events */ test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event)); assert(test_events); /* Metadata */ - empty_struct_ft = bt_ctf_field_type_structure_create(); + empty_struct_ft = bt_field_type_structure_create(); assert(empty_struct_ft); - trace = bt_ctf_trace_create(); + trace = bt_trace_create(); assert(trace); - ret = bt_ctf_trace_set_packet_header_type(trace, empty_struct_ft); + ret = bt_trace_set_packet_header_type(trace, empty_struct_ft); assert(ret == 0); src_empty_cc_prio_map = bt_clock_class_priority_map_create(); assert(src_empty_cc_prio_map); - src_stream_class = bt_ctf_stream_class_create("my-stream-class"); + src_stream_class = bt_stream_class_create("my-stream-class"); assert(src_stream_class); - ret = bt_ctf_stream_class_set_packet_context_type(src_stream_class, + ret = bt_stream_class_set_packet_context_type(src_stream_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_header_type(src_stream_class, + ret = bt_stream_class_set_event_header_type(src_stream_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_context_type(src_stream_class, + ret = bt_stream_class_set_event_context_type(src_stream_class, empty_struct_ft); assert(ret == 0); - src_event_class = bt_ctf_event_class_create("my-event-class"); - ret = bt_ctf_event_class_set_context_type(src_event_class, + src_event_class = bt_event_class_create("my-event-class"); + ret = bt_event_class_set_context_type(src_event_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_event_class_set_context_type(src_event_class, + ret = bt_event_class_set_context_type(src_event_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_stream_class_add_event_class(src_stream_class, + ret = bt_stream_class_add_event_class(src_stream_class, src_event_class); assert(ret == 0); - ret = bt_ctf_trace_add_stream_class(trace, src_stream_class); + ret = bt_trace_add_stream_class(trace, src_stream_class); assert(ret == 0); - src_stream1 = bt_ctf_stream_create(src_stream_class, "stream-1"); + src_stream1 = bt_stream_create(src_stream_class, "stream-1"); assert(src_stream1); - src_stream2 = bt_ctf_stream_create(src_stream_class, "stream-2"); + src_stream2 = bt_stream_create(src_stream_class, "stream-2"); assert(src_stream2); - src_stream1_packet1 = bt_ctf_packet_create(src_stream1); + src_stream1_packet1 = bt_packet_create(src_stream1); assert(src_stream1_packet1); - src_stream1_packet2 = bt_ctf_packet_create(src_stream1); + src_stream1_packet2 = bt_packet_create(src_stream1); assert(src_stream1_packet2); - src_stream2_packet1 = bt_ctf_packet_create(src_stream2); + src_stream2_packet1 = bt_packet_create(src_stream2); assert(src_stream2_packet1); - src_stream2_packet2 = bt_ctf_packet_create(src_stream2); + src_stream2_packet2 = bt_packet_create(src_stream2); assert(src_stream2_packet2); if (debug) { @@ -551,13 +551,13 @@ enum bt_notification_iterator_status src_iter_init( } static -struct bt_ctf_event *src_create_event(struct bt_ctf_packet *packet) +struct bt_event *src_create_event(struct bt_packet *packet) { - struct bt_ctf_event *event = bt_ctf_event_create(src_event_class); + struct bt_event *event = bt_event_create(src_event_class); int ret; assert(event); - ret = bt_ctf_event_set_packet(event, packet); + ret = bt_event_set_packet(event, packet); assert(ret == 0); return event; } @@ -570,7 +570,7 @@ struct bt_notification_iterator_next_method_return src_iter_next_seq( .status = BT_NOTIFICATION_ITERATOR_STATUS_OK, }; int64_t cur_ts_ns; - struct bt_ctf_packet *event_packet = NULL; + struct bt_packet *event_packet = NULL; assert(user_data->seq); cur_ts_ns = user_data->seq[user_data->at]; @@ -662,7 +662,7 @@ struct bt_notification_iterator_next_method_return src_iter_next_seq( } if (event_packet) { - struct bt_ctf_event *event = src_create_event(event_packet); + struct bt_event *event = src_create_event(event_packet); assert(event); next_return.notification = bt_notification_event_create(event, @@ -745,12 +745,12 @@ enum bt_notification_iterator_status common_consume( switch (bt_notification_get_type(notification)) { case BT_NOTIFICATION_TYPE_EVENT: { - struct bt_ctf_event *event; + struct bt_event *event; test_event.type = TEST_EV_TYPE_NOTIF_EVENT; event = bt_notification_event_get_event(notification); assert(event); - test_event.packet = bt_ctf_event_get_packet(event); + test_event.packet = bt_event_get_packet(event); bt_put(event); assert(test_event.packet); bt_put(test_event.packet); @@ -793,7 +793,7 @@ enum bt_notification_iterator_status common_consume( } if (test_event.packet) { - test_event.stream = bt_ctf_packet_get_stream(test_event.packet); + test_event.stream = bt_packet_get_stream(test_event.packet); assert(test_event.stream); bt_put(test_event.stream); } diff --git a/tests/lib/test_cc_prio_map.c b/tests/lib/test_cc_prio_map.c index 7a371e84..f2a2f8dc 100644 --- a/tests/lib/test_cc_prio_map.c +++ b/tests/lib/test_cc_prio_map.c @@ -30,20 +30,20 @@ static void test_clock_class_priority_map(void) { struct bt_clock_class_priority_map *cc_prio_map; struct bt_clock_class_priority_map *cc_prio_map_copy; - struct bt_ctf_clock_class *cc1; - struct bt_ctf_clock_class *cc2; - struct bt_ctf_clock_class *cc3; - struct bt_ctf_clock_class *cc; + struct bt_clock_class *cc1; + struct bt_clock_class *cc2; + struct bt_clock_class *cc3; + struct bt_clock_class *cc; uint64_t prio; int ret; cc_prio_map = bt_clock_class_priority_map_create(); ok(cc_prio_map, "bt_clock_class_priority_map_create() succeeds"); - cc1 = bt_ctf_clock_class_create("cc1", 1); + cc1 = bt_clock_class_create("cc1", 1); assert(cc1); - cc2 = bt_ctf_clock_class_create("cc2", 2); + cc2 = bt_clock_class_create("cc2", 2); assert(cc2); - cc3 = bt_ctf_clock_class_create("cc3", 3); + cc3 = bt_clock_class_create("cc3", 3); assert(cc3); ok(!bt_clock_class_priority_map_get_highest_priority_clock_class(NULL), "bt_clock_class_priority_map_get_highest_priority_clock_class() handles NULL"); diff --git a/tests/lib/test_ctf_ir_ref.c b/tests/lib/test_ctf_ir_ref.c index e2ee556c..5709b2ec 100644 --- a/tests/lib/test_ctf_ir_ref.c +++ b/tests/lib/test_ctf_ir_ref.c @@ -38,11 +38,11 @@ struct user { struct bt_ctf_writer *writer; - struct bt_ctf_trace *tc; - struct bt_ctf_stream_class *sc; - struct bt_ctf_event_class *ec; - struct bt_ctf_stream *stream; - struct bt_ctf_event *event; + struct bt_trace *tc; + struct bt_stream_class *sc; + struct bt_event_class *ec; + struct bt_stream *stream; + struct bt_event *event; }; const char *user_names[] = { @@ -62,45 +62,45 @@ static const size_t USER_NR_ELEMENTS = sizeof(struct user) / sizeof(void *); * - uint16_t payload_16; * - uint32_t payload_32; */ -static struct bt_ctf_field_type *create_integer_struct(void) +static struct bt_field_type *create_integer_struct(void) { int ret; - struct bt_ctf_field_type *structure = NULL; - struct bt_ctf_field_type *ui8 = NULL, *ui16 = NULL, *ui32 = NULL; + struct bt_field_type *structure = NULL; + struct bt_field_type *ui8 = NULL, *ui16 = NULL, *ui32 = NULL; - structure = bt_ctf_field_type_structure_create(); + structure = bt_field_type_structure_create(); if (!structure) { goto error; } - ui8 = bt_ctf_field_type_integer_create(8); + ui8 = bt_field_type_integer_create(8); if (!ui8) { diag("Failed to create uint8_t type"); goto error; } - ret = bt_ctf_field_type_structure_add_field(structure, ui8, + ret = bt_field_type_structure_add_field(structure, ui8, "payload_8"); if (ret) { diag("Failed to add uint8_t to structure"); goto error; } - ui16 = bt_ctf_field_type_integer_create(16); + ui16 = bt_field_type_integer_create(16); if (!ui16) { diag("Failed to create uint16_t type"); goto error; } - ret = bt_ctf_field_type_structure_add_field(structure, ui16, + ret = bt_field_type_structure_add_field(structure, ui16, "payload_16"); if (ret) { diag("Failed to add uint16_t to structure"); goto error; } - ui32 = bt_ctf_field_type_integer_create(32); + ui32 = bt_field_type_integer_create(32); if (!ui32) { diag("Failed to create uint32_t type"); goto error; } - ret = bt_ctf_field_type_structure_add_field(structure, ui32, + ret = bt_field_type_structure_add_field(structure, ui32, "payload_32"); if (ret) { diag("Failed to add uint32_t to structure"); @@ -122,14 +122,14 @@ error: * - uint16_t payload_16; * - uint32_t payload_32; */ -static struct bt_ctf_event_class *create_simple_event(const char *name) +static struct bt_event_class *create_simple_event(const char *name) { int ret; - struct bt_ctf_event_class *event = NULL; - struct bt_ctf_field_type *payload = NULL; + struct bt_event_class *event = NULL; + struct bt_field_type *payload = NULL; assert(name); - event = bt_ctf_event_class_create(name); + event = bt_event_class_create(name); if (!event) { diag("Failed to create simple event"); goto error; @@ -141,7 +141,7 @@ static struct bt_ctf_event_class *create_simple_event(const char *name) goto error; } - ret = bt_ctf_event_class_set_payload_type(event, payload); + ret = bt_event_class_set_payload_type(event, payload); if (ret) { diag("Failed to set simple event payload"); goto error; @@ -164,14 +164,14 @@ error: * - uint16_t payload_16; * - uint32_t payload_32; */ -static struct bt_ctf_event_class *create_complex_event(const char *name) +static struct bt_event_class *create_complex_event(const char *name) { int ret; - struct bt_ctf_event_class *event = NULL; - struct bt_ctf_field_type *inner = NULL, *outer = NULL; + struct bt_event_class *event = NULL; + struct bt_field_type *inner = NULL, *outer = NULL; assert(name); - event = bt_ctf_event_class_create(name); + event = bt_event_class_create(name); if (!event) { diag("Failed to create complex event"); goto error; @@ -189,14 +189,14 @@ static struct bt_ctf_event_class *create_complex_event(const char *name) goto error; } - ret = bt_ctf_field_type_structure_add_field(outer, inner, + ret = bt_field_type_structure_add_field(outer, inner, "payload_struct"); if (ret) { diag("Failed to add inner structure to outer structure"); goto error; } - ret = bt_ctf_event_class_set_payload_type(event, outer); + ret = bt_event_class_set_payload_type(event, outer); if (ret) { diag("Failed to set complex event payload"); goto error; @@ -211,41 +211,41 @@ error: } static void set_stream_class_field_types( - struct bt_ctf_stream_class *stream_class) + struct bt_stream_class *stream_class) { - struct bt_ctf_field_type *packet_context_type; - struct bt_ctf_field_type *event_header_type; - struct bt_ctf_field_type *ft; + struct bt_field_type *packet_context_type; + struct bt_field_type *event_header_type; + struct bt_field_type *ft; int ret; - packet_context_type = bt_ctf_field_type_structure_create(); + packet_context_type = bt_field_type_structure_create(); assert(packet_context_type); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, ft, "packet_size"); assert(ret == 0); bt_put(ft); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, ft, "content_size"); assert(ret == 0); bt_put(ft); - event_header_type = bt_ctf_field_type_structure_create(); + event_header_type = bt_field_type_structure_create(); assert(event_header_type); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(event_header_type, + ret = bt_field_type_structure_add_field(event_header_type, ft, "id"); assert(ret == 0); bt_put(ft); - ret = bt_ctf_stream_class_set_packet_context_type(stream_class, + ret = bt_stream_class_set_packet_context_type(stream_class, packet_context_type); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_header_type(stream_class, + ret = bt_stream_class_set_event_header_type(stream_class, event_header_type); assert(ret == 0); @@ -253,13 +253,13 @@ static void set_stream_class_field_types( bt_put(event_header_type); } -static struct bt_ctf_stream_class *create_sc1(void) +static struct bt_stream_class *create_sc1(void) { int ret; - struct bt_ctf_event_class *ec1 = NULL, *ec2 = NULL; - struct bt_ctf_stream_class *sc1 = NULL, *ret_stream = NULL; + struct bt_event_class *ec1 = NULL, *ec2 = NULL; + struct bt_stream_class *sc1 = NULL, *ret_stream = NULL; - sc1 = bt_ctf_stream_class_create_empty("sc1"); + sc1 = bt_stream_class_create_empty("sc1"); if (!sc1) { diag("Failed to create Stream Class"); goto error; @@ -271,7 +271,7 @@ static struct bt_ctf_stream_class *create_sc1(void) diag("Failed to create complex event EC1"); goto error; } - ret = bt_ctf_stream_class_add_event_class(sc1, ec1); + ret = bt_stream_class_add_event_class(sc1, ec1); if (ret) { diag("Failed to add EC1 to SC1"); goto error; @@ -282,17 +282,17 @@ static struct bt_ctf_stream_class *create_sc1(void) diag("Failed to create simple event EC2"); goto error; } - ret = bt_ctf_stream_class_add_event_class(sc1, ec2); + ret = bt_stream_class_add_event_class(sc1, ec2); if (ret) { diag("Failed to add EC1 to SC1"); goto error; } - ret_stream = bt_ctf_event_class_get_stream_class(ec1); + ret_stream = bt_event_class_get_stream_class(ec1); ok(ret_stream == sc1, "Get parent stream SC1 from EC1"); BT_PUT(ret_stream); - ret_stream = bt_ctf_event_class_get_stream_class(ec2); + ret_stream = bt_event_class_get_stream_class(ec2); ok(ret_stream == sc1, "Get parent stream SC1 from EC2"); end: BT_PUT(ret_stream); @@ -304,13 +304,13 @@ error: goto end; } -static struct bt_ctf_stream_class *create_sc2(void) +static struct bt_stream_class *create_sc2(void) { int ret; - struct bt_ctf_event_class *ec3 = NULL; - struct bt_ctf_stream_class *sc2 = NULL, *ret_stream = NULL; + struct bt_event_class *ec3 = NULL; + struct bt_stream_class *sc2 = NULL, *ret_stream = NULL; - sc2 = bt_ctf_stream_class_create_empty("sc2"); + sc2 = bt_stream_class_create_empty("sc2"); if (!sc2) { diag("Failed to create Stream Class"); goto error; @@ -322,13 +322,13 @@ static struct bt_ctf_stream_class *create_sc2(void) diag("Failed to create simple event EC3"); goto error; } - ret = bt_ctf_stream_class_add_event_class(sc2, ec3); + ret = bt_stream_class_add_event_class(sc2, ec3); if (ret) { diag("Failed to add EC3 to SC2"); goto error; } - ret_stream = bt_ctf_event_class_get_stream_class(ec3); + ret_stream = bt_event_class_get_stream_class(ec3); ok(ret_stream == sc2, "Get parent stream SC2 from EC3"); end: BT_PUT(ret_stream); @@ -339,37 +339,37 @@ error: goto end; } -static void set_trace_packet_header(struct bt_ctf_trace *trace) +static void set_trace_packet_header(struct bt_trace *trace) { - struct bt_ctf_field_type *packet_header_type; - struct bt_ctf_field_type *ft; + struct bt_field_type *packet_header_type; + struct bt_field_type *ft; int ret; - packet_header_type = bt_ctf_field_type_structure_create(); + packet_header_type = bt_field_type_structure_create(); assert(packet_header_type); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(packet_header_type, + ret = bt_field_type_structure_add_field(packet_header_type, ft, "stream_id"); assert(ret == 0); bt_put(ft); - ret = bt_ctf_trace_set_packet_header_type(trace, + ret = bt_trace_set_packet_header_type(trace, packet_header_type); assert(ret == 0); bt_put(packet_header_type); } -static struct bt_ctf_trace *create_tc1(void) +static struct bt_trace *create_tc1(void) { int ret; - struct bt_ctf_trace *tc1 = NULL; - struct bt_ctf_stream_class *sc1 = NULL, *sc2 = NULL; + struct bt_trace *tc1 = NULL; + struct bt_stream_class *sc1 = NULL, *sc2 = NULL; - tc1 = bt_ctf_trace_create(); + tc1 = bt_trace_create(); if (!tc1) { - diag("bt_ctf_trace_create returned NULL"); + diag("bt_trace_create returned NULL"); goto error; } @@ -379,7 +379,7 @@ static struct bt_ctf_trace *create_tc1(void) if (!sc1) { goto error; } - ret = bt_ctf_trace_add_stream_class(tc1, sc1); + ret = bt_trace_add_stream_class(tc1, sc1); ok(!ret, "Add SC1 to TC1"); if (ret) { goto error; @@ -390,7 +390,7 @@ static struct bt_ctf_trace *create_tc1(void) if (!sc2) { goto error; } - ret = bt_ctf_trace_add_stream_class(tc1, sc2); + ret = bt_trace_add_stream_class(tc1, sc2); ok(!ret, "Add SC2 to TC1"); if (ret) { goto error; @@ -404,20 +404,20 @@ error: goto end; } -static void init_weak_refs(struct bt_ctf_trace *tc, - struct bt_ctf_trace **tc1, - struct bt_ctf_stream_class **sc1, - struct bt_ctf_stream_class **sc2, - struct bt_ctf_event_class **ec1, - struct bt_ctf_event_class **ec2, - struct bt_ctf_event_class **ec3) +static void init_weak_refs(struct bt_trace *tc, + struct bt_trace **tc1, + struct bt_stream_class **sc1, + struct bt_stream_class **sc2, + struct bt_event_class **ec1, + struct bt_event_class **ec2, + struct bt_event_class **ec3) { *tc1 = tc; - *sc1 = bt_ctf_trace_get_stream_class_by_index(tc, 0); - *sc2 = bt_ctf_trace_get_stream_class_by_index(tc, 1); - *ec1 = bt_ctf_stream_class_get_event_class_by_index(*sc1, 0); - *ec2 = bt_ctf_stream_class_get_event_class_by_index(*sc1, 1); - *ec3 = bt_ctf_stream_class_get_event_class_by_index(*sc2, 0); + *sc1 = bt_trace_get_stream_class_by_index(tc, 0); + *sc2 = bt_trace_get_stream_class_by_index(tc, 1); + *ec1 = bt_stream_class_get_event_class_by_index(*sc1, 0); + *ec2 = bt_stream_class_get_event_class_by_index(*sc1, 1); + *ec3 = bt_stream_class_get_event_class_by_index(*sc2, 0); bt_put(*sc1); bt_put(*sc2); bt_put(*ec1); @@ -434,9 +434,9 @@ static void test_example_scenario(void) * counts without affecting them by taking "real" references to the * objects. */ - struct bt_ctf_trace *tc1 = NULL, *weak_tc1 = NULL; - struct bt_ctf_stream_class *weak_sc1 = NULL, *weak_sc2 = NULL; - struct bt_ctf_event_class *weak_ec1 = NULL, *weak_ec2 = NULL, + struct bt_trace *tc1 = NULL, *weak_tc1 = NULL; + struct bt_stream_class *weak_sc1 = NULL, *weak_sc2 = NULL; + struct bt_event_class *weak_ec1 = NULL, *weak_ec2 = NULL, *weak_ec3 = NULL; struct user user_a = { 0 }, user_b = { 0 }, user_c = { 0 }; @@ -467,7 +467,7 @@ static void test_example_scenario(void) "TC1 reference count is 1"); /* User A acquires a reference to SC2 from TC1. */ - user_a.sc = bt_ctf_trace_get_stream_class_by_index(user_a.tc, 1); + user_a.sc = bt_trace_get_stream_class_by_index(user_a.tc, 1); ok(user_a.sc, "User A acquires SC2 from TC1"); ok(bt_object_get_ref_count(weak_tc1) == 2, "TC1 reference count is 2"); @@ -475,7 +475,7 @@ static void test_example_scenario(void) "SC2 reference count is 1"); /* User A acquires a reference to EC3 from SC2. */ - user_a.ec = bt_ctf_stream_class_get_event_class_by_index(user_a.sc, 0); + user_a.ec = bt_stream_class_get_event_class_by_index(user_a.sc, 0); ok(user_a.ec, "User A acquires EC3 from SC2"); ok(bt_object_get_ref_count(weak_tc1) == 2, "TC1 reference count is 2"); @@ -522,7 +522,7 @@ static void test_example_scenario(void) /* User C acquires a reference to EC1. */ diag("User C acquires a reference to EC1"); - user_c.ec = bt_ctf_stream_class_get_event_class_by_index(user_b.sc, 0); + user_c.ec = bt_stream_class_get_event_class_by_index(user_b.sc, 0); ok(bt_object_get_ref_count(weak_ec1) == 1, "EC1 reference count is 1"); ok(bt_object_get_ref_count(weak_sc1) == 2, @@ -568,8 +568,8 @@ static void test_example_scenario(void) static void create_user_full(struct user *user) { gchar *trace_path; - struct bt_ctf_field_type *ft; - struct bt_ctf_field *field; + struct bt_field_type *ft; + struct bt_field *field; struct bt_ctf_clock *clock; int ret; @@ -581,48 +581,48 @@ static void create_user_full(struct user *user) user->writer = bt_ctf_writer_create(trace_path); assert(user->writer); ret = bt_ctf_writer_set_byte_order(user->writer, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); user->tc = bt_ctf_writer_get_trace(user->writer); assert(user->tc); - user->sc = bt_ctf_stream_class_create("sc"); + user->sc = bt_stream_class_create("sc"); assert(user->sc); clock = bt_ctf_clock_create("the_clock"); assert(clock); ret = bt_ctf_writer_add_clock(user->writer, clock); assert(!ret); - ret = bt_ctf_stream_class_set_clock(user->sc, clock); + ret = bt_stream_class_set_clock(user->sc, clock); assert(!ret); BT_PUT(clock); user->stream = bt_ctf_writer_create_stream(user->writer, user->sc); assert(user->stream); - user->ec = bt_ctf_event_class_create("ec"); + user->ec = bt_event_class_create("ec"); assert(user->ec); ft = create_integer_struct(); assert(ft); - ret = bt_ctf_event_class_set_payload_type(user->ec, ft); + ret = bt_event_class_set_payload_type(user->ec, ft); BT_PUT(ft); assert(!ret); - ret = bt_ctf_stream_class_add_event_class(user->sc, user->ec); + ret = bt_stream_class_add_event_class(user->sc, user->ec); assert(!ret); - user->event = bt_ctf_event_create(user->ec); + user->event = bt_event_create(user->ec); assert(user->event); - field = bt_ctf_event_get_payload(user->event, "payload_8"); + field = bt_event_get_payload(user->event, "payload_8"); assert(field); - ret = bt_ctf_field_unsigned_integer_set_value(field, 10); + ret = bt_field_unsigned_integer_set_value(field, 10); assert(!ret); BT_PUT(field); - field = bt_ctf_event_get_payload(user->event, "payload_16"); + field = bt_event_get_payload(user->event, "payload_16"); assert(field); - ret = bt_ctf_field_unsigned_integer_set_value(field, 20); + ret = bt_field_unsigned_integer_set_value(field, 20); assert(!ret); BT_PUT(field); - field = bt_ctf_event_get_payload(user->event, "payload_32"); + field = bt_event_get_payload(user->event, "payload_32"); assert(field); - ret = bt_ctf_field_unsigned_integer_set_value(field, 30); + ret = bt_field_unsigned_integer_set_value(field, 30); assert(!ret); BT_PUT(field); - ret = bt_ctf_stream_append_event(user->stream, user->event); + ret = bt_stream_append_event(user->stream, user->event); assert(!ret); recursive_rmdir(trace_path); g_free(trace_path); diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index e2cf2434..103de0ab 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -141,50 +141,50 @@ result: } static -void append_simple_event(struct bt_ctf_stream_class *stream_class, - struct bt_ctf_stream *stream, struct bt_ctf_clock *clock) +void append_simple_event(struct bt_stream_class *stream_class, + struct bt_stream *stream, struct bt_ctf_clock *clock) { /* Create and add a simple event class */ - struct bt_ctf_event_class *simple_event_class = - bt_ctf_event_class_create("Simple Event"); - struct bt_ctf_field_type *uint_12_type = - bt_ctf_field_type_integer_create(12); - struct bt_ctf_field_type *int_64_type = - bt_ctf_field_type_integer_create(64); - struct bt_ctf_field_type *float_type = - bt_ctf_field_type_floating_point_create(); - struct bt_ctf_field_type *enum_type; - struct bt_ctf_field_type *enum_type_unsigned = - bt_ctf_field_type_enumeration_create(uint_12_type); - struct bt_ctf_field_type *event_context_type = - bt_ctf_field_type_structure_create(); - struct bt_ctf_field_type *event_payload_type = NULL; - struct bt_ctf_field_type *returned_type; - struct bt_ctf_event *simple_event; - struct bt_ctf_field *integer_field; - struct bt_ctf_field *float_field; - struct bt_ctf_field *enum_field; - struct bt_ctf_field *enum_field_unsigned; - struct bt_ctf_field *enum_container_field; + struct bt_event_class *simple_event_class = + bt_event_class_create("Simple Event"); + struct bt_field_type *uint_12_type = + bt_field_type_integer_create(12); + struct bt_field_type *int_64_type = + bt_field_type_integer_create(64); + struct bt_field_type *float_type = + bt_field_type_floating_point_create(); + struct bt_field_type *enum_type; + struct bt_field_type *enum_type_unsigned = + bt_field_type_enumeration_create(uint_12_type); + struct bt_field_type *event_context_type = + bt_field_type_structure_create(); + struct bt_field_type *event_payload_type = NULL; + struct bt_field_type *returned_type; + struct bt_event *simple_event; + struct bt_field *integer_field; + struct bt_field *float_field; + struct bt_field *enum_field; + struct bt_field *enum_field_unsigned; + struct bt_field *enum_container_field; const char *mapping_name_test = "truie"; const double double_test_value = 3.1415; - struct bt_ctf_field *enum_container_field_unsigned; + struct bt_field *enum_container_field_unsigned; const char *mapping_name_negative_test = "negative_value"; const char *ret_char; double ret_double; int64_t ret_range_start_int64_t, ret_range_end_int64_t; uint64_t ret_range_start_uint64_t, ret_range_end_uint64_t; - struct bt_ctf_event_class *ret_event_class; - struct bt_ctf_field *packet_context; - struct bt_ctf_field *packet_context_field; - struct bt_ctf_field *stream_event_context; - struct bt_ctf_field *stream_event_context_field; - struct bt_ctf_field *event_context; - struct bt_ctf_field *event_context_field; - struct bt_ctf_field_type *ep_integer_field_type = NULL; - struct bt_ctf_field_type *ep_enum_field_type = NULL; - struct bt_ctf_field_type *ep_enum_field_unsigned_type = NULL; - struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; + struct bt_event_class *ret_event_class; + struct bt_field *packet_context; + struct bt_field *packet_context_field; + struct bt_field *stream_event_context; + struct bt_field *stream_event_context_field; + struct bt_field *event_context; + struct bt_field *event_context_field; + struct bt_field_type *ep_integer_field_type = NULL; + struct bt_field_type *ep_enum_field_type = NULL; + struct bt_field_type *ep_enum_field_unsigned_type = NULL; + struct bt_field_type_enumeration_mapping_iterator *iter = NULL; int ret; ok(uint_12_type, "Create an unsigned integer type"); @@ -192,343 +192,343 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class, ok(!bt_ctf_field_type_integer_set_signed(int_64_type, 1), "Set signed 64 bit integer signedness to true"); ok(int_64_type, "Create a signed integer type"); - enum_type = bt_ctf_field_type_enumeration_create(int_64_type); + enum_type = bt_field_type_enumeration_create(int_64_type); - returned_type = bt_ctf_field_type_enumeration_get_container_type(enum_type); - ok(returned_type == int_64_type, "bt_ctf_field_type_enumeration_get_container_type returns the right type"); - ok(!bt_ctf_field_type_enumeration_get_container_type(NULL), "bt_ctf_field_type_enumeration_get_container_type handles NULL correctly"); - ok(!bt_ctf_field_type_enumeration_create(enum_type), - "bt_ctf_field_enumeration_type_create rejects non-integer container field types"); + returned_type = bt_field_type_enumeration_get_container_type(enum_type); + ok(returned_type == int_64_type, "bt_field_type_enumeration_get_container_type returns the right type"); + ok(!bt_field_type_enumeration_get_container_type(NULL), "bt_field_type_enumeration_get_container_type handles NULL correctly"); + ok(!bt_field_type_enumeration_create(enum_type), + "bt_field_enumeration_type_create rejects non-integer container field types"); bt_put(returned_type); - bt_ctf_field_type_set_alignment(float_type, 32); - ok(bt_ctf_field_type_get_alignment(NULL) < 0, - "bt_ctf_field_type_get_alignment handles NULL correctly"); - ok(bt_ctf_field_type_get_alignment(float_type) == 32, - "bt_ctf_field_type_get_alignment returns a correct value"); + bt_field_type_set_alignment(float_type, 32); + ok(bt_field_type_get_alignment(NULL) < 0, + "bt_field_type_get_alignment handles NULL correctly"); + ok(bt_field_type_get_alignment(float_type) == 32, + "bt_field_type_get_alignment returns a correct value"); - ok(bt_ctf_field_type_floating_point_set_exponent_digits(float_type, 11) == 0, + ok(bt_field_type_floating_point_set_exponent_digits(float_type, 11) == 0, "Set a floating point type's exponent digit count"); - ok(bt_ctf_field_type_floating_point_set_mantissa_digits(float_type, 53) == 0, + ok(bt_field_type_floating_point_set_mantissa_digits(float_type, 53) == 0, "Set a floating point type's mantissa digit count"); - ok(bt_ctf_field_type_floating_point_get_exponent_digits(NULL) < 0, - "bt_ctf_field_type_floating_point_get_exponent_digits handles NULL properly"); - ok(bt_ctf_field_type_floating_point_get_mantissa_digits(NULL) < 0, - "bt_ctf_field_type_floating_point_get_mantissa_digits handles NULL properly"); - ok(bt_ctf_field_type_floating_point_get_exponent_digits(float_type) == 11, - "bt_ctf_field_type_floating_point_get_exponent_digits returns the correct value"); - ok(bt_ctf_field_type_floating_point_get_mantissa_digits(float_type) == 53, - "bt_ctf_field_type_floating_point_get_mantissa_digits returns the correct value"); + ok(bt_field_type_floating_point_get_exponent_digits(NULL) < 0, + "bt_field_type_floating_point_get_exponent_digits handles NULL properly"); + ok(bt_field_type_floating_point_get_mantissa_digits(NULL) < 0, + "bt_field_type_floating_point_get_mantissa_digits handles NULL properly"); + ok(bt_field_type_floating_point_get_exponent_digits(float_type) == 11, + "bt_field_type_floating_point_get_exponent_digits returns the correct value"); + ok(bt_field_type_floating_point_get_mantissa_digits(float_type) == 53, + "bt_field_type_floating_point_get_mantissa_digits returns the correct value"); ok(bt_ctf_field_type_enumeration_add_mapping(enum_type, mapping_name_negative_test, -12345, 0) == 0, - "bt_ctf_field_type_enumeration_add_mapping accepts negative enumeration mappings"); + "bt_field_type_enumeration_add_mapping accepts negative enumeration mappings"); ok(bt_ctf_field_type_enumeration_add_mapping(enum_type, "escaping; \"test\"", 1, 1) == 0, - "bt_ctf_field_type_enumeration_add_mapping accepts enumeration mapping strings containing quotes"); + "bt_field_type_enumeration_add_mapping accepts enumeration mapping strings containing quotes"); ok(bt_ctf_field_type_enumeration_add_mapping(enum_type, "\tanother \'escaping\'\n test\"", 2, 4) == 0, - "bt_ctf_field_type_enumeration_add_mapping accepts enumeration mapping strings containing special characters"); + "bt_field_type_enumeration_add_mapping accepts enumeration mapping strings containing special characters"); ok(bt_ctf_field_type_enumeration_add_mapping(enum_type, "event clock int float", 5, 22) == 0, "Accept enumeration mapping strings containing reserved keywords"); bt_ctf_field_type_enumeration_add_mapping(enum_type, mapping_name_test, 42, 42); ok(bt_ctf_field_type_enumeration_add_mapping(enum_type, mapping_name_test, - 43, 51) == 0, "bt_ctf_field_type_enumeration_add_mapping accepts duplicate mapping names"); + 43, 51) == 0, "bt_field_type_enumeration_add_mapping accepts duplicate mapping names"); ok(bt_ctf_field_type_enumeration_add_mapping(enum_type, "something", - -500, -400) == 0, "bt_ctf_field_type_enumeration_add_mapping accepts overlapping enum entries"); + -500, -400) == 0, "bt_field_type_enumeration_add_mapping accepts overlapping enum entries"); ok(bt_ctf_field_type_enumeration_add_mapping(enum_type, mapping_name_test, - -54, -55), "bt_ctf_field_type_enumeration_add_mapping rejects mapping where end < start"); + -54, -55), "bt_field_type_enumeration_add_mapping rejects mapping where end < start"); bt_ctf_field_type_enumeration_add_mapping(enum_type, "another entry", -42000, -13000); - iter = bt_ctf_field_type_enumeration_find_mappings_by_signed_value(NULL, -42); - ok(iter == NULL, "bt_ctf_field_type_enumeration_find_mappings_by_signed_value handles a NULL field type correctly"); + iter = bt_field_type_enumeration_find_mappings_by_signed_value(NULL, -42); + ok(iter == NULL, "bt_field_type_enumeration_find_mappings_by_signed_value handles a NULL field type correctly"); - iter = bt_ctf_field_type_enumeration_find_mappings_by_signed_value(enum_type, -4200000); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); - ok(iter && ret, "bt_ctf_field_type_enumeration_find_mappings_by_signed_value rejects non-mapped values"); + iter = bt_field_type_enumeration_find_mappings_by_signed_value(enum_type, -4200000); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); + ok(iter && ret, "bt_field_type_enumeration_find_mappings_by_signed_value rejects non-mapped values"); BT_PUT(iter); - iter = bt_ctf_field_type_enumeration_find_mappings_by_signed_value(enum_type, 3); - ok(iter != NULL, "bt_ctf_field_type_enumeration_find_mappings_by_signed_value succeeds with mapped value"); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); - ok(!ret && bt_ctf_field_type_enumeration_mapping_iterator_get_signed(iter, NULL, NULL, NULL) == 0, - "bt_ctf_field_type_enumeration_mapping_iterator_get_signed handles mapped values correctly"); + iter = bt_field_type_enumeration_find_mappings_by_signed_value(enum_type, 3); + ok(iter != NULL, "bt_field_type_enumeration_find_mappings_by_signed_value succeeds with mapped value"); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); + ok(!ret && bt_field_type_enumeration_mapping_iterator_get_signed(iter, NULL, NULL, NULL) == 0, + "bt_field_type_enumeration_mapping_iterator_get_signed handles mapped values correctly"); BT_PUT(iter); - ok(bt_ctf_event_class_add_field(simple_event_class, enum_type, + ok(bt_event_class_add_field(simple_event_class, enum_type, "enum_field") == 0, "Add signed enumeration field to event"); - ok(bt_ctf_field_type_enumeration_get_mapping_signed(NULL, 0, &ret_char, + ok(bt_field_type_enumeration_get_mapping_signed(NULL, 0, &ret_char, &ret_range_start_int64_t, &ret_range_end_int64_t) < 0, - "bt_ctf_field_type_enumeration_get_mapping_signed handles a NULL enumeration correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_signed(enum_type, 0, NULL, + "bt_field_type_enumeration_get_mapping_signed handles a NULL enumeration correctly"); + ok(bt_field_type_enumeration_get_mapping_signed(enum_type, 0, NULL, &ret_range_start_int64_t, &ret_range_end_int64_t) == 0, - "bt_ctf_field_type_enumeration_get_mapping_signed handles a NULL string correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_signed(enum_type, 0, &ret_char, + "bt_field_type_enumeration_get_mapping_signed handles a NULL string correctly"); + ok(bt_field_type_enumeration_get_mapping_signed(enum_type, 0, &ret_char, NULL, &ret_range_end_int64_t) == 0, - "bt_ctf_field_type_enumeration_get_mapping_signed handles a NULL start correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_signed(enum_type, 0, &ret_char, + "bt_field_type_enumeration_get_mapping_signed handles a NULL start correctly"); + ok(bt_field_type_enumeration_get_mapping_signed(enum_type, 0, &ret_char, &ret_range_start_int64_t, NULL) == 0, - "bt_ctf_field_type_enumeration_get_mapping_signed handles a NULL end correctly"); + "bt_field_type_enumeration_get_mapping_signed handles a NULL end correctly"); /* Assumes entries are sorted by range_start values. */ - ok(bt_ctf_field_type_enumeration_get_mapping_signed(enum_type, 6, &ret_char, + ok(bt_field_type_enumeration_get_mapping_signed(enum_type, 6, &ret_char, &ret_range_start_int64_t, &ret_range_end_int64_t) == 0, - "bt_ctf_field_type_enumeration_get_mapping_signed returns a value"); + "bt_field_type_enumeration_get_mapping_signed returns a value"); ok(!strcmp(ret_char, mapping_name_test), - "bt_ctf_field_type_enumeration_get_mapping_signed returns a correct mapping name"); + "bt_field_type_enumeration_get_mapping_signed returns a correct mapping name"); ok(ret_range_start_int64_t == 42, - "bt_ctf_field_type_enumeration_get_mapping_signed returns a correct mapping start"); + "bt_field_type_enumeration_get_mapping_signed returns a correct mapping start"); ok(ret_range_end_int64_t == 42, - "bt_ctf_field_type_enumeration_get_mapping_signed returns a correct mapping end"); + "bt_field_type_enumeration_get_mapping_signed returns a correct mapping end"); - ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, + ok(bt_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, "escaping; \"test\"", 0, 0) == 0, - "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing quotes"); - ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, + "bt_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing quotes"); + ok(bt_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, "\tanother \'escaping\'\n test\"", 1, 4) == 0, - "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing special characters"); - ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, + "bt_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing special characters"); + ok(bt_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, "event clock int float", 5, 22) == 0, - "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing reserved keywords"); - ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test, - 42, 42) == 0, "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts single-value ranges"); - ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test, - 43, 51) == 0, "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts duplicate mapping names"); - ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, "something", - 7, 8) == 0, "bt_ctf_field_type_enumeration_add_mapping_unsigned accepts overlapping enum entries"); - ok(bt_ctf_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test, - 55, 54), "bt_ctf_field_type_enumeration_add_mapping_unsigned rejects mapping where end < start"); - ok(bt_ctf_event_class_add_field(simple_event_class, enum_type_unsigned, + "bt_field_type_enumeration_add_mapping_unsigned accepts enumeration mapping strings containing reserved keywords"); + ok(bt_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test, + 42, 42) == 0, "bt_field_type_enumeration_add_mapping_unsigned accepts single-value ranges"); + ok(bt_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test, + 43, 51) == 0, "bt_field_type_enumeration_add_mapping_unsigned accepts duplicate mapping names"); + ok(bt_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, "something", + 7, 8) == 0, "bt_field_type_enumeration_add_mapping_unsigned accepts overlapping enum entries"); + ok(bt_field_type_enumeration_add_mapping_unsigned(enum_type_unsigned, mapping_name_test, + 55, 54), "bt_field_type_enumeration_add_mapping_unsigned rejects mapping where end < start"); + ok(bt_event_class_add_field(simple_event_class, enum_type_unsigned, "enum_field_unsigned") == 0, "Add unsigned enumeration field to event"); - ok(bt_ctf_field_type_enumeration_get_mapping_count(NULL) < 0, - "bt_ctf_field_type_enumeration_get_mapping_count handles NULL correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_count(enum_type_unsigned) == 6, - "bt_ctf_field_type_enumeration_get_mapping_count returns the correct value"); + ok(bt_field_type_enumeration_get_mapping_count(NULL) < 0, + "bt_field_type_enumeration_get_mapping_count handles NULL correctly"); + ok(bt_field_type_enumeration_get_mapping_count(enum_type_unsigned) == 6, + "bt_field_type_enumeration_get_mapping_count returns the correct value"); - ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(NULL, 0, &ret_char, + ok(bt_field_type_enumeration_get_mapping_unsigned(NULL, 0, &ret_char, &ret_range_start_uint64_t, &ret_range_end_uint64_t) < 0, - "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL enumeration correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, NULL, + "bt_field_type_enumeration_get_mapping_unsigned handles a NULL enumeration correctly"); + ok(bt_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, NULL, &ret_range_start_uint64_t, &ret_range_end_uint64_t) == 0, - "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL string correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, &ret_char, + "bt_field_type_enumeration_get_mapping_unsigned handles a NULL string correctly"); + ok(bt_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, &ret_char, NULL, &ret_range_end_uint64_t) == 0, - "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL start correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, &ret_char, + "bt_field_type_enumeration_get_mapping_unsigned handles a NULL start correctly"); + ok(bt_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 0, &ret_char, &ret_range_start_uint64_t, NULL) == 0, - "bt_ctf_field_type_enumeration_get_mapping_unsigned handles a NULL end correctly"); - ok(bt_ctf_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 4, &ret_char, + "bt_field_type_enumeration_get_mapping_unsigned handles a NULL end correctly"); + ok(bt_field_type_enumeration_get_mapping_unsigned(enum_type_unsigned, 4, &ret_char, &ret_range_start_uint64_t, &ret_range_end_uint64_t) == 0, - "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a value"); + "bt_field_type_enumeration_get_mapping_unsigned returns a value"); ok(!strcmp(ret_char, mapping_name_test), - "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a correct mapping name"); + "bt_field_type_enumeration_get_mapping_unsigned returns a correct mapping name"); ok(ret_range_start_uint64_t == 42, - "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a correct mapping start"); + "bt_field_type_enumeration_get_mapping_unsigned returns a correct mapping start"); ok(ret_range_end_uint64_t == 42, - "bt_ctf_field_type_enumeration_get_mapping_unsigned returns a correct mapping end"); + "bt_field_type_enumeration_get_mapping_unsigned returns a correct mapping end"); - bt_ctf_event_class_add_field(simple_event_class, uint_12_type, + bt_event_class_add_field(simple_event_class, uint_12_type, "integer_field"); - bt_ctf_event_class_add_field(simple_event_class, float_type, + bt_event_class_add_field(simple_event_class, float_type, "float_field"); - assert(!bt_ctf_event_class_set_id(simple_event_class, 13)); + assert(!bt_event_class_set_id(simple_event_class, 13)); /* Set an event context type which will contain a single integer. */ - ok(!bt_ctf_field_type_structure_add_field(event_context_type, uint_12_type, + ok(!bt_field_type_structure_add_field(event_context_type, uint_12_type, "event_specific_context"), "Add event specific context field"); - ok(bt_ctf_event_class_get_context_type(NULL) == NULL, - "bt_ctf_event_class_get_context_type handles NULL correctly"); + ok(bt_event_class_get_context_type(NULL) == NULL, + "bt_event_class_get_context_type handles NULL correctly"); - ok(bt_ctf_event_class_set_context_type(NULL, event_context_type) < 0, - "bt_ctf_event_class_set_context_type handles a NULL event class correctly"); - ok(!bt_ctf_event_class_set_context_type(simple_event_class, event_context_type), + ok(bt_event_class_set_context_type(NULL, event_context_type) < 0, + "bt_event_class_set_context_type handles a NULL event class correctly"); + ok(!bt_event_class_set_context_type(simple_event_class, event_context_type), "Set an event class' context type successfully"); - returned_type = bt_ctf_event_class_get_context_type(simple_event_class); + returned_type = bt_event_class_get_context_type(simple_event_class); ok(returned_type == event_context_type, - "bt_ctf_event_class_get_context_type returns the appropriate type"); + "bt_event_class_get_context_type returns the appropriate type"); bt_put(returned_type); - ok(!bt_ctf_stream_class_add_event_class(stream_class, simple_event_class), + ok(!bt_stream_class_add_event_class(stream_class, simple_event_class), "Adding simple event class to stream class"); /* - * bt_ctf_stream_class_add_event_class() copies the field types + * bt_stream_class_add_event_class() copies the field types * of simple_event_class, so we retrieve the new ones to create * the appropriate fields. */ BT_PUT(event_context_type); BT_PUT(event_payload_type); - event_payload_type = bt_ctf_event_class_get_payload_type( + event_payload_type = bt_event_class_get_payload_type( simple_event_class); assert(event_payload_type); - event_context_type = bt_ctf_event_class_get_context_type( + event_context_type = bt_event_class_get_context_type( simple_event_class); assert(event_context_type); ep_integer_field_type = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( event_payload_type, "integer_field"); assert(ep_integer_field_type); ep_enum_field_type = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( event_payload_type, "enum_field"); assert(ep_enum_field_type); ep_enum_field_unsigned_type = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( event_payload_type, "enum_field_unsigned"); assert(ep_enum_field_unsigned_type); - ok(bt_ctf_stream_class_get_event_class_count(NULL) < 0, - "bt_ctf_stream_class_get_event_class_count handles NULL correctly"); - ok(bt_ctf_stream_class_get_event_class_count(stream_class) == 1, - "bt_ctf_stream_class_get_event_class_count returns a correct number of event classes"); - ok(bt_ctf_stream_class_get_event_class_by_index(NULL, 0) == NULL, - "bt_ctf_stream_class_get_event_class handles NULL correctly"); - ok(bt_ctf_stream_class_get_event_class_by_index(stream_class, 8724) == NULL, - "bt_ctf_stream_class_get_event_class handles invalid indexes correctly"); - ret_event_class = bt_ctf_stream_class_get_event_class_by_index(stream_class, 0); + ok(bt_stream_class_get_event_class_count(NULL) < 0, + "bt_stream_class_get_event_class_count handles NULL correctly"); + ok(bt_stream_class_get_event_class_count(stream_class) == 1, + "bt_stream_class_get_event_class_count returns a correct number of event classes"); + ok(bt_stream_class_get_event_class_by_index(NULL, 0) == NULL, + "bt_stream_class_get_event_class handles NULL correctly"); + ok(bt_stream_class_get_event_class_by_index(stream_class, 8724) == NULL, + "bt_stream_class_get_event_class handles invalid indexes correctly"); + ret_event_class = bt_stream_class_get_event_class_by_index(stream_class, 0); ok(ret_event_class == simple_event_class, - "bt_ctf_stream_class_get_event_class returns the correct event class"); + "bt_stream_class_get_event_class returns the correct event class"); bt_put(ret_event_class); - ok(!bt_ctf_stream_class_get_event_class_by_id(NULL, 0), - "bt_ctf_stream_class_get_event_class_by_id handles NULL correctly"); - ok(!bt_ctf_stream_class_get_event_class_by_id(stream_class, 2), - "bt_ctf_stream_class_get_event_class_by_id returns NULL when the requested ID doesn't exist"); + ok(!bt_stream_class_get_event_class_by_id(NULL, 0), + "bt_stream_class_get_event_class_by_id handles NULL correctly"); + ok(!bt_stream_class_get_event_class_by_id(stream_class, 2), + "bt_stream_class_get_event_class_by_id returns NULL when the requested ID doesn't exist"); ret_event_class = - bt_ctf_stream_class_get_event_class_by_id(stream_class, 13); + bt_stream_class_get_event_class_by_id(stream_class, 13); ok(ret_event_class == simple_event_class, - "bt_ctf_stream_class_get_event_class_by_id returns a correct event class"); + "bt_stream_class_get_event_class_by_id returns a correct event class"); bt_put(ret_event_class); - simple_event = bt_ctf_event_create(simple_event_class); + simple_event = bt_event_create(simple_event_class); ok(simple_event, "Instantiate an event containing a single integer field"); - integer_field = bt_ctf_field_create(ep_integer_field_type); - bt_ctf_field_unsigned_integer_set_value(integer_field, 42); - ok(bt_ctf_event_set_payload(simple_event, "integer_field", - integer_field) == 0, "Use bt_ctf_event_set_payload to set a manually allocated field"); - - float_field = bt_ctf_event_get_payload(simple_event, "float_field"); - ok(bt_ctf_field_floating_point_get_value(float_field, &ret_double), - "bt_ctf_field_floating_point_get_value fails on an unset float field"); - bt_ctf_field_floating_point_set_value(float_field, double_test_value); - ok(bt_ctf_field_floating_point_get_value(NULL, &ret_double), - "bt_ctf_field_floating_point_get_value properly handles a NULL field"); - ok(bt_ctf_field_floating_point_get_value(float_field, NULL), - "bt_ctf_field_floating_point_get_value properly handles a NULL return value pointer"); - ok(!bt_ctf_field_floating_point_get_value(float_field, &ret_double), - "bt_ctf_field_floating_point_get_value returns a double value"); + integer_field = bt_field_create(ep_integer_field_type); + bt_field_unsigned_integer_set_value(integer_field, 42); + ok(bt_event_set_payload(simple_event, "integer_field", + integer_field) == 0, "Use bt_event_set_payload to set a manually allocated field"); + + float_field = bt_event_get_payload(simple_event, "float_field"); + ok(bt_field_floating_point_get_value(float_field, &ret_double), + "bt_field_floating_point_get_value fails on an unset float field"); + bt_field_floating_point_set_value(float_field, double_test_value); + ok(bt_field_floating_point_get_value(NULL, &ret_double), + "bt_field_floating_point_get_value properly handles a NULL field"); + ok(bt_field_floating_point_get_value(float_field, NULL), + "bt_field_floating_point_get_value properly handles a NULL return value pointer"); + ok(!bt_field_floating_point_get_value(float_field, &ret_double), + "bt_field_floating_point_get_value returns a double value"); ok(fabs(ret_double - double_test_value) <= DBL_EPSILON, - "bt_ctf_field_floating_point_get_value returns a correct value"); + "bt_field_floating_point_get_value returns a correct value"); - enum_field = bt_ctf_field_create(ep_enum_field_type); + enum_field = bt_field_create(ep_enum_field_type); assert(enum_field); - iter = bt_ctf_field_enumeration_get_mappings(NULL); - ok(!iter, "bt_ctf_field_enumeration_get_mappings handles NULL correctly"); - iter = bt_ctf_field_enumeration_get_mappings(enum_field); - ok(!iter, "bt_ctf_field_enumeration_get_mappings returns NULL if the enumeration's container field is unset"); - enum_container_field = bt_ctf_field_enumeration_get_container( + iter = bt_field_enumeration_get_mappings(NULL); + ok(!iter, "bt_field_enumeration_get_mappings handles NULL correctly"); + iter = bt_field_enumeration_get_mappings(enum_field); + ok(!iter, "bt_field_enumeration_get_mappings returns NULL if the enumeration's container field is unset"); + enum_container_field = bt_field_enumeration_get_container( enum_field); - ok(bt_ctf_field_signed_integer_set_value( + ok(bt_field_signed_integer_set_value( enum_container_field, -42) == 0, "Set signed enumeration container value"); - iter = bt_ctf_field_enumeration_get_mappings(enum_field); - ok(iter, "bt_ctf_field_enumeration_get_mappings returns an iterator to matching mappings"); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); - ok(!ret, "bt_ctf_field_enumeration_get_mappings returned a non-empty match"); - ret = bt_ctf_field_type_enumeration_mapping_iterator_get_signed(iter, &ret_char, NULL, NULL); - ok(!ret && ret_char, "bt_ctf_field_type_enumeration_mapping_iterator_get_signed return a mapping name"); + iter = bt_field_enumeration_get_mappings(enum_field); + ok(iter, "bt_field_enumeration_get_mappings returns an iterator to matching mappings"); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); + ok(!ret, "bt_field_enumeration_get_mappings returned a non-empty match"); + ret = bt_field_type_enumeration_mapping_iterator_get_signed(iter, &ret_char, NULL, NULL); + ok(!ret && ret_char, "bt_field_type_enumeration_mapping_iterator_get_signed return a mapping name"); assert(ret_char); ok(!strcmp(ret_char, mapping_name_negative_test), - "bt_ctf_field_enumeration_get_single_mapping_name returns the correct mapping name with an signed container"); - ret = bt_ctf_event_set_payload(simple_event, "enum_field", enum_field); + "bt_field_enumeration_get_single_mapping_name returns the correct mapping name with an signed container"); + ret = bt_event_set_payload(simple_event, "enum_field", enum_field); assert(!ret); BT_PUT(iter); - enum_field_unsigned = bt_ctf_field_create(ep_enum_field_unsigned_type); + enum_field_unsigned = bt_field_create(ep_enum_field_unsigned_type); assert(enum_field_unsigned); - enum_container_field_unsigned = bt_ctf_field_enumeration_get_container( + enum_container_field_unsigned = bt_field_enumeration_get_container( enum_field_unsigned); - ok(bt_ctf_field_unsigned_integer_set_value( + ok(bt_field_unsigned_integer_set_value( enum_container_field_unsigned, 42) == 0, "Set unsigned enumeration container value"); - ret = bt_ctf_event_set_payload(simple_event, "enum_field_unsigned", + ret = bt_event_set_payload(simple_event, "enum_field_unsigned", enum_field_unsigned); assert(!ret); - iter = bt_ctf_field_enumeration_get_mappings(enum_field_unsigned); + iter = bt_field_enumeration_get_mappings(enum_field_unsigned); assert(iter); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); assert(!ret); - (void) bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(iter, &ret_char, NULL, NULL); + (void) bt_field_type_enumeration_mapping_iterator_get_unsigned(iter, &ret_char, NULL, NULL); ok(ret_char && !strcmp(ret_char, mapping_name_test), - "bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned returns the correct mapping name with an unsigned container"); + "bt_field_type_enumeration_mapping_iterator_get_unsigned returns the correct mapping name with an unsigned container"); ok(bt_ctf_clock_set_time(clock, current_time) == 0, "Set clock time"); /* Populate stream event context */ stream_event_context = - bt_ctf_event_get_stream_event_context(simple_event); + bt_event_get_stream_event_context(simple_event); assert(stream_event_context); - stream_event_context_field = bt_ctf_field_structure_get_field( + stream_event_context_field = bt_field_structure_get_field_by_name( stream_event_context, "common_event_context"); - bt_ctf_field_unsigned_integer_set_value(stream_event_context_field, 42); + bt_field_unsigned_integer_set_value(stream_event_context_field, 42); /* Populate the event's context */ - ok(bt_ctf_event_get_event_context(NULL) == NULL, - "bt_ctf_event_get_event_context handles NULL correctly"); - event_context = bt_ctf_event_get_event_context(simple_event); + ok(bt_event_get_event_context(NULL) == NULL, + "bt_event_get_event_context handles NULL correctly"); + event_context = bt_event_get_event_context(simple_event); ok(event_context, - "bt_ctf_event_get_event_context returns a field"); - returned_type = bt_ctf_field_get_type(event_context); + "bt_event_get_event_context returns a field"); + returned_type = bt_field_get_type(event_context); ok(returned_type == event_context_type, - "bt_ctf_event_get_event_context returns a field of the appropriate type"); - event_context_field = bt_ctf_field_structure_get_field(event_context, + "bt_event_get_event_context returns a field of the appropriate type"); + event_context_field = bt_field_structure_get_field_by_name(event_context, "event_specific_context"); - ok(!bt_ctf_field_unsigned_integer_set_value(event_context_field, 1234), + ok(!bt_field_unsigned_integer_set_value(event_context_field, 1234), "Successfully set an event context's value"); - ok(bt_ctf_event_set_event_context(NULL, event_context) < 0, - "bt_ctf_event_set_event_context handles a NULL event correctly"); - ok(bt_ctf_event_set_event_context(simple_event, NULL) < 0, - "bt_ctf_event_set_event_context handles a NULL event context correctly"); - ok(bt_ctf_event_set_event_context(simple_event, event_context_field) < 0, - "bt_ctf_event_set_event_context rejects a context of the wrong type"); - ok(!bt_ctf_event_set_event_context(simple_event, event_context), + ok(bt_event_set_event_context(NULL, event_context) < 0, + "bt_event_set_event_context handles a NULL event correctly"); + ok(bt_event_set_event_context(simple_event, NULL) < 0, + "bt_event_set_event_context handles a NULL event context correctly"); + ok(bt_event_set_event_context(simple_event, event_context_field) < 0, + "bt_event_set_event_context rejects a context of the wrong type"); + ok(!bt_event_set_event_context(simple_event, event_context), "Set an event context successfully"); - ok(bt_ctf_stream_append_event(stream, simple_event) == 0, + ok(bt_stream_append_event(stream, simple_event) == 0, "Append simple event to trace stream"); - ok(bt_ctf_stream_get_packet_context(NULL) == NULL, - "bt_ctf_stream_get_packet_context handles NULL correctly"); - packet_context = bt_ctf_stream_get_packet_context(stream); + ok(bt_stream_get_packet_context(NULL) == NULL, + "bt_stream_get_packet_context handles NULL correctly"); + packet_context = bt_stream_get_packet_context(stream); ok(packet_context, - "bt_ctf_stream_get_packet_context returns a packet context"); + "bt_stream_get_packet_context returns a packet context"); - packet_context_field = bt_ctf_field_structure_get_field(packet_context, + packet_context_field = bt_field_structure_get_field_by_name(packet_context, "packet_size"); ok(packet_context_field, "Packet context contains the default packet_size field."); bt_put(packet_context_field); - packet_context_field = bt_ctf_field_structure_get_field(packet_context, + packet_context_field = bt_field_structure_get_field_by_name(packet_context, "custom_packet_context_field"); - ok(bt_ctf_field_unsigned_integer_set_value(packet_context_field, 8) == 0, + ok(bt_field_unsigned_integer_set_value(packet_context_field, 8) == 0, "Custom packet context field value successfully set."); - ok(bt_ctf_stream_set_packet_context(NULL, packet_context_field) < 0, - "bt_ctf_stream_set_packet_context handles a NULL stream correctly"); - ok(bt_ctf_stream_set_packet_context(stream, NULL) < 0, - "bt_ctf_stream_set_packet_context handles a NULL packet context correctly"); - ok(bt_ctf_stream_set_packet_context(stream, packet_context) == 0, + ok(bt_stream_set_packet_context(NULL, packet_context_field) < 0, + "bt_stream_set_packet_context handles a NULL stream correctly"); + ok(bt_stream_set_packet_context(stream, NULL) < 0, + "bt_stream_set_packet_context handles a NULL packet context correctly"); + ok(bt_stream_set_packet_context(stream, packet_context) == 0, "Successfully set a stream's packet context"); - ok(bt_ctf_stream_flush(stream) == 0, + ok(bt_stream_flush(stream) == 0, "Flush trace stream with one event"); bt_put(simple_event_class); @@ -560,8 +560,8 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class, } static -void append_complex_event(struct bt_ctf_stream_class *stream_class, - struct bt_ctf_stream *stream, struct bt_ctf_clock *clock) +void append_complex_event(struct bt_stream_class *stream_class, + struct bt_stream *stream, struct bt_ctf_clock *clock) { int i, ret; struct event_class_attrs_counts ; @@ -571,29 +571,29 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class, const char *test_string_3 = "abcdefghi"; const char *test_string_4 = "abcd\0efg\0hi"; const char *test_string_cat = "Test string abcdeabcd"; - struct bt_ctf_field_type *uint_35_type = - bt_ctf_field_type_integer_create(35); - struct bt_ctf_field_type *int_16_type = - bt_ctf_field_type_integer_create(16); - struct bt_ctf_field_type *uint_3_type = - bt_ctf_field_type_integer_create(3); - struct bt_ctf_field_type *enum_variant_type = - bt_ctf_field_type_enumeration_create(uint_3_type); - struct bt_ctf_field_type *variant_type = - bt_ctf_field_type_variant_create(enum_variant_type, + struct bt_field_type *uint_35_type = + bt_field_type_integer_create(35); + struct bt_field_type *int_16_type = + bt_field_type_integer_create(16); + struct bt_field_type *uint_3_type = + bt_field_type_integer_create(3); + struct bt_field_type *enum_variant_type = + bt_field_type_enumeration_create(uint_3_type); + struct bt_field_type *variant_type = + bt_field_type_variant_create(enum_variant_type, "variant_selector"); - struct bt_ctf_field_type *string_type = - bt_ctf_field_type_string_create(); - struct bt_ctf_field_type *sequence_type; - struct bt_ctf_field_type *array_type; - struct bt_ctf_field_type *inner_structure_type = - bt_ctf_field_type_structure_create(); - struct bt_ctf_field_type *complex_structure_type = - bt_ctf_field_type_structure_create(); - struct bt_ctf_field_type *ret_field_type; - struct bt_ctf_event_class *event_class; - struct bt_ctf_event *event; - struct bt_ctf_field *uint_35_field, *int_16_field, *a_string_field, + struct bt_field_type *string_type = + bt_field_type_string_create(); + struct bt_field_type *sequence_type; + struct bt_field_type *array_type; + struct bt_field_type *inner_structure_type = + bt_field_type_structure_create(); + struct bt_field_type *complex_structure_type = + bt_field_type_structure_create(); + struct bt_field_type *ret_field_type; + struct bt_event_class *event_class; + struct bt_event *event; + struct bt_field *uint_35_field, *int_16_field, *a_string_field, *inner_structure_field, *complex_structure_field, *a_sequence_field, *enum_variant_field, *enum_container_field, *variant_field, *an_array_field, *stream_event_ctx_field, @@ -601,51 +601,51 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class, uint64_t ret_unsigned_int; int64_t ret_signed_int; const char *ret_string; - struct bt_ctf_stream_class *ret_stream_class; - struct bt_ctf_event_class *ret_event_class; - struct bt_ctf_field *packet_context, *packet_context_field; - struct bt_ctf_field_type_enumeration_mapping_iterator *iter = NULL; - - ok(bt_ctf_field_type_set_alignment(int_16_type, 0), - "bt_ctf_field_type_set_alignment handles 0-alignment correctly"); - ok(bt_ctf_field_type_set_alignment(int_16_type, 3), - "bt_ctf_field_type_set_alignment handles wrong alignment correctly (3)"); - ok(bt_ctf_field_type_set_alignment(int_16_type, 24), - "bt_ctf_field_type_set_alignment handles wrong alignment correctly (24)"); - ok(!bt_ctf_field_type_set_alignment(int_16_type, 4), - "bt_ctf_field_type_set_alignment handles correct alignment correctly (4)"); - ok(!bt_ctf_field_type_set_alignment(int_16_type, 32), + struct bt_stream_class *ret_stream_class; + struct bt_event_class *ret_event_class; + struct bt_field *packet_context, *packet_context_field; + struct bt_field_type_enumeration_mapping_iterator *iter = NULL; + + ok(bt_field_type_set_alignment(int_16_type, 0), + "bt_field_type_set_alignment handles 0-alignment correctly"); + ok(bt_field_type_set_alignment(int_16_type, 3), + "bt_field_type_set_alignment handles wrong alignment correctly (3)"); + ok(bt_field_type_set_alignment(int_16_type, 24), + "bt_field_type_set_alignment handles wrong alignment correctly (24)"); + ok(!bt_field_type_set_alignment(int_16_type, 4), + "bt_field_type_set_alignment handles correct alignment correctly (4)"); + ok(!bt_field_type_set_alignment(int_16_type, 32), "Set alignment of signed 16 bit integer to 32"); ok(!bt_ctf_field_type_integer_set_signed(int_16_type, 1), "Set integer signedness to true"); - ok(!bt_ctf_field_type_integer_set_base(uint_35_type, - BT_CTF_INTEGER_BASE_HEXADECIMAL), + ok(!bt_field_type_integer_set_base(uint_35_type, + BT_INTEGER_BASE_HEXADECIMAL), "Set signed 16 bit integer base to hexadecimal"); - array_type = bt_ctf_field_type_array_create(int_16_type, ARRAY_TEST_LENGTH); - sequence_type = bt_ctf_field_type_sequence_create(int_16_type, + array_type = bt_field_type_array_create(int_16_type, ARRAY_TEST_LENGTH); + sequence_type = bt_field_type_sequence_create(int_16_type, "seq_len"); - ok(bt_ctf_field_type_array_get_element_type(NULL) == NULL, - "bt_ctf_field_type_array_get_element_type handles NULL correctly"); - ret_field_type = bt_ctf_field_type_array_get_element_type( + ok(bt_field_type_array_get_element_type(NULL) == NULL, + "bt_field_type_array_get_element_type handles NULL correctly"); + ret_field_type = bt_field_type_array_get_element_type( array_type); ok(ret_field_type == int_16_type, - "bt_ctf_field_type_array_get_element_type returns the correct type"); + "bt_field_type_array_get_element_type returns the correct type"); bt_put(ret_field_type); - ok(bt_ctf_field_type_array_get_length(NULL) < 0, - "bt_ctf_field_type_array_get_length handles NULL correctly"); - ok(bt_ctf_field_type_array_get_length(array_type) == ARRAY_TEST_LENGTH, - "bt_ctf_field_type_array_get_length returns the correct length"); + ok(bt_field_type_array_get_length(NULL) < 0, + "bt_field_type_array_get_length handles NULL correctly"); + ok(bt_field_type_array_get_length(array_type) == ARRAY_TEST_LENGTH, + "bt_field_type_array_get_length returns the correct length"); - ok(bt_ctf_field_type_structure_add_field(inner_structure_type, + ok(bt_field_type_structure_add_field(inner_structure_type, inner_structure_type, "yes"), "Cannot add self to structure"); - ok(!bt_ctf_field_type_structure_add_field(inner_structure_type, + ok(!bt_field_type_structure_add_field(inner_structure_type, uint_35_type, "seq_len"), "Add seq_len field to inner structure"); - ok(!bt_ctf_field_type_structure_add_field(inner_structure_type, + ok(!bt_field_type_structure_add_field(inner_structure_type, sequence_type, "a_sequence"), "Add a_sequence field to inner structure"); - ok(!bt_ctf_field_type_structure_add_field(inner_structure_type, + ok(!bt_field_type_structure_add_field(inner_structure_type, array_type, "an_array"), "Add an_array field to inner structure"); bt_ctf_field_type_enumeration_add_mapping(enum_variant_type, @@ -655,392 +655,392 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class, bt_ctf_field_type_enumeration_add_mapping(enum_variant_type, "UINT35_TYPE", 2, 7); - iter = bt_ctf_field_type_enumeration_find_mappings_by_name(NULL, "INT16_TYPE"); - ok(iter == NULL, "bt_ctf_field_type_enumeration_find_mappings_by_name handles a NULL field type correctly"); + iter = bt_field_type_enumeration_find_mappings_by_name(NULL, "INT16_TYPE"); + ok(iter == NULL, "bt_field_type_enumeration_find_mappings_by_name handles a NULL field type correctly"); - iter = bt_ctf_field_type_enumeration_find_mappings_by_name(enum_variant_type, "INT16_TYPE"); - ok(iter != NULL, "bt_ctf_field_type_enumeration_find_mappings_by_name returns a non-NULL iterator"); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); - ok(!ret, "bt_ctf_field_type_enumeration_find_mappings_by_name handles an existing mapping correctly"); - ok(bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) == 0, - "bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned handles mapped values correctly"); + iter = bt_field_type_enumeration_find_mappings_by_name(enum_variant_type, "INT16_TYPE"); + ok(iter != NULL, "bt_field_type_enumeration_find_mappings_by_name returns a non-NULL iterator"); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); + ok(!ret, "bt_field_type_enumeration_find_mappings_by_name handles an existing mapping correctly"); + ok(bt_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) == 0, + "bt_field_type_enumeration_mapping_iterator_get_unsigned handles mapped values correctly"); BT_PUT(iter); - iter = bt_ctf_field_type_enumeration_find_mappings_by_name(enum_variant_type, NULL); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); - ok(iter && ret, "bt_ctf_field_type_enumeration_find_mappings_by_name handles a NULL name correctly"); + iter = bt_field_type_enumeration_find_mappings_by_name(enum_variant_type, NULL); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); + ok(iter && ret, "bt_field_type_enumeration_find_mappings_by_name handles a NULL name correctly"); BT_PUT(iter); - iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(NULL, 1); - ok(iter == NULL, "bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value handles a NULL field type correctly"); + iter = bt_field_type_enumeration_find_mappings_by_unsigned_value(NULL, 1); + ok(iter == NULL, "bt_field_type_enumeration_find_mappings_by_unsigned_value handles a NULL field type correctly"); - iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(enum_variant_type, -42); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); - ok(iter && ret, "bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value handles invalid values correctly"); - ok(bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) != 0, - "bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned handles invalid values correctly"); + iter = bt_field_type_enumeration_find_mappings_by_unsigned_value(enum_variant_type, -42); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); + ok(iter && ret, "bt_field_type_enumeration_find_mappings_by_unsigned_value handles invalid values correctly"); + ok(bt_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) != 0, + "bt_field_type_enumeration_mapping_iterator_get_unsigned handles invalid values correctly"); BT_PUT(iter); - iter = bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value(enum_variant_type, 5); - ret = bt_ctf_field_type_enumeration_mapping_iterator_next(iter); - ok(iter != NULL && !ret, "bt_ctf_field_type_enumeration_find_mappings_by_unsigned_value handles valid values correctly"); - ok(bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) == 0, - "bt_ctf_field_type_enumeration_mapping_iterator_get_unsigned handles valid values correctly"); + iter = bt_field_type_enumeration_find_mappings_by_unsigned_value(enum_variant_type, 5); + ret = bt_field_type_enumeration_mapping_iterator_next(iter); + ok(iter != NULL && !ret, "bt_field_type_enumeration_find_mappings_by_unsigned_value handles valid values correctly"); + ok(bt_field_type_enumeration_mapping_iterator_get_unsigned(iter, NULL, NULL, NULL) == 0, + "bt_field_type_enumeration_mapping_iterator_get_unsigned handles valid values correctly"); BT_PUT(iter); - ok(bt_ctf_field_type_variant_add_field(variant_type, uint_3_type, + ok(bt_field_type_variant_add_field(variant_type, uint_3_type, "An unknown entry"), "Reject a variant field based on an unknown tag value"); - ok(bt_ctf_field_type_variant_add_field(variant_type, uint_3_type, + ok(bt_field_type_variant_add_field(variant_type, uint_3_type, "UINT3_TYPE") == 0, "Add a field to a variant"); - ok(!bt_ctf_field_type_variant_add_field(variant_type, int_16_type, + ok(!bt_field_type_variant_add_field(variant_type, int_16_type, "INT16_TYPE"), "Add INT16_TYPE field to variant"); - ok(!bt_ctf_field_type_variant_add_field(variant_type, uint_35_type, + ok(!bt_field_type_variant_add_field(variant_type, uint_35_type, "UINT35_TYPE"), "Add UINT35_TYPE field to variant"); - ok(bt_ctf_field_type_variant_get_tag_type(NULL) == NULL, - "bt_ctf_field_type_variant_get_tag_type handles NULL correctly"); - ret_field_type = bt_ctf_field_type_variant_get_tag_type(variant_type); + ok(bt_field_type_variant_get_tag_type(NULL) == NULL, + "bt_field_type_variant_get_tag_type handles NULL correctly"); + ret_field_type = bt_field_type_variant_get_tag_type(variant_type); ok(ret_field_type == enum_variant_type, - "bt_ctf_field_type_variant_get_tag_type returns a correct tag type"); + "bt_field_type_variant_get_tag_type returns a correct tag type"); bt_put(ret_field_type); - ok(bt_ctf_field_type_variant_get_tag_name(NULL) == NULL, - "bt_ctf_field_type_variant_get_tag_name handles NULL correctly"); - ret_string = bt_ctf_field_type_variant_get_tag_name(variant_type); + ok(bt_field_type_variant_get_tag_name(NULL) == NULL, + "bt_field_type_variant_get_tag_name handles NULL correctly"); + ret_string = bt_field_type_variant_get_tag_name(variant_type); ok(ret_string ? !strcmp(ret_string, "variant_selector") : 0, - "bt_ctf_field_type_variant_get_tag_name returns the correct variant tag name"); - ok(bt_ctf_field_type_variant_get_field_type_by_name(NULL, + "bt_field_type_variant_get_tag_name returns the correct variant tag name"); + ok(bt_field_type_variant_get_field_type_by_name(NULL, "INT16_TYPE") == NULL, - "bt_ctf_field_type_variant_get_field_type_by_name handles a NULL variant_type correctly"); - ok(bt_ctf_field_type_variant_get_field_type_by_name(variant_type, + "bt_field_type_variant_get_field_type_by_name handles a NULL variant_type correctly"); + ok(bt_field_type_variant_get_field_type_by_name(variant_type, NULL) == NULL, - "bt_ctf_field_type_variant_get_field_type_by_name handles a NULL field name correctly"); - ret_field_type = bt_ctf_field_type_variant_get_field_type_by_name( + "bt_field_type_variant_get_field_type_by_name handles a NULL field name correctly"); + ret_field_type = bt_field_type_variant_get_field_type_by_name( variant_type, "INT16_TYPE"); ok(ret_field_type == int_16_type, - "bt_ctf_field_type_variant_get_field_type_by_name returns a correct field type"); + "bt_field_type_variant_get_field_type_by_name returns a correct field type"); bt_put(ret_field_type); - ok(bt_ctf_field_type_variant_get_field_count(NULL) < 0, - "bt_ctf_field_type_variant_get_field_count handles NULL correctly"); - ok(bt_ctf_field_type_variant_get_field_count(variant_type) == 3, - "bt_ctf_field_type_variant_get_field_count returns the correct count"); + ok(bt_field_type_variant_get_field_count(NULL) < 0, + "bt_field_type_variant_get_field_count handles NULL correctly"); + ok(bt_field_type_variant_get_field_count(variant_type) == 3, + "bt_field_type_variant_get_field_count returns the correct count"); - ok(bt_ctf_field_type_variant_get_field(NULL, &ret_string, &ret_field_type, 0) < 0, - "bt_ctf_field_type_variant_get_field handles a NULL type correctly"); - ok(bt_ctf_field_type_variant_get_field(variant_type, NULL, &ret_field_type, 0) == 0, - "bt_ctf_field_type_variant_get_field handles a NULL field name correctly"); + ok(bt_field_type_variant_get_field_by_index(NULL, &ret_string, &ret_field_type, 0) < 0, + "bt_field_type_variant_get_field handles a NULL type correctly"); + ok(bt_field_type_variant_get_field_by_index(variant_type, NULL, &ret_field_type, 0) == 0, + "bt_field_type_variant_get_field handles a NULL field name correctly"); bt_put(ret_field_type); - ok(bt_ctf_field_type_variant_get_field(variant_type, &ret_string, NULL, 0) == 0, - "bt_ctf_field_type_variant_get_field handles a NULL field type correctly"); - ok(bt_ctf_field_type_variant_get_field(variant_type, &ret_string, &ret_field_type, 200) < 0, - "bt_ctf_field_type_variant_get_field handles an invalid index correctly"); - ok(bt_ctf_field_type_variant_get_field(variant_type, &ret_string, &ret_field_type, 1) == 0, - "bt_ctf_field_type_variant_get_field returns a field"); + ok(bt_field_type_variant_get_field_by_index(variant_type, &ret_string, NULL, 0) == 0, + "bt_field_type_variant_get_field handles a NULL field type correctly"); + ok(bt_field_type_variant_get_field_by_index(variant_type, &ret_string, &ret_field_type, 200) < 0, + "bt_field_type_variant_get_field handles an invalid index correctly"); + ok(bt_field_type_variant_get_field_by_index(variant_type, &ret_string, &ret_field_type, 1) == 0, + "bt_field_type_variant_get_field returns a field"); ok(!strcmp("INT16_TYPE", ret_string), - "bt_ctf_field_type_variant_get_field returns a correct field name"); + "bt_field_type_variant_get_field returns a correct field name"); ok(ret_field_type == int_16_type, - "bt_ctf_field_type_variant_get_field returns a correct field type"); + "bt_field_type_variant_get_field returns a correct field type"); bt_put(ret_field_type); - ok(!bt_ctf_field_type_structure_add_field(complex_structure_type, + ok(!bt_field_type_structure_add_field(complex_structure_type, enum_variant_type, "variant_selector"), "Add variant_selector field to complex structure"); - ok(!bt_ctf_field_type_structure_add_field(complex_structure_type, + ok(!bt_field_type_structure_add_field(complex_structure_type, string_type, "string"), "Add `string` field to complex structure"); - ok(!bt_ctf_field_type_structure_add_field(complex_structure_type, + ok(!bt_field_type_structure_add_field(complex_structure_type, variant_type, "variant_value"), "Add variant_value field to complex structure"); - ok(!bt_ctf_field_type_structure_add_field(complex_structure_type, + ok(!bt_field_type_structure_add_field(complex_structure_type, inner_structure_type, "inner_structure"), "Add inner_structure field to complex structure"); - event_class = bt_ctf_event_class_create(complex_test_event_string); + event_class = bt_event_class_create(complex_test_event_string); ok(event_class, "Create an event class"); - ok(bt_ctf_event_class_add_field(event_class, uint_35_type, ""), + ok(bt_event_class_add_field(event_class, uint_35_type, ""), "Reject addition of a field with an empty name to an event"); - ok(bt_ctf_event_class_add_field(event_class, NULL, "an_integer"), + ok(bt_event_class_add_field(event_class, NULL, "an_integer"), "Reject addition of a field with a NULL type to an event"); - ok(bt_ctf_event_class_add_field(event_class, uint_35_type, + ok(bt_event_class_add_field(event_class, uint_35_type, "int"), "Reject addition of a type with an illegal name to an event"); - ok(bt_ctf_event_class_add_field(event_class, uint_35_type, + ok(bt_event_class_add_field(event_class, uint_35_type, "uint_35") == 0, "Add field of type unsigned integer to an event"); - ok(bt_ctf_event_class_add_field(event_class, int_16_type, + ok(bt_event_class_add_field(event_class, int_16_type, "int_16") == 0, "Add field of type signed integer to an event"); - ok(bt_ctf_event_class_add_field(event_class, complex_structure_type, + ok(bt_event_class_add_field(event_class, complex_structure_type, "complex_structure") == 0, "Add composite structure to an event"); - ok(bt_ctf_event_class_get_name(NULL) == NULL, - "bt_ctf_event_class_get_name handles NULL correctly"); - ret_string = bt_ctf_event_class_get_name(event_class); + ok(bt_event_class_get_name(NULL) == NULL, + "bt_event_class_get_name handles NULL correctly"); + ret_string = bt_event_class_get_name(event_class); ok(!strcmp(ret_string, complex_test_event_string), - "bt_ctf_event_class_get_name returns a correct name"); - ok(bt_ctf_event_class_get_id(event_class) < 0, - "bt_ctf_event_class_get_id returns a negative value when not set"); - ok(bt_ctf_event_class_get_id(NULL) < 0, - "bt_ctf_event_class_get_id handles NULL correctly"); - ok(bt_ctf_event_class_set_id(NULL, 42) < 0, - "bt_ctf_event_class_set_id handles NULL correctly"); - ok(bt_ctf_event_class_set_id(event_class, 42) == 0, + "bt_event_class_get_name returns a correct name"); + ok(bt_event_class_get_id(event_class) < 0, + "bt_event_class_get_id returns a negative value when not set"); + ok(bt_event_class_get_id(NULL) < 0, + "bt_event_class_get_id handles NULL correctly"); + ok(bt_event_class_set_id(NULL, 42) < 0, + "bt_event_class_set_id handles NULL correctly"); + ok(bt_event_class_set_id(event_class, 42) == 0, "Set an event class' id"); - ok(bt_ctf_event_class_get_id(event_class) == 42, - "bt_ctf_event_class_get_id returns the correct value"); + ok(bt_event_class_get_id(event_class) == 42, + "bt_event_class_get_id returns the correct value"); /* Test event class attributes */ - ok(bt_ctf_event_class_get_log_level(event_class) == BT_CTF_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED, + ok(bt_event_class_get_log_level(event_class) == BT_EVENT_CLASS_LOG_LEVEL_UNSPECIFIED, "event class has the expected initial log level"); - ok(!bt_ctf_event_class_get_emf_uri(event_class), + ok(!bt_event_class_get_emf_uri(event_class), "as expected, event class has no initial EMF URI"); - ok(bt_ctf_event_class_set_log_level(NULL, BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO), - "bt_ctf_event_class_set_log_level handles a NULL event class correctly"); - ok(bt_ctf_event_class_set_log_level(event_class, BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN), - "bt_ctf_event_class_set_log_level handles an unknown log level correctly"); - ok(!bt_ctf_event_class_set_log_level(event_class, BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO), - "bt_ctf_event_class_set_log_level succeeds with a valid log level"); - ok(bt_ctf_event_class_get_log_level(NULL) == BT_CTF_EVENT_CLASS_LOG_LEVEL_UNKNOWN, - "bt_ctf_event_class_get_log_level handles a NULL event class correctly"); - ok(bt_ctf_event_class_get_log_level(event_class) == BT_CTF_EVENT_CLASS_LOG_LEVEL_INFO, - "bt_ctf_event_class_get_log_level returns the expected log level"); - ok(bt_ctf_event_class_set_emf_uri(NULL, "http://diamon.org/babeltrace/"), - "bt_ctf_event_class_set_emf_uri handles a NULL event class correctly"); - ok(!bt_ctf_event_class_set_emf_uri(event_class, "http://diamon.org/babeltrace/"), - "bt_ctf_event_class_set_emf_uri succeeds with a valid EMF URI"); - ok(!bt_ctf_event_class_get_emf_uri(NULL), - "bt_ctf_event_class_get_emf_uri handles a NULL event class correctly"); - ok(strcmp(bt_ctf_event_class_get_emf_uri(event_class), "http://diamon.org/babeltrace/") == 0, - "bt_ctf_event_class_get_emf_uri returns the expected EMF URI"); - ok(!bt_ctf_event_class_set_emf_uri(event_class, NULL), - "bt_ctf_event_class_set_emf_uri succeeds with NULL (to reset)"); - ok(!bt_ctf_event_class_get_emf_uri(event_class), + ok(bt_event_class_set_log_level(NULL, BT_EVENT_CLASS_LOG_LEVEL_INFO), + "bt_event_class_set_log_level handles a NULL event class correctly"); + ok(bt_event_class_set_log_level(event_class, BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN), + "bt_event_class_set_log_level handles an unknown log level correctly"); + ok(!bt_event_class_set_log_level(event_class, BT_EVENT_CLASS_LOG_LEVEL_INFO), + "bt_event_class_set_log_level succeeds with a valid log level"); + ok(bt_event_class_get_log_level(NULL) == BT_EVENT_CLASS_LOG_LEVEL_UNKNOWN, + "bt_event_class_get_log_level handles a NULL event class correctly"); + ok(bt_event_class_get_log_level(event_class) == BT_EVENT_CLASS_LOG_LEVEL_INFO, + "bt_event_class_get_log_level returns the expected log level"); + ok(bt_event_class_set_emf_uri(NULL, "http://diamon.org/babeltrace/"), + "bt_event_class_set_emf_uri handles a NULL event class correctly"); + ok(!bt_event_class_set_emf_uri(event_class, "http://diamon.org/babeltrace/"), + "bt_event_class_set_emf_uri succeeds with a valid EMF URI"); + ok(!bt_event_class_get_emf_uri(NULL), + "bt_event_class_get_emf_uri handles a NULL event class correctly"); + ok(strcmp(bt_event_class_get_emf_uri(event_class), "http://diamon.org/babeltrace/") == 0, + "bt_event_class_get_emf_uri returns the expected EMF URI"); + ok(!bt_event_class_set_emf_uri(event_class, NULL), + "bt_event_class_set_emf_uri succeeds with NULL (to reset)"); + ok(!bt_event_class_get_emf_uri(event_class), "as expected, event class has no EMF URI after reset"); /* Add event class to the stream class */ - ok(bt_ctf_stream_class_add_event_class(stream_class, NULL), + ok(bt_stream_class_add_event_class(stream_class, NULL), "Reject addition of NULL event class to a stream class"); - ok(bt_ctf_stream_class_add_event_class(stream_class, + ok(bt_stream_class_add_event_class(stream_class, event_class) == 0, "Add an event class to stream class"); - ok(bt_ctf_event_class_get_stream_class(NULL) == NULL, - "bt_ctf_event_class_get_stream_class handles NULL correctly"); - ret_stream_class = bt_ctf_event_class_get_stream_class(event_class); + ok(bt_event_class_get_stream_class(NULL) == NULL, + "bt_event_class_get_stream_class handles NULL correctly"); + ret_stream_class = bt_event_class_get_stream_class(event_class); ok(ret_stream_class == stream_class, - "bt_ctf_event_class_get_stream_class returns the correct stream class"); + "bt_event_class_get_stream_class returns the correct stream class"); bt_put(ret_stream_class); - ok(bt_ctf_event_class_get_payload_type_field_count(NULL) < 0, - "bt_ctf_event_class_get_field_count handles NULL correctly"); - ok(bt_ctf_event_class_get_payload_type_field_count(event_class) == 3, - "bt_ctf_event_class_get_field_count returns a correct value"); + ok(bt_event_class_get_payload_type_field_count(NULL) < 0, + "bt_event_class_get_field_count handles NULL correctly"); + ok(bt_event_class_get_payload_type_field_count(event_class) == 3, + "bt_event_class_get_field_count returns a correct value"); - ok(bt_ctf_event_class_get_payload_type_field_by_index(NULL, &ret_string, + ok(bt_event_class_get_payload_type_field_by_index(NULL, &ret_string, &ret_field_type, 0) < 0, - "bt_ctf_event_class_get_field handles a NULL event class correctly"); - ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, NULL, + "bt_event_class_get_field handles a NULL event class correctly"); + ok(bt_event_class_get_payload_type_field_by_index(event_class, NULL, &ret_field_type, 0) == 0, - "bt_ctf_event_class_get_field handles a NULL field name correctly"); + "bt_event_class_get_field handles a NULL field name correctly"); bt_put(ret_field_type); - ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string, + ok(bt_event_class_get_payload_type_field_by_index(event_class, &ret_string, NULL, 0) == 0, - "bt_ctf_event_class_get_field handles a NULL field type correctly"); - ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string, + "bt_event_class_get_field handles a NULL field type correctly"); + ok(bt_event_class_get_payload_type_field_by_index(event_class, &ret_string, &ret_field_type, 42) < 0, - "bt_ctf_event_class_get_field handles an invalid index correctly"); - ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string, + "bt_event_class_get_field handles an invalid index correctly"); + ok(bt_event_class_get_payload_type_field_by_index(event_class, &ret_string, &ret_field_type, 0) == 0, - "bt_ctf_event_class_get_field returns a field"); - ok(bt_ctf_field_type_compare(ret_field_type, uint_35_type) == 0, - "bt_ctf_event_class_get_field returns a correct field type"); + "bt_event_class_get_field returns a field"); + ok(bt_field_type_compare(ret_field_type, uint_35_type) == 0, + "bt_event_class_get_field returns a correct field type"); bt_put(ret_field_type); ok(!strcmp(ret_string, "uint_35"), - "bt_ctf_event_class_get_field returns a correct field name"); + "bt_event_class_get_field returns a correct field name"); ok(bt_ctf_event_class_get_field_by_name(NULL, "") == NULL, - "bt_ctf_event_class_get_field_by_name handles a NULL event class correctly"); + "bt_event_class_get_field_by_name handles a NULL event class correctly"); ok(bt_ctf_event_class_get_field_by_name(event_class, NULL) == NULL, - "bt_ctf_event_class_get_field_by_name handles a NULL field name correctly"); + "bt_event_class_get_field_by_name handles a NULL field name correctly"); ok(bt_ctf_event_class_get_field_by_name(event_class, "truie") == NULL, - "bt_ctf_event_class_get_field_by_name handles an invalid field name correctly"); + "bt_event_class_get_field_by_name handles an invalid field name correctly"); ret_field_type = bt_ctf_event_class_get_field_by_name(event_class, "complex_structure"); - ok(bt_ctf_field_type_compare(ret_field_type, complex_structure_type) == 0, - "bt_ctf_event_class_get_field_by_name returns a correct field type"); + ok(bt_field_type_compare(ret_field_type, complex_structure_type) == 0, + "bt_event_class_get_field_by_name returns a correct field type"); bt_put(ret_field_type); - event = bt_ctf_event_create(event_class); + event = bt_event_create(event_class); ok(event, "Instanciate a complex event"); - ok(bt_ctf_event_get_class(NULL) == NULL, - "bt_ctf_event_get_class handles NULL correctly"); - ret_event_class = bt_ctf_event_get_class(event); + ok(bt_event_get_class(NULL) == NULL, + "bt_event_get_class handles NULL correctly"); + ret_event_class = bt_event_get_class(event); ok(ret_event_class == event_class, - "bt_ctf_event_get_class returns the correct event class"); + "bt_event_get_class returns the correct event class"); bt_put(ret_event_class); - uint_35_field = bt_ctf_event_get_payload(event, "uint_35"); + uint_35_field = bt_event_get_payload(event, "uint_35"); if (!uint_35_field) { printf("uint_35_field is NULL\n"); } - ok(uint_35_field, "Use bt_ctf_event_get_payload to get a field instance "); - bt_ctf_field_unsigned_integer_set_value(uint_35_field, 0x0DDF00D); - ok(bt_ctf_field_unsigned_integer_get_value(NULL, &ret_unsigned_int) < 0, - "bt_ctf_field_unsigned_integer_get_value properly properly handles a NULL field."); - ok(bt_ctf_field_unsigned_integer_get_value(uint_35_field, NULL) < 0, - "bt_ctf_field_unsigned_integer_get_value properly handles a NULL return value"); - ok(bt_ctf_field_unsigned_integer_get_value(uint_35_field, + ok(uint_35_field, "Use bt_event_get_payload to get a field instance "); + bt_field_unsigned_integer_set_value(uint_35_field, 0x0DDF00D); + ok(bt_field_unsigned_integer_get_value(NULL, &ret_unsigned_int) < 0, + "bt_field_unsigned_integer_get_value properly properly handles a NULL field."); + ok(bt_field_unsigned_integer_get_value(uint_35_field, NULL) < 0, + "bt_field_unsigned_integer_get_value properly handles a NULL return value"); + ok(bt_field_unsigned_integer_get_value(uint_35_field, &ret_unsigned_int) == 0, - "bt_ctf_field_unsigned_integer_get_value succeeds after setting a value"); + "bt_field_unsigned_integer_get_value succeeds after setting a value"); ok(ret_unsigned_int == 0x0DDF00D, - "bt_ctf_field_unsigned_integer_get_value returns the correct value"); - ok(bt_ctf_field_signed_integer_get_value(uint_35_field, + "bt_field_unsigned_integer_get_value returns the correct value"); + ok(bt_field_signed_integer_get_value(uint_35_field, &ret_signed_int) < 0, - "bt_ctf_field_signed_integer_get_value fails on an unsigned field"); + "bt_field_signed_integer_get_value fails on an unsigned field"); bt_put(uint_35_field); - int_16_field = bt_ctf_event_get_payload(event, "int_16"); - bt_ctf_field_signed_integer_set_value(int_16_field, -12345); - ok(bt_ctf_field_signed_integer_get_value(NULL, &ret_signed_int) < 0, - "bt_ctf_field_signed_integer_get_value properly handles a NULL field"); - ok(bt_ctf_field_signed_integer_get_value(int_16_field, NULL) < 0, - "bt_ctf_field_signed_integer_get_value properly handles a NULL return value"); - ok(bt_ctf_field_signed_integer_get_value(int_16_field, + int_16_field = bt_event_get_payload(event, "int_16"); + bt_field_signed_integer_set_value(int_16_field, -12345); + ok(bt_field_signed_integer_get_value(NULL, &ret_signed_int) < 0, + "bt_field_signed_integer_get_value properly handles a NULL field"); + ok(bt_field_signed_integer_get_value(int_16_field, NULL) < 0, + "bt_field_signed_integer_get_value properly handles a NULL return value"); + ok(bt_field_signed_integer_get_value(int_16_field, &ret_signed_int) == 0, - "bt_ctf_field_signed_integer_get_value succeeds after setting a value"); + "bt_field_signed_integer_get_value succeeds after setting a value"); ok(ret_signed_int == -12345, - "bt_ctf_field_signed_integer_get_value returns the correct value"); - ok(bt_ctf_field_unsigned_integer_get_value(int_16_field, + "bt_field_signed_integer_get_value returns the correct value"); + ok(bt_field_unsigned_integer_get_value(int_16_field, &ret_unsigned_int) < 0, - "bt_ctf_field_unsigned_integer_get_value fails on a signed field"); + "bt_field_unsigned_integer_get_value fails on a signed field"); bt_put(int_16_field); - complex_structure_field = bt_ctf_event_get_payload(event, + complex_structure_field = bt_event_get_payload(event, "complex_structure"); - ok(bt_ctf_field_structure_get_field_by_index(NULL, 0) == NULL, - "bt_ctf_field_structure_get_field_by_index handles NULL correctly"); - ok(bt_ctf_field_structure_get_field_by_index(NULL, 9) == NULL, - "bt_ctf_field_structure_get_field_by_index handles an invalid index correctly"); - inner_structure_field = bt_ctf_field_structure_get_field_by_index( + ok(bt_field_structure_get_field_by_index(NULL, 0) == NULL, + "bt_field_structure_get_field_by_index handles NULL correctly"); + ok(bt_field_structure_get_field_by_index(NULL, 9) == NULL, + "bt_field_structure_get_field_by_index handles an invalid index correctly"); + inner_structure_field = bt_field_structure_get_field_by_index( complex_structure_field, 3); - ret_field_type = bt_ctf_field_get_type(inner_structure_field); + ret_field_type = bt_field_get_type(inner_structure_field); bt_put(inner_structure_field); - ok(bt_ctf_field_type_compare(ret_field_type, inner_structure_type) == 0, - "bt_ctf_field_structure_get_field_by_index returns a correct field"); + ok(bt_field_type_compare(ret_field_type, inner_structure_type) == 0, + "bt_field_structure_get_field_by_index returns a correct field"); bt_put(ret_field_type); - inner_structure_field = bt_ctf_field_structure_get_field( + inner_structure_field = bt_field_structure_get_field_by_name( complex_structure_field, "inner_structure"); - a_string_field = bt_ctf_field_structure_get_field( + a_string_field = bt_field_structure_get_field_by_name( complex_structure_field, "string"); - enum_variant_field = bt_ctf_field_structure_get_field( + enum_variant_field = bt_field_structure_get_field_by_name( complex_structure_field, "variant_selector"); - variant_field = bt_ctf_field_structure_get_field( + variant_field = bt_field_structure_get_field_by_name( complex_structure_field, "variant_value"); - uint_35_field = bt_ctf_field_structure_get_field( + uint_35_field = bt_field_structure_get_field_by_name( inner_structure_field, "seq_len"); - a_sequence_field = bt_ctf_field_structure_get_field( + a_sequence_field = bt_field_structure_get_field_by_name( inner_structure_field, "a_sequence"); - an_array_field = bt_ctf_field_structure_get_field( + an_array_field = bt_field_structure_get_field_by_name( inner_structure_field, "an_array"); - enum_container_field = bt_ctf_field_enumeration_get_container( + enum_container_field = bt_field_enumeration_get_container( enum_variant_field); - bt_ctf_field_unsigned_integer_set_value(enum_container_field, 1); - int_16_field = bt_ctf_field_variant_get_field(variant_field, + bt_field_unsigned_integer_set_value(enum_container_field, 1); + int_16_field = bt_field_variant_get_field(variant_field, enum_variant_field); - bt_ctf_field_signed_integer_set_value(int_16_field, -200); + bt_field_signed_integer_set_value(int_16_field, -200); bt_put(int_16_field); - ok(!bt_ctf_field_string_get_value(a_string_field), - "bt_ctf_field_string_get_value returns NULL on an unset field"); - bt_ctf_field_string_set_value(a_string_field, + ok(!bt_field_string_get_value(a_string_field), + "bt_field_string_get_value returns NULL on an unset field"); + bt_field_string_set_value(a_string_field, test_string_1); - ok(!bt_ctf_field_string_get_value(NULL), - "bt_ctf_field_string_get_value correctly handles NULL"); - ok(bt_ctf_field_string_append(NULL, "yeah"), - "bt_ctf_field_string_append correctly handles a NULL string field"); - ok(bt_ctf_field_string_append(a_string_field, NULL), - "bt_ctf_field_string_append correctly handles a NULL string value"); - ok(!bt_ctf_field_string_append(a_string_field, test_string_2), - "bt_ctf_field_string_append succeeds"); - ok(bt_ctf_field_string_append_len(NULL, "oh noes", 3), - "bt_ctf_field_string_append_len correctly handles a NULL string field"); - ok(bt_ctf_field_string_append_len(a_string_field, NULL, 3), - "bt_ctf_field_string_append_len correctly handles a NULL string value"); - ok(!bt_ctf_field_string_append_len(a_string_field, test_string_3, 5), - "bt_ctf_field_string_append_len succeeds (append 5 characters)"); - ok(!bt_ctf_field_string_append_len(a_string_field, test_string_4, 10), - "bt_ctf_field_string_append_len succeeds (append 4 characters)"); - ok(!bt_ctf_field_string_append_len(a_string_field, &test_string_4[4], 3), - "bt_ctf_field_string_append_len succeeds (append 0 characters)"); - ok(!bt_ctf_field_string_append_len(a_string_field, test_string_3, 0), - "bt_ctf_field_string_append_len succeeds (append 0 characters)"); - - ret_string = bt_ctf_field_string_get_value(a_string_field); - ok(ret_string, "bt_ctf_field_string_get_value returns a string"); + ok(!bt_field_string_get_value(NULL), + "bt_field_string_get_value correctly handles NULL"); + ok(bt_field_string_append(NULL, "yeah"), + "bt_field_string_append correctly handles a NULL string field"); + ok(bt_field_string_append(a_string_field, NULL), + "bt_field_string_append correctly handles a NULL string value"); + ok(!bt_field_string_append(a_string_field, test_string_2), + "bt_field_string_append succeeds"); + ok(bt_field_string_append_len(NULL, "oh noes", 3), + "bt_field_string_append_len correctly handles a NULL string field"); + ok(bt_field_string_append_len(a_string_field, NULL, 3), + "bt_field_string_append_len correctly handles a NULL string value"); + ok(!bt_field_string_append_len(a_string_field, test_string_3, 5), + "bt_field_string_append_len succeeds (append 5 characters)"); + ok(!bt_field_string_append_len(a_string_field, test_string_4, 10), + "bt_field_string_append_len succeeds (append 4 characters)"); + ok(!bt_field_string_append_len(a_string_field, &test_string_4[4], 3), + "bt_field_string_append_len succeeds (append 0 characters)"); + ok(!bt_field_string_append_len(a_string_field, test_string_3, 0), + "bt_field_string_append_len succeeds (append 0 characters)"); + + ret_string = bt_field_string_get_value(a_string_field); + ok(ret_string, "bt_field_string_get_value returns a string"); ok(ret_string ? !strcmp(ret_string, test_string_cat) : 0, - "bt_ctf_field_string_get_value returns a correct value"); - bt_ctf_field_unsigned_integer_set_value(uint_35_field, + "bt_field_string_get_value returns a correct value"); + bt_field_unsigned_integer_set_value(uint_35_field, SEQUENCE_TEST_LENGTH); - ok(bt_ctf_field_type_variant_get_field_type_from_tag(NULL, + ok(bt_field_type_variant_get_field_type_from_tag(NULL, enum_container_field) == NULL, - "bt_ctf_field_type_variant_get_field_type_from_tag handles a NULL variant type correctly"); - ok(bt_ctf_field_type_variant_get_field_type_from_tag(variant_type, + "bt_field_type_variant_get_field_type_from_tag handles a NULL variant type correctly"); + ok(bt_field_type_variant_get_field_type_from_tag(variant_type, NULL) == NULL, - "bt_ctf_field_type_variant_get_field_type_from_tag handles a NULL tag correctly"); - ret_field_type = bt_ctf_field_type_variant_get_field_type_from_tag( + "bt_field_type_variant_get_field_type_from_tag handles a NULL tag correctly"); + ret_field_type = bt_field_type_variant_get_field_type_from_tag( variant_type, enum_variant_field); ok(ret_field_type == int_16_type, - "bt_ctf_field_type_variant_get_field_type_from_tag returns the correct field type"); + "bt_field_type_variant_get_field_type_from_tag returns the correct field type"); - ok(bt_ctf_field_sequence_get_length(a_sequence_field) == NULL, - "bt_ctf_field_sequence_get_length returns NULL when length is unset"); - ok(bt_ctf_field_sequence_set_length(a_sequence_field, + ok(bt_field_sequence_get_length(a_sequence_field) == NULL, + "bt_field_sequence_get_length returns NULL when length is unset"); + ok(bt_field_sequence_set_length(a_sequence_field, uint_35_field) == 0, "Set a sequence field's length"); - ret_field = bt_ctf_field_sequence_get_length(a_sequence_field); + ret_field = bt_field_sequence_get_length(a_sequence_field); ok(ret_field == uint_35_field, - "bt_ctf_field_sequence_get_length returns the correct length field"); - ok(bt_ctf_field_sequence_get_length(NULL) == NULL, - "bt_ctf_field_sequence_get_length properly handles NULL"); + "bt_field_sequence_get_length returns the correct length field"); + ok(bt_field_sequence_get_length(NULL) == NULL, + "bt_field_sequence_get_length properly handles NULL"); for (i = 0; i < SEQUENCE_TEST_LENGTH; i++) { - int_16_field = bt_ctf_field_sequence_get_field( + int_16_field = bt_field_sequence_get_field( a_sequence_field, i); - bt_ctf_field_signed_integer_set_value(int_16_field, 4 - i); + bt_field_signed_integer_set_value(int_16_field, 4 - i); bt_put(int_16_field); } for (i = 0; i < ARRAY_TEST_LENGTH; i++) { - int_16_field = bt_ctf_field_array_get_field( + int_16_field = bt_field_array_get_field( an_array_field, i); - bt_ctf_field_signed_integer_set_value(int_16_field, i); + bt_field_signed_integer_set_value(int_16_field, i); bt_put(int_16_field); } - stream_event_ctx_field = bt_ctf_event_get_stream_event_context(event); + stream_event_ctx_field = bt_event_get_stream_event_context(event); assert(stream_event_ctx_field); - stream_event_ctx_int_field = bt_ctf_field_structure_get_field( + stream_event_ctx_int_field = bt_field_structure_get_field_by_name( stream_event_ctx_field, "common_event_context"); BT_PUT(stream_event_ctx_field); - bt_ctf_field_unsigned_integer_set_value(stream_event_ctx_int_field, 17); + bt_field_unsigned_integer_set_value(stream_event_ctx_int_field, 17); BT_PUT(stream_event_ctx_int_field); bt_ctf_clock_set_time(clock, ++current_time); - ok(bt_ctf_stream_append_event(stream, event) == 0, + ok(bt_stream_append_event(stream, event) == 0, "Append a complex event to a stream"); /* * Populate the custom packet context field with a dummy value * otherwise flush will fail. */ - packet_context = bt_ctf_stream_get_packet_context(stream); - packet_context_field = bt_ctf_field_structure_get_field(packet_context, + packet_context = bt_stream_get_packet_context(stream); + packet_context_field = bt_field_structure_get_field_by_name(packet_context, "custom_packet_context_field"); - bt_ctf_field_unsigned_integer_set_value(packet_context_field, 1); + bt_field_unsigned_integer_set_value(packet_context_field, 1); - ok(bt_ctf_stream_flush(stream) == 0, + ok(bt_stream_flush(stream) == 0, "Flush a stream containing a complex event"); bt_put(uint_35_field); @@ -1071,107 +1071,107 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class, } static -void field_copy_tests_validate_same_type(struct bt_ctf_field *field, - struct bt_ctf_field_type *expected_type, const char *name) +void field_copy_tests_validate_same_type(struct bt_field *field, + struct bt_field_type *expected_type, const char *name) { - struct bt_ctf_field_type *copy_type; + struct bt_field_type *copy_type; - copy_type = bt_ctf_field_get_type(field); + copy_type = bt_field_get_type(field); ok(copy_type == expected_type, - "bt_ctf_field_copy does not copy the type (%s)", name); + "bt_field_copy does not copy the type (%s)", name); bt_put(copy_type); } static -void field_copy_tests_validate_diff_ptrs(struct bt_ctf_field *field_a, - struct bt_ctf_field *field_b, const char *name) +void field_copy_tests_validate_diff_ptrs(struct bt_field *field_a, + struct bt_field *field_b, const char *name) { ok(field_a != field_b, - "bt_ctf_field_copy creates different pointers (%s)", name); + "bt_field_copy creates different pointers (%s)", name); } static void field_copy_tests() { - struct bt_ctf_field_type *len_type = NULL; - struct bt_ctf_field_type *fp_type = NULL; - struct bt_ctf_field_type *s_type = NULL; - struct bt_ctf_field_type *e_int_type = NULL; - struct bt_ctf_field_type *e_type = NULL; - struct bt_ctf_field_type *v_type = NULL; - struct bt_ctf_field_type *v_label1_type = NULL; - struct bt_ctf_field_type *v_label1_array_type = NULL; - struct bt_ctf_field_type *v_label2_type = NULL; - struct bt_ctf_field_type *v_label2_seq_type = NULL; - struct bt_ctf_field_type *strct_type = NULL; - struct bt_ctf_field *len = NULL; - struct bt_ctf_field *fp = NULL; - struct bt_ctf_field *s = NULL; - struct bt_ctf_field *e_int = NULL; - struct bt_ctf_field *e = NULL; - struct bt_ctf_field *v = NULL; - struct bt_ctf_field *v_selected = NULL; - struct bt_ctf_field *v_selected_cur = NULL; - struct bt_ctf_field *v_selected_0 = NULL; - struct bt_ctf_field *v_selected_1 = NULL; - struct bt_ctf_field *v_selected_2 = NULL; - struct bt_ctf_field *v_selected_3 = NULL; - struct bt_ctf_field *v_selected_4 = NULL; - struct bt_ctf_field *v_selected_5 = NULL; - struct bt_ctf_field *v_selected_6 = NULL; - struct bt_ctf_field *a = NULL; - struct bt_ctf_field *a_0 = NULL; - struct bt_ctf_field *a_1 = NULL; - struct bt_ctf_field *a_2 = NULL; - struct bt_ctf_field *a_3 = NULL; - struct bt_ctf_field *a_4 = NULL; - struct bt_ctf_field *strct = NULL; - struct bt_ctf_field *len_copy = NULL; - struct bt_ctf_field *fp_copy = NULL; - struct bt_ctf_field *s_copy = NULL; - struct bt_ctf_field *e_int_copy = NULL; - struct bt_ctf_field *e_copy = NULL; - struct bt_ctf_field *v_copy = NULL; - struct bt_ctf_field *v_selected_copy = NULL; - struct bt_ctf_field *v_selected_copy_len = NULL; - struct bt_ctf_field *v_selected_0_copy = NULL; - struct bt_ctf_field *v_selected_1_copy = NULL; - struct bt_ctf_field *v_selected_2_copy = NULL; - struct bt_ctf_field *v_selected_3_copy = NULL; - struct bt_ctf_field *v_selected_4_copy = NULL; - struct bt_ctf_field *v_selected_5_copy = NULL; - struct bt_ctf_field *v_selected_6_copy = NULL; - struct bt_ctf_field *a_copy = NULL; - struct bt_ctf_field *a_0_copy = NULL; - struct bt_ctf_field *a_1_copy = NULL; - struct bt_ctf_field *a_2_copy = NULL; - struct bt_ctf_field *a_3_copy = NULL; - struct bt_ctf_field *a_4_copy = NULL; - struct bt_ctf_field *strct_copy = NULL; - struct bt_ctf_field_type_enumeration_mapping_iterator *e_iter = NULL; + struct bt_field_type *len_type = NULL; + struct bt_field_type *fp_type = NULL; + struct bt_field_type *s_type = NULL; + struct bt_field_type *e_int_type = NULL; + struct bt_field_type *e_type = NULL; + struct bt_field_type *v_type = NULL; + struct bt_field_type *v_label1_type = NULL; + struct bt_field_type *v_label1_array_type = NULL; + struct bt_field_type *v_label2_type = NULL; + struct bt_field_type *v_label2_seq_type = NULL; + struct bt_field_type *strct_type = NULL; + struct bt_field *len = NULL; + struct bt_field *fp = NULL; + struct bt_field *s = NULL; + struct bt_field *e_int = NULL; + struct bt_field *e = NULL; + struct bt_field *v = NULL; + struct bt_field *v_selected = NULL; + struct bt_field *v_selected_cur = NULL; + struct bt_field *v_selected_0 = NULL; + struct bt_field *v_selected_1 = NULL; + struct bt_field *v_selected_2 = NULL; + struct bt_field *v_selected_3 = NULL; + struct bt_field *v_selected_4 = NULL; + struct bt_field *v_selected_5 = NULL; + struct bt_field *v_selected_6 = NULL; + struct bt_field *a = NULL; + struct bt_field *a_0 = NULL; + struct bt_field *a_1 = NULL; + struct bt_field *a_2 = NULL; + struct bt_field *a_3 = NULL; + struct bt_field *a_4 = NULL; + struct bt_field *strct = NULL; + struct bt_field *len_copy = NULL; + struct bt_field *fp_copy = NULL; + struct bt_field *s_copy = NULL; + struct bt_field *e_int_copy = NULL; + struct bt_field *e_copy = NULL; + struct bt_field *v_copy = NULL; + struct bt_field *v_selected_copy = NULL; + struct bt_field *v_selected_copy_len = NULL; + struct bt_field *v_selected_0_copy = NULL; + struct bt_field *v_selected_1_copy = NULL; + struct bt_field *v_selected_2_copy = NULL; + struct bt_field *v_selected_3_copy = NULL; + struct bt_field *v_selected_4_copy = NULL; + struct bt_field *v_selected_5_copy = NULL; + struct bt_field *v_selected_6_copy = NULL; + struct bt_field *a_copy = NULL; + struct bt_field *a_0_copy = NULL; + struct bt_field *a_1_copy = NULL; + struct bt_field *a_2_copy = NULL; + struct bt_field *a_3_copy = NULL; + struct bt_field *a_4_copy = NULL; + struct bt_field *strct_copy = NULL; + struct bt_field_type_enumeration_mapping_iterator *e_iter = NULL; uint64_t uint64_t_val; const char *str_val; double double_val; int ret; /* create len type */ - len_type = bt_ctf_field_type_integer_create(32); + len_type = bt_field_type_integer_create(32); assert(len_type); /* create fp type */ - fp_type = bt_ctf_field_type_floating_point_create(); + fp_type = bt_field_type_floating_point_create(); assert(fp_type); /* create s type */ - s_type = bt_ctf_field_type_string_create(); + s_type = bt_field_type_string_create(); assert(s_type); /* create e_int type */ - e_int_type = bt_ctf_field_type_integer_create(8); + e_int_type = bt_field_type_integer_create(8); assert(e_int_type); /* create e type */ - e_type = bt_ctf_field_type_enumeration_create(e_int_type); + e_type = bt_field_type_enumeration_create(e_int_type); assert(e_type); ret = bt_ctf_field_type_enumeration_add_mapping(e_type, "LABEL1", 10, 15); @@ -1181,213 +1181,213 @@ void field_copy_tests() assert(!ret); /* create v_label1 type */ - v_label1_type = bt_ctf_field_type_string_create(); + v_label1_type = bt_field_type_string_create(); assert(v_label1_type); /* create v_label1_array type */ - v_label1_array_type = bt_ctf_field_type_array_create(v_label1_type, 5); + v_label1_array_type = bt_field_type_array_create(v_label1_type, 5); assert(v_label1_array_type); /* create v_label2 type */ - v_label2_type = bt_ctf_field_type_integer_create(16); + v_label2_type = bt_field_type_integer_create(16); assert(v_label2_type); /* create v_label2_seq type */ - v_label2_seq_type = bt_ctf_field_type_sequence_create(v_label2_type, + v_label2_seq_type = bt_field_type_sequence_create(v_label2_type, "len"); assert(v_label2_seq_type); /* create v type */ - v_type = bt_ctf_field_type_variant_create(e_type, "e"); + v_type = bt_field_type_variant_create(e_type, "e"); assert(v_type); - ret = bt_ctf_field_type_variant_add_field(v_type, v_label1_array_type, + ret = bt_field_type_variant_add_field(v_type, v_label1_array_type, "LABEL1"); assert(!ret); - ret = bt_ctf_field_type_variant_add_field(v_type, v_label2_seq_type, + ret = bt_field_type_variant_add_field(v_type, v_label2_seq_type, "LABEL2"); assert(!ret); /* create strct type */ - strct_type = bt_ctf_field_type_structure_create(); + strct_type = bt_field_type_structure_create(); assert(strct_type); - ret = bt_ctf_field_type_structure_add_field(strct_type, len_type, + ret = bt_field_type_structure_add_field(strct_type, len_type, "len"); assert(!ret); - ret = bt_ctf_field_type_structure_add_field(strct_type, fp_type, "fp"); + ret = bt_field_type_structure_add_field(strct_type, fp_type, "fp"); assert(!ret); - ret = bt_ctf_field_type_structure_add_field(strct_type, s_type, "s"); + ret = bt_field_type_structure_add_field(strct_type, s_type, "s"); assert(!ret); - ret = bt_ctf_field_type_structure_add_field(strct_type, e_type, "e"); + ret = bt_field_type_structure_add_field(strct_type, e_type, "e"); assert(!ret); - ret = bt_ctf_field_type_structure_add_field(strct_type, v_type, "v"); + ret = bt_field_type_structure_add_field(strct_type, v_type, "v"); assert(!ret); - ret = bt_ctf_field_type_structure_add_field(strct_type, + ret = bt_field_type_structure_add_field(strct_type, v_label1_array_type, "a"); assert(!ret); /* create strct */ - strct = bt_ctf_field_create(strct_type); + strct = bt_field_create(strct_type); assert(strct); /* get len field */ - len = bt_ctf_field_structure_get_field(strct, "len"); + len = bt_field_structure_get_field_by_name(strct, "len"); assert(len); /* get fp field */ - fp = bt_ctf_field_structure_get_field(strct, "fp"); + fp = bt_field_structure_get_field_by_name(strct, "fp"); assert(fp); /* get s field */ - s = bt_ctf_field_structure_get_field(strct, "s"); + s = bt_field_structure_get_field_by_name(strct, "s"); assert(s); /* get e field */ - e = bt_ctf_field_structure_get_field(strct, "e"); + e = bt_field_structure_get_field_by_name(strct, "e"); assert(e); /* get e_int (underlying integer) */ - e_int = bt_ctf_field_enumeration_get_container(e); + e_int = bt_field_enumeration_get_container(e); assert(e_int); /* get v field */ - v = bt_ctf_field_structure_get_field(strct, "v"); + v = bt_field_structure_get_field_by_name(strct, "v"); assert(v); /* get a field */ - a = bt_ctf_field_structure_get_field(strct, "a"); + a = bt_field_structure_get_field_by_name(strct, "a"); assert(a); /* set len field */ - ret = bt_ctf_field_unsigned_integer_set_value(len, 7); + ret = bt_field_unsigned_integer_set_value(len, 7); assert(!ret); /* set fp field */ - ret = bt_ctf_field_floating_point_set_value(fp, 3.14); + ret = bt_field_floating_point_set_value(fp, 3.14); assert(!ret); /* set s field */ - ret = bt_ctf_field_string_set_value(s, "btbt"); + ret = bt_field_string_set_value(s, "btbt"); assert(!ret); /* set e field (LABEL2) */ - ret = bt_ctf_field_unsigned_integer_set_value(e_int, 23); + ret = bt_field_unsigned_integer_set_value(e_int, 23); assert(!ret); /* set v field */ - v_selected = bt_ctf_field_variant_get_field(v, e); + v_selected = bt_field_variant_get_field(v, e); assert(v_selected); - ok(!bt_ctf_field_variant_get_current_field(NULL), - "bt_ctf_field_variant_get_current_field handles NULL correctly"); - v_selected_cur = bt_ctf_field_variant_get_current_field(v); + ok(!bt_field_variant_get_current_field(NULL), + "bt_field_variant_get_current_field handles NULL correctly"); + v_selected_cur = bt_field_variant_get_current_field(v); ok(v_selected_cur == v_selected, - "bt_ctf_field_variant_get_current_field returns the current field"); + "bt_field_variant_get_current_field returns the current field"); bt_put(v_selected_cur); /* set selected v field */ - ret = bt_ctf_field_sequence_set_length(v_selected, len); + ret = bt_field_sequence_set_length(v_selected, len); assert(!ret); - v_selected_0 = bt_ctf_field_sequence_get_field(v_selected, 0); + v_selected_0 = bt_field_sequence_get_field(v_selected, 0); assert(v_selected_0); - ret = bt_ctf_field_unsigned_integer_set_value(v_selected_0, 7); + ret = bt_field_unsigned_integer_set_value(v_selected_0, 7); assert(!ret); - v_selected_1 = bt_ctf_field_sequence_get_field(v_selected, 1); + v_selected_1 = bt_field_sequence_get_field(v_selected, 1); assert(v_selected_1); - ret = bt_ctf_field_unsigned_integer_set_value(v_selected_1, 6); + ret = bt_field_unsigned_integer_set_value(v_selected_1, 6); assert(!ret); - v_selected_2 = bt_ctf_field_sequence_get_field(v_selected, 2); + v_selected_2 = bt_field_sequence_get_field(v_selected, 2); assert(v_selected_2); - ret = bt_ctf_field_unsigned_integer_set_value(v_selected_2, 5); + ret = bt_field_unsigned_integer_set_value(v_selected_2, 5); assert(!ret); - v_selected_3 = bt_ctf_field_sequence_get_field(v_selected, 3); + v_selected_3 = bt_field_sequence_get_field(v_selected, 3); assert(v_selected_3); - ret = bt_ctf_field_unsigned_integer_set_value(v_selected_3, 4); + ret = bt_field_unsigned_integer_set_value(v_selected_3, 4); assert(!ret); - v_selected_4 = bt_ctf_field_sequence_get_field(v_selected, 4); + v_selected_4 = bt_field_sequence_get_field(v_selected, 4); assert(v_selected_4); - ret = bt_ctf_field_unsigned_integer_set_value(v_selected_4, 3); + ret = bt_field_unsigned_integer_set_value(v_selected_4, 3); assert(!ret); - v_selected_5 = bt_ctf_field_sequence_get_field(v_selected, 5); + v_selected_5 = bt_field_sequence_get_field(v_selected, 5); assert(v_selected_5); - ret = bt_ctf_field_unsigned_integer_set_value(v_selected_5, 2); + ret = bt_field_unsigned_integer_set_value(v_selected_5, 2); assert(!ret); - v_selected_6 = bt_ctf_field_sequence_get_field(v_selected, 6); + v_selected_6 = bt_field_sequence_get_field(v_selected, 6); assert(v_selected_6); - ret = bt_ctf_field_unsigned_integer_set_value(v_selected_6, 1); + ret = bt_field_unsigned_integer_set_value(v_selected_6, 1); assert(!ret); /* set a field */ - a_0 = bt_ctf_field_array_get_field(a, 0); + a_0 = bt_field_array_get_field(a, 0); assert(a_0); - ret = bt_ctf_field_string_set_value(a_0, "a_0"); + ret = bt_field_string_set_value(a_0, "a_0"); assert(!ret); - a_1 = bt_ctf_field_array_get_field(a, 1); + a_1 = bt_field_array_get_field(a, 1); assert(a_1); - ret = bt_ctf_field_string_set_value(a_1, "a_1"); + ret = bt_field_string_set_value(a_1, "a_1"); assert(!ret); - a_2 = bt_ctf_field_array_get_field(a, 2); + a_2 = bt_field_array_get_field(a, 2); assert(a_2); - ret = bt_ctf_field_string_set_value(a_2, "a_2"); + ret = bt_field_string_set_value(a_2, "a_2"); assert(!ret); - a_3 = bt_ctf_field_array_get_field(a, 3); + a_3 = bt_field_array_get_field(a, 3); assert(a_3); - ret = bt_ctf_field_string_set_value(a_3, "a_3"); + ret = bt_field_string_set_value(a_3, "a_3"); assert(!ret); - a_4 = bt_ctf_field_array_get_field(a, 4); + a_4 = bt_field_array_get_field(a, 4); assert(a_4); - ret = bt_ctf_field_string_set_value(a_4, "a_4"); + ret = bt_field_string_set_value(a_4, "a_4"); assert(!ret); /* create copy of strct */ - ok(!bt_ctf_field_copy(NULL), - "bt_ctf_field_copy handles NULL correctly"); - strct_copy = bt_ctf_field_copy(strct); + ok(!bt_field_copy(NULL), + "bt_field_copy handles NULL correctly"); + strct_copy = bt_field_copy(strct); ok(strct_copy, - "bt_ctf_field_copy returns a valid pointer"); + "bt_field_copy returns a valid pointer"); /* get all copied fields */ - len_copy = bt_ctf_field_structure_get_field(strct_copy, "len"); + len_copy = bt_field_structure_get_field_by_name(strct_copy, "len"); assert(len_copy); - fp_copy = bt_ctf_field_structure_get_field(strct_copy, "fp"); + fp_copy = bt_field_structure_get_field_by_name(strct_copy, "fp"); assert(fp_copy); - s_copy = bt_ctf_field_structure_get_field(strct_copy, "s"); + s_copy = bt_field_structure_get_field_by_name(strct_copy, "s"); assert(s_copy); - e_copy = bt_ctf_field_structure_get_field(strct_copy, "e"); + e_copy = bt_field_structure_get_field_by_name(strct_copy, "e"); assert(e_copy); - e_int_copy = bt_ctf_field_enumeration_get_container(e_copy); + e_int_copy = bt_field_enumeration_get_container(e_copy); assert(e_int_copy); - v_copy = bt_ctf_field_structure_get_field(strct_copy, "v"); + v_copy = bt_field_structure_get_field_by_name(strct_copy, "v"); assert(v_copy); - v_selected_copy = bt_ctf_field_variant_get_field(v_copy, e_copy); + v_selected_copy = bt_field_variant_get_field(v_copy, e_copy); assert(v_selected_copy); - v_selected_0_copy = bt_ctf_field_sequence_get_field(v_selected_copy, 0); + v_selected_0_copy = bt_field_sequence_get_field(v_selected_copy, 0); assert(v_selected_0_copy); - v_selected_1_copy = bt_ctf_field_sequence_get_field(v_selected_copy, 1); + v_selected_1_copy = bt_field_sequence_get_field(v_selected_copy, 1); assert(v_selected_1_copy); - v_selected_2_copy = bt_ctf_field_sequence_get_field(v_selected_copy, 2); + v_selected_2_copy = bt_field_sequence_get_field(v_selected_copy, 2); assert(v_selected_2_copy); - v_selected_3_copy = bt_ctf_field_sequence_get_field(v_selected_copy, 3); + v_selected_3_copy = bt_field_sequence_get_field(v_selected_copy, 3); assert(v_selected_3_copy); - v_selected_4_copy = bt_ctf_field_sequence_get_field(v_selected_copy, 4); + v_selected_4_copy = bt_field_sequence_get_field(v_selected_copy, 4); assert(v_selected_4_copy); - v_selected_5_copy = bt_ctf_field_sequence_get_field(v_selected_copy, 5); + v_selected_5_copy = bt_field_sequence_get_field(v_selected_copy, 5); assert(v_selected_5_copy); - v_selected_6_copy = bt_ctf_field_sequence_get_field(v_selected_copy, 6); + v_selected_6_copy = bt_field_sequence_get_field(v_selected_copy, 6); assert(v_selected_6_copy); - ok(!bt_ctf_field_sequence_get_field(v_selected_copy, 7), + ok(!bt_field_sequence_get_field(v_selected_copy, 7), "sequence field copy is not too large"); - a_copy = bt_ctf_field_structure_get_field(strct_copy, "a"); + a_copy = bt_field_structure_get_field_by_name(strct_copy, "a"); assert(a_copy); - a_0_copy = bt_ctf_field_array_get_field(a_copy, 0); + a_0_copy = bt_field_array_get_field(a_copy, 0); assert(a_0_copy); - a_1_copy = bt_ctf_field_array_get_field(a_copy, 1); + a_1_copy = bt_field_array_get_field(a_copy, 1); assert(a_1_copy); - a_2_copy = bt_ctf_field_array_get_field(a_copy, 2); + a_2_copy = bt_field_array_get_field(a_copy, 2); assert(a_2_copy); - a_3_copy = bt_ctf_field_array_get_field(a_copy, 3); + a_3_copy = bt_field_array_get_field(a_copy, 3); assert(a_3_copy); - a_4_copy = bt_ctf_field_array_get_field(a_copy, 4); + a_4_copy = bt_field_array_get_field(a_copy, 4); assert(a_4_copy); - ok(!bt_ctf_field_array_get_field(v_selected_copy, 5), + ok(!bt_field_array_get_field(v_selected_copy, 5), "array field copy is not too large"); /* make sure copied fields are different pointers */ @@ -1452,101 +1452,101 @@ void field_copy_tests() field_copy_tests_validate_same_type(a_4_copy, v_label1_type, "a_4"); /* validate len copy */ - ret = bt_ctf_field_unsigned_integer_get_value(len_copy, &uint64_t_val); + ret = bt_field_unsigned_integer_get_value(len_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 7, - "bt_ctf_field_copy creates a valid integer field copy"); + "bt_field_copy creates a valid integer field copy"); /* validate fp copy */ - ret = bt_ctf_field_floating_point_get_value(fp_copy, &double_val); + ret = bt_field_floating_point_get_value(fp_copy, &double_val); assert(!ret); ok(double_val == 3.14, - "bt_ctf_field_copy creates a valid floating point number field copy"); + "bt_field_copy creates a valid floating point number field copy"); /* validate s copy */ - str_val = bt_ctf_field_string_get_value(s_copy); + str_val = bt_field_string_get_value(s_copy); ok(str_val && !strcmp(str_val, "btbt"), - "bt_ctf_field_copy creates a valid string field copy"); + "bt_field_copy creates a valid string field copy"); /* validate e_int copy */ - ret = bt_ctf_field_unsigned_integer_get_value(e_int_copy, + ret = bt_field_unsigned_integer_get_value(e_int_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 23, - "bt_ctf_field_copy creates a valid enum's integer field copy"); + "bt_field_copy creates a valid enum's integer field copy"); /* validate e copy */ - e_iter = bt_ctf_field_enumeration_get_mappings(e_copy); - (void) bt_ctf_field_type_enumeration_mapping_iterator_next(e_iter); - (void) bt_ctf_field_type_enumeration_mapping_iterator_get_signed(e_iter, + e_iter = bt_field_enumeration_get_mappings(e_copy); + (void) bt_field_type_enumeration_mapping_iterator_next(e_iter); + (void) bt_field_type_enumeration_mapping_iterator_get_signed(e_iter, &str_val, NULL, NULL); ok(str_val && !strcmp(str_val, "LABEL2"), - "bt_ctf_field_copy creates a valid enum field copy"); + "bt_field_copy creates a valid enum field copy"); /* validate v_selected copy */ - v_selected_copy_len = bt_ctf_field_sequence_get_length(v_selected); + v_selected_copy_len = bt_field_sequence_get_length(v_selected); assert(v_selected_copy_len); - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_copy_len, + ret = bt_field_unsigned_integer_get_value(v_selected_copy_len, &uint64_t_val); assert(!ret); ok(uint64_t_val == 7, - "bt_ctf_field_copy creates a sequence field copy with the proper length"); + "bt_field_copy creates a sequence field copy with the proper length"); bt_put(v_selected_copy_len); v_selected_copy_len = NULL; /* validate v_selected copy fields */ - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_0_copy, + ret = bt_field_unsigned_integer_get_value(v_selected_0_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 7, - "bt_ctf_field_copy creates a valid sequence field element copy (v_selected_0)"); - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_1_copy, + "bt_field_copy creates a valid sequence field element copy (v_selected_0)"); + ret = bt_field_unsigned_integer_get_value(v_selected_1_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 6, - "bt_ctf_field_copy creates a valid sequence field element copy (v_selected_1)"); - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_2_copy, + "bt_field_copy creates a valid sequence field element copy (v_selected_1)"); + ret = bt_field_unsigned_integer_get_value(v_selected_2_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 5, - "bt_ctf_field_copy creates a valid sequence field element copy (v_selected_2)"); - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_3_copy, + "bt_field_copy creates a valid sequence field element copy (v_selected_2)"); + ret = bt_field_unsigned_integer_get_value(v_selected_3_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 4, - "bt_ctf_field_copy creates a valid sequence field element copy (v_selected_3)"); - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_4_copy, + "bt_field_copy creates a valid sequence field element copy (v_selected_3)"); + ret = bt_field_unsigned_integer_get_value(v_selected_4_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 3, - "bt_ctf_field_copy creates a valid sequence field element copy (v_selected_4)"); - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_5_copy, + "bt_field_copy creates a valid sequence field element copy (v_selected_4)"); + ret = bt_field_unsigned_integer_get_value(v_selected_5_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 2, - "bt_ctf_field_copy creates a valid sequence field element copy (v_selected_5)"); - ret = bt_ctf_field_unsigned_integer_get_value(v_selected_6_copy, + "bt_field_copy creates a valid sequence field element copy (v_selected_5)"); + ret = bt_field_unsigned_integer_get_value(v_selected_6_copy, &uint64_t_val); assert(!ret); ok(uint64_t_val == 1, - "bt_ctf_field_copy creates a valid sequence field element copy (v_selected_6)"); + "bt_field_copy creates a valid sequence field element copy (v_selected_6)"); /* validate a copy fields */ - str_val = bt_ctf_field_string_get_value(a_0_copy); + str_val = bt_field_string_get_value(a_0_copy); ok(str_val && !strcmp(str_val, "a_0"), - "bt_ctf_field_copy creates a valid array field element copy (a_0)"); - str_val = bt_ctf_field_string_get_value(a_1_copy); + "bt_field_copy creates a valid array field element copy (a_0)"); + str_val = bt_field_string_get_value(a_1_copy); ok(str_val && !strcmp(str_val, "a_1"), - "bt_ctf_field_copy creates a valid array field element copy (a_1)"); - str_val = bt_ctf_field_string_get_value(a_2_copy); + "bt_field_copy creates a valid array field element copy (a_1)"); + str_val = bt_field_string_get_value(a_2_copy); ok(str_val && !strcmp(str_val, "a_2"), - "bt_ctf_field_copy creates a valid array field element copy (a_2)"); - str_val = bt_ctf_field_string_get_value(a_3_copy); + "bt_field_copy creates a valid array field element copy (a_2)"); + str_val = bt_field_string_get_value(a_3_copy); ok(str_val && !strcmp(str_val, "a_3"), - "bt_ctf_field_copy creates a valid array field element copy (a_3)"); - str_val = bt_ctf_field_string_get_value(a_4_copy); + "bt_field_copy creates a valid array field element copy (a_3)"); + str_val = bt_field_string_get_value(a_4_copy); ok(str_val && !strcmp(str_val, "a_4"), - "bt_ctf_field_copy creates a valid array field element copy (a_4)"); + "bt_field_copy creates a valid array field element copy (a_4)"); /* put everything */ bt_put(len_type); @@ -1608,270 +1608,270 @@ void field_copy_tests() static void type_field_tests() { - struct bt_ctf_field *uint_12; - struct bt_ctf_field *int_16; - struct bt_ctf_field *string; - struct bt_ctf_field *enumeration; - struct bt_ctf_field_type *composite_structure_type; - struct bt_ctf_field_type *structure_seq_type; - struct bt_ctf_field_type *string_type; - struct bt_ctf_field_type *sequence_type; - struct bt_ctf_field_type *uint_8_type; - struct bt_ctf_field_type *int_16_type; - struct bt_ctf_field_type *uint_12_type = - bt_ctf_field_type_integer_create(12); - struct bt_ctf_field_type *enumeration_type; - struct bt_ctf_field_type *returned_type; + struct bt_field *uint_12; + struct bt_field *int_16; + struct bt_field *string; + struct bt_field *enumeration; + struct bt_field_type *composite_structure_type; + struct bt_field_type *structure_seq_type; + struct bt_field_type *string_type; + struct bt_field_type *sequence_type; + struct bt_field_type *uint_8_type; + struct bt_field_type *int_16_type; + struct bt_field_type *uint_12_type = + bt_field_type_integer_create(12); + struct bt_field_type *enumeration_type; + struct bt_field_type *returned_type; const char *ret_string; - returned_type = bt_ctf_field_get_type(NULL); - ok(!returned_type, "bt_ctf_field_get_type handles NULL correctly"); + returned_type = bt_field_get_type(NULL); + ok(!returned_type, "bt_field_get_type handles NULL correctly"); ok(uint_12_type, "Create an unsigned integer type"); - ok(bt_ctf_field_type_integer_set_base(uint_12_type, - BT_CTF_INTEGER_BASE_BINARY) == 0, + ok(bt_field_type_integer_set_base(uint_12_type, + BT_INTEGER_BASE_BINARY) == 0, "Set integer type's base as binary"); - ok(bt_ctf_field_type_integer_set_base(uint_12_type, - BT_CTF_INTEGER_BASE_DECIMAL) == 0, + ok(bt_field_type_integer_set_base(uint_12_type, + BT_INTEGER_BASE_DECIMAL) == 0, "Set integer type's base as decimal"); - ok(bt_ctf_field_type_integer_set_base(uint_12_type, - BT_CTF_INTEGER_BASE_UNKNOWN), + ok(bt_field_type_integer_set_base(uint_12_type, + BT_INTEGER_BASE_UNKNOWN), "Reject integer type's base set as unknown"); - ok(bt_ctf_field_type_integer_set_base(uint_12_type, - BT_CTF_INTEGER_BASE_OCTAL) == 0, + ok(bt_field_type_integer_set_base(uint_12_type, + BT_INTEGER_BASE_OCTAL) == 0, "Set integer type's base as octal"); - ok(bt_ctf_field_type_integer_set_base(uint_12_type, - BT_CTF_INTEGER_BASE_HEXADECIMAL) == 0, + ok(bt_field_type_integer_set_base(uint_12_type, + BT_INTEGER_BASE_HEXADECIMAL) == 0, "Set integer type's base as hexadecimal"); - ok(bt_ctf_field_type_integer_set_base(uint_12_type, 457417), + ok(bt_field_type_integer_set_base(uint_12_type, 457417), "Reject unknown integer base value"); ok(bt_ctf_field_type_integer_set_signed(uint_12_type, 952835) == 0, "Set integer type signedness to signed"); ok(bt_ctf_field_type_integer_set_signed(uint_12_type, 0) == 0, "Set integer type signedness to unsigned"); - ok(bt_ctf_field_type_integer_get_size(NULL) < 0, - "bt_ctf_field_type_integer_get_size handles NULL correctly"); - ok(bt_ctf_field_type_integer_get_size(uint_12_type) == 12, - "bt_ctf_field_type_integer_get_size returns a correct value"); + ok(bt_field_type_integer_get_size(NULL) < 0, + "bt_field_type_integer_get_size handles NULL correctly"); + ok(bt_field_type_integer_get_size(uint_12_type) == 12, + "bt_field_type_integer_get_size returns a correct value"); ok(bt_ctf_field_type_integer_get_signed(NULL) < 0, - "bt_ctf_field_type_integer_get_signed handles NULL correctly"); + "bt_field_type_integer_get_signed handles NULL correctly"); ok(bt_ctf_field_type_integer_get_signed(uint_12_type) == 0, - "bt_ctf_field_type_integer_get_signed returns a correct value for unsigned types"); - - ok(bt_ctf_field_type_set_byte_order(NULL, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN) < 0, - "bt_ctf_field_type_set_byte_order handles NULL correctly"); - ok(bt_ctf_field_type_set_byte_order(uint_12_type, - (enum bt_ctf_byte_order) 42) < 0, - "bt_ctf_field_type_set_byte_order rejects invalid values"); - ok(bt_ctf_field_type_set_byte_order(uint_12_type, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN) == 0, + "bt_field_type_integer_get_signed returns a correct value for unsigned types"); + + ok(bt_field_type_set_byte_order(NULL, + BT_BYTE_ORDER_LITTLE_ENDIAN) < 0, + "bt_field_type_set_byte_order handles NULL correctly"); + ok(bt_field_type_set_byte_order(uint_12_type, + (enum bt_byte_order) 42) < 0, + "bt_field_type_set_byte_order rejects invalid values"); + ok(bt_field_type_set_byte_order(uint_12_type, + BT_BYTE_ORDER_LITTLE_ENDIAN) == 0, "Set an integer's byte order to little endian"); - ok(bt_ctf_field_type_set_byte_order(uint_12_type, - BT_CTF_BYTE_ORDER_BIG_ENDIAN) == 0, + ok(bt_field_type_set_byte_order(uint_12_type, + BT_BYTE_ORDER_BIG_ENDIAN) == 0, "Set an integer's byte order to big endian"); - ok(bt_ctf_field_type_get_byte_order(uint_12_type) == - BT_CTF_BYTE_ORDER_BIG_ENDIAN, - "bt_ctf_field_type_get_byte_order returns a correct value"); - ok(bt_ctf_field_type_get_byte_order(NULL) == - BT_CTF_BYTE_ORDER_UNKNOWN, - "bt_ctf_field_type_get_byte_order handles NULL correctly"); - - ok(bt_ctf_field_type_get_type_id(NULL) == - BT_CTF_FIELD_TYPE_ID_UNKNOWN, - "bt_ctf_field_type_get_type_id handles NULL correctly"); - ok(bt_ctf_field_type_get_type_id(uint_12_type) == - BT_CTF_FIELD_TYPE_ID_INTEGER, - "bt_ctf_field_type_get_type_id returns a correct value with an integer type"); - - ok(bt_ctf_field_type_integer_get_base(NULL) == - BT_CTF_INTEGER_BASE_UNKNOWN, - "bt_ctf_field_type_integer_get_base handles NULL correctly"); - ok(bt_ctf_field_type_integer_get_base(uint_12_type) == - BT_CTF_INTEGER_BASE_HEXADECIMAL, - "bt_ctf_field_type_integer_get_base returns a correct value"); - - ok(bt_ctf_field_type_integer_set_encoding(NULL, - BT_CTF_STRING_ENCODING_ASCII) < 0, - "bt_ctf_field_type_integer_set_encoding handles NULL correctly"); - ok(bt_ctf_field_type_integer_set_encoding(uint_12_type, - (enum bt_ctf_string_encoding) 123) < 0, - "bt_ctf_field_type_integer_set_encoding handles invalid encodings correctly"); - ok(bt_ctf_field_type_integer_set_encoding(uint_12_type, - BT_CTF_STRING_ENCODING_UTF8) == 0, + ok(bt_field_type_get_byte_order(uint_12_type) == + BT_BYTE_ORDER_BIG_ENDIAN, + "bt_field_type_get_byte_order returns a correct value"); + ok(bt_field_type_get_byte_order(NULL) == + BT_BYTE_ORDER_UNKNOWN, + "bt_field_type_get_byte_order handles NULL correctly"); + + ok(bt_field_type_get_type_id(NULL) == + BT_FIELD_TYPE_ID_UNKNOWN, + "bt_field_type_get_type_id handles NULL correctly"); + ok(bt_field_type_get_type_id(uint_12_type) == + BT_FIELD_TYPE_ID_INTEGER, + "bt_field_type_get_type_id returns a correct value with an integer type"); + + ok(bt_field_type_integer_get_base(NULL) == + BT_INTEGER_BASE_UNKNOWN, + "bt_field_type_integer_get_base handles NULL correctly"); + ok(bt_field_type_integer_get_base(uint_12_type) == + BT_INTEGER_BASE_HEXADECIMAL, + "bt_field_type_integer_get_base returns a correct value"); + + ok(bt_field_type_integer_set_encoding(NULL, + BT_STRING_ENCODING_ASCII) < 0, + "bt_field_type_integer_set_encoding handles NULL correctly"); + ok(bt_field_type_integer_set_encoding(uint_12_type, + (enum bt_string_encoding) 123) < 0, + "bt_field_type_integer_set_encoding handles invalid encodings correctly"); + ok(bt_field_type_integer_set_encoding(uint_12_type, + BT_STRING_ENCODING_UTF8) == 0, "Set integer type encoding to UTF8"); - ok(bt_ctf_field_type_integer_get_encoding(NULL) == - BT_CTF_STRING_ENCODING_UNKNOWN, - "bt_ctf_field_type_integer_get_encoding handles NULL correctly"); - ok(bt_ctf_field_type_integer_get_encoding(uint_12_type) == - BT_CTF_STRING_ENCODING_UTF8, - "bt_ctf_field_type_integer_get_encoding returns a correct value"); - - int_16_type = bt_ctf_field_type_integer_create(16); + ok(bt_field_type_integer_get_encoding(NULL) == + BT_STRING_ENCODING_UNKNOWN, + "bt_field_type_integer_get_encoding handles NULL correctly"); + ok(bt_field_type_integer_get_encoding(uint_12_type) == + BT_STRING_ENCODING_UTF8, + "bt_field_type_integer_get_encoding returns a correct value"); + + int_16_type = bt_field_type_integer_create(16); assert(int_16_type); ok(!bt_ctf_field_type_integer_set_signed(int_16_type, 1), "Set signedness of 16 bit integer to true"); ok(bt_ctf_field_type_integer_get_signed(int_16_type) == 1, - "bt_ctf_field_type_integer_get_signed returns a correct value for signed types"); - uint_8_type = bt_ctf_field_type_integer_create(8); + "bt_field_type_integer_get_signed returns a correct value for signed types"); + uint_8_type = bt_field_type_integer_create(8); sequence_type = - bt_ctf_field_type_sequence_create(int_16_type, "seq_len"); + bt_field_type_sequence_create(int_16_type, "seq_len"); ok(sequence_type, "Create a sequence of int16_t type"); - ok(bt_ctf_field_type_get_type_id(sequence_type) == - BT_CTF_FIELD_TYPE_ID_SEQUENCE, - "bt_ctf_field_type_get_type_id returns a correct value with a sequence type"); + ok(bt_field_type_get_type_id(sequence_type) == + BT_FIELD_TYPE_ID_SEQUENCE, + "bt_field_type_get_type_id returns a correct value with a sequence type"); - ok(bt_ctf_field_type_sequence_get_length_field_name(NULL) == NULL, - "bt_ctf_field_type_sequence_get_length_field_name handles NULL correctly"); - ret_string = bt_ctf_field_type_sequence_get_length_field_name( + ok(bt_field_type_sequence_get_length_field_name(NULL) == NULL, + "bt_field_type_sequence_get_length_field_name handles NULL correctly"); + ret_string = bt_field_type_sequence_get_length_field_name( sequence_type); ok(!strcmp(ret_string, "seq_len"), - "bt_ctf_field_type_sequence_get_length_field_name returns the correct value"); - ok(bt_ctf_field_type_sequence_get_element_type(NULL) == NULL, - "bt_ctf_field_type_sequence_get_element_type handles NULL correctly"); - returned_type = bt_ctf_field_type_sequence_get_element_type( + "bt_field_type_sequence_get_length_field_name returns the correct value"); + ok(bt_field_type_sequence_get_element_type(NULL) == NULL, + "bt_field_type_sequence_get_element_type handles NULL correctly"); + returned_type = bt_field_type_sequence_get_element_type( sequence_type); ok(returned_type == int_16_type, - "bt_ctf_field_type_sequence_get_element_type returns the correct type"); + "bt_field_type_sequence_get_element_type returns the correct type"); bt_put(returned_type); - string_type = bt_ctf_field_type_string_create(); + string_type = bt_field_type_string_create(); ok(string_type, "Create a string type"); - ok(bt_ctf_field_type_string_set_encoding(string_type, - BT_CTF_STRING_ENCODING_NONE), + ok(bt_field_type_string_set_encoding(string_type, + BT_STRING_ENCODING_NONE), "Reject invalid \"None\" string encoding"); - ok(bt_ctf_field_type_string_set_encoding(string_type, + ok(bt_field_type_string_set_encoding(string_type, 42), "Reject invalid string encoding"); - ok(bt_ctf_field_type_string_set_encoding(string_type, - BT_CTF_STRING_ENCODING_ASCII) == 0, + ok(bt_field_type_string_set_encoding(string_type, + BT_STRING_ENCODING_ASCII) == 0, "Set string encoding to ASCII"); - ok(bt_ctf_field_type_string_get_encoding(NULL) == - BT_CTF_STRING_ENCODING_UNKNOWN, - "bt_ctf_field_type_string_get_encoding handles NULL correctly"); - ok(bt_ctf_field_type_string_get_encoding(string_type) == - BT_CTF_STRING_ENCODING_ASCII, - "bt_ctf_field_type_string_get_encoding returns the correct value"); - - structure_seq_type = bt_ctf_field_type_structure_create(); - ok(bt_ctf_field_type_get_type_id(structure_seq_type) == - BT_CTF_FIELD_TYPE_ID_STRUCT, - "bt_ctf_field_type_get_type_id returns a correct value with a structure type"); + ok(bt_field_type_string_get_encoding(NULL) == + BT_STRING_ENCODING_UNKNOWN, + "bt_field_type_string_get_encoding handles NULL correctly"); + ok(bt_field_type_string_get_encoding(string_type) == + BT_STRING_ENCODING_ASCII, + "bt_field_type_string_get_encoding returns the correct value"); + + structure_seq_type = bt_field_type_structure_create(); + ok(bt_field_type_get_type_id(structure_seq_type) == + BT_FIELD_TYPE_ID_STRUCT, + "bt_field_type_get_type_id returns a correct value with a structure type"); ok(structure_seq_type, "Create a structure type"); - ok(bt_ctf_field_type_structure_add_field(structure_seq_type, + ok(bt_field_type_structure_add_field(structure_seq_type, uint_8_type, "seq_len") == 0, "Add a uint8_t type to a structure"); - ok(bt_ctf_field_type_structure_add_field(structure_seq_type, + ok(bt_field_type_structure_add_field(structure_seq_type, sequence_type, "a_sequence") == 0, "Add a sequence type to a structure"); - ok(bt_ctf_field_type_structure_get_field_count(NULL) < 0, - "bt_ctf_field_type_structure_get_field_count handles NULL correctly"); - ok(bt_ctf_field_type_structure_get_field_count(structure_seq_type) == 2, - "bt_ctf_field_type_structure_get_field_count returns a correct value"); + ok(bt_field_type_structure_get_field_count(NULL) < 0, + "bt_field_type_structure_get_field_count handles NULL correctly"); + ok(bt_field_type_structure_get_field_count(structure_seq_type) == 2, + "bt_field_type_structure_get_field_count returns a correct value"); ok(bt_ctf_field_type_structure_get_field(NULL, &ret_string, &returned_type, 1) < 0, - "bt_ctf_field_type_structure_get_field handles a NULL type correctly"); + "bt_field_type_structure_get_field handles a NULL type correctly"); ok(bt_ctf_field_type_structure_get_field(structure_seq_type, NULL, &returned_type, 1) == 0, - "bt_ctf_field_type_structure_get_field handles a NULL name correctly"); + "bt_field_type_structure_get_field handles a NULL name correctly"); bt_put(returned_type); ok(bt_ctf_field_type_structure_get_field(structure_seq_type, &ret_string, NULL, 1) == 0, - "bt_ctf_field_type_structure_get_field handles a NULL return type correctly"); + "bt_field_type_structure_get_field handles a NULL return type correctly"); ok(bt_ctf_field_type_structure_get_field(structure_seq_type, &ret_string, &returned_type, 10) < 0, - "bt_ctf_field_type_structure_get_field handles an invalid index correctly"); + "bt_field_type_structure_get_field handles an invalid index correctly"); ok(bt_ctf_field_type_structure_get_field(structure_seq_type, &ret_string, &returned_type, 1) == 0, - "bt_ctf_field_type_structure_get_field returns a field"); + "bt_field_type_structure_get_field returns a field"); ok(!strcmp(ret_string, "a_sequence"), - "bt_ctf_field_type_structure_get_field returns a correct field name"); + "bt_field_type_structure_get_field returns a correct field name"); ok(returned_type == sequence_type, - "bt_ctf_field_type_structure_get_field returns a correct field type"); + "bt_field_type_structure_get_field returns a correct field type"); bt_put(returned_type); - ok(bt_ctf_field_type_structure_get_field_type_by_name(NULL, "a_sequence") == NULL, - "bt_ctf_field_type_structure_get_field_type_by_name handles a NULL structure correctly"); - ok(bt_ctf_field_type_structure_get_field_type_by_name(structure_seq_type, NULL) == NULL, - "bt_ctf_field_type_structure_get_field_type_by_name handles a NULL field name correctly"); - returned_type = bt_ctf_field_type_structure_get_field_type_by_name( + ok(bt_field_type_structure_get_field_type_by_name(NULL, "a_sequence") == NULL, + "bt_field_type_structure_get_field_type_by_name handles a NULL structure correctly"); + ok(bt_field_type_structure_get_field_type_by_name(structure_seq_type, NULL) == NULL, + "bt_field_type_structure_get_field_type_by_name handles a NULL field name correctly"); + returned_type = bt_field_type_structure_get_field_type_by_name( structure_seq_type, "a_sequence"); ok(returned_type == sequence_type, - "bt_ctf_field_type_structure_get_field_type_by_name returns the correct field type"); + "bt_field_type_structure_get_field_type_by_name returns the correct field type"); bt_put(returned_type); - composite_structure_type = bt_ctf_field_type_structure_create(); - ok(bt_ctf_field_type_structure_add_field(composite_structure_type, + composite_structure_type = bt_field_type_structure_create(); + ok(bt_field_type_structure_add_field(composite_structure_type, string_type, "a_string") == 0, "Add a string type to a structure"); - ok(bt_ctf_field_type_structure_add_field(composite_structure_type, + ok(bt_field_type_structure_add_field(composite_structure_type, structure_seq_type, "inner_structure") == 0, "Add a structure type to a structure"); - ok(bt_ctf_field_type_structure_get_field_type_by_name( + ok(bt_field_type_structure_get_field_type_by_name( NULL, "a_sequence") == NULL, - "bt_ctf_field_type_structure_get_field_type_by_name handles a NULL field correctly"); - ok(bt_ctf_field_type_structure_get_field_type_by_name( + "bt_field_type_structure_get_field_type_by_name handles a NULL field correctly"); + ok(bt_field_type_structure_get_field_type_by_name( structure_seq_type, NULL) == NULL, - "bt_ctf_field_type_structure_get_field_type_by_name handles a NULL field name correctly"); - returned_type = bt_ctf_field_type_structure_get_field_type_by_name( + "bt_field_type_structure_get_field_type_by_name handles a NULL field name correctly"); + returned_type = bt_field_type_structure_get_field_type_by_name( structure_seq_type, "a_sequence"); ok(returned_type == sequence_type, - "bt_ctf_field_type_structure_get_field_type_by_name returns a correct type"); + "bt_field_type_structure_get_field_type_by_name returns a correct type"); bt_put(returned_type); - int_16 = bt_ctf_field_create(int_16_type); + int_16 = bt_field_create(int_16_type); ok(int_16, "Instanciate a signed 16-bit integer"); - uint_12 = bt_ctf_field_create(uint_12_type); + uint_12 = bt_field_create(uint_12_type); ok(uint_12, "Instanciate an unsigned 12-bit integer"); - returned_type = bt_ctf_field_get_type(int_16); + returned_type = bt_field_get_type(int_16); ok(returned_type == int_16_type, - "bt_ctf_field_get_type returns the correct type"); + "bt_field_get_type returns the correct type"); /* Can't modify types after instanciating them */ - ok(bt_ctf_field_type_integer_set_base(uint_12_type, - BT_CTF_INTEGER_BASE_DECIMAL), + ok(bt_field_type_integer_set_base(uint_12_type, + BT_INTEGER_BASE_DECIMAL), "Check an integer type' base can't be modified after instanciation"); ok(bt_ctf_field_type_integer_set_signed(uint_12_type, 0), "Check an integer type's signedness can't be modified after instanciation"); /* Check signed property is checked */ - ok(bt_ctf_field_signed_integer_set_value(uint_12, -52), - "Check bt_ctf_field_signed_integer_set_value is not allowed on an unsigned integer"); - ok(bt_ctf_field_unsigned_integer_set_value(int_16, 42), - "Check bt_ctf_field_unsigned_integer_set_value is not allowed on a signed integer"); + ok(bt_field_signed_integer_set_value(uint_12, -52), + "Check bt_field_signed_integer_set_value is not allowed on an unsigned integer"); + ok(bt_field_unsigned_integer_set_value(int_16, 42), + "Check bt_field_unsigned_integer_set_value is not allowed on a signed integer"); /* Check overflows are properly tested for */ - ok(bt_ctf_field_signed_integer_set_value(int_16, -32768) == 0, + ok(bt_field_signed_integer_set_value(int_16, -32768) == 0, "Check -32768 is allowed for a signed 16-bit integer"); - ok(bt_ctf_field_signed_integer_set_value(int_16, 32767) == 0, + ok(bt_field_signed_integer_set_value(int_16, 32767) == 0, "Check 32767 is allowed for a signed 16-bit integer"); - ok(bt_ctf_field_signed_integer_set_value(int_16, 32768), + ok(bt_field_signed_integer_set_value(int_16, 32768), "Check 32768 is not allowed for a signed 16-bit integer"); - ok(bt_ctf_field_signed_integer_set_value(int_16, -32769), + ok(bt_field_signed_integer_set_value(int_16, -32769), "Check -32769 is not allowed for a signed 16-bit integer"); - ok(bt_ctf_field_signed_integer_set_value(int_16, -42) == 0, + ok(bt_field_signed_integer_set_value(int_16, -42) == 0, "Check -42 is allowed for a signed 16-bit integer"); - ok(bt_ctf_field_unsigned_integer_set_value(uint_12, 4095) == 0, + ok(bt_field_unsigned_integer_set_value(uint_12, 4095) == 0, "Check 4095 is allowed for an unsigned 12-bit integer"); - ok(bt_ctf_field_unsigned_integer_set_value(uint_12, 4096), + ok(bt_field_unsigned_integer_set_value(uint_12, 4096), "Check 4096 is not allowed for a unsigned 12-bit integer"); - ok(bt_ctf_field_unsigned_integer_set_value(uint_12, 0) == 0, + ok(bt_field_unsigned_integer_set_value(uint_12, 0) == 0, "Check 0 is allowed for an unsigned 12-bit integer"); - string = bt_ctf_field_create(string_type); + string = bt_field_create(string_type); ok(string, "Instanciate a string field"); - ok(bt_ctf_field_string_set_value(string, "A value") == 0, + ok(bt_field_string_set_value(string, "A value") == 0, "Set a string's value"); - enumeration_type = bt_ctf_field_type_enumeration_create(uint_12_type); + enumeration_type = bt_field_type_enumeration_create(uint_12_type); ok(enumeration_type, "Create an enumeration type with an unsigned 12-bit integer as container"); - enumeration = bt_ctf_field_create(enumeration_type); + enumeration = bt_field_create(enumeration_type); ok(!enumeration, "Check enumeration types are validated before instantiation"); @@ -1891,8 +1891,8 @@ void type_field_tests() } static -void packet_resize_test(struct bt_ctf_stream_class *stream_class, - struct bt_ctf_stream *stream, struct bt_ctf_clock *clock) +void packet_resize_test(struct bt_stream_class *stream_class, + struct bt_stream *stream, struct bt_ctf_clock *clock) { /* * Append enough events to force the underlying packet to be resized. @@ -1901,89 +1901,89 @@ void packet_resize_test(struct bt_ctf_stream_class *stream_class, */ int ret = 0; int i; - struct bt_ctf_event_class *event_class = bt_ctf_event_class_create( + struct bt_event_class *event_class = bt_event_class_create( "Spammy_Event"); - struct bt_ctf_field_type *integer_type = - bt_ctf_field_type_integer_create(17); - struct bt_ctf_field_type *string_type = - bt_ctf_field_type_string_create(); - struct bt_ctf_event *event = NULL; - struct bt_ctf_field *ret_field = NULL; - struct bt_ctf_field_type *ret_field_type = NULL; + struct bt_field_type *integer_type = + bt_field_type_integer_create(17); + struct bt_field_type *string_type = + bt_field_type_string_create(); + struct bt_event *event = NULL; + struct bt_field *ret_field = NULL; + struct bt_field_type *ret_field_type = NULL; uint64_t ret_uint64; int events_appended = 0; - struct bt_ctf_field *packet_context = NULL, + struct bt_field *packet_context = NULL, *packet_context_field = NULL, *stream_event_context = NULL; - struct bt_ctf_field_type *ep_field_1_type = NULL; - struct bt_ctf_field_type *ep_a_string_type = NULL; - struct bt_ctf_field_type *ep_type = NULL; + struct bt_field_type *ep_field_1_type = NULL; + struct bt_field_type *ep_a_string_type = NULL; + struct bt_field_type *ep_type = NULL; - ret |= bt_ctf_event_class_add_field(event_class, integer_type, + ret |= bt_event_class_add_field(event_class, integer_type, "field_1"); - ret |= bt_ctf_event_class_add_field(event_class, string_type, + ret |= bt_event_class_add_field(event_class, string_type, "a_string"); - ret |= bt_ctf_stream_class_add_event_class(stream_class, event_class); + ret |= bt_stream_class_add_event_class(stream_class, event_class); ok(ret == 0, "Add a new event class to a stream class after writing an event"); if (ret) { goto end; } /* - * bt_ctf_stream_class_add_event_class() copies the field types + * bt_stream_class_add_event_class() copies the field types * of event_class, so we retrieve the new ones to create the * appropriate fields. */ - ep_type = bt_ctf_event_class_get_payload_type(event_class); + ep_type = bt_event_class_get_payload_type(event_class); assert(ep_type); - ep_field_1_type = bt_ctf_field_type_structure_get_field_type_by_name( + ep_field_1_type = bt_field_type_structure_get_field_type_by_name( ep_type, "field_1"); assert(ep_field_1_type); - ep_a_string_type = bt_ctf_field_type_structure_get_field_type_by_name( + ep_a_string_type = bt_field_type_structure_get_field_type_by_name( ep_type, "a_string"); assert(ep_a_string_type); - event = bt_ctf_event_create(event_class); - ret_field = bt_ctf_event_get_payload_by_index(event, 0); - ret_field_type = bt_ctf_field_get_type(ret_field); - ok(bt_ctf_field_type_compare(ret_field_type, integer_type) == 0, - "bt_ctf_event_get_payload_by_index returns a correct field"); + event = bt_event_create(event_class); + ret_field = bt_event_get_payload_by_index(event, 0); + ret_field_type = bt_field_get_type(ret_field); + ok(bt_field_type_compare(ret_field_type, integer_type) == 0, + "bt_event_get_payload_by_index returns a correct field"); bt_put(ret_field_type); bt_put(ret_field); - ok(bt_ctf_event_get_payload_by_index(NULL, 0) == NULL, - "bt_ctf_event_get_payload_by_index handles NULL correctly"); - ok(bt_ctf_event_get_payload_by_index(event, 4) == NULL, - "bt_ctf_event_get_payload_by_index handles an invalid index correctly"); + ok(bt_event_get_payload_by_index(NULL, 0) == NULL, + "bt_event_get_payload_by_index handles NULL correctly"); + ok(bt_event_get_payload_by_index(event, 4) == NULL, + "bt_event_get_payload_by_index handles an invalid index correctly"); bt_put(event); for (i = 0; i < packet_resize_test_length; i++) { - event = bt_ctf_event_create(event_class); - struct bt_ctf_field *integer = - bt_ctf_field_create(ep_field_1_type); - struct bt_ctf_field *string = - bt_ctf_field_create(ep_a_string_type); + event = bt_event_create(event_class); + struct bt_field *integer = + bt_field_create(ep_field_1_type); + struct bt_field *string = + bt_field_create(ep_a_string_type); ret |= bt_ctf_clock_set_time(clock, ++current_time); - ret |= bt_ctf_field_unsigned_integer_set_value(integer, i); - ret |= bt_ctf_event_set_payload(event, "field_1", + ret |= bt_field_unsigned_integer_set_value(integer, i); + ret |= bt_event_set_payload(event, "field_1", integer); bt_put(integer); - ret |= bt_ctf_field_string_set_value(string, "This is a test"); - ret |= bt_ctf_event_set_payload(event, "a_string", + ret |= bt_field_string_set_value(string, "This is a test"); + ret |= bt_event_set_payload(event, "a_string", string); bt_put(string); /* Populate stream event context */ stream_event_context = - bt_ctf_event_get_stream_event_context(event); - integer = bt_ctf_field_structure_get_field(stream_event_context, + bt_event_get_stream_event_context(event); + integer = bt_field_structure_get_field_by_name(stream_event_context, "common_event_context"); BT_PUT(stream_event_context); - ret |= bt_ctf_field_unsigned_integer_set_value(integer, + ret |= bt_field_unsigned_integer_set_value(integer, i % 42); bt_put(integer); - ret |= bt_ctf_stream_append_event(stream, event); + ret |= bt_stream_append_event(stream, event); bt_put(event); if (ret) { @@ -1992,17 +1992,17 @@ void packet_resize_test(struct bt_ctf_stream_class *stream_class, } events_appended = !!(i == packet_resize_test_length); - ok(bt_ctf_stream_get_discarded_events_count(NULL, &ret_uint64) < 0, - "bt_ctf_stream_get_discarded_events_count handles a NULL stream correctly"); - ok(bt_ctf_stream_get_discarded_events_count(stream, NULL) < 0, - "bt_ctf_stream_get_discarded_events_count handles a NULL return pointer correctly"); - ret = bt_ctf_stream_get_discarded_events_count(stream, &ret_uint64); + ok(bt_stream_get_discarded_events_count(NULL, &ret_uint64) < 0, + "bt_stream_get_discarded_events_count handles a NULL stream correctly"); + ok(bt_stream_get_discarded_events_count(stream, NULL) < 0, + "bt_stream_get_discarded_events_count handles a NULL return pointer correctly"); + ret = bt_stream_get_discarded_events_count(stream, &ret_uint64); ok(ret == 0 && ret_uint64 == 0, - "bt_ctf_stream_get_discarded_events_count returns a correct number of discarded events when none were discarded"); - bt_ctf_stream_append_discarded_events(stream, 1000); - ret = bt_ctf_stream_get_discarded_events_count(stream, &ret_uint64); + "bt_stream_get_discarded_events_count returns a correct number of discarded events when none were discarded"); + bt_stream_append_discarded_events(stream, 1000); + ret = bt_stream_get_discarded_events_count(stream, &ret_uint64); ok(ret == 0 && ret_uint64 == 1000, - "bt_ctf_stream_get_discarded_events_count returns a correct number of discarded events when some were discarded"); + "bt_stream_get_discarded_events_count returns a correct number of discarded events when some were discarded"); end: ok(events_appended, "Append 100 000 events to a stream"); @@ -2011,16 +2011,16 @@ end: * Populate the custom packet context field with a dummy value * otherwise flush will fail. */ - packet_context = bt_ctf_stream_get_packet_context(stream); - packet_context_field = bt_ctf_field_structure_get_field(packet_context, + packet_context = bt_stream_get_packet_context(stream); + packet_context_field = bt_field_structure_get_field_by_name(packet_context, "custom_packet_context_field"); - bt_ctf_field_unsigned_integer_set_value(packet_context_field, 2); + bt_field_unsigned_integer_set_value(packet_context_field, 2); - ok(bt_ctf_stream_flush(stream) == 0, + ok(bt_stream_flush(stream) == 0, "Flush a stream that forces a packet resize"); - ret = bt_ctf_stream_get_discarded_events_count(stream, &ret_uint64); + ret = bt_stream_get_discarded_events_count(stream, &ret_uint64); ok(ret == 0 && ret_uint64 == 1000, - "bt_ctf_stream_get_discarded_events_count returns a correct number of discarded events after a flush"); + "bt_stream_get_discarded_events_count returns a correct number of discarded events after a flush"); bt_put(integer_type); bt_put(string_type); bt_put(packet_context); @@ -2036,9 +2036,9 @@ static void test_empty_stream(struct bt_ctf_writer *writer) { int ret = 0; - struct bt_ctf_trace *trace = NULL, *ret_trace = NULL; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_stream *stream = NULL; + struct bt_trace *trace = NULL, *ret_trace = NULL; + struct bt_stream_class *stream_class = NULL; + struct bt_stream *stream = NULL; trace = bt_ctf_writer_get_trace(writer); if (!trace) { @@ -2047,22 +2047,22 @@ void test_empty_stream(struct bt_ctf_writer *writer) goto end; } - stream_class = bt_ctf_stream_class_create("empty_stream"); + stream_class = bt_stream_class_create("empty_stream"); if (!stream_class) { diag("Failed to create stream class"); ret = -1; goto end; } - ret = bt_ctf_stream_class_set_packet_context_type(stream_class, NULL); + ret = bt_stream_class_set_packet_context_type(stream_class, NULL); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_header_type(stream_class, NULL); + ret = bt_stream_class_set_event_header_type(stream_class, NULL); assert(ret == 0); - ok(bt_ctf_stream_class_get_trace(NULL) == NULL, - "bt_ctf_stream_class_get_trace handles NULL correctly"); - ok(bt_ctf_stream_class_get_trace(stream_class) == NULL, - "bt_ctf_stream_class_get_trace returns NULL when stream class is orphaned"); + ok(bt_stream_class_get_trace(NULL) == NULL, + "bt_stream_class_get_trace handles NULL correctly"); + ok(bt_stream_class_get_trace(stream_class) == NULL, + "bt_stream_class_get_trace returns NULL when stream class is orphaned"); stream = bt_ctf_writer_create_stream(writer, stream_class); if (!stream) { @@ -2071,9 +2071,9 @@ void test_empty_stream(struct bt_ctf_writer *writer) goto end; } - ret_trace = bt_ctf_stream_class_get_trace(stream_class); + ret_trace = bt_stream_class_get_trace(stream_class); ok(ret_trace == trace, - "bt_ctf_stream_class_get_trace returns the correct trace after a stream has been created"); + "bt_stream_class_get_trace returns the correct trace after a stream has been created"); end: ok(ret == 0, "Created a stream class with default attributes and an empty stream"); @@ -2088,22 +2088,22 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer, struct bt_ctf_clock *clock) { int i, ret; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_stream *stream = NULL; - struct bt_ctf_field_type *integer_type = NULL, + struct bt_stream_class *stream_class = NULL; + struct bt_stream *stream = NULL; + struct bt_field_type *integer_type = NULL, *sequence_type = NULL, *event_header_type = NULL; - struct bt_ctf_field *integer = NULL, *sequence = NULL, + struct bt_field *integer = NULL, *sequence = NULL, *event_header = NULL, *packet_header = NULL; - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_event *event = NULL; + struct bt_event_class *event_class = NULL; + struct bt_event *event = NULL; - stream_class = bt_ctf_stream_class_create("custom_event_header_stream"); + stream_class = bt_stream_class_create("custom_event_header_stream"); if (!stream_class) { fail("Failed to create stream class"); goto end; } - ret = bt_ctf_stream_class_set_clock(stream_class, clock); + ret = bt_stream_class_set_clock(stream_class, clock); if (ret) { fail("Failed to set stream class clock"); goto end; @@ -2114,27 +2114,27 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer, * which will be used as the length of a sequence in an event of this * stream. */ - event_header_type = bt_ctf_stream_class_get_event_header_type( + event_header_type = bt_stream_class_get_event_header_type( stream_class); if (!event_header_type) { fail("Failed to get event header type"); goto end; } - integer_type = bt_ctf_field_type_integer_create(13); + integer_type = bt_field_type_integer_create(13); if (!integer_type) { fail("Failed to create length integer type"); goto end; } - ret = bt_ctf_field_type_structure_add_field(event_header_type, + ret = bt_field_type_structure_add_field(event_header_type, integer_type, "seq_len"); if (ret) { fail("Failed to add a new field to stream event header"); goto end; } - event_class = bt_ctf_event_class_create("sequence_event"); + event_class = bt_event_class_create("sequence_event"); if (!event_class) { fail("Failed to create event class"); goto end; @@ -2144,21 +2144,21 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer, * This event's payload will contain a sequence which references * stream.event.header.seq_len as its length field. */ - sequence_type = bt_ctf_field_type_sequence_create(integer_type, + sequence_type = bt_field_type_sequence_create(integer_type, "stream.event.header.seq_len"); if (!sequence_type) { fail("Failed to create a sequence"); goto end; } - ret = bt_ctf_event_class_add_field(event_class, sequence_type, + ret = bt_event_class_add_field(event_class, sequence_type, "some_sequence"); if (ret) { fail("Failed to add a sequence to an event class"); goto end; } - ret = bt_ctf_stream_class_add_event_class(stream_class, event_class); + ret = bt_stream_class_add_event_class(stream_class, event_class); if (ret) { fail("Failed to add event class to stream class"); goto end; @@ -2174,59 +2174,59 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer, * We have defined a custom packet header field. We have to populate it * explicitly. */ - packet_header = bt_ctf_stream_get_packet_header(stream); + packet_header = bt_stream_get_packet_header(stream); if (!packet_header) { fail("Failed to get stream packet header"); goto end; } - integer = bt_ctf_field_structure_get_field(packet_header, + integer = bt_field_structure_get_field_by_name(packet_header, "custom_trace_packet_header_field"); if (!integer) { fail("Failed to retrieve custom_trace_packet_header_field"); goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(integer, 3487); + ret = bt_field_unsigned_integer_set_value(integer, 3487); if (ret) { fail("Failed to set custom_trace_packet_header_field value"); goto end; } bt_put(integer); - event = bt_ctf_event_create(event_class); + event = bt_event_create(event_class); if (!event) { fail("Failed to create event"); goto end; } - event_header = bt_ctf_event_get_header(event); + event_header = bt_event_get_header(event); if (!event_header) { fail("Failed to get event header"); goto end; } - integer = bt_ctf_field_structure_get_field(event_header, + integer = bt_field_structure_get_field_by_name(event_header, "seq_len"); if (!integer) { fail("Failed to get seq_len field from event header"); goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(integer, 2); + ret = bt_field_unsigned_integer_set_value(integer, 2); if (ret) { fail("Failed to set seq_len value in event header"); goto end; } /* Populate both sequence integer fields */ - sequence = bt_ctf_event_get_payload(event, "some_sequence"); + sequence = bt_event_get_payload(event, "some_sequence"); if (!sequence) { fail("Failed to retrieve sequence from event"); goto end; } - ret = bt_ctf_field_sequence_set_length(sequence, integer); + ret = bt_field_sequence_set_length(sequence, integer); if (ret) { fail("Failed to set sequence length"); goto end; @@ -2234,13 +2234,13 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer, bt_put(integer); for (i = 0; i < 2; i++) { - integer = bt_ctf_field_sequence_get_field(sequence, i); + integer = bt_field_sequence_get_field(sequence, i); if (ret) { fail("Failed to retrieve sequence element"); goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(integer, i); + ret = bt_field_unsigned_integer_set_value(integer, i); if (ret) { fail("Failed to set sequence element value"); goto end; @@ -2250,13 +2250,13 @@ void test_custom_event_header_stream(struct bt_ctf_writer *writer, integer = NULL; } - ret = bt_ctf_stream_append_event(stream, event); + ret = bt_stream_append_event(stream, event); if (ret) { fail("Failed to append event to stream"); goto end; } - ret = bt_ctf_stream_flush(stream); + ret = bt_stream_flush(stream); if (ret) { fail("Failed to flush custom_event_header stream"); } @@ -2279,63 +2279,63 @@ void test_instanciate_event_before_stream(struct bt_ctf_writer *writer, struct bt_ctf_clock *clock) { int ret = 0; - struct bt_ctf_stream_class *stream_class = NULL; - struct bt_ctf_stream *stream = NULL, + struct bt_stream_class *stream_class = NULL; + struct bt_stream *stream = NULL, *ret_stream = NULL; - struct bt_ctf_event_class *event_class = NULL; - struct bt_ctf_event *event = NULL; - struct bt_ctf_field_type *integer_type = NULL; - struct bt_ctf_field *integer = NULL; + struct bt_event_class *event_class = NULL; + struct bt_event *event = NULL; + struct bt_field_type *integer_type = NULL; + struct bt_field *integer = NULL; - stream_class = bt_ctf_stream_class_create("event_before_stream_test"); + stream_class = bt_stream_class_create("event_before_stream_test"); if (!stream_class) { diag("Failed to create stream class"); ret = -1; goto end; } - ret = bt_ctf_stream_class_set_clock(stream_class, clock); + ret = bt_stream_class_set_clock(stream_class, clock); if (ret) { diag("Failed to set stream class clock"); goto end; } - event_class = bt_ctf_event_class_create("some_event_class_name"); - integer_type = bt_ctf_field_type_integer_create(32); + event_class = bt_event_class_create("some_event_class_name"); + integer_type = bt_field_type_integer_create(32); if (!integer_type) { diag("Failed to create integer field type"); ret = -1; goto end; } - ret = bt_ctf_event_class_add_field(event_class, integer_type, + ret = bt_event_class_add_field(event_class, integer_type, "integer_field"); if (ret) { diag("Failed to add field to event class"); goto end; } - ret = bt_ctf_stream_class_add_event_class(stream_class, + ret = bt_stream_class_add_event_class(stream_class, event_class); if (ret) { diag("Failed to add event class to stream class"); } - event = bt_ctf_event_create(event_class); + event = bt_event_create(event_class); if (!event) { diag("Failed to create event"); ret = -1; goto end; } - integer = bt_ctf_event_get_payload_by_index(event, 0); + integer = bt_event_get_payload_by_index(event, 0); if (!integer) { diag("Failed to get integer field payload from event"); ret = -1; goto end; } - ret = bt_ctf_field_unsigned_integer_set_value(integer, 1234); + ret = bt_field_unsigned_integer_set_value(integer, 1234); if (ret) { diag("Failed to set integer field value"); goto end; @@ -2348,20 +2348,20 @@ void test_instanciate_event_before_stream(struct bt_ctf_writer *writer, goto end; } - ok(bt_ctf_event_get_stream(NULL) == NULL, - "bt_ctf_event_get_stream handles NULL correctly"); - ok(bt_ctf_event_get_stream(event) == NULL, - "bt_ctf_event_get_stream returns NULL on event which has not yet been appended to a stream"); + ok(bt_event_get_stream(NULL) == NULL, + "bt_event_get_stream handles NULL correctly"); + ok(bt_event_get_stream(event) == NULL, + "bt_event_get_stream returns NULL on event which has not yet been appended to a stream"); - ret = bt_ctf_stream_append_event(stream, event); + ret = bt_stream_append_event(stream, event); if (ret) { diag("Failed to append event to stream"); goto end; } - ret_stream = bt_ctf_event_get_stream(event); + ret_stream = bt_event_get_stream(event); ok(ret_stream == stream, - "bt_ctf_event_get_stream returns an event's stream after it has been appended"); + "bt_event_get_stream returns an event's stream after it has been appended"); end: ok(ret == 0, "Create an event before instanciating its associated stream"); @@ -2375,36 +2375,36 @@ end: } static -void append_existing_event_class(struct bt_ctf_stream_class *stream_class) +void append_existing_event_class(struct bt_stream_class *stream_class) { - struct bt_ctf_event_class *event_class; + struct bt_event_class *event_class; - event_class = bt_ctf_event_class_create("Simple Event"); + event_class = bt_event_class_create("Simple Event"); assert(event_class); - ok(bt_ctf_stream_class_add_event_class(stream_class, event_class) == 0, + ok(bt_stream_class_add_event_class(stream_class, event_class) == 0, "two event classes with the same name may cohabit within the same stream class"); bt_put(event_class); - event_class = bt_ctf_event_class_create("different name, ok"); + event_class = bt_event_class_create("different name, ok"); assert(event_class); - assert(!bt_ctf_event_class_set_id(event_class, 13)); - ok(bt_ctf_stream_class_add_event_class(stream_class, event_class), + assert(!bt_event_class_set_id(event_class, 13)); + ok(bt_stream_class_add_event_class(stream_class, event_class), "two event classes with the same ID cannot cohabit within the same stream class"); bt_put(event_class); } static -struct bt_ctf_event_class *create_minimal_event_class(void) +struct bt_event_class *create_minimal_event_class(void) { - struct bt_ctf_event_class *ec = NULL; - struct bt_ctf_field_type *int_ft = NULL; + struct bt_event_class *ec = NULL; + struct bt_field_type *int_ft = NULL; int ret; - int_ft = bt_ctf_field_type_integer_create(23); + int_ft = bt_field_type_integer_create(23); assert(int_ft); - ec = bt_ctf_event_class_create("minimal"); + ec = bt_event_class_create("minimal"); assert(ec); - ret = bt_ctf_event_class_add_field(ec, int_ft, "field"); + ret = bt_event_class_add_field(ec, int_ft, "field"); assert(!ret); BT_PUT(int_ft); @@ -2418,25 +2418,25 @@ void test_create_writer_vs_non_writer_mode(void) gchar *trace_path; const char *writer_stream_name = "writer stream instance"; struct bt_ctf_writer *writer = NULL; - struct bt_ctf_trace *writer_trace = NULL; - struct bt_ctf_stream_class *writer_sc = NULL; - struct bt_ctf_stream *writer_stream = NULL; - struct bt_ctf_stream *writer_stream2 = NULL; - struct bt_ctf_stream *packet_stream = NULL; - struct bt_ctf_trace *non_writer_trace = NULL; - struct bt_ctf_stream_class *non_writer_sc = NULL; - struct bt_ctf_stream *non_writer_stream = NULL; - struct bt_ctf_stream *non_writer_stream2 = NULL; - struct bt_ctf_event_class *writer_ec = NULL; - struct bt_ctf_event_class *non_writer_ec = NULL; - struct bt_ctf_event *event = NULL; - struct bt_ctf_event *event2 = NULL; - struct bt_ctf_field_type *empty_struct_ft = NULL; - struct bt_ctf_field *int_field = NULL; + struct bt_trace *writer_trace = NULL; + struct bt_stream_class *writer_sc = NULL; + struct bt_stream *writer_stream = NULL; + struct bt_stream *writer_stream2 = NULL; + struct bt_stream *packet_stream = NULL; + struct bt_trace *non_writer_trace = NULL; + struct bt_stream_class *non_writer_sc = NULL; + struct bt_stream *non_writer_stream = NULL; + struct bt_stream *non_writer_stream2 = NULL; + struct bt_event_class *writer_ec = NULL; + struct bt_event_class *non_writer_ec = NULL; + struct bt_event *event = NULL; + struct bt_event *event2 = NULL; + struct bt_field_type *empty_struct_ft = NULL; + struct bt_field *int_field = NULL; struct bt_ctf_clock *writer_clock = NULL; - struct bt_ctf_clock_class *non_writer_clock_class = NULL; - struct bt_ctf_packet *packet = NULL; - struct bt_ctf_packet *packet2 = NULL; + struct bt_clock_class *non_writer_clock_class = NULL; + struct bt_packet *packet = NULL; + struct bt_packet *packet2 = NULL; trace_path = g_build_filename(g_get_tmp_dir(), "ctfwriter_XXXXXX", NULL); if (!bt_mkdtemp(trace_path)) { @@ -2444,7 +2444,7 @@ void test_create_writer_vs_non_writer_mode(void) } /* Create empty structure field type (event header) */ - empty_struct_ft = bt_ctf_field_type_structure_create(); + empty_struct_ft = bt_field_type_structure_create(); assert(empty_struct_ft); /* Create writer, writer stream class, stream, and clock */ @@ -2454,138 +2454,138 @@ void test_create_writer_vs_non_writer_mode(void) assert(writer_clock); ret = bt_ctf_writer_add_clock(writer, writer_clock); assert(!ret); - ret = bt_ctf_writer_set_byte_order(writer, BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_ctf_writer_set_byte_order(writer, BT_BYTE_ORDER_LITTLE_ENDIAN); assert(!ret); writer_trace = bt_ctf_writer_get_trace(writer); ok(writer_trace, "bt_ctf_writer_get_trace() returns a trace"); - writer_sc = bt_ctf_stream_class_create("writer_sc"); + writer_sc = bt_stream_class_create("writer_sc"); assert(writer_sc); - ret = bt_ctf_stream_class_set_event_header_type(writer_sc, + ret = bt_stream_class_set_event_header_type(writer_sc, empty_struct_ft); assert(!ret); - ret = bt_ctf_stream_class_set_clock(writer_sc, writer_clock); + ret = bt_stream_class_set_clock(writer_sc, writer_clock); assert(!ret); - ret = bt_ctf_trace_add_stream_class(writer_trace, writer_sc); + ret = bt_trace_add_stream_class(writer_trace, writer_sc); assert(!ret); - writer_stream = bt_ctf_stream_create(writer_sc, writer_stream_name); + writer_stream = bt_stream_create(writer_sc, writer_stream_name); assert(writer_stream); - ok(!strcmp(bt_ctf_stream_get_name(writer_stream), writer_stream_name), - "bt_ctf_stream_get_name() returns the stream's name"); + ok(!strcmp(bt_stream_get_name(writer_stream), writer_stream_name), + "bt_stream_get_name() returns the stream's name"); /* Create non-writer trace, stream class, stream, and clock */ - non_writer_trace = bt_ctf_trace_create(); + non_writer_trace = bt_trace_create(); assert(non_writer_trace); - non_writer_sc = bt_ctf_stream_class_create("nonwriter_sc"); + non_writer_sc = bt_stream_class_create("nonwriter_sc"); assert(non_writer_sc); - ret = bt_ctf_stream_class_set_event_header_type(non_writer_sc, + ret = bt_stream_class_set_event_header_type(non_writer_sc, empty_struct_ft); assert(!ret); - ret = bt_ctf_stream_class_set_packet_context_type(non_writer_sc, NULL); + ret = bt_stream_class_set_packet_context_type(non_writer_sc, NULL); assert(!ret); - ret = bt_ctf_trace_add_stream_class(non_writer_trace, non_writer_sc); + ret = bt_trace_add_stream_class(non_writer_trace, non_writer_sc); assert(!ret); - non_writer_stream = bt_ctf_stream_create(non_writer_sc, NULL); + non_writer_stream = bt_stream_create(non_writer_sc, NULL); assert(non_writer_stream); non_writer_clock_class = - bt_ctf_clock_class_create("non_writer_clock_class", + bt_clock_class_create("non_writer_clock_class", 1000000000); assert(non_writer_clock_class); - ret = bt_ctf_trace_add_clock_class(non_writer_trace, + ret = bt_trace_add_clock_class(non_writer_trace, non_writer_clock_class); assert(!ret); /* Create event class and event */ writer_ec = create_minimal_event_class(); assert(writer_ec); - ret = bt_ctf_stream_class_add_event_class(writer_sc, writer_ec); + ret = bt_stream_class_add_event_class(writer_sc, writer_ec); assert(!ret); - event = bt_ctf_event_create(writer_ec); + event = bt_event_create(writer_ec); assert(event); - int_field = bt_ctf_event_get_payload_by_index(event, 0); + int_field = bt_event_get_payload_by_index(event, 0); assert(int_field); - bt_ctf_field_unsigned_integer_set_value(int_field, 17); + bt_field_unsigned_integer_set_value(int_field, 17); /* * Verify non-writer stream: it should be impossible to append * an event to it. */ - ok(bt_ctf_stream_append_event(non_writer_stream, event), - "bt_ctf_stream_append_event() fails with a non-writer stream"); + ok(bt_stream_append_event(non_writer_stream, event), + "bt_stream_append_event() fails with a non-writer stream"); /* * Verify writer stream: it should be possible to append an * event to it. */ - ok(!bt_ctf_stream_append_event(writer_stream, event), - "bt_ctf_stream_append_event() succeeds with a writer stream"); + ok(!bt_stream_append_event(writer_stream, event), + "bt_stream_append_event() succeeds with a writer stream"); /* * It should be possible to create a packet from a non-writer * stream, but not from a writer stream. */ - packet = bt_ctf_packet_create(writer_stream); - ok(!packet, "bt_ctf_packet_create() fails with a writer stream"); - packet = bt_ctf_packet_create(non_writer_stream); - ok(packet, "bt_ctf_packet_create() succeeds with a non-writer stream"); - packet_stream = bt_ctf_packet_get_stream(packet); + packet = bt_packet_create(writer_stream); + ok(!packet, "bt_packet_create() fails with a writer stream"); + packet = bt_packet_create(non_writer_stream); + ok(packet, "bt_packet_create() succeeds with a non-writer stream"); + packet_stream = bt_packet_get_stream(packet); ok(packet_stream == non_writer_stream, - "bt_ctf_packet_get_stream() returns the correct stream"); + "bt_packet_get_stream() returns the correct stream"); /* * It should not be possible to append an event associated to * a stream to a different stream. */ - writer_stream2 = bt_ctf_stream_create(writer_sc, "zoo"); + writer_stream2 = bt_stream_create(writer_sc, "zoo"); assert(writer_stream2); - ok(bt_ctf_stream_append_event(writer_stream2, event), - "bt_ctf_stream_append_event() fails with an event associated to another stream"); + ok(bt_stream_append_event(writer_stream2, event), + "bt_stream_append_event() fails with an event associated to another stream"); /* * It should not be possible to set the packet of an event * associated to a given stream to a packet associated with * a different stream. */ - ok(bt_ctf_event_set_packet(event, packet), - "bt_ctf_event_set_packet() fails with a packet not sharing the event's stream"); + ok(bt_event_set_packet(event, packet), + "bt_event_set_packet() fails with a packet not sharing the event's stream"); /* * It should be possible to set the packet of a fresh event, as * long as the originating stream classes are the same. */ - event2 = bt_ctf_event_create(writer_ec); + event2 = bt_event_create(writer_ec); assert(event2); - ok(bt_ctf_event_set_packet(event2, packet), - "bt_ctf_event_set_packet() fails when the event's and the packet's stream class differ"); + ok(bt_event_set_packet(event2, packet), + "bt_event_set_packet() fails when the event's and the packet's stream class differ"); non_writer_ec = create_minimal_event_class(); assert(non_writer_ec); - ret = bt_ctf_stream_class_add_event_class(non_writer_sc, non_writer_ec); + ret = bt_stream_class_add_event_class(non_writer_sc, non_writer_ec); assert(!ret); BT_PUT(event2); - event2 = bt_ctf_event_create(non_writer_ec); + event2 = bt_event_create(non_writer_ec); assert(event2); - ok(!bt_ctf_event_set_packet(event2, packet), - "bt_ctf_event_set_packet() succeeds when the event's and the packet's stream class are the same"); + ok(!bt_event_set_packet(event2, packet), + "bt_event_set_packet() succeeds when the event's and the packet's stream class are the same"); /* * It should be possible to set a packet created from the same * stream to an event with an existing packet. */ - packet2 = bt_ctf_packet_create(non_writer_stream); + packet2 = bt_packet_create(non_writer_stream); assert(packet2); - ok(!bt_ctf_event_set_packet(event2, packet2), - "bt_ctf_event_set_packet() succeeds when the event's current packet has the same stream"); + ok(!bt_event_set_packet(event2, packet2), + "bt_event_set_packet() succeeds when the event's current packet has the same stream"); BT_PUT(packet2); /* * It should not be possible to set a packet created from a * different stream to an event with an existing packet. */ - non_writer_stream2 = bt_ctf_stream_create(non_writer_sc, "rj45"); + non_writer_stream2 = bt_stream_create(non_writer_sc, "rj45"); assert(non_writer_stream2); - packet2 = bt_ctf_packet_create(non_writer_stream); + packet2 = bt_packet_create(non_writer_stream); assert(packet2); - ok(!bt_ctf_event_set_packet(event2, packet2), - "bt_ctf_event_set_packet() fails when the event's current packet does not have the same stream"); + ok(!bt_event_set_packet(event2, packet2), + "bt_event_set_packet() fails when the event's current packet does not have the same stream"); bt_put(writer); bt_put(writer_trace); @@ -2634,25 +2634,25 @@ void test_clock_utils(void) void test_set_clock_non_writer_stream_class(void) { struct bt_ctf_clock *clock; - struct bt_ctf_trace *trace; - struct bt_ctf_stream_class *sc; + struct bt_trace *trace; + struct bt_stream_class *sc; int ret; clock = bt_ctf_clock_create("the_clock"); assert(clock); - trace = bt_ctf_trace_create(); + trace = bt_trace_create(); assert(trace); - sc = bt_ctf_stream_class_create(NULL); + sc = bt_stream_class_create(NULL); assert(sc); - ret = bt_ctf_stream_class_set_clock(sc, clock); + ret = bt_stream_class_set_clock(sc, clock); assert(ret == 0); - ret = bt_ctf_trace_add_stream_class(trace, sc); + ret = bt_trace_add_stream_class(trace, sc); ok(ret < 0, - "bt_ctf_trace_add_stream_class() fails with a stream class with a registered clock"); + "bt_trace_add_stream_class() fails with a stream class with a registered clock"); bt_put(clock); bt_put(trace); @@ -2662,40 +2662,40 @@ void test_set_clock_non_writer_stream_class(void) static void test_static_trace(void) { - struct bt_ctf_trace *trace; - struct bt_ctf_stream_class *stream_class; - struct bt_ctf_stream_class *stream_class2; - struct bt_ctf_stream *stream; - struct bt_ctf_clock_class *clock_class; + struct bt_trace *trace; + struct bt_stream_class *stream_class; + struct bt_stream_class *stream_class2; + struct bt_stream *stream; + struct bt_clock_class *clock_class; int ret; - trace = bt_ctf_trace_create(); + trace = bt_trace_create(); assert(trace); - stream_class = bt_ctf_stream_class_create(NULL); + stream_class = bt_stream_class_create(NULL); assert(stream_class); - ret = bt_ctf_stream_class_set_packet_context_type(stream_class, NULL); + ret = bt_stream_class_set_packet_context_type(stream_class, NULL); assert(ret == 0); - ret = bt_ctf_trace_add_stream_class(trace, stream_class); + ret = bt_trace_add_stream_class(trace, stream_class); assert(ret == 0); - stream = bt_ctf_stream_create(stream_class, "hello"); - ok(stream, "bt_ctf_stream_create() succeeds with a non-static trace"); + stream = bt_stream_create(stream_class, "hello"); + ok(stream, "bt_stream_create() succeeds with a non-static trace"); bt_put(stream); - ok(!bt_ctf_trace_is_static(trace), - "bt_ctf_trace_is_static() returns the expected value"); - ok(bt_ctf_trace_set_is_static(trace) == 0, - "bt_ctf_trace_set_is_static() succeeds"); - ok(bt_ctf_trace_is_static(trace), - "bt_ctf_trace_is_static() returns the expected value"); - clock_class = bt_ctf_clock_class_create("yes", 1000000000); + ok(!bt_trace_is_static(trace), + "bt_trace_is_static() returns the expected value"); + ok(bt_trace_set_is_static(trace) == 0, + "bt_trace_set_is_static() succeeds"); + ok(bt_trace_is_static(trace), + "bt_trace_is_static() returns the expected value"); + clock_class = bt_clock_class_create("yes", 1000000000); assert(clock_class); - stream_class2 = bt_ctf_stream_class_create(NULL); + stream_class2 = bt_stream_class_create(NULL); assert(stream_class2); - ok(bt_ctf_trace_add_stream_class(trace, stream_class2), - "bt_ctf_trace_add_stream_class() fails with a static trace"); - ok(bt_ctf_trace_add_clock_class(trace, clock_class), - "bt_ctf_trace_add_clock_class() fails with a static trace"); - ok(!bt_ctf_stream_create(stream_class, "hello2"), - "bt_ctf_stream_create() fails with a static trace"); + ok(bt_trace_add_stream_class(trace, stream_class2), + "bt_trace_add_stream_class() fails with a static trace"); + ok(bt_trace_add_clock_class(trace, clock_class), + "bt_trace_add_clock_class() fails with a static trace"); + ok(!bt_stream_create(stream_class, "hello2"), + "bt_stream_create() fails with a static trace"); bt_put(trace); bt_put(stream_class); @@ -2704,13 +2704,13 @@ void test_static_trace(void) } static -void trace_is_static_listener(struct bt_ctf_trace *trace, void *data) +void trace_is_static_listener(struct bt_trace *trace, void *data) { *((int *) data) |= 1; } static -void trace_listener_removed(struct bt_ctf_trace *trace, void *data) +void trace_listener_removed(struct bt_trace *trace, void *data) { *((int *) data) |= 2; } @@ -2718,7 +2718,7 @@ void trace_listener_removed(struct bt_ctf_trace *trace, void *data) static void test_trace_is_static_listener(void) { - struct bt_ctf_trace *trace; + struct bt_trace *trace; int ret; int called1 = 0; int called2 = 0; @@ -2729,45 +2729,45 @@ void test_trace_is_static_listener(void) int listener3_id; int listener4_id; - trace = bt_ctf_trace_create(); + trace = bt_trace_create(); assert(trace); - ret = bt_ctf_trace_add_is_static_listener(NULL, + ret = bt_trace_add_is_static_listener(NULL, trace_is_static_listener, trace_listener_removed, &called1); - ok(ret < 0, "bt_ctf_trace_add_is_static_listener() handles NULL (trace)"); - ret = bt_ctf_trace_add_is_static_listener(trace, NULL, + ok(ret < 0, "bt_trace_add_is_static_listener() handles NULL (trace)"); + ret = bt_trace_add_is_static_listener(trace, NULL, trace_listener_removed, &called1); - ok(ret < 0, "bt_ctf_trace_add_is_static_listener() handles NULL (listener)"); - listener1_id = bt_ctf_trace_add_is_static_listener(trace, + ok(ret < 0, "bt_trace_add_is_static_listener() handles NULL (listener)"); + listener1_id = bt_trace_add_is_static_listener(trace, trace_is_static_listener, trace_listener_removed, &called1); - ok(listener1_id >= 0, "bt_ctf_trace_add_is_static_listener() succeeds (1)"); - listener2_id = bt_ctf_trace_add_is_static_listener(trace, + ok(listener1_id >= 0, "bt_trace_add_is_static_listener() succeeds (1)"); + listener2_id = bt_trace_add_is_static_listener(trace, trace_is_static_listener, trace_listener_removed, &called2); - ok(listener2_id >= 0, "bt_ctf_trace_add_is_static_listener() succeeds (2)"); - listener3_id = bt_ctf_trace_add_is_static_listener(trace, + ok(listener2_id >= 0, "bt_trace_add_is_static_listener() succeeds (2)"); + listener3_id = bt_trace_add_is_static_listener(trace, trace_is_static_listener, trace_listener_removed, &called3); - ok(listener3_id >= 0, "bt_ctf_trace_add_is_static_listener() succeeds (3)"); - ret = bt_ctf_trace_remove_is_static_listener(NULL, 0); - ok(ret < 0, "bt_ctf_trace_remove_is_static_listener() handles NULL (trace)"); - ret = bt_ctf_trace_remove_is_static_listener(trace, -2); - ok(ret < 0, "bt_ctf_trace_remove_is_static_listener() handles invalid ID (negative)"); - ret = bt_ctf_trace_remove_is_static_listener(trace, 77); - ok(ret < 0, "bt_ctf_trace_remove_is_static_listener() handles invalid ID (non existing)"); - ret = bt_ctf_trace_remove_is_static_listener(trace, listener2_id); - ok(ret == 0, "bt_ctf_trace_remove_is_static_listener() succeeds"); - ok(called2 == 2, "bt_ctf_trace_remove_is_static_listener() calls the remove listener"); - listener4_id = bt_ctf_trace_add_is_static_listener(trace, + ok(listener3_id >= 0, "bt_trace_add_is_static_listener() succeeds (3)"); + ret = bt_trace_remove_is_static_listener(NULL, 0); + ok(ret < 0, "bt_trace_remove_is_static_listener() handles NULL (trace)"); + ret = bt_trace_remove_is_static_listener(trace, -2); + ok(ret < 0, "bt_trace_remove_is_static_listener() handles invalid ID (negative)"); + ret = bt_trace_remove_is_static_listener(trace, 77); + ok(ret < 0, "bt_trace_remove_is_static_listener() handles invalid ID (non existing)"); + ret = bt_trace_remove_is_static_listener(trace, listener2_id); + ok(ret == 0, "bt_trace_remove_is_static_listener() succeeds"); + ok(called2 == 2, "bt_trace_remove_is_static_listener() calls the remove listener"); + listener4_id = bt_trace_add_is_static_listener(trace, trace_is_static_listener, NULL, &called4); - ok(listener4_id >= 0, "bt_ctf_trace_add_is_static_listener() succeeds (4)"); + ok(listener4_id >= 0, "bt_trace_add_is_static_listener() succeeds (4)"); ok(called1 == 0, "\"trace is static\" listener not called before the trace is made static (1)"); ok(called2 == 2, "\"trace is static\" listener not called before the trace is made static (2)"); ok(called3 == 0, "\"trace is static\" listener not called before the trace is made static (3)"); ok(called4 == 0, "\"trace is static\" listener not called before the trace is made static (4)"); - ret = bt_ctf_trace_set_is_static(trace); + ret = bt_trace_set_is_static(trace); assert(ret == 0); - ret = bt_ctf_trace_add_is_static_listener(trace, + ret = bt_trace_add_is_static_listener(trace, trace_is_static_listener, trace_listener_removed, &called1); ok(ret < 0, - "bt_ctf_trace_add_is_static_listener() fails when the trace is static"); + "bt_trace_add_is_static_listener() fails when the trace is static"); ok(called1 == 1, "\"trace is static\" listener called when the trace is made static (1)"); ok(called2 == 2, "\"trace is static\" listener not called when the trace is made static (2)"); ok(called3 == 1, "\"trace is static\" listener called when the trace is made static (3)"); @@ -2786,30 +2786,30 @@ void test_trace_is_static_listener(void) static void test_trace_uuid(void) { - struct bt_ctf_trace *trace; + struct bt_trace *trace; const unsigned char uuid[] = { 0x35, 0x92, 0x63, 0xab, 0xb4, 0xbe, 0x40, 0xb4, 0xb2, 0x60, 0xd3, 0xf1, 0x3b, 0xb0, 0xd8, 0x59, }; const unsigned char *ret_uuid; - trace = bt_ctf_trace_create(); + trace = bt_trace_create(); assert(trace); - ok(!bt_ctf_trace_get_uuid(NULL), - "bt_ctf_trace_get_uuid() handles NULL"); - ok(!bt_ctf_trace_get_uuid(trace), - "bt_ctf_trace_get_uuid() returns NULL initially"); - ok(bt_ctf_trace_set_uuid(NULL, uuid), - "bt_ctf_trace_set_uuid() handles NULL (trace)"); - ok(bt_ctf_trace_set_uuid(trace, NULL), - "bt_ctf_trace_set_uuid() handles NULL (UUID)"); - ok(bt_ctf_trace_set_uuid(trace, uuid) == 0, - "bt_ctf_trace_set_uuid() succeeds with a valid UUID"); - ret_uuid = bt_ctf_trace_get_uuid(trace); - ok(ret_uuid, "bt_ctf_trace_get_uuid() returns a UUID"); + ok(!bt_trace_get_uuid(NULL), + "bt_trace_get_uuid() handles NULL"); + ok(!bt_trace_get_uuid(trace), + "bt_trace_get_uuid() returns NULL initially"); + ok(bt_trace_set_uuid(NULL, uuid), + "bt_trace_set_uuid() handles NULL (trace)"); + ok(bt_trace_set_uuid(trace, NULL), + "bt_trace_set_uuid() handles NULL (UUID)"); + ok(bt_trace_set_uuid(trace, uuid) == 0, + "bt_trace_set_uuid() succeeds with a valid UUID"); + ret_uuid = bt_trace_get_uuid(trace); + ok(ret_uuid, "bt_trace_get_uuid() returns a UUID"); assert(ret_uuid); ok(memcmp(uuid, ret_uuid, 16) == 0, - "bt_ctf_trace_get_uuid() returns the expected UUID"); + "bt_trace_get_uuid() returns the expected UUID"); bt_put(trace); } @@ -2835,14 +2835,14 @@ int main(int argc, char **argv) struct bt_utsname name = {"GNU/Linux", "testhost", "4.4.0-87-generic", "#110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017", "x86_64"}; struct bt_ctf_clock *clock, *ret_clock; - struct bt_ctf_clock_class *ret_clock_class; - struct bt_ctf_stream_class *stream_class, *ret_stream_class; - struct bt_ctf_stream *stream1; - struct bt_ctf_stream *stream; + struct bt_clock_class *ret_clock_class; + struct bt_stream_class *stream_class, *ret_stream_class; + struct bt_stream *stream1; + struct bt_stream *stream; const char *ret_string; const unsigned char *ret_uuid; unsigned char tmp_uuid[16] = { 0 }; - struct bt_ctf_field_type *packet_context_type, + struct bt_field_type *packet_context_type, *packet_context_field_type, *packet_header_type, *packet_header_field_type, @@ -2850,8 +2850,8 @@ int main(int argc, char **argv) *stream_event_context_type, *ret_field_type, *event_header_field_type; - struct bt_ctf_field *packet_header, *packet_header_field; - struct bt_ctf_trace *trace; + struct bt_field *packet_header, *packet_header_field; + struct bt_trace *trace; int ret; int64_t ret_int64_t; struct bt_value *obj; @@ -2877,21 +2877,21 @@ int main(int argc, char **argv) metadata_path = g_build_filename(trace_path, "metadata", NULL); writer = bt_ctf_writer_create(trace_path); - ok(writer, "bt_ctf_create succeeds in creating trace with path"); + ok(writer, "bt_create succeeds in creating trace with path"); ok(!bt_ctf_writer_get_trace(NULL), "bt_ctf_writer_get_trace correctly handles NULL"); trace = bt_ctf_writer_get_trace(writer); - ok(bt_ctf_trace_set_native_byte_order(trace, BT_CTF_BYTE_ORDER_NATIVE), - "Cannot set a trace's byte order to BT_CTF_BYTE_ORDER_NATIVE"); - ok(bt_ctf_trace_set_native_byte_order(trace, BT_CTF_BYTE_ORDER_UNSPECIFIED), - "Cannot set a trace's byte order to BT_CTF_BYTE_ORDER_UNSPECIFIED"); + ok(bt_trace_set_native_byte_order(trace, BT_BYTE_ORDER_NATIVE), + "Cannot set a trace's byte order to BT_BYTE_ORDER_NATIVE"); + ok(bt_trace_set_native_byte_order(trace, BT_BYTE_ORDER_UNSPECIFIED), + "Cannot set a trace's byte order to BT_BYTE_ORDER_UNSPECIFIED"); ok(trace, - "bt_ctf_writer_get_trace returns a bt_ctf_trace object"); - ok(bt_ctf_trace_set_native_byte_order(trace, BT_CTF_BYTE_ORDER_BIG_ENDIAN) == 0, + "bt_ctf_writer_get_trace returns a bt_trace object"); + ok(bt_trace_set_native_byte_order(trace, BT_BYTE_ORDER_BIG_ENDIAN) == 0, "Set a trace's byte order to big endian"); - ok(bt_ctf_trace_get_native_byte_order(trace) == BT_CTF_BYTE_ORDER_BIG_ENDIAN, - "bt_ctf_trace_get_native_byte_order returns a correct endianness"); + ok(bt_trace_get_native_byte_order(trace) == BT_BYTE_ORDER_BIG_ENDIAN, + "bt_trace_get_native_byte_order returns a correct endianness"); /* Add environment context to the trace */ ok(bt_ctf_writer_add_environment_field(writer, "host", name.nodename) == 0, @@ -2907,117 +2907,117 @@ int main(int argc, char **argv) NULL), "bt_ctf_writer_add_environment_field error with NULL field value"); - /* Test bt_ctf_trace_set_environment_field with an integer object */ + /* Test bt_trace_set_environment_field with an integer object */ obj = bt_value_integer_create_init(23); assert(obj); - ok(bt_ctf_trace_set_environment_field(NULL, "test_env_int_obj", obj), - "bt_ctf_trace_set_environment_field handles a NULL trace correctly"); - ok(bt_ctf_trace_set_environment_field(trace, NULL, obj), - "bt_ctf_trace_set_environment_field handles a NULL name correctly"); - ok(bt_ctf_trace_set_environment_field(trace, "test_env_int_obj", NULL), - "bt_ctf_trace_set_environment_field handles a NULL value correctly"); - ok(!bt_ctf_trace_set_environment_field(trace, "test_env_int_obj", obj), - "bt_ctf_trace_set_environment_field succeeds in adding an integer object"); + ok(bt_trace_set_environment_field(NULL, "test_env_int_obj", obj), + "bt_trace_set_environment_field handles a NULL trace correctly"); + ok(bt_trace_set_environment_field(trace, NULL, obj), + "bt_trace_set_environment_field handles a NULL name correctly"); + ok(bt_trace_set_environment_field(trace, "test_env_int_obj", NULL), + "bt_trace_set_environment_field handles a NULL value correctly"); + ok(!bt_trace_set_environment_field(trace, "test_env_int_obj", obj), + "bt_trace_set_environment_field succeeds in adding an integer object"); BT_PUT(obj); - /* Test bt_ctf_trace_set_environment_field with a string object */ + /* Test bt_trace_set_environment_field with a string object */ obj = bt_value_string_create_init("the value"); assert(obj); - ok(!bt_ctf_trace_set_environment_field(trace, "test_env_str_obj", obj), - "bt_ctf_trace_set_environment_field succeeds in adding a string object"); + ok(!bt_trace_set_environment_field(trace, "test_env_str_obj", obj), + "bt_trace_set_environment_field succeeds in adding a string object"); BT_PUT(obj); - /* Test bt_ctf_trace_set_environment_field_integer */ - ok(bt_ctf_trace_set_environment_field_integer(NULL, "test_env_int", + /* Test bt_trace_set_environment_field_integer */ + ok(bt_trace_set_environment_field_integer(NULL, "test_env_int", -194875), - "bt_ctf_trace_set_environment_field_integer handles a NULL trace correctly"); - ok(bt_ctf_trace_set_environment_field_integer(trace, NULL, -194875), - "bt_ctf_trace_set_environment_field_integer handles a NULL name correctly"); - ok(!bt_ctf_trace_set_environment_field_integer(trace, "test_env_int", + "bt_trace_set_environment_field_integer handles a NULL trace correctly"); + ok(bt_trace_set_environment_field_integer(trace, NULL, -194875), + "bt_trace_set_environment_field_integer handles a NULL name correctly"); + ok(!bt_trace_set_environment_field_integer(trace, "test_env_int", -164973), - "bt_ctf_trace_set_environment_field_integer succeeds"); + "bt_trace_set_environment_field_integer succeeds"); - /* Test bt_ctf_trace_set_environment_field_string */ - ok(bt_ctf_trace_set_environment_field_string(NULL, "test_env_str", + /* Test bt_trace_set_environment_field_string */ + ok(bt_trace_set_environment_field_string(NULL, "test_env_str", "yeah"), - "bt_ctf_trace_set_environment_field_string handles a NULL trace correctly"); - ok(bt_ctf_trace_set_environment_field_string(trace, NULL, "yeah"), - "bt_ctf_trace_set_environment_field_string handles a NULL name correctly"); - ok(bt_ctf_trace_set_environment_field_string(trace, "test_env_str", + "bt_trace_set_environment_field_string handles a NULL trace correctly"); + ok(bt_trace_set_environment_field_string(trace, NULL, "yeah"), + "bt_trace_set_environment_field_string handles a NULL name correctly"); + ok(bt_trace_set_environment_field_string(trace, "test_env_str", NULL), - "bt_ctf_trace_set_environment_field_string handles a NULL value correctly"); - ok(!bt_ctf_trace_set_environment_field_string(trace, "test_env_str", + "bt_trace_set_environment_field_string handles a NULL value correctly"); + ok(!bt_trace_set_environment_field_string(trace, "test_env_str", "oh yeah"), - "bt_ctf_trace_set_environment_field_string succeeds"); - - /* Test bt_ctf_trace_get_environment_field_count */ - ok(bt_ctf_trace_get_environment_field_count(NULL) < 0, - "bt_ctf_trace_get_environment_field_count handles a NULL trace correctly"); - ok(bt_ctf_trace_get_environment_field_count(trace) == 5, - "bt_ctf_trace_get_environment_field_count returns a correct number of environment fields"); - - /* Test bt_ctf_trace_get_environment_field_name */ - ok(bt_ctf_trace_get_environment_field_name_by_index(NULL, 0) == NULL, - "bt_ctf_trace_get_environment_field_name handles a NULL trace correctly"); - ok(bt_ctf_trace_get_environment_field_name_by_index(trace, 5) == NULL, - "bt_ctf_trace_get_environment_field_name handles an invalid index correctly (too large)"); - ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 0); + "bt_trace_set_environment_field_string succeeds"); + + /* Test bt_trace_get_environment_field_count */ + ok(bt_trace_get_environment_field_count(NULL) < 0, + "bt_trace_get_environment_field_count handles a NULL trace correctly"); + ok(bt_trace_get_environment_field_count(trace) == 5, + "bt_trace_get_environment_field_count returns a correct number of environment fields"); + + /* Test bt_trace_get_environment_field_name */ + ok(bt_trace_get_environment_field_name_by_index(NULL, 0) == NULL, + "bt_trace_get_environment_field_name handles a NULL trace correctly"); + ok(bt_trace_get_environment_field_name_by_index(trace, 5) == NULL, + "bt_trace_get_environment_field_name handles an invalid index correctly (too large)"); + ret_string = bt_trace_get_environment_field_name_by_index(trace, 0); ok(ret_string && !strcmp(ret_string, "host"), - "bt_ctf_trace_get_environment_field_name returns a correct field name"); - ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 1); + "bt_trace_get_environment_field_name returns a correct field name"); + ret_string = bt_trace_get_environment_field_name_by_index(trace, 1); ok(ret_string && !strcmp(ret_string, "test_env_int_obj"), - "bt_ctf_trace_get_environment_field_name returns a correct field name"); - ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 2); + "bt_trace_get_environment_field_name returns a correct field name"); + ret_string = bt_trace_get_environment_field_name_by_index(trace, 2); ok(ret_string && !strcmp(ret_string, "test_env_str_obj"), - "bt_ctf_trace_get_environment_field_name returns a correct field name"); - ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 3); + "bt_trace_get_environment_field_name returns a correct field name"); + ret_string = bt_trace_get_environment_field_name_by_index(trace, 3); ok(ret_string && !strcmp(ret_string, "test_env_int"), - "bt_ctf_trace_get_environment_field_name returns a correct field name"); - ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 4); + "bt_trace_get_environment_field_name returns a correct field name"); + ret_string = bt_trace_get_environment_field_name_by_index(trace, 4); ok(ret_string && !strcmp(ret_string, "test_env_str"), - "bt_ctf_trace_get_environment_field_name returns a correct field name"); - - /* Test bt_ctf_trace_get_environment_field_value */ - ok(bt_ctf_trace_get_environment_field_value_by_index(NULL, 0) == NULL, - "bt_ctf_trace_get_environment_field_value handles a NULL trace correctly"); - ok(bt_ctf_trace_get_environment_field_value_by_index(trace, 5) == NULL, - "bt_ctf_trace_get_environment_field_value handles an invalid index correctly (too large)"); - obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 1); + "bt_trace_get_environment_field_name returns a correct field name"); + + /* Test bt_trace_get_environment_field_value */ + ok(bt_trace_get_environment_field_value_by_index(NULL, 0) == NULL, + "bt_trace_get_environment_field_value handles a NULL trace correctly"); + ok(bt_trace_get_environment_field_value_by_index(trace, 5) == NULL, + "bt_trace_get_environment_field_value handles an invalid index correctly (too large)"); + obj = bt_trace_get_environment_field_value_by_index(trace, 1); ret = bt_value_integer_get(obj, &ret_int64_t); ok(!ret && ret_int64_t == 23, - "bt_ctf_trace_get_environment_field_value succeeds in getting an integer value"); + "bt_trace_get_environment_field_value succeeds in getting an integer value"); BT_PUT(obj); - obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 2); + obj = bt_trace_get_environment_field_value_by_index(trace, 2); ret = bt_value_string_get(obj, &ret_string); ok(!ret && ret_string && !strcmp(ret_string, "the value"), - "bt_ctf_trace_get_environment_field_value succeeds in getting a string value"); + "bt_trace_get_environment_field_value succeeds in getting a string value"); BT_PUT(obj); - /* Test bt_ctf_trace_get_environment_field_value_by_name */ - ok(!bt_ctf_trace_get_environment_field_value_by_name(NULL, + /* Test bt_trace_get_environment_field_value_by_name */ + ok(!bt_trace_get_environment_field_value_by_name(NULL, "test_env_str"), - "bt_ctf_trace_get_environment_field_value_by_name handles a NULL trace correctly"); - ok(!bt_ctf_trace_get_environment_field_value_by_name(trace, NULL), - "bt_ctf_trace_get_environment_field_value_by_name handles a NULL name correctly"); - ok(!bt_ctf_trace_get_environment_field_value_by_name(trace, "oh oh"), - "bt_ctf_trace_get_environment_field_value_by_name returns NULL or an unknown field name"); - obj = bt_ctf_trace_get_environment_field_value_by_name(trace, + "bt_trace_get_environment_field_value_by_name handles a NULL trace correctly"); + ok(!bt_trace_get_environment_field_value_by_name(trace, NULL), + "bt_trace_get_environment_field_value_by_name handles a NULL name correctly"); + ok(!bt_trace_get_environment_field_value_by_name(trace, "oh oh"), + "bt_trace_get_environment_field_value_by_name returns NULL or an unknown field name"); + obj = bt_trace_get_environment_field_value_by_name(trace, "test_env_str"); ret = bt_value_string_get(obj, &ret_string); ok(!ret && ret_string && !strcmp(ret_string, "oh yeah"), - "bt_ctf_trace_get_environment_field_value_by_name succeeds in getting an existing field"); + "bt_trace_get_environment_field_value_by_name succeeds in getting an existing field"); BT_PUT(obj); /* Test environment field replacement */ - ok(!bt_ctf_trace_set_environment_field_integer(trace, "test_env_int", + ok(!bt_trace_set_environment_field_integer(trace, "test_env_int", 654321), - "bt_ctf_trace_set_environment_field_integer succeeds with an existing name"); - ok(bt_ctf_trace_get_environment_field_count(trace) == 5, - "bt_ctf_trace_set_environment_field_integer with an existing key does not increase the environment size"); - obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 3); + "bt_trace_set_environment_field_integer succeeds with an existing name"); + ok(bt_trace_get_environment_field_count(trace) == 5, + "bt_trace_set_environment_field_integer with an existing key does not increase the environment size"); + obj = bt_trace_get_environment_field_value_by_index(trace, 3); ret = bt_value_integer_get(obj, &ret_int64_t); ok(!ret && ret_int64_t == 654321, - "bt_ctf_trace_get_environment_field_value successfully replaces an existing field"); + "bt_trace_get_environment_field_value successfully replaces an existing field"); BT_PUT(obj); ok(bt_ctf_writer_add_environment_field(writer, "sysname", name.sysname) @@ -3161,25 +3161,25 @@ int main(int argc, char **argv) "bt_ctf_clock_get_uuid returns the correct UUID after setting a new one"); /* Define a stream class */ - stream_class = bt_ctf_stream_class_create("test_stream"); + stream_class = bt_stream_class_create("test_stream"); - ok(bt_ctf_stream_class_get_name(NULL) == NULL, - "bt_ctf_stream_class_get_name handles NULL correctly"); - ret_string = bt_ctf_stream_class_get_name(stream_class); + ok(bt_stream_class_get_name(NULL) == NULL, + "bt_stream_class_get_name handles NULL correctly"); + ret_string = bt_stream_class_get_name(stream_class); ok(ret_string && !strcmp(ret_string, "test_stream"), - "bt_ctf_stream_class_get_name returns a correct stream class name"); + "bt_stream_class_get_name returns a correct stream class name"); - ok(bt_ctf_stream_class_get_clock(stream_class) == NULL, - "bt_ctf_stream_class_get_clock returns NULL when a clock was not set"); - ok(bt_ctf_stream_class_get_clock(NULL) == NULL, - "bt_ctf_stream_class_get_clock handles NULL correctly"); + ok(bt_stream_class_get_clock(stream_class) == NULL, + "bt_stream_class_get_clock returns NULL when a clock was not set"); + ok(bt_stream_class_get_clock(NULL) == NULL, + "bt_stream_class_get_clock handles NULL correctly"); ok(stream_class, "Create stream class"); - ok(bt_ctf_stream_class_set_clock(stream_class, clock) == 0, + ok(bt_stream_class_set_clock(stream_class, clock) == 0, "Set a stream class' clock"); - ret_clock = bt_ctf_stream_class_get_clock(stream_class); + ret_clock = bt_stream_class_get_clock(stream_class); ok(ret_clock == clock, - "bt_ctf_stream_class_get_clock returns a correct clock"); + "bt_stream_class_get_clock returns a correct clock"); bt_put(ret_clock); /* Test the event fields and event types APIs */ @@ -3188,136 +3188,136 @@ int main(int argc, char **argv) /* Test fields copying */ field_copy_tests(); - ok(bt_ctf_stream_class_get_id(stream_class) < 0, - "bt_ctf_stream_class_get_id returns an error when no id is set"); - ok(bt_ctf_stream_class_get_id(NULL) < 0, - "bt_ctf_stream_class_get_id handles NULL correctly"); - ok(bt_ctf_stream_class_set_id(NULL, 123) < 0, - "bt_ctf_stream_class_set_id handles NULL correctly"); - ok(bt_ctf_stream_class_set_id(stream_class, 123) == 0, + ok(bt_stream_class_get_id(stream_class) < 0, + "bt_stream_class_get_id returns an error when no id is set"); + ok(bt_stream_class_get_id(NULL) < 0, + "bt_stream_class_get_id handles NULL correctly"); + ok(bt_stream_class_set_id(NULL, 123) < 0, + "bt_stream_class_set_id handles NULL correctly"); + ok(bt_stream_class_set_id(stream_class, 123) == 0, "Set an stream class' id"); - ok(bt_ctf_stream_class_get_id(stream_class) == 123, - "bt_ctf_stream_class_get_id returns the correct value"); + ok(bt_stream_class_get_id(stream_class) == 123, + "bt_stream_class_get_id returns the correct value"); /* Validate default event header fields */ - ok(bt_ctf_stream_class_get_event_header_type(NULL) == NULL, - "bt_ctf_stream_class_get_event_header_type handles NULL correctly"); - ret_field_type = bt_ctf_stream_class_get_event_header_type( + ok(bt_stream_class_get_event_header_type(NULL) == NULL, + "bt_stream_class_get_event_header_type handles NULL correctly"); + ret_field_type = bt_stream_class_get_event_header_type( stream_class); ok(ret_field_type, - "bt_ctf_stream_class_get_event_header_type returns an event header type"); - ok(bt_ctf_field_type_get_type_id(ret_field_type) == BT_CTF_FIELD_TYPE_ID_STRUCT, + "bt_stream_class_get_event_header_type returns an event header type"); + ok(bt_field_type_get_type_id(ret_field_type) == BT_FIELD_TYPE_ID_STRUCT, "Default event header type is a structure"); event_header_field_type = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( ret_field_type, "id"); ok(event_header_field_type, "Default event header type contains an \"id\" field"); - ok(bt_ctf_field_type_get_type_id( - event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER, + ok(bt_field_type_get_type_id( + event_header_field_type) == BT_FIELD_TYPE_ID_INTEGER, "Default event header \"id\" field is an integer"); bt_put(event_header_field_type); event_header_field_type = - bt_ctf_field_type_structure_get_field_type_by_name( + bt_field_type_structure_get_field_type_by_name( ret_field_type, "timestamp"); ok(event_header_field_type, "Default event header type contains a \"timestamp\" field"); - ok(bt_ctf_field_type_get_type_id( - event_header_field_type) == BT_CTF_FIELD_TYPE_ID_INTEGER, + ok(bt_field_type_get_type_id( + event_header_field_type) == BT_FIELD_TYPE_ID_INTEGER, "Default event header \"timestamp\" field is an integer"); bt_put(event_header_field_type); bt_put(ret_field_type); /* Add a custom trace packet header field */ - ok(bt_ctf_trace_get_packet_header_type(NULL) == NULL, - "bt_ctf_trace_get_packet_header_type handles NULL correctly"); - packet_header_type = bt_ctf_trace_get_packet_header_type(trace); + ok(bt_trace_get_packet_header_type(NULL) == NULL, + "bt_trace_get_packet_header_type handles NULL correctly"); + packet_header_type = bt_trace_get_packet_header_type(trace); ok(packet_header_type, - "bt_ctf_trace_get_packet_header_type returns a packet header"); - ok(bt_ctf_field_type_get_type_id(packet_header_type) == BT_CTF_FIELD_TYPE_ID_STRUCT, - "bt_ctf_trace_get_packet_header_type returns a packet header of type struct"); - ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name( + "bt_trace_get_packet_header_type returns a packet header"); + ok(bt_field_type_get_type_id(packet_header_type) == BT_FIELD_TYPE_ID_STRUCT, + "bt_trace_get_packet_header_type returns a packet header of type struct"); + ret_field_type = bt_field_type_structure_get_field_type_by_name( packet_header_type, "magic"); ok(ret_field_type, "Default packet header type contains a \"magic\" field"); bt_put(ret_field_type); - ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name( + ret_field_type = bt_field_type_structure_get_field_type_by_name( packet_header_type, "uuid"); ok(ret_field_type, "Default packet header type contains a \"uuid\" field"); bt_put(ret_field_type); - ret_field_type = bt_ctf_field_type_structure_get_field_type_by_name( + ret_field_type = bt_field_type_structure_get_field_type_by_name( packet_header_type, "stream_id"); ok(ret_field_type, "Default packet header type contains a \"stream_id\" field"); bt_put(ret_field_type); - packet_header_field_type = bt_ctf_field_type_integer_create(22); - ok(!bt_ctf_field_type_structure_add_field(packet_header_type, + packet_header_field_type = bt_field_type_integer_create(22); + ok(!bt_field_type_structure_add_field(packet_header_type, packet_header_field_type, "custom_trace_packet_header_field"), "Added a custom trace packet header field successfully"); - ok(bt_ctf_trace_set_packet_header_type(NULL, packet_header_type) < 0, - "bt_ctf_trace_set_packet_header_type handles a NULL trace correctly"); - ok(!bt_ctf_trace_set_packet_header_type(trace, packet_header_type), + ok(bt_trace_set_packet_header_type(NULL, packet_header_type) < 0, + "bt_trace_set_packet_header_type handles a NULL trace correctly"); + ok(!bt_trace_set_packet_header_type(trace, packet_header_type), "Set a trace packet_header_type successfully"); - ok(bt_ctf_stream_class_get_packet_context_type(NULL) == NULL, - "bt_ctf_stream_class_get_packet_context_type handles NULL correctly"); + ok(bt_stream_class_get_packet_context_type(NULL) == NULL, + "bt_stream_class_get_packet_context_type handles NULL correctly"); /* Add a custom field to the stream class' packet context */ - packet_context_type = bt_ctf_stream_class_get_packet_context_type(stream_class); + packet_context_type = bt_stream_class_get_packet_context_type(stream_class); ok(packet_context_type, - "bt_ctf_stream_class_get_packet_context_type returns a packet context type."); - ok(bt_ctf_field_type_get_type_id(packet_context_type) == BT_CTF_FIELD_TYPE_ID_STRUCT, + "bt_stream_class_get_packet_context_type returns a packet context type."); + ok(bt_field_type_get_type_id(packet_context_type) == BT_FIELD_TYPE_ID_STRUCT, "Packet context is a structure"); - ok(bt_ctf_stream_class_set_packet_context_type(NULL, packet_context_type), - "bt_ctf_stream_class_set_packet_context_type handles a NULL stream class correctly"); + ok(bt_stream_class_set_packet_context_type(NULL, packet_context_type), + "bt_stream_class_set_packet_context_type handles a NULL stream class correctly"); - integer_type = bt_ctf_field_type_integer_create(32); - ok(bt_ctf_stream_class_set_packet_context_type(stream_class, + integer_type = bt_field_type_integer_create(32); + ok(bt_stream_class_set_packet_context_type(stream_class, integer_type) < 0, - "bt_ctf_stream_class_set_packet_context_type rejects a packet context that is not a structure"); + "bt_stream_class_set_packet_context_type rejects a packet context that is not a structure"); /* Create a "uint5_t" equivalent custom packet context field */ - packet_context_field_type = bt_ctf_field_type_integer_create(5); + packet_context_field_type = bt_field_type_integer_create(5); - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, packet_context_field_type, "custom_packet_context_field"); ok(ret == 0, "Packet context field added successfully"); /* Define a stream event context containing a my_integer field. */ - ok(bt_ctf_stream_class_get_event_context_type(NULL) == NULL, - "bt_ctf_stream_class_get_event_context_type handles NULL correctly"); - stream_event_context_type = bt_ctf_field_type_structure_create(); - bt_ctf_field_type_structure_add_field(stream_event_context_type, + ok(bt_stream_class_get_event_context_type(NULL) == NULL, + "bt_stream_class_get_event_context_type handles NULL correctly"); + stream_event_context_type = bt_field_type_structure_create(); + bt_field_type_structure_add_field(stream_event_context_type, integer_type, "common_event_context"); - ok(bt_ctf_stream_class_set_event_context_type(NULL, + ok(bt_stream_class_set_event_context_type(NULL, stream_event_context_type) < 0, - "bt_ctf_stream_class_set_event_context_type handles a NULL stream_class correctly"); - ok(bt_ctf_stream_class_set_event_context_type(stream_class, + "bt_stream_class_set_event_context_type handles a NULL stream_class correctly"); + ok(bt_stream_class_set_event_context_type(stream_class, integer_type) < 0, - "bt_ctf_stream_class_set_event_context_type validates that the event context os a structure"); + "bt_stream_class_set_event_context_type validates that the event context os a structure"); - ok(bt_ctf_stream_class_set_event_context_type( + ok(bt_stream_class_set_event_context_type( stream_class, stream_event_context_type) == 0, "Set a new stream event context type"); - ret_field_type = bt_ctf_stream_class_get_event_context_type( + ret_field_type = bt_stream_class_get_event_context_type( stream_class); ok(ret_field_type == stream_event_context_type, - "bt_ctf_stream_class_get_event_context_type returns the correct field type."); + "bt_stream_class_get_event_context_type returns the correct field type."); bt_put(ret_field_type); /* Instantiate a stream and append events */ ret = bt_ctf_writer_add_clock(writer, clock); assert(ret == 0); - ok(bt_ctf_trace_get_stream_count(trace) == 0, - "bt_ctf_trace_get_stream_count() succeeds and returns the correct value (0)"); + ok(bt_trace_get_stream_count(trace) == 0, + "bt_trace_get_stream_count() succeeds and returns the correct value (0)"); stream1 = bt_ctf_writer_create_stream(writer, stream_class); ok(stream1, "Instanciate a stream class from writer"); - ok(bt_ctf_trace_get_stream_count(trace) == 1, - "bt_ctf_trace_get_stream_count() succeeds and returns the correct value (1)"); - stream = bt_ctf_trace_get_stream_by_index(trace, 0); + ok(bt_trace_get_stream_count(trace) == 1, + "bt_trace_get_stream_count() succeeds and returns the correct value (1)"); + stream = bt_trace_get_stream_by_index(trace, 0); ok(stream == stream1, - "bt_ctf_trace_get_stream_by_index() succeeds and returns the correct value"); + "bt_trace_get_stream_by_index() succeeds and returns the correct value"); BT_PUT(stream); /* @@ -3325,38 +3325,38 @@ int main(int argc, char **argv) * class to the writer's trace, thus registering the stream * class's clock to the trace. */ - ok(bt_ctf_trace_get_clock_class_count(NULL) < 0, - "bt_ctf_trace_get_clock_class_count correctly handles NULL"); - ok(bt_ctf_trace_get_clock_class_count(trace) == 1, - "bt_ctf_trace_get_clock_class_count returns the correct number of clocks"); - ok(!bt_ctf_trace_get_clock_class_by_index(NULL, 0), - "bt_ctf_trace_get_clock_class correctly handles NULL"); - ok(!bt_ctf_trace_get_clock_class_by_index(trace, 1), - "bt_ctf_trace_get_clock_class correctly handles out of bound accesses"); - ret_clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0); - ok(strcmp(bt_ctf_clock_class_get_name(ret_clock_class), + ok(bt_trace_get_clock_class_count(NULL) < 0, + "bt_trace_get_clock_class_count correctly handles NULL"); + ok(bt_trace_get_clock_class_count(trace) == 1, + "bt_trace_get_clock_class_count returns the correct number of clocks"); + ok(!bt_trace_get_clock_class_by_index(NULL, 0), + "bt_trace_get_clock_class correctly handles NULL"); + ok(!bt_trace_get_clock_class_by_index(trace, 1), + "bt_trace_get_clock_class correctly handles out of bound accesses"); + ret_clock_class = bt_trace_get_clock_class_by_index(trace, 0); + ok(strcmp(bt_clock_class_get_name(ret_clock_class), bt_ctf_clock_get_name(clock)) == 0, - "bt_ctf_trace_get_clock_class returns the right clock instance"); + "bt_trace_get_clock_class returns the right clock instance"); bt_put(ret_clock_class); - ok(!bt_ctf_trace_get_clock_class_by_name(trace, NULL), - "bt_ctf_trace_get_clock_class_by_name correctly handles NULL (trace)"); - ok(!bt_ctf_trace_get_clock_class_by_name(NULL, clock_name), - "bt_ctf_trace_get_clock_by_name correctly handles NULL (clock name)"); - ok(!bt_ctf_trace_get_clock_class_by_name(NULL, NULL), - "bt_ctf_trace_get_clock_by_name correctly handles NULL (both)"); - ret_clock_class = bt_ctf_trace_get_clock_class_by_name(trace, clock_name); - ok(strcmp(bt_ctf_clock_class_get_name(ret_clock_class), + ok(!bt_trace_get_clock_class_by_name(trace, NULL), + "bt_trace_get_clock_class_by_name correctly handles NULL (trace)"); + ok(!bt_trace_get_clock_class_by_name(NULL, clock_name), + "bt_trace_get_clock_by_name correctly handles NULL (clock name)"); + ok(!bt_trace_get_clock_class_by_name(NULL, NULL), + "bt_trace_get_clock_by_name correctly handles NULL (both)"); + ret_clock_class = bt_trace_get_clock_class_by_name(trace, clock_name); + ok(strcmp(bt_clock_class_get_name(ret_clock_class), bt_ctf_clock_get_name(clock)) == 0, - "bt_ctf_trace_get_clock_class returns the right clock instance"); + "bt_trace_get_clock_class returns the right clock instance"); bt_put(ret_clock_class); - ok(!bt_ctf_trace_get_clock_class_by_name(trace, "random"), - "bt_ctf_trace_get_clock_by_name fails when the requested clock doesn't exist"); + ok(!bt_trace_get_clock_class_by_name(trace, "random"), + "bt_trace_get_clock_by_name fails when the requested clock doesn't exist"); - ok(bt_ctf_stream_get_class(NULL) == NULL, - "bt_ctf_stream_get_class correctly handles NULL"); - ret_stream_class = bt_ctf_stream_get_class(stream1); + ok(bt_stream_get_class(NULL) == NULL, + "bt_stream_get_class correctly handles NULL"); + ret_stream_class = bt_stream_get_class(stream1); ok(ret_stream_class, - "bt_ctf_stream_get_class returns a stream class"); + "bt_stream_get_class returns a stream class"); ok(ret_stream_class == stream_class, "Returned stream class is of the correct type"); @@ -3368,20 +3368,20 @@ int main(int argc, char **argv) BT_PUT(packet_header_type); BT_PUT(packet_context_type); BT_PUT(stream_event_context_type); - packet_header_type = bt_ctf_trace_get_packet_header_type(trace); + packet_header_type = bt_trace_get_packet_header_type(trace); assert(packet_header_type); packet_context_type = - bt_ctf_stream_class_get_packet_context_type(stream_class); + bt_stream_class_get_packet_context_type(stream_class); assert(packet_context_type); stream_event_context_type = - bt_ctf_stream_class_get_event_context_type(stream_class); + bt_stream_class_get_event_context_type(stream_class); assert(stream_event_context_type); /* * Try to modify the packet context type after a stream has been * created. */ - ret = bt_ctf_field_type_structure_add_field(packet_header_type, + ret = bt_field_type_structure_add_field(packet_header_type, packet_header_field_type, "should_fail"); ok(ret < 0, "Trace packet header type can't be modified once a stream has been instanciated"); @@ -3390,7 +3390,7 @@ int main(int argc, char **argv) * Try to modify the packet context type after a stream has been * created. */ - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, packet_context_field_type, "should_fail"); ok(ret < 0, "Packet context type can't be modified once a stream has been instanciated"); @@ -3399,41 +3399,41 @@ int main(int argc, char **argv) * Try to modify the stream event context type after a stream has been * created. */ - ret = bt_ctf_field_type_structure_add_field(stream_event_context_type, + ret = bt_field_type_structure_add_field(stream_event_context_type, integer_type, "should_fail"); ok(ret < 0, "Stream event context type can't be modified once a stream has been instanciated"); /* Should fail after instanciating a stream (frozen) */ - ok(bt_ctf_stream_class_set_clock(stream_class, clock), + ok(bt_stream_class_set_clock(stream_class, clock), "Changes to a stream class that was already instantiated fail"); /* Populate the custom packet header field only once for all tests */ - ok(bt_ctf_stream_get_packet_header(NULL) == NULL, - "bt_ctf_stream_get_packet_header handles NULL correctly"); - packet_header = bt_ctf_stream_get_packet_header(stream1); + ok(bt_stream_get_packet_header(NULL) == NULL, + "bt_stream_get_packet_header handles NULL correctly"); + packet_header = bt_stream_get_packet_header(stream1); ok(packet_header, - "bt_ctf_stream_get_packet_header returns a packet header"); - ret_field_type = bt_ctf_field_get_type(packet_header); + "bt_stream_get_packet_header returns a packet header"); + ret_field_type = bt_field_get_type(packet_header); ok(ret_field_type == packet_header_type, "Stream returns a packet header of the appropriate type"); bt_put(ret_field_type); - packet_header_field = bt_ctf_field_structure_get_field(packet_header, + packet_header_field = bt_field_structure_get_field_by_name(packet_header, "custom_trace_packet_header_field"); ok(packet_header_field, "Packet header structure contains a custom field with the appropriate name"); - ret_field_type = bt_ctf_field_get_type(packet_header_field); - ok(bt_ctf_field_type_compare(ret_field_type, packet_header_field_type) == 0, + ret_field_type = bt_field_get_type(packet_header_field); + ok(bt_field_type_compare(ret_field_type, packet_header_field_type) == 0, "Custom packet header field is of the expected type"); - ok(!bt_ctf_field_unsigned_integer_set_value(packet_header_field, + ok(!bt_field_unsigned_integer_set_value(packet_header_field, 54321), "Set custom packet header value successfully"); - ok(bt_ctf_stream_set_packet_header(stream1, NULL) < 0, - "bt_ctf_stream_set_packet_header handles a NULL packet header correctly"); - ok(bt_ctf_stream_set_packet_header(NULL, packet_header) < 0, - "bt_ctf_stream_set_packet_header handles a NULL stream correctly"); - ok(bt_ctf_stream_set_packet_header(stream1, packet_header_field) < 0, - "bt_ctf_stream_set_packet_header rejects a packet header of the wrong type"); - ok(!bt_ctf_stream_set_packet_header(stream1, packet_header), + ok(bt_stream_set_packet_header(stream1, NULL) < 0, + "bt_stream_set_packet_header handles a NULL packet header correctly"); + ok(bt_stream_set_packet_header(NULL, packet_header) < 0, + "bt_stream_set_packet_header handles a NULL stream correctly"); + ok(bt_stream_set_packet_header(stream1, packet_header_field) < 0, + "bt_stream_set_packet_header rejects a packet header of the wrong type"); + ok(!bt_stream_set_packet_header(stream1, packet_header), "Successfully set a stream's packet header"); ok(bt_ctf_writer_add_environment_field(writer, "new_field", "test") == 0, @@ -3489,7 +3489,7 @@ int main(int argc, char **argv) validate_trace(argv[1], trace_path); - recursive_rmdir(trace_path); + //recursive_rmdir(trace_path); g_free(trace_path); g_free(metadata_path); diff --git a/tests/lib/test_ir_visit.c b/tests/lib/test_ir_visit.c index fbbdb745..7c1c8c26 100644 --- a/tests/lib/test_ir_visit.c +++ b/tests/lib/test_ir_visit.c @@ -39,48 +39,48 @@ struct visitor_state { struct expected_result { const char *object_name; - enum bt_ctf_object_type object_type; + enum bt_visitor_object_type object_type; }; struct expected_result expected_results[] = { - { NULL, BT_CTF_OBJECT_TYPE_TRACE }, - { "sc1", BT_CTF_OBJECT_TYPE_STREAM_CLASS }, - { "ec1", BT_CTF_OBJECT_TYPE_EVENT_CLASS }, - { "sc2", BT_CTF_OBJECT_TYPE_STREAM_CLASS }, - { "ec2", BT_CTF_OBJECT_TYPE_EVENT_CLASS }, - { "ec3", BT_CTF_OBJECT_TYPE_EVENT_CLASS }, + { NULL, BT_VISITOR_OBJECT_TYPE_TRACE }, + { "sc1", BT_VISITOR_OBJECT_TYPE_STREAM_CLASS }, + { "ec1", BT_VISITOR_OBJECT_TYPE_EVENT_CLASS }, + { "sc2", BT_VISITOR_OBJECT_TYPE_STREAM_CLASS }, + { "ec2", BT_VISITOR_OBJECT_TYPE_EVENT_CLASS }, + { "ec3", BT_VISITOR_OBJECT_TYPE_EVENT_CLASS }, }; -const char *object_type_str(enum bt_ctf_object_type type) +const char *object_type_str(enum bt_visitor_object_type type) { switch (type) { - case BT_CTF_OBJECT_TYPE_TRACE: + case BT_VISITOR_OBJECT_TYPE_TRACE: return "trace"; - case BT_CTF_OBJECT_TYPE_STREAM_CLASS: + case BT_VISITOR_OBJECT_TYPE_STREAM_CLASS: return "stream class"; - case BT_CTF_OBJECT_TYPE_STREAM: + case BT_VISITOR_OBJECT_TYPE_STREAM: return "stream"; - case BT_CTF_OBJECT_TYPE_EVENT_CLASS: + case BT_VISITOR_OBJECT_TYPE_EVENT_CLASS: return "event class"; - case BT_CTF_OBJECT_TYPE_EVENT: + case BT_VISITOR_OBJECT_TYPE_EVENT: return "event"; default: return "unknown"; } } -struct bt_ctf_event_class *init_event_class(const char *name) +struct bt_event_class *init_event_class(const char *name) { int ret; - struct bt_ctf_event_class *ec = bt_ctf_event_class_create(name); - struct bt_ctf_field_type *int_field = - bt_ctf_field_type_integer_create(8); + struct bt_event_class *ec = bt_event_class_create(name); + struct bt_field_type *int_field = + bt_field_type_integer_create(8); if (!ec || !int_field) { goto error; } - ret = bt_ctf_event_class_add_field(ec, int_field, "an_int_field"); + ret = bt_event_class_add_field(ec, int_field, "an_int_field"); if (ret) { goto error; } @@ -94,41 +94,41 @@ error: } static void set_stream_class_field_types( - struct bt_ctf_stream_class *stream_class) + struct bt_stream_class *stream_class) { - struct bt_ctf_field_type *packet_context_type; - struct bt_ctf_field_type *event_header_type; - struct bt_ctf_field_type *ft; + struct bt_field_type *packet_context_type; + struct bt_field_type *event_header_type; + struct bt_field_type *ft; int ret; - packet_context_type = bt_ctf_field_type_structure_create(); + packet_context_type = bt_field_type_structure_create(); assert(packet_context_type); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, ft, "packet_size"); assert(ret == 0); bt_put(ft); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(packet_context_type, + ret = bt_field_type_structure_add_field(packet_context_type, ft, "content_size"); assert(ret == 0); bt_put(ft); - event_header_type = bt_ctf_field_type_structure_create(); + event_header_type = bt_field_type_structure_create(); assert(event_header_type); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(event_header_type, + ret = bt_field_type_structure_add_field(event_header_type, ft, "id"); assert(ret == 0); bt_put(ft); - ret = bt_ctf_stream_class_set_packet_context_type(stream_class, + ret = bt_stream_class_set_packet_context_type(stream_class, packet_context_type); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_header_type(stream_class, + ret = bt_stream_class_set_event_header_type(stream_class, event_header_type); assert(ret == 0); @@ -136,37 +136,37 @@ static void set_stream_class_field_types( bt_put(event_header_type); } -static void set_trace_packet_header(struct bt_ctf_trace *trace) +static void set_trace_packet_header(struct bt_trace *trace) { - struct bt_ctf_field_type *packet_header_type; - struct bt_ctf_field_type *ft; + struct bt_field_type *packet_header_type; + struct bt_field_type *ft; int ret; - packet_header_type = bt_ctf_field_type_structure_create(); + packet_header_type = bt_field_type_structure_create(); assert(packet_header_type); - ft = bt_ctf_field_type_integer_create(32); + ft = bt_field_type_integer_create(32); assert(ft); - ret = bt_ctf_field_type_structure_add_field(packet_header_type, + ret = bt_field_type_structure_add_field(packet_header_type, ft, "stream_id"); assert(ret == 0); bt_put(ft); - ret = bt_ctf_trace_set_packet_header_type(trace, + ret = bt_trace_set_packet_header_type(trace, packet_header_type); assert(ret == 0); bt_put(packet_header_type); } -struct bt_ctf_trace *init_trace(void) +struct bt_trace *init_trace(void) { int ret; - struct bt_ctf_trace *trace = bt_ctf_trace_create(); - struct bt_ctf_stream_class *sc1 = bt_ctf_stream_class_create("sc1"); - struct bt_ctf_stream_class *sc2 = bt_ctf_stream_class_create("sc2"); - struct bt_ctf_event_class *ec1 = init_event_class("ec1"); - struct bt_ctf_event_class *ec2 = init_event_class("ec2"); - struct bt_ctf_event_class *ec3 = init_event_class("ec3"); + struct bt_trace *trace = bt_trace_create(); + struct bt_stream_class *sc1 = bt_stream_class_create("sc1"); + struct bt_stream_class *sc2 = bt_stream_class_create("sc2"); + struct bt_event_class *ec1 = init_event_class("ec1"); + struct bt_event_class *ec2 = init_event_class("ec2"); + struct bt_event_class *ec3 = init_event_class("ec3"); if (!trace || !sc1 || !sc2 || !ec1 || !ec2 || !ec3) { goto end; @@ -175,27 +175,27 @@ struct bt_ctf_trace *init_trace(void) set_trace_packet_header(trace); set_stream_class_field_types(sc1); set_stream_class_field_types(sc2); - ret = bt_ctf_stream_class_add_event_class(sc1, ec1); + ret = bt_stream_class_add_event_class(sc1, ec1); if (ret) { goto error; } - ret = bt_ctf_stream_class_add_event_class(sc2, ec2); + ret = bt_stream_class_add_event_class(sc2, ec2); if (ret) { goto error; } - ret = bt_ctf_stream_class_add_event_class(sc2, ec3); + ret = bt_stream_class_add_event_class(sc2, ec3); if (ret) { goto error; } - ret = bt_ctf_trace_add_stream_class(trace, sc1); + ret = bt_trace_add_stream_class(trace, sc1); if (ret) { goto error; } - ret = bt_ctf_trace_add_stream_class(trace, sc2); + ret = bt_trace_add_stream_class(trace, sc2); if (ret) { goto error; } @@ -211,7 +211,7 @@ error: goto end; } -int visitor(struct bt_ctf_object *object, void *data) +int visitor(struct bt_visitor_object *object, void *data) { int ret = 0; bool names_match; @@ -219,14 +219,14 @@ int visitor(struct bt_ctf_object *object, void *data) struct visitor_state *state = data; struct expected_result *expected = &expected_results[state->i++]; - switch (bt_ctf_object_get_type(object)) { - case BT_CTF_OBJECT_TYPE_TRACE: + switch (bt_visitor_object_get_type(object)) { + case BT_VISITOR_OBJECT_TYPE_TRACE: object_name = NULL; names_match = expected->object_name == NULL; break; - case BT_CTF_OBJECT_TYPE_STREAM_CLASS: - object_name = bt_ctf_stream_class_get_name( - bt_ctf_object_get_object(object)); + case BT_VISITOR_OBJECT_TYPE_STREAM_CLASS: + object_name = bt_stream_class_get_name( + bt_visitor_object_get_object(object)); if (!object_name) { ret = -1; goto end; @@ -234,9 +234,9 @@ int visitor(struct bt_ctf_object *object, void *data) names_match = !strcmp(object_name, expected->object_name); break; - case BT_CTF_OBJECT_TYPE_EVENT_CLASS: - object_name = bt_ctf_event_class_get_name( - bt_ctf_object_get_object(object)); + case BT_VISITOR_OBJECT_TYPE_EVENT_CLASS: + object_name = bt_event_class_get_name( + bt_visitor_object_get_object(object)); if (!object_name) { ret = -1; goto end; @@ -250,10 +250,10 @@ int visitor(struct bt_ctf_object *object, void *data) goto end; } - ok(expected->object_type == bt_ctf_object_get_type(object), + ok(expected->object_type == bt_visitor_object_get_type(object), "Encoutered object type %s, expected %s", object_type_str(expected->object_type), - object_type_str(bt_ctf_object_get_type(object))); + object_type_str(bt_visitor_object_get_type(object))); ok(names_match, "Element name is %s, expected %s", object_name ? : "NULL", expected->object_name ? : "NULL"); @@ -264,14 +264,14 @@ end: int main(int argc, char **argv) { int ret; - struct bt_ctf_trace *trace; + struct bt_trace *trace; struct visitor_state state = { 0 }; plan_tests(NR_TESTS); /* * Initialize a reference trace which we'll walk using the - * bt_ctf_*_visit() interface. + * bt_*_visit() interface. */ trace = init_trace(); if (!trace) { @@ -279,8 +279,8 @@ int main(int argc, char **argv) exit(-1); } - ret = bt_ctf_trace_visit(trace, visitor, &state); - ok(!ret, "bt_ctf_trace_visit returned success"); + ret = bt_trace_visit(trace, visitor, &state); + ok(!ret, "bt_trace_visit returned success"); BT_PUT(trace); return exit_status(); diff --git a/tests/plugins/test-utils-muxer.c b/tests/plugins/test-utils-muxer.c index 0430b7f7..292ee0fe 100644 --- a/tests/plugins/test-utils-muxer.c +++ b/tests/plugins/test-utils-muxer.c @@ -74,13 +74,13 @@ static enum test current_test; static GArray *test_events; static struct bt_clock_class_priority_map *src_cc_prio_map; static struct bt_clock_class_priority_map *src_empty_cc_prio_map; -static struct bt_ctf_clock_class *src_clock_class; -static struct bt_ctf_stream_class *src_stream_class; -static struct bt_ctf_event_class *src_event_class; -static struct bt_ctf_packet *src_packet0; -static struct bt_ctf_packet *src_packet1; -static struct bt_ctf_packet *src_packet2; -static struct bt_ctf_packet *src_packet3; +static struct bt_clock_class *src_clock_class; +static struct bt_stream_class *src_stream_class; +static struct bt_event_class *src_event_class; +static struct bt_packet *src_packet0; +static struct bt_packet *src_packet1; +static struct bt_packet *src_packet2; +static struct bt_packet *src_packet3; enum { SEQ_END = -1, @@ -93,7 +93,7 @@ struct src_iter_user_data { size_t iter_index; int64_t *seq; size_t at; - struct bt_ctf_packet *packet; + struct bt_packet *packet; }; struct sink_user_data { @@ -287,29 +287,29 @@ static void init_static_data(void) { int ret; - struct bt_ctf_trace *trace; - struct bt_ctf_stream *stream; - struct bt_ctf_field_type *empty_struct_ft; + struct bt_trace *trace; + struct bt_stream *stream; + struct bt_field_type *empty_struct_ft; /* Test events */ test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event)); assert(test_events); /* Metadata */ - empty_struct_ft = bt_ctf_field_type_structure_create(); + empty_struct_ft = bt_field_type_structure_create(); assert(empty_struct_ft); - trace = bt_ctf_trace_create(); + trace = bt_trace_create(); assert(trace); - ret = bt_ctf_trace_set_native_byte_order(trace, - BT_CTF_BYTE_ORDER_LITTLE_ENDIAN); + ret = bt_trace_set_native_byte_order(trace, + BT_BYTE_ORDER_LITTLE_ENDIAN); assert(ret == 0); - ret = bt_ctf_trace_set_packet_header_type(trace, empty_struct_ft); + ret = bt_trace_set_packet_header_type(trace, empty_struct_ft); assert(ret == 0); - src_clock_class = bt_ctf_clock_class_create("my-clock", 1000000000); + src_clock_class = bt_clock_class_create("my-clock", 1000000000); assert(src_clock_class); - ret = bt_ctf_clock_class_set_is_absolute(src_clock_class, 1); + ret = bt_clock_class_set_is_absolute(src_clock_class, 1); assert(ret == 0); - ret = bt_ctf_trace_add_clock_class(trace, src_clock_class); + ret = bt_trace_add_clock_class(trace, src_clock_class); assert(ret == 0); src_empty_cc_prio_map = bt_clock_class_priority_map_create(); assert(src_empty_cc_prio_map); @@ -318,47 +318,47 @@ void init_static_data(void) ret = bt_clock_class_priority_map_add_clock_class(src_cc_prio_map, src_clock_class, 0); assert(ret == 0); - src_stream_class = bt_ctf_stream_class_create("my-stream-class"); + src_stream_class = bt_stream_class_create("my-stream-class"); assert(src_stream_class); - ret = bt_ctf_stream_class_set_packet_context_type(src_stream_class, + ret = bt_stream_class_set_packet_context_type(src_stream_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_header_type(src_stream_class, + ret = bt_stream_class_set_event_header_type(src_stream_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_stream_class_set_event_context_type(src_stream_class, + ret = bt_stream_class_set_event_context_type(src_stream_class, empty_struct_ft); assert(ret == 0); - src_event_class = bt_ctf_event_class_create("my-event-class"); - ret = bt_ctf_event_class_set_context_type(src_event_class, + src_event_class = bt_event_class_create("my-event-class"); + ret = bt_event_class_set_context_type(src_event_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_event_class_set_context_type(src_event_class, + ret = bt_event_class_set_context_type(src_event_class, empty_struct_ft); assert(ret == 0); - ret = bt_ctf_stream_class_add_event_class(src_stream_class, + ret = bt_stream_class_add_event_class(src_stream_class, src_event_class); assert(ret == 0); - ret = bt_ctf_trace_add_stream_class(trace, src_stream_class); + ret = bt_trace_add_stream_class(trace, src_stream_class); assert(ret == 0); - stream = bt_ctf_stream_create(src_stream_class, "stream0"); + stream = bt_stream_create(src_stream_class, "stream0"); assert(stream); - src_packet0 = bt_ctf_packet_create(stream); + src_packet0 = bt_packet_create(stream); assert(src_packet0); bt_put(stream); - stream = bt_ctf_stream_create(src_stream_class, "stream1"); + stream = bt_stream_create(src_stream_class, "stream1"); assert(stream); - src_packet1 = bt_ctf_packet_create(stream); + src_packet1 = bt_packet_create(stream); assert(src_packet0); bt_put(stream); - stream = bt_ctf_stream_create(src_stream_class, "stream2"); + stream = bt_stream_create(src_stream_class, "stream2"); assert(stream); - src_packet2 = bt_ctf_packet_create(stream); + src_packet2 = bt_packet_create(stream); assert(src_packet0); bt_put(stream); - stream = bt_ctf_stream_create(src_stream_class, "stream3"); + stream = bt_stream_create(src_stream_class, "stream3"); assert(stream); - src_packet3 = bt_ctf_packet_create(stream); + src_packet3 = bt_packet_create(stream); assert(src_packet0); bt_put(stream); @@ -481,23 +481,23 @@ enum bt_notification_iterator_status src_iter_init( } static -struct bt_ctf_event *src_create_event(struct bt_ctf_packet *packet, +struct bt_event *src_create_event(struct bt_packet *packet, int64_t ts_ns) { - struct bt_ctf_event *event = bt_ctf_event_create(src_event_class); + struct bt_event *event = bt_event_create(src_event_class); int ret; assert(event); - ret = bt_ctf_event_set_packet(event, packet); + ret = bt_event_set_packet(event, packet); assert(ret == 0); if (ts_ns != -1) { - struct bt_ctf_clock_value *clock_value; + struct bt_clock_value *clock_value; - clock_value = bt_ctf_clock_value_create(src_clock_class, + clock_value = bt_clock_value_create(src_clock_class, (uint64_t) ts_ns); assert(clock_value); - ret = bt_ctf_event_set_clock_value(event, clock_value); + ret = bt_event_set_clock_value(event, clock_value); assert(ret == 0); bt_put(clock_value); } @@ -538,7 +538,7 @@ struct bt_notification_iterator_next_method_return src_iter_next_seq( break; default: { - struct bt_ctf_event *event = src_create_event( + struct bt_event *event = src_create_event( user_data->packet, cur_ts_ns); assert(event); @@ -583,7 +583,7 @@ struct bt_notification_iterator_next_method_return src_iter_next( user_data->packet); assert(next_return.notification); } else if (user_data->at < 6) { - struct bt_ctf_event *event = src_create_event( + struct bt_event *event = src_create_event( user_data->packet, -1); assert(event); @@ -740,7 +740,7 @@ enum bt_component_status sink_consume( switch (bt_notification_get_type(notification)) { case BT_NOTIFICATION_TYPE_EVENT: { - struct bt_ctf_event *event; + struct bt_event *event; struct bt_clock_class_priority_map *cc_prio_map; test_event.type = TEST_EV_TYPE_NOTIF_EVENT; @@ -752,16 +752,16 @@ enum bt_component_status sink_consume( assert(event); if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map) > 0) { - struct bt_ctf_clock_value *clock_value; - struct bt_ctf_clock_class *clock_class = + struct bt_clock_value *clock_value; + struct bt_clock_class *clock_class = bt_clock_class_priority_map_get_highest_priority_clock_class( cc_prio_map); assert(clock_class); - clock_value = bt_ctf_event_get_clock_value(event, + clock_value = bt_event_get_clock_value(event, clock_class); assert(clock_value); - ret = bt_ctf_clock_value_get_value_ns_from_epoch( + ret = bt_clock_value_get_value_ns_from_epoch( clock_value, &test_event.ts_ns); assert(ret == 0); bt_put(clock_value); @@ -784,8 +784,8 @@ enum bt_component_status sink_consume( assert(cc_prio_map); if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map) > 0) { - struct bt_ctf_clock_value *clock_value; - struct bt_ctf_clock_class *clock_class = + struct bt_clock_value *clock_value; + struct bt_clock_class *clock_class = bt_clock_class_priority_map_get_highest_priority_clock_class( cc_prio_map); @@ -794,7 +794,7 @@ enum bt_component_status sink_consume( bt_notification_inactivity_get_clock_value( notification, clock_class); assert(clock_value); - ret = bt_ctf_clock_value_get_value_ns_from_epoch( + ret = bt_clock_value_get_value_ns_from_epoch( clock_value, &test_event.ts_ns); assert(ret == 0); bt_put(clock_value); -- 2.34.1