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')
@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
@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):
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')
@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
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
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
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):
# 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)
@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
@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
@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
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
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
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
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:
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")
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')
@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
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
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
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')
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)
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
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)
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()))
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")
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)
@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
@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")
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)
@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")
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)
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)
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
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)
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)
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)
_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)
@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")
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)
_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)
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)
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)
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
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)
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)
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,
}
# 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
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)
@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")
@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:
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")
@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:
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)
@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)
@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)
@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)
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
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)
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)
@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
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)
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):
@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)
@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
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,
}
}
/* 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);
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);
*/
/* 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);
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);
*/
/* 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);
*/
/* 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);
*/
/* 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);
*/
/* 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);
/* 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(
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);
*/
/* 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);
*/
/* 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);
*/
/* 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);
*/
/* 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();
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);
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);
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
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
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):
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
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):
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')
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
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')
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:
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
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
@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
@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
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
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
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")
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')
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
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
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)
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
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:
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
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
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:
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")
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
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')
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)
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
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
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
@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
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")
@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.
*/
----
#include <assert.h>
#include <babeltrace/ctf-ir/field-types.h>
-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;
#include <assert.h>
#include <babeltrace/ctf-ir/field-types.h>
-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;
#include <assert.h>
#include <babeltrace/ctf-ir/field-types.h>
-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;
#include <assert.h>
#include <babeltrace/ctf-ir/field-types.h>
-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;
#include <assert.h>
#include <babeltrace/ctf-ir/field-types.h>
-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;
When the documentation says that a given
\link ctfirfieldtypes CTF IR field type\endlink must be
<em>equivalent to</em> 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"
*/
#include <babeltrace/values.h>
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
}
#include <stdint.h>
#include <glib.h>
-struct bt_ctf_clock_class {
+struct bt_clock_class {
struct bt_object base;
GString *name;
GString *description;
};
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 */
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
}
#include <stdbool.h>
#include <stdint.h>
-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;
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
}
#include <babeltrace/object-internal.h>
#include <glib.h>
-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;
/*
/* 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)";
}
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.
counts</a>. 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.
*/
/**
-@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,
};
/**
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 <em>not set</em>. 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).
@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
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.
@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);
/** @} */
@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.
@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
@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
@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
@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
@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);
/** @} */
@post <strong>On success, if the return value is a field type</strong>, 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
@post <strong>On success, if \p context_type is not \c NULL</strong>,
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
@post <strong>On success, if the return value is a field type</strong>, 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
@post <strong>On success, if \p payload_type is not \c NULL</strong>,
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
@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.
@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
@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.
@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 <strong>On success, if \p field_type is not \c NULL</strong>, 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);
/**
@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.
@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
@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.
@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
#include <assert.h>
#include <glib.h>
-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;
#endif
struct bt_value;
-struct bt_ctf_clock_class;
+struct bt_clock_class;
/**
@defgroup ctfirevent CTF IR event
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
\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
<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
*/
/**
-@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
\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
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.
@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,
@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,
@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
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.
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
@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);
/** @} */
@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
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
@prenotnull{event}
@prehot{event}
@pre <strong>\p header, if not \c NULL</strong>, 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 <strong>On success, if \p header is not \c NULL</strong>,
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
@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
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.
@prenotnull{event}
@prehot{event}
@pre <strong>\p context, if not \c NULL</strong>, 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 <strong>On success, if \p context is not \c NULL</strong>, 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.
@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.
@prenotnull{event}
@prehot{event}
@pre <strong>\p context, if not \c NULL</strong>, 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 <strong>On success, if \p context is not \c NULL</strong>, 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.
@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.
@prenotnull{event}
@prehot{event}
@pre <strong>\p payload, if not \c NULL</strong>, 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 <strong>On success, if \p payload is not \c NULL</strong>, 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.
* 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
*
* 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.
* 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 */
@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
@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
#include <assert.h>
#include <glib.h>
-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
};
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;
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);
extern "C" {
#endif
-struct bt_ctf_field_type;
+struct bt_field_type;
/**
@defgroup ctfirfieldpath CTF IR field path
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 <em>root scope</em> which indicates from which of the
six CTF scopes to begin. It also has a list of structure field <em>path
*/
/**
-@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
@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
@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);
/** @} */
#include <babeltrace/types.h>
#include <glib.h>
-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;
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 {
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;
} 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)";
}
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.
\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.
<th>CTF IR field which you can create from this field type
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_INTEGER
+ <td>#BT_FIELD_TYPE_ID_INTEGER
<td>\ref ctfirintfieldtype
<td>\ref ctfirintfield
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_FLOAT
+ <td>#BT_FIELD_TYPE_ID_FLOAT
<td>\ref ctfirfloatfieldtype
<td>\ref ctfirfloatfield
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_ENUM
+ <td>#BT_FIELD_TYPE_ID_ENUM
<td>\ref ctfirenumfieldtype
<td>\ref ctfirenumfield
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_STRING
+ <td>#BT_FIELD_TYPE_ID_STRING
<td>\ref ctfirstringfieldtype
<td>\ref ctfirstringfield
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_STRUCT
+ <td>#BT_FIELD_TYPE_ID_STRUCT
<td>\ref ctfirstructfieldtype
<td>\ref ctfirstructfield
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_ARRAY
+ <td>#BT_FIELD_TYPE_ID_ARRAY
<td>\ref ctfirarrayfieldtype
<td>\ref ctfirarrayfield
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_SEQUENCE
+ <td>#BT_FIELD_TYPE_ID_SEQUENCE
<td>\ref ctfirseqfieldtype
<td>\ref ctfirseqfield
</tr>
<tr>
- <td>#BT_CTF_FIELD_TYPE_ID_VARIANT
+ <td>#BT_FIELD_TYPE_ID_VARIANT
<td>\ref ctfirvarfieldtype
<td>\ref ctfirvarfield
</tr>
</table>
Each field type has its own <strong>type ID</strong> (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.
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
*/
/**
-@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
};
/**
@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,
};
/**
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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);
/** @} */
@brief <a href="https://en.wikipedia.org/wiki/Endianness">Byte order</a>
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
* 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,
/// <a href="https://en.wikipedia.org/wiki/UTF-8">UTF-8</a>.
- BT_CTF_STRING_ENCODING_UTF8 = CTF_STRING_UTF8,
+ BT_STRING_ENCODING_UTF8,
/// <a href="https://en.wikipedia.org/wiki/ASCII">ASCII</a>.
- BT_CTF_STRING_ENCODING_ASCII = CTF_STRING_ASCII,
+ BT_STRING_ENCODING_ASCII,
};
/**
@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
@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);
/**
@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
@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);
/** @} */
@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.
@postsuccessrefcountret1
@post <strong>On success</strong>, 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);
/** @} */
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:
<tr>
<td>\b Alignment (bits) of the described integer fields
<td>1
- <td>bt_ctf_field_type_get_alignment()
- <td>bt_ctf_field_type_set_alignment()
+ <td>bt_field_type_get_alignment()
+ <td>bt_field_type_set_alignment()
</tr>
<tr>
<td><strong>Byte order</strong> of the described integer fields
- <td>#BT_CTF_BYTE_ORDER_NATIVE
- <td>bt_ctf_field_type_get_byte_order()
- <td>bt_ctf_field_type_set_byte_order()
+ <td>#BT_BYTE_ORDER_NATIVE
+ <td>bt_field_type_get_byte_order()
+ <td>bt_field_type_set_byte_order()
</tr>
<tr>
<td><strong>Storage size</strong> (bits) of the described
integer fields
<td>Specified at creation
- <td>bt_ctf_field_type_integer_get_size()
- <td>bt_ctf_field_type_integer_set_size()
+ <td>bt_field_type_integer_get_size()
+ <td>bt_field_type_integer_set_size()
</tr>
<tr>
<td><strong>Signedness</strong> of the described integer fields
<td>Unsigned
- <td>bt_ctf_field_type_integer_is_signed()
- <td>bt_ctf_field_type_integer_set_is_signed()
+ <td>bt_field_type_integer_is_signed()
+ <td>bt_field_type_integer_set_is_signed()
</tr>
<tr>
<td><strong>Preferred display base</strong> of the described
integer fields
- <td>#BT_CTF_INTEGER_BASE_DECIMAL
- <td>bt_ctf_field_type_integer_get_base()
- <td>bt_ctf_field_type_integer_set_base()
+ <td>#BT_INTEGER_BASE_DECIMAL
+ <td>bt_field_type_integer_get_base()
+ <td>bt_field_type_integer_set_base()
</tr>
<tr>
<td>\b Encoding of the described integer fields
- <td>#BT_CTF_STRING_ENCODING_NONE
- <td>bt_ctf_field_type_integer_get_encoding()
- <td>bt_ctf_field_type_integer_set_encoding()
+ <td>#BT_STRING_ENCODING_NONE
+ <td>bt_field_type_integer_get_encoding()
+ <td>bt_field_type_integer_set_encoding()
</tr>
<tr>
<td><strong>Mapped
\link ctfirclockclass CTF IR clock class\endlink</strong>
<td>None
- <td>bt_ctf_field_type_integer_get_mapped_clock_class()
- <td>bt_ctf_field_type_integer_set_mapped_clock_class()
+ <td>bt_field_type_integer_get_mapped_clock_class()
+ <td>bt_field_type_integer_set_mapped_clock_class()
</tr>
</table>
/**
@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,
};
/**
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.
@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);
/**
@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
@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
@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
@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
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
@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
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
@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
@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
@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);
/** @} */
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:
<td>\b Alignment (bits) of the described floating point
number fields
<td>1
- <td>bt_ctf_field_type_get_alignment()
- <td>bt_ctf_field_type_set_alignment()
+ <td>bt_field_type_get_alignment()
+ <td>bt_field_type_set_alignment()
</tr>
<tr>
<td><strong>Byte order</strong> of the described floating point
number fields
- <td>#BT_CTF_BYTE_ORDER_NATIVE
- <td>bt_ctf_field_type_get_byte_order()
- <td>bt_ctf_field_type_set_byte_order()
+ <td>#BT_BYTE_ORDER_NATIVE
+ <td>bt_field_type_get_byte_order()
+ <td>bt_field_type_set_byte_order()
</tr>
<tr>
<td><strong>Exponent storage size</strong> (bits) of the described
floating point number fields
<td>8
- <td>bt_ctf_field_type_floating_point_get_exponent_digits()
- <td>bt_ctf_field_type_floating_point_set_exponent_digits()
+ <td>bt_field_type_floating_point_get_exponent_digits()
+ <td>bt_field_type_floating_point_set_exponent_digits()
</tr>
<tr>
<td><strong>Mantissa and sign storage size</strong> (bits) of the
described floating point number fields
<td>24 (23-bit mantissa, 1-bit sign)
- <td>bt_ctf_field_type_floating_point_get_mantissa_digits()
- <td>bt_ctf_field_type_floating_point_set_mantissa_digits()
+ <td>bt_field_type_floating_point_get_mantissa_digits()
+ <td>bt_field_type_floating_point_set_mantissa_digits()
</tr>
</table>
@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
@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
@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);
/**
@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
@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);
/** @} */
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.
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
@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.
@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
@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.
@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);
/**
\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.
@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);
@post <strong>On success</strong>, 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);
/**
@post <strong>On success</strong>, 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);
/**
@post <strong>On success</strong>, 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);
/**
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.
@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
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.
@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);
/** @} */
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.
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
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.
*/
/**
-@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
*/
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
@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);
/**
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
@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);
/**
@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);
/** @} */
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
@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
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
@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);
/** @} */
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
<a href="http://diamon.org/ctf/">CTF</a>, is the \em maximum value amongst
the effective alignments of all its fields. Note that the effective
You can set the byte order of <em>all the contained fields</em>,
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
@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
@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
@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 <strong>On success</strong>, 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.
@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);
/**
@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);
/** @} */
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.
@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);
/**
@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
@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);
/** @} */
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
@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);
/**
@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.
@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
@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);
/** @} */
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
You can set the byte order of <em>all the contained fields</em>,
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
\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
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);
/**
@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.
@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.
@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);
/**
@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
@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
@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 <strong>On success</strong>, 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
@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);
/**
\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.
@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
@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
#include <stdbool.h>
#include <glib.h>
-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 */
extern "C" {
#endif
-struct bt_ctf_field_type;
+struct bt_field_type;
/**
@defgroup ctfirfields CTF IR fields
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:
- @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.
*/
/**
-@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
@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,
@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);
/** @} */
@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.
*
*
* 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);
/**
@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.
@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.
@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.
@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.
@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.
@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.
@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.
@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);
/** @} */
@postsuccessrefcountret1
@post <strong>On success</strong>, 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);
/** @} */
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
@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
@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
@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
@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);
/** @} */
@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
@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
@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);
/** @} */
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
@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
@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
@post <strong>On success</strong>, 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);
/** @} */
A CTF IR <strong><em>string field</em></strong> 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
@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
@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);
/**
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
@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);
/**
@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);
/** @} */
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
@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
@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
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
@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 <strong>On success, the field in \p struct_field named \p name</strong>
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);
/** @} */
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
@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);
/** @} */
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.
@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.
@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 <strong>On success</strong>, 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
@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);
/** @} */
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
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.
@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
@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.
@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 <strong>On success</strong>, 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
#include <babeltrace/babeltrace-internal.h>
#include <assert.h>
-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;
@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
<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
*/
/**
-@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
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.
@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.
@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);
/** @} */
@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
\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.
@prenotnull{packet}
@prehot{packet}
@pre <strong>\p header, if not \c NULL</strong>, 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 <strong>On success, if \p header is not \c NULL</strong>, 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
@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.
@prenotnull{packet}
@prehot{packet}
@pre <strong>\p context, if not \c NULL</strong>, 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 <strong>On success, if \p context is not \c NULL</strong>, 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);
/** @} */
#include <babeltrace/babeltrace-internal.h>
#include <glib.h>
-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,
};
/*
* 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 */
#include <assert.h>
#include <glib.h>
-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;
};
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);
#include <stdint.h>
-/* For bt_ctf_visitor */
+/* For bt_visitor */
#include <babeltrace/ctf-ir/visitor.h>
#ifdef __cplusplus
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:
@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
<a href="https://en.wikipedia.org/wiki/Reference_counting">reference
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
*/
/**
-@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
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.
@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);
/**
- <code>timestamp</code>: 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.
@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
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.
@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);
/** @} */
@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
@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.
@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
@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);
/** @} */
@post <strong>On success, if the return value is a field type</strong>, 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
@post <strong>On success, if \p packet_context_type is not \c NULL</strong>,
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
@post <strong>On success, if the return value is a field type</strong>, 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
@post <strong>On success, if \p event_header_type is not \c NULL</strong>,
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
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
@post <strong>On success, if \p event_context_type is not \c NULL</strong>,
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);
/** @} */
@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
@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
@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
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.
@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);
/** @} */
@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
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
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;
extern "C" {
#endif
-struct bt_ctf_stream_class;
+struct bt_stream_class;
/**
@defgroup ctfirstream CTF IR stream
You can obtain a CTF IR stream object in two different modes:
-- <strong>Normal mode</strong>: use bt_ctf_stream_create() or
- bt_ctf_stream_create_with_id() with a stream class having a
+- <strong>Normal mode</strong>: 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.
-- <strong>CTF writer mode</strong>: use bt_ctf_stream_create() with
+- <strong>CTF writer mode</strong>: 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:
*/
/**
-@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
@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);
/**
\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.
@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);
/**
@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.
@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
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,
@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
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;
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.
@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
@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.
* 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 */
* http://www.efficios.com/ctf
*/
-/* For bt_ctf_visitor */
+/* For bt_visitor */
#include <babeltrace/ctf-ir/visitor.h>
/* For bt_bool */
extern "C" {
#endif
-struct bt_ctf_field_type;
+struct bt_field_type;
struct bt_value;
/**
You can obtain a trace class in two different modes:
-- <strong>Normal mode</strong>: use bt_ctf_trace_create() to create a
+- <strong>Normal mode</strong>: use bt_trace_create() to create a
default, empty trace class.
-- <strong>CTF writer mode</strong>: use bt_ctf_writer_get_trace() to
+- <strong>CTF writer mode</strong>: use bt_writer_get_trace() to
get the trace class created by a given CTF writer object.
A trace class has the following properties:
- A \b name.
- A <strong>native byte order</strong>: 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
\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 <strong>trace packet header</strong>
\link ctfirfieldtypes field type\endlink, which represents the
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
*/
/**
-@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
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:
- <strong>Name</strong>: none. You can set a name
- with bt_ctf_trace_set_name().
+ with bt_trace_set_name().
- <strong>UUID</strong>: none. You can set a UUID with
- bt_ctf_trace_set_uuid().
-- <strong>Native byte order</strong>: #BT_CTF_BYTE_ORDER_UNSPECIFIED.
+ bt_trace_set_uuid().
+- <strong>Native byte order</strong>: #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().
- <strong>Environment</strong>: 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);
/** @} */
@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
@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);
/**
@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
\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
- <strong>If the trace is not in CTF writer mode<strong>,
- #BT_CTF_BYTE_ORDER_UNSPECIFIED.
+ #BT_BYTE_ORDER_UNSPECIFIED.
@param[in] trace_class Trace class of which to set the 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.
@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
@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);
/**
@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
@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
@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);
/**
@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
@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);
/**
@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);
/**
@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);
/** @} */
@post <strong>On success, if the return value is a field type</strong>, 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
@post <strong>On success, if \p packet_header_type is not \c NULL</strong>,
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);
/** @} */
@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
@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
@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
@post <strong>On success, if \p trace_class is frozen</strong>,
\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);
/** @} */
@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
@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
@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
@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);
/** @} */
@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
@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);
/** @} */
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.
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.
@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.
@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
@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
@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
@prenotnull{identifier}
*/
-extern bt_bool bt_ctf_identifier_is_valid(const char *identifier);
+extern bt_bool bt_identifier_is_valid(const char *identifier);
/** @} */
#include <babeltrace/values.h>
#include <babeltrace/babeltrace-internal.h>
-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,
};
/*
*
* `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;
};
/*
* 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
* 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
*
* 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
* `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 */
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 */
A CTF IR <strong><em>visitor</em></strong> 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.
*/
/**
-@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 <strong>no reference count</strong>: do \em
@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 <strong>no reference count</strong>: do \em not use
@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);
/**
@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
@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);
/** @} */
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 */
};
* 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
*
* @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
}
* 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
*
* @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
}
* 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
*
* @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
*
* @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
}
#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 */
};
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;
}
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;
}
}
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));
}
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;
}
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;
}
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 */
#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.
*
* 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);
* http://www.efficios.com/ctf
*/
+#include <babeltrace/ctf-ir/event.h>
#include <babeltrace/ctf-ir/stream.h>
#include <babeltrace/ctf-writer/stream-class.h>
#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
*
* 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.
* @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.
*
* 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.
*
* 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.
*
* 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
*
* 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
}
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;
};
*/
#include <babeltrace/ctf-ir/field-types.h>
+#include <babeltrace/ctf-ir/stream-class.h>
+#include <babeltrace/ctf-ir/stream.h>
#include <babeltrace/ctf-ir/trace.h>
#ifdef __cplusplus
#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 */
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;
};
extern "C" {
#endif
-struct bt_ctf_clock_class;
+struct bt_clock_class;
/**
@defgroup graphclockclassprioritymap Clock class priority map
@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);
@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);
@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);
*/
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
*/
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
#include <babeltrace/graph/notification-internal.h>
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);
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;
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
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
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,
#endif
struct bt_notification;
-struct bt_ctf_event;
+struct bt_event;
struct bt_clock_class_priority_map;
/***BT_NOTIFICATION_TYPE_EVENT ***/
* @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);
/**
* @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 *
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);
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
}
#include <babeltrace/ctf-ir/stream.h>
#include <babeltrace/types.h>
-typedef struct bt_ctf_stream *(*get_stream_func)(
+typedef struct bt_stream *(*get_stream_func)(
struct bt_notification *notification);
struct bt_notification {
* 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;
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 =
}
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 =
#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
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 =
}
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 =
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
#include <assert.h>
#include <babeltrace/compat/string-internal.h>
-#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;
}
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;
}
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;
}
}
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;
}
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:
}
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;
}
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;
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;
}
}
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;
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);
}
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:
}
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;
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,
#include <babeltrace/object-internal.h>
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;
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);
}
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;
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);
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;
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\"",
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;
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;
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;
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;
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;
}
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;
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;
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;
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;
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;
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;
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;
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;
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;
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_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;
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;
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;
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;
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;
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;
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;
}
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;
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;
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->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],
}
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.");
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;
}
}
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);
}
}
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;
}
}
-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;
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;
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.");
#include <stdlib.h>
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);
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;
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:
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;
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;
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;
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 (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;
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;
}
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;
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;
}
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;
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;
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;
}
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.");
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;
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;
}
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;
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;
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 (!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;
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;
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: "
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);
* 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.");
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;
}
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;
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;
}
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.");
}
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);
}
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;
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");
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);
}
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: "
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);
#include <inttypes.h>
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
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,
* 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
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;
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.");
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.");
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.");
* 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);
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
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);
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.");
* 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);
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;
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);
"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;
}
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);
}
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.");
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;
}
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.");
}
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);
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.");
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;
}
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.");
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;
}
"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;
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.");
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;
}
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.");
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;
}
"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;
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.");
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;
}
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.");
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.
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;
}
"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;
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);
}
/* 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) {
/*
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: "
"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;
}
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: "
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;
}
"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;
}
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;
}
"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);
}
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;
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;
}
}
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.");
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;
}
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) {
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;
}
* 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);
"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;
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);
}
BT_HIDDEN
-void bt_ctf_event_freeze(struct bt_ctf_event *event)
+void bt_event_freeze(struct bt_event *event)
{
assert(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;
}
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);
}
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.");
}
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,
}
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;
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.");
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;
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;
};
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
}
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);
}
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;
}
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;
}
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: "
*/
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++) {
}
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",
}
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 */
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",
}
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",
}
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);
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: "
}
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);
}
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;
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\", "
* 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\"",
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: "
* 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);
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);
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.");
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.");
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.");
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);
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.");
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;
}
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);
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;
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;
}
}
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.");
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:
}
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) {
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;
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:
}
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",
}
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;
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: "
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) {
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: "
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: "
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)
{
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)
{
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)
{
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)
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);
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) {
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;
}
.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,
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) {
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;
}
.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,
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.");
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.");
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);
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.");
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.");
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 !=
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.");
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.");
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) &&
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.");
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;
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`,
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, 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: "
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.");
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;
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: "
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.");
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)) {
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(
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, "
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);
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) {
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);
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.");
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);
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);
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);
/*
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;
}
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) {
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.");
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: "
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.");
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: "
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.");
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:
}
-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;
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: "
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);
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);
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:
}
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.");
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);
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.");
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);
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);
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);
}
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.");
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);
}
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.");
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.");
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.");
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) {
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;
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) {
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);
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;
}
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.");
}
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;
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;
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;
}
}
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;
}
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;
}
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;
}
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;
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);
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.");
}
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.");
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;
}
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),
}
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.");
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;
}
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),
}
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.");
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);
}
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.");
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);
}
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.");
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);
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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
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);
}
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:
}
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:
{
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, '_');
}
}
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: "
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);
}
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);
}
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);
}
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: "
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, "
}
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: "
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, "
}
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);
}
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);
}
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);
}
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](
}
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](
}
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]) {
}
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[
}
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;
}
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++) {
}
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;
}
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);
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: "
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 ", "
}
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 */
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: "
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 ", "
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.");
}
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;
}
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) {
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.");
}
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;
}
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 */
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;
}
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;
}
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;
}
"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;
}
}
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;
}
}
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",
}
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;
}
}
/* 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",
}
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;
}
}
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)) {
}
/* 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",
}
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) {
}
/* 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: "
}
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,
}
/* 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: "
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;
"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;
}
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:
}
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;
}
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;
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;
}
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:
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:
#include <inttypes.h>
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) {
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: "
}
/* 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.");
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) {
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: "
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,
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);
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;
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)) {
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",
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;
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",
}
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,
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",
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;
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) {
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);
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;
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) {
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) {
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);
* 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;
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: "
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, "
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) {
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);
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 */
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;
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: "
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: "
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);
}
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.");
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);
}
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;
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);
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.");
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);
}
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;
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);
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.");
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.");
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;
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.");
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.");
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 {
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.");
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);
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.");
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) {
}
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.");
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);
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.");
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);
}
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);
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);
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);
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;
}
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);
}
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);
}
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",
}
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);
}
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;
}
}
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);
}
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);
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) {
}
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);
}
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);
}
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);
}
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);
}
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.");
}
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);
}
}
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);
}
}
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.");
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: "
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.");
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: "
}
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.");
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",
}
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.");
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, "
}
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.");
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, "
}
static
-int bt_ctf_field_generic_reset(struct bt_ctf_field *field)
+int bt_field_generic_reset(struct bt_field *field)
{
int ret = 0;
}
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.");
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.");
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) {
/*
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, "
}
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.");
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:
}
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.");
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) {
/*
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, "
}
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.");
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;
}
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.");
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);
}
}
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
}
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) {
/*
}
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) {
}
}
- 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;
}
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);
}
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, "
}
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: "
}
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: "
}
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, "
"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.");
}
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;
}
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.");
}
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,
}
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;
}
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;
}
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,
}
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;
/* 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.");
}
/* 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: "
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,
}
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);
}
static
-int increase_packet_size(struct bt_ctf_stream_pos *pos)
+int increase_packet_size(struct bt_stream_pos *pos)
{
int ret;
}
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;
}
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;
}
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;
}
}
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;
}
#include <babeltrace/ref.h>
#include <inttypes.h>
-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.");
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) {
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",
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.");
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) {
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",
}
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;
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);
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.");
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);
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.");
* `type` is owned by the stack frame.
*/
struct type_stack_frame {
- struct bt_ctf_field_type *type;
+ struct bt_field_type *type;
int index;
};
*/
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,
};
/*
* `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;
* 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];
}
/*
* 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
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;
}
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;
}
* 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;
/* 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) {
/*
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: "
*/
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,
/* 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;
}
*/
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.");
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,
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;
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;
/* 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--;
* 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;
/* 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;
/* 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;
* 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);
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: "
* 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;
*
* `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 =
* `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);
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;
}
/*
* 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;
}
* `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();
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;
/* 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: "
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: "
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: "
* `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: "
/* 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;
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",
}
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) {
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 =
* 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 = {
event_context_type,
event_payload_type,
},
- .root_scope = BT_CTF_SCOPE_UNKNOWN,
+ .root_scope = BT_SCOPE_UNKNOWN,
};
BT_LOGV("Resolving field 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);
}
/* 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);
}
/* 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);
}
/* 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);
}
/* 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);
}
/* 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);
#include <stdbool.h>
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;
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;
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;
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;
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;
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;
}
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;
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;
}
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: "
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;
}
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));
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;
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;
}
}
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 {
};
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;
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;
}
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;
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) {
* 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 */
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;
}
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: "
"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;
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: "
"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;
}
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,
}
/* 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);
* 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 */
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);
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;
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.");
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;
}
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.");
"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;
}
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.");
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;
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;
}
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.");
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;
}
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;
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;
}
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.");
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;
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;
}
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);
}
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: "
}
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) {
* 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) {
/*
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: "
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: "
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: "
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;
}
}
}
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) {
}
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) {
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.");
}
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.");
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;
* 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.");
}
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) {
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:
}
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.");
}
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.");
}
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.");
#include <unistd.h>
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.");
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: "
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: "
}
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;
/* 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:
}
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);
/* 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;
}
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);
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);
}
}
static
-int auto_populate_packet_header(struct bt_ctf_stream *stream)
+int auto_populate_packet_header(struct bt_stream *stream)
{
int ret = 0;
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;
}
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;
}
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);
/* 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);
}
}
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);
/* 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);
}
}
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);
/* 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;
}
* 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;
}
"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);
}
}
}
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;
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: "
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: "
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: "
}
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);
/* 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;
}
"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;
}
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);
}
}
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;
}
}
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;
}
}
static
-int auto_populate_packet_context(struct bt_ctf_stream *stream)
+int auto_populate_packet_context(struct bt_stream *stream)
{
int ret = 0;
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;
}
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;
}
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;
}
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;
}
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)) {
/*
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);
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) {
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,
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:
}
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);
}
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) {
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:
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;
}
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) {
}
}
- 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.
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;
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.");
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;
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) {
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.");
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;
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;
}
}
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: "
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.");
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.");
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.");
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);
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: "
* 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;
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);
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;
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
/* 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);
/*
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;
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.");
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;
}
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.");
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;
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.");
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;
}
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.");
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) {
"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;
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;
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);
}
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) {
}
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);
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) {
/* 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: "
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: "
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: "
/* 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) {
}
/* 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;
}
}
* 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);
}
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: "
}
/* 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;
}
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, "
}
/* 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
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:
* <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;
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;
}
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_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,
}
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);
}
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);
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;
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;
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:
#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[] = {
[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) {
}
/* 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;
}
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;
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;
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;
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;
}
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;
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;
}
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],
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
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);
if (trace->environment) {
BT_LOGD_STR("Destroying environment attributes.");
- bt_ctf_attributes_destroy(trace->environment);
+ bt_attributes_destroy(trace->environment);
}
if (trace->name) {
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;
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;
}
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;
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;
}
* 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;
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;
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:
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;
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:
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;
goto end;
}
- ret = bt_ctf_attributes_get_count(trace->environment);
+ ret = bt_attributes_get_count(trace->environment);
assert(ret >= 0);
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;
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;
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;
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;
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;
}
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;
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.");
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;
}
}
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) {
/*
}
/* 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;
}
* 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);
* 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;
}
* 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) {
* 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;
* 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;
}
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 */
}
/* 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;
}
* 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;
* 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;
* 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;
* 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);
* 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);
}
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
* 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;
}
/* 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;
}
* 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;
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.");
"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) {
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;
}
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;
}
* 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,
}
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.");
/* 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
*/
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,
}
}
- 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) {
/* 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: "
}
}
- 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: "
* 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.");
* 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) {
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);
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;
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.");
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;
}
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;
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.");
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;
}
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) {
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);
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.");
}
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;
}
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 };
}
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:
}
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;
}
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,
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;
}
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;
}
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);
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;
}
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;
}
}
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.");
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;
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;
}
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.");
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;
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;
}
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;
}
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.");
}
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:
}
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;
}
// 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 =
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;
}
}
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);
}
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;
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);
}
}
static
-void bt_ctf_trace_freeze(struct bt_ctf_trace *trace)
+void bt_trace_freeze(struct bt_trace *trace)
{
int i;
}
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;
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;
}
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);
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,
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;
}
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;
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.");
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;
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;
/* 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);
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:
}
}
-int bt_ctf_validate_identifier(const char *input_string)
+int bt_validate_identifier(const char *input_string)
{
int ret = 0;
char *string = NULL;
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);
}
*/
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;
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);
/* 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);
}
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);
*/
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;
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);
/* 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);
}
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);
}
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: "
*/
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;
"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);
/* 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);
* `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;
}
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);
}
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;
/* 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 */
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) {
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.");
* 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:
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 =
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;
* 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:
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;
* 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:
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;
* 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:
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;
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 =
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;
* 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:
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;
* 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:
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;
}
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,
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);
#include <babeltrace/ref.h>
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;
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;
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;
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;
}
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;
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;
const char *description = NULL;
if (clock) {
- description = bt_ctf_clock_class_get_description(
+ description = bt_clock_class_get_description(
clock->clock_class);
}
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);
}
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;
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);
}
uint64_t precision = -1ULL;
if (clock) {
- precision = bt_ctf_clock_class_get_precision(
+ precision = bt_clock_class_get_precision(
clock->clock_class);
}
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);
}
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);
}
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);
}
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);
}
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);
}
int is_absolute = -1;
if (clock) {
- is_absolute = bt_ctf_clock_class_is_absolute(
+ is_absolute = bt_clock_class_is_absolute(
clock->clock_class);
}
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);
}
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;
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;
* 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));
{
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:
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:
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:
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:
{
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:
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:
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:
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:
}
}
- 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)) {
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);
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);
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;
}
}
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;
}
}
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;
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;
goto error_destroy;
}
- writer->trace = bt_ctf_trace_create();
+ writer->trace = bt_trace_create();
if (!writer->trace) {
goto error_destroy;
}
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;
}
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 */
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;
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;
}
/* 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) {
}
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) {
}
}
- stream = bt_ctf_stream_create(stream_class, NULL);
+ stream = bt_stream_create(stream_class, NULL);
if (!stream) {
goto error;
}
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;
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;
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;
}
goto end;
}
- metadata_string = bt_ctf_trace_get_metadata_string(
+ metadata_string = bt_trace_get_metadata_string(
writer->trace);
end:
return metadata_string;
goto end;
}
- metadata_string = bt_ctf_trace_get_metadata_string(
+ metadata_string = bt_trace_get_metadata_string(
writer->trace);
if (!metadata_string) {
goto 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;
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;
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.");
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.");
}
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);
struct clock_class_prio {
uint64_t prio;
- struct bt_ctf_clock_class *clock_class;
+ struct bt_clock_class *clock_class;
};
static
}
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 = {
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.");
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;
"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;
}
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;
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;
"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);
}
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);
"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;
}
}
#include <stdlib.h>
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;
/* 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;
/* 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;
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);
* 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;
}
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);
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;
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);
}
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;
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) {
/*
"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,
"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) {
/*
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;
}
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:
"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;
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;
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:
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;
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:
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;
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;
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,
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 = {
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;
}
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);
}
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;
}
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",
}
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;
}
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",
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;
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;
}
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;
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);
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);
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;
}
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;
}
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);
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;
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;
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;
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;
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;
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;
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;
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);
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:
}
if (notif_packet) {
- notif_stream = bt_ctf_packet_borrow_stream(notif_packet);
+ notif_stream = bt_packet_borrow_stream(notif_packet);
assert(notif_stream);
}
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;
"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) {
"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;
}
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) {
}
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) {
}
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) {
#include <babeltrace/graph/notification-discarded-elements-internal.h>
#include <stdint.h>
-struct bt_ctf_clock_value *
+struct bt_clock_value *
bt_notification_discarded_events_get_begin_clock_value(
struct bt_notification *notification)
{
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)
{
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(
#include <babeltrace/graph/notification-discarded-elements-internal.h>
#include <stdint.h>
-struct bt_ctf_clock_value *
+struct bt_clock_value *
bt_notification_discarded_packets_get_begin_clock_value(
struct bt_notification *notification)
{
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)
{
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(
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(
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: "
"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);
"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;
}
}
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.");
}
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;
}
"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;
}
"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: "
"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;
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) {
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) {
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) {
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) {
"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;
"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:
}
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.");
"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) {
}
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.");
"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) {
}
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) {
"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;
}
"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.");
"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.");
}
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) {
"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;
}
"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.");
"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.");
*
* 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;
};
/* 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;
* 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 {
/* User stuff */
struct {
/* Callback functions */
- struct bt_ctf_btr_cbs cbs;
+ struct bt_btr_cbs cbs;
/* Private data */
void *data;
}
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;
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;
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;
}
}
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);
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;
}
}
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);
}
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:
}
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);
break;
}
default:
- size = BT_CTF_BTR_STATUS_ERROR;
+ size = BT_BTR_STATUS_ERROR;
break;
}
}
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;
}
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));
}
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:
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:
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) {
}
/* 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) {
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;
}
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;
}
/* 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;
}
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));
}
}
}
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
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;
}
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;
}
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));
}
}
}
}
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,
}
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,
}
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;
}
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;
}
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;
}
/* 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;
}
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;
}
/* 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;
}
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;
}
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;
}
}
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);
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;
}
}
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;
}
}
}
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();
}
}
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();
}
}
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;
}
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;
}
/* 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;
}
} 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:
}
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;
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;
}
}
}
/* 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(
"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;
}
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;
}
}
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;
}
}
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));
}
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;
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;
}
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);
}
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",
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);
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, "
*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;
}
}
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;
}
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;
}
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);
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);
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;
}
/**
* 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.
*
* 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
* All the type callback functions return one of the following
* values:
*
- * - <b>#BT_CTF_BTR_STATUS_OK</b>: Everything is okay;
+ * - <b>#BT_BTR_STATUS_OK</b>: Everything is okay;
* continue the decoding process.
- * - <b>#BT_CTF_BTR_STATUS_ERROR</b>: General error (reported
+ * - <b>#BT_BTR_STATUS_ERROR</b>: General error (reported
* to type reader's user).
*
* Any member of this structure may be set to \c NULL, should
* @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
* @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
* @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);
/**
*
* @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.
* 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;
/**
* @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);
/**
* @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;
};
* @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.
* The \p status output parameter is where a status is written, amongst
* the following:
*
- * - <b>#BT_CTF_BTR_STATUS_OK</b>: Decoding is done.
- * - <b>#BT_CTF_BTR_STATUS_EOF</b>: The end of the buffer was reached,
+ * - <b>#BT_BTR_STATUS_OK</b>: Decoding is done.
+ * - <b>#BT_BTR_STATUS_EOF</b>: 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.
- * - <b>#BT_CTF_BTR_STATUS_INVAL</b>: Invalid argument.
- * - <b>#BT_CTF_BTR_STATUS_ERROR</b>: General error.
+ * - <b>#BT_BTR_STATUS_INVAL</b>: Invalid argument.
+ * - <b>#BT_BTR_STATUS_ERROR</b>: 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)
* @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.
* The \p status output parameter is where a status is placed, amongst
* the following:
*
- * - <b>#BT_CTF_BTR_STATUS_OK</b>: decoding is done.
- * - <b>#BT_CTF_BTR_STATUS_EOF</b>: the end of the buffer was reached,
+ * - <b>#BT_BTR_STATUS_OK</b>: decoding is done.
+ * - <b>#BT_BTR_STATUS_EOF</b>: 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.
- * - <b>#BT_CTF_BTR_STATUS_INVAL</b>: invalid argument.
- * - <b>#BT_CTF_BTR_STATUS_ERROR</b>: general error.
+ * - <b>#BT_BTR_STATUS_INVAL</b>: invalid argument.
+ * - <b>#BT_BTR_STATUS_ERROR</b>: general error.
*
* @param btr Binary type reader
* @param buf Buffer
* @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)";
}
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
}
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);
#include <stdint.h>
#include <stdbool.h>
-struct bt_ctf_trace;
+struct bt_trace;
/* A CTF metadata decoder object */
struct ctf_metadata_decoder;
* 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);
/*
#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, \
/*
* Alias name to field type.
*
- * GQuark -> struct bt_ctf_field_type *
+ * GQuark -> struct bt_field_type *
*/
GHashTable *decl_map;
*/
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;
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];
/*
* Stream IDs to stream classes.
*
- * int64_t -> struct bt_ctf_stream_class *
+ * int64_t -> struct bt_stream_class *
*/
GHashTable *stream_classes;
}
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:
* @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);
* @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,
* @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,
* @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,
* @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,
*/
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);
*/
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);
*/
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);
*/
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);
*/
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);
* @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)
{
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;
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)
}
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,
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: "
}
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;
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,
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
}
/* 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,
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 {
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;
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) {
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;
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);
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);
/* 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);
}
/* 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) {
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);
/* 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);
}
/* 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) {
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,
}
/* 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;
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)) {
}
/* 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;
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;
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;
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;
/* 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.");
}
/* 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;
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);
}
}
- *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;
}
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: "
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.");
}
/* 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.");
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);
}
}
- 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.");
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) {
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;
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) {
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.");
}
/* 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;
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);
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;
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: "
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("");
}
/* 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.");
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;
}
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);
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,
!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: "
!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: "
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,
}
}
- *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;
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;
}
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);
}
}
- *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;
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;
!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: "
}
}
- *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;
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;
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:
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: "
}
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) {
}
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) {
_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",
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,
_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,
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:
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;
}
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;
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;
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.
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
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,
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);
}
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,
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.");
}
/* 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",
}
}
- 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);
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,
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) {
* 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.");
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.");
* 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:
}
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;
}
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;
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);
}
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:
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: "
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) {
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) {
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) {
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) {
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, "
}
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) {
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, "
}
/* 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.");
* 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) {
{
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:
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;
}
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) {
}
}
- ret = bt_ctf_trace_set_environment_field_string(
+ ret = bt_trace_set_environment_field_string(
ctx->trace, left, right);
g_free(right);
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,
}
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",
&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.");
}
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,
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;
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");
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.");
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.");
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.");
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.");
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.");
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.");
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.");
}
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;
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;
{
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;
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.");
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) {
/*
* 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.");
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.");
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
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.");
* 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;
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;
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
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;
{
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;
}
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;
* 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,
}
}
- 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);
#include "notif-iter.h"
#include "../btr/btr.h"
-struct bt_ctf_notif_iter;
+struct bt_notif_iter;
/* A visit stack entry */
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;
};
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;
* 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;
/*
* 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;
} 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;
*/
off_t cur_packet_offset;
- /* bt_ctf_clock_class to uint64_t. */
+ /* bt_clock_class to uint64_t. */
GHashTable *clock_states;
/*
*/
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;
};
}
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)
}
static
-struct stack *stack_new(struct bt_ctf_notif_iter *notit)
+struct stack *stack_new(struct bt_notif_iter *notit)
{
struct stack *stack = NULL;
}
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;
}
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);
}
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);
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) */
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
}
}
- 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) {
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) {
/* 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);
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);
}
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;
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;
}
}
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;
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;
}
}
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);
}
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);
}
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;
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,
"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:
}
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;
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);
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: "
"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;
}
}
}
- 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: "
"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;
}
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;
}
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) {
/*
// 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;
}
"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;
}
"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 {
"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
"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:
}
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;
}
}
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;
}
"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,
"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);
}
}
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);
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: "
"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);
"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;
}
}
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;
}
}
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;
"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;
"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,
"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:
}
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
* 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) {
/*
/* 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) {
* |_____|_| |_||_| |_|\__, | 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: "
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);
}
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;
}
"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: "
"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;
}
"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);
}
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;
}
}
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;
"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,
"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);
}
}
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;
"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,
"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);
}
}
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;
"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,
"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);
}
}
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);
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;
}
}
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",
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;
}
* 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);
}
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;
}
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();
}
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);
}
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;
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;
}
"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);
}
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;
}
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);
}
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)) {
}
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;
}
}
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);
}
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++;
}
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;
}
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;
}
* 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;
}
}
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 */
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;
}
}
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;
/*
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;
}
}
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;
}
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 */
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);
}
}
- 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);
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;
}
}
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) {
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",
}
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, "
}
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) {
* 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",
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);
}
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: "
"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;
}
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: "
"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: "
"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: "
"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: "
"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;
}
"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;
}
}
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;
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;
}
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));
}
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);
"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, "
"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: "
"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: "
"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;
}
}
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;
}
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;
}
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 */
}
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: "
}
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,
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;
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);
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;
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);
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) {
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);
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",
/* 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;
}
}
/* 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:
}
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);
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",
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:
}
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);
}
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;
/**
* 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,
};
/**
* 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.
*
* This function must return one of the following statuses:
*
- * - <b>#BT_CTF_NOTIF_ITER_MEDIUM_STATUS_OK</b>: Everything
+ * - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_OK</b>: 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.
- * - <b>#BT_CTF_NOTIF_ITER_MEDIUM_STATUS_AGAIN</b>: No data is
+ * - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_AGAIN</b>: 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.
- * - <b>#BT_CTF_NOTIF_ITER_MEDIUM_STATUS_EOF</b>: The end of
+ * - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_EOF</b>: 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.
- * - <b>#BT_CTF_NOTIF_ITER_MEDIUM_STATUS_ERROR</b>: A fatal
+ * - <b>#BT_NOTIF_ITER_MEDIUM_STATUS_ERROR</b>: 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.
*
* @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);
* 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);
/**
* @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;
};
/**
* @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)
* 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);
/**
* @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.
*
* @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);
* 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)";
}
#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;
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;
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);
}
#include <babeltrace/babeltrace.h>
#include <babeltrace/babeltrace-internal.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);
#endif /* CTF_UTILS_H */
#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);
}
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.");
}
}
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;
}
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);
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;
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;
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;
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;
}
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;
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);
}
/* 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;
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,
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);
}
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,
}
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,
}
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) {
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);
}
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);
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);
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);
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);
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;
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);
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);
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;
}
}
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;
}
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) {
}
case BT_NOTIFICATION_TYPE_PACKET_END:
{
- struct bt_ctf_packet *packet =
+ struct bt_packet *packet =
bt_notification_packet_end_get_packet(notification);
if (!packet) {
}
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) {
}
case BT_NOTIFICATION_TYPE_STREAM_BEGIN:
{
- struct bt_ctf_stream *stream =
+ struct bt_stream *stream =
bt_notification_stream_begin_get_stream(notification);
if (!stream) {
}
case BT_NOTIFICATION_TYPE_STREAM_END:
{
- struct bt_ctf_stream *stream =
+ struct bt_stream *stream =
bt_notification_stream_end_get_stream(notification);
if (!stream) {
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;
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;
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(
}
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) {
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 */
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) {
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)",
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) {
}
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;
}
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 {
}
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,
}
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;
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.");
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.");
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);
}
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;
}
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);
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,
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;
{
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);
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",
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:
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();
}
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;
}
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;
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;
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;
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);
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 */
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);
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);
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;
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;
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;
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;
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;
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.");
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);
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);
}
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);
* 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;
struct ctf_fs_metadata {
/* Owned by this */
- struct bt_ctf_trace *trace;
+ struct bt_trace *trace;
/* Owned by this */
char *text;
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;
size_t ds_file_info_index;
/* Owned by this */
- struct bt_ctf_notif_iter *notif_iter;
+ struct bt_notif_iter *notif_iter;
};
BT_HIDDEN
}
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);
}
}
- 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;
#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;
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);
}
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);
}
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) {
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) {
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
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) {
}
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);
#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(
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. */
* 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;
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;
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,
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,
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);
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);
}
}
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)
{
case LTTNG_LIVE_STREAM_EOF:
break;
}
- return BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK;
+ return BT_LTTNG_LIVE_ITERATOR_STATUS_OK;
}
/*
* 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
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);
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;
}
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);
}
* 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;
}
}
}
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;
* 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;
}
}
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;
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;
}
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;
}
}
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.
*/
}
}
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;
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;
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;
}
}
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;
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;
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;
} __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;
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(
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;
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;
}
}
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;
}
}
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;
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:
goto end;
error:
- status = BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
+ status = BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR;
end:
if (fp) {
int closeret;
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);
}
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)
{
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;
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:
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;
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) {
}
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");
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;
}
* 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;
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);
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");
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;
}
#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.");
}
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;
}
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.");
}
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.");
}
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);
}
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);
}
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);
}
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;
}
}
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.");
}
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.");
}
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;
}
}
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,
}
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,
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;
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,
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,
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,
}
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.");
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);
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;
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.");
#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
}
#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:
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);
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.");
}
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.");
}
}
- 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.");
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) {
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) {
/*
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.");
}
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.");
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);
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) {
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.");
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.");
}
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.");
}
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;
}
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.");
}
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;
}
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);
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.");
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.");
}
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);
}
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;
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,
}
/* 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.");
}
/* 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;
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;
}
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) {
}
}
- 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
* 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;
}
}
- 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.");
}
}
- 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;
}
}
- 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;
*
* 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
*/
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.
* 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
*/
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.
* 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);
/*
*/
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);
/*
* 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
* 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
* 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
* 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
* 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);
/*
* 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
* 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
}
#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);
}
}
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);
}
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);
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;
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);
}
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);
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;
}
goto error;
}
- ret = bt_ctf_field_signed_integer_get_value(field, value);
+ ret = bt_field_signed_integer_get_value(field, value);
goto end;
error:
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);
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;
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);
}
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);
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;
}
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);
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;
/*
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);
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;
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);
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);
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(
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;
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) {
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) {
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;
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,
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;
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);
}
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,
}
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);
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,
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);
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);
}
/* 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;
}
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;
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) {
}
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. */
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.");
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) {
}
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.");
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.");
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;
}
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.");
* 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.");
}
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);
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;
}
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(
}
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) {
}
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(
}
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);
}
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);
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);
}
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);
}
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;
}
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;
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;
}
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);
}
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);
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) {
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);
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);
/*
* 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
*/
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);
}
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) {
}
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);
}
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);
}
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);
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;
* 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;
}
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;
}
/* 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);
}
/* 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,
}
/* 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;
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;
}
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);
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.");
}
}
- 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);
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);
}
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;
}
#include <babeltrace/babeltrace.h>
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 */
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;
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;
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;
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;
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;
}
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;
}
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;
};
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;
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
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;
}
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;
}
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);
}
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;
}
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;
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);
}
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;
}
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: "
}
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: "
}
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: "
}
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: "
}
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;
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;
}
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;
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.");
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.");
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.");
}
}
- 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;
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);
}
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;
}
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;
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) {
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;
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);
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;
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);
}
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;
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;
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);
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;
}
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;
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
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
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 */
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");
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;
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);
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;
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, ", ");
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;
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;
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;
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;
}
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];
}
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, ", ");
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);
}
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;
} 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;
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;
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;
}
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;
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;
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;
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);
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;
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;
}
}
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;
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;
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) {
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;
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;
}
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) {
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;
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;
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;
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);
}
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);
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);
{
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) {
{
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
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)) {
}
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
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;
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) {
* 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;
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\"",
}
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\"",
}
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\"",
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:
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);
#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;
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);
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);
}
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);
/*
}
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) {
}
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);
}
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;
}
#include <babeltrace/babeltrace.h>
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 */
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;
{
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;
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.");
}
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;
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;
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);
* 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);
{
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;
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;
}
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);
/*
- * test_bt_ctf_field_type_validation.c
+ * test_bt_field_type_validation.c
*
* Babeltrace CTF IR field type validation test
*
#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:
*/
- 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);
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);
}
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:
*/
- 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);
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:
*/
- 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);
}
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:
*/
- 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);
}
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:
*/
- 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);
}
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:
*/
- 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);
}
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;
}
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);
#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);
}
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);
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;
}
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);
/* 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);
/* 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);
/* 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);
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();
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);
}
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);
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:
*/
- 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);
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);
}
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:
*/
- 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);
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);
}
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:
*/
- 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);
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);
}
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:
*/
- 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);
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);
}
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:
*/
- 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);
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);
}
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:
*/
- 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);
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);
}
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:
*/
- 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);
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);
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);
}
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:
*/
- 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);
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);
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,
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) {
}
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;
}
.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];
}
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,
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);
}
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);
}
{
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");
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[] = {
* - 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");
* - 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;
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;
* - 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;
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;
}
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);
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;
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;
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);
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;
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);
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;
}
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;
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;
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);
* 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 };
"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");
"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");
/* 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,
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;
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);
}
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");
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);
}
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 ;
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,
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,
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);
}
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);
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 */
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);
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");
}
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.
*/
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) {
}
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");
* 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);
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) {
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) {
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");
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;
* 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;
* 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;
* 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;
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;
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");
}
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;
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");
}
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);
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)) {
}
/* 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 */
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);
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);
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);
}
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;
}
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;
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)");
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);
}
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,
*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;
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,
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)
"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 */
/* 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);
/*
* 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");
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");
* 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");
* 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,
validate_trace(argv[1], trace_path);
- recursive_rmdir(trace_path);
+ //recursive_rmdir(trace_path);
g_free(trace_path);
g_free(metadata_path);
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;
}
}
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);
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;
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;
}
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;
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;
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;
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");
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) {
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();
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,
size_t iter_index;
int64_t *seq;
size_t at;
- struct bt_ctf_packet *packet;
+ struct bt_packet *packet;
};
struct sink_user_data {
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);
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);
}
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);
}
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);
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);
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;
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);
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);
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);