The bt_msg_iter structure is specific to iterating on CTF messages, so
it would be more appropriate for it to be called ctf_msg_iter. Rename
it, as well as related types and functions.
Change-Id: I0ce498e492295a3f7390d73d921ef2eca1cc6d00
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2322
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
#include "msg-iter.h"
#include "../bfcr/bfcr.h"
#include "msg-iter.h"
#include "../bfcr/bfcr.h"
/* A visit stack entry */
struct stack_entry {
/* A visit stack entry */
struct stack_entry {
/* Visit stack */
struct stack {
/* Visit stack */
struct stack {
- struct bt_msg_iter *msg_it;
+ struct ctf_msg_iter *msg_it;
/* Entries (struct stack_entry) */
GArray *entries;
/* Entries (struct stack_entry) */
GArray *entries;
};
/* CTF message iterator */
};
/* CTF message iterator */
/* Visit stack */
struct stack *stack;
/* Visit stack */
struct stack *stack;
/* Current medium data */
struct {
/* Current medium data */
struct {
- struct bt_msg_iter_medium_ops medops;
+ struct ctf_msg_iter_medium_ops medops;
size_t max_request_sz;
void *data;
} medium;
size_t max_request_sz;
void *data;
} medium;
-struct stack *stack_new(struct bt_msg_iter *msg_it)
+struct stack *stack_new(struct ctf_msg_iter *msg_it)
{
bt_self_component *self_comp = msg_it->self_comp;
struct stack *stack = NULL;
{
bt_self_component *self_comp = msg_it->self_comp;
struct stack *stack = NULL;
static
void stack_destroy(struct stack *stack)
{
static
void stack_destroy(struct stack *stack)
{
- struct bt_msg_iter *msg_it;
+ struct ctf_msg_iter *msg_it;
BT_ASSERT_DBG(stack);
msg_it = stack->msg_it;
BT_ASSERT_DBG(stack);
msg_it = stack->msg_it;
void stack_push(struct stack *stack, bt_field *base)
{
struct stack_entry *entry;
void stack_push(struct stack *stack, bt_field *base)
{
struct stack_entry *entry;
- struct bt_msg_iter *msg_it;
+ struct ctf_msg_iter *msg_it;
BT_ASSERT_DBG(stack);
msg_it = stack->msg_it;
BT_ASSERT_DBG(stack);
msg_it = stack->msg_it;
static
void stack_pop(struct stack *stack)
{
static
void stack_pop(struct stack *stack)
{
- struct bt_msg_iter *msg_it;
+ struct ctf_msg_iter *msg_it;
BT_ASSERT_DBG(stack);
BT_ASSERT_DBG(stack_size(stack));
BT_ASSERT_DBG(stack);
BT_ASSERT_DBG(stack_size(stack));
-enum bt_msg_iter_status msg_iter_status_from_m_status(
- enum bt_msg_iter_medium_status m_status)
+enum ctf_msg_iter_status msg_iter_status_from_m_status(
+ enum ctf_msg_iter_medium_status m_status)
{
/* They are the same */
return (int) m_status;
}
static inline
{
/* They are the same */
return (int) m_status;
}
static inline
-size_t buf_size_bits(struct bt_msg_iter *msg_it)
+size_t buf_size_bits(struct ctf_msg_iter *msg_it)
{
return msg_it->buf.sz * 8;
}
static inline
{
return msg_it->buf.sz * 8;
}
static inline
-size_t buf_available_bits(struct bt_msg_iter *msg_it)
+size_t buf_available_bits(struct ctf_msg_iter *msg_it)
{
return buf_size_bits(msg_it) - msg_it->buf.at;
}
static inline
{
return buf_size_bits(msg_it) - msg_it->buf.at;
}
static inline
-size_t packet_at(struct bt_msg_iter *msg_it)
+size_t packet_at(struct ctf_msg_iter *msg_it)
{
return msg_it->buf.packet_offset + msg_it->buf.at;
}
static inline
{
return msg_it->buf.packet_offset + msg_it->buf.at;
}
static inline
-void buf_consume_bits(struct bt_msg_iter *msg_it, size_t incr)
+void buf_consume_bits(struct ctf_msg_iter *msg_it, size_t incr)
{
BT_COMP_LOGT("Advancing cursor: msg-it-addr=%p, cur-before=%zu, cur-after=%zu",
msg_it, msg_it->buf.at, msg_it->buf.at + incr);
{
BT_COMP_LOGT("Advancing cursor: msg-it-addr=%p, cur-before=%zu, cur-after=%zu",
msg_it, msg_it->buf.at, msg_it->buf.at + incr);
-enum bt_msg_iter_status request_medium_bytes(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status request_medium_bytes(
+ struct ctf_msg_iter *msg_it)
{
bt_self_component *self_comp = msg_it->self_comp;
uint8_t *buffer_addr = NULL;
size_t buffer_sz = 0;
{
bt_self_component *self_comp = msg_it->self_comp;
uint8_t *buffer_addr = NULL;
size_t buffer_sz = 0;
- enum bt_msg_iter_medium_status m_status;
+ enum ctf_msg_iter_medium_status m_status;
BT_COMP_LOGD("Calling user function (request bytes): msg-it-addr=%p, "
"request-size=%zu", msg_it, msg_it->medium.max_request_sz);
BT_COMP_LOGD("Calling user function (request bytes): msg-it-addr=%p, "
"request-size=%zu", msg_it, msg_it->medium.max_request_sz);
msg_it->medium.max_request_sz, &buffer_addr,
&buffer_sz, msg_it->medium.data);
BT_COMP_LOGD("User function returned: status=%s, buf-addr=%p, buf-size=%zu",
msg_it->medium.max_request_sz, &buffer_addr,
&buffer_sz, msg_it->medium.data);
BT_COMP_LOGD("User function returned: status=%s, buf-addr=%p, buf-size=%zu",
- bt_msg_iter_medium_status_string(m_status),
+ ctf_msg_iter_medium_status_string(m_status),
- if (m_status == BT_MSG_ITER_MEDIUM_STATUS_OK) {
+ if (m_status == CTF_MSG_ITER_MEDIUM_STATUS_OK) {
BT_ASSERT(buffer_sz != 0);
/* New packet offset is old one + old size (in bits) */
BT_ASSERT(buffer_sz != 0);
/* New packet offset is old one + old size (in bits) */
msg_it->buf.sz, msg_it->buf.addr);
BT_COMP_LOGD_MEM(buffer_addr, buffer_sz, "Returned bytes at %p:",
buffer_addr);
msg_it->buf.sz, msg_it->buf.addr);
BT_COMP_LOGD_MEM(buffer_addr, buffer_sz, "Returned bytes at %p:",
buffer_addr);
- } else if (m_status == BT_MSG_ITER_MEDIUM_STATUS_EOF) {
+ } else if (m_status == CTF_MSG_ITER_MEDIUM_STATUS_EOF) {
/*
* User returned end of stream: validate that we're not
* in the middle of a packet header, packet context, or
/*
* User returned end of stream: validate that we're not
* in the middle of a packet header, packet context, or
"User function returned %s, but message iterator is in an unexpected state: "
"state=%s, cur-packet-size=%" PRId64 ", cur=%zu, "
"packet-cur=%zu, last-eh-at=%zu",
"User function returned %s, but message iterator is in an unexpected state: "
"state=%s, cur-packet-size=%" PRId64 ", cur=%zu, "
"packet-cur=%zu, last-eh-at=%zu",
- bt_msg_iter_medium_status_string(m_status),
+ ctf_msg_iter_medium_status_string(m_status),
state_string(msg_it->state),
msg_it->cur_exp_packet_total_size,
msg_it->buf.at, packet_at(msg_it),
msg_it->buf.last_eh_at);
state_string(msg_it->state),
msg_it->cur_exp_packet_total_size,
msg_it->buf.at, packet_at(msg_it),
msg_it->buf.last_eh_at);
- m_status = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
+ m_status = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
} else if (m_status < 0) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp, "User function failed: "
} else if (m_status < 0) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp, "User function failed: "
- "status=%s", bt_msg_iter_medium_status_string(m_status));
+ "status=%s", ctf_msg_iter_medium_status_string(m_status));
-enum bt_msg_iter_status buf_ensure_available_bits(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status buf_ensure_available_bits(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
if (G_UNLIKELY(buf_available_bits(msg_it) == 0)) {
/*
if (G_UNLIKELY(buf_available_bits(msg_it) == 0)) {
/*
- * This _cannot_ return BT_MSG_ITER_STATUS_OK
+ * This _cannot_ return CTF_MSG_ITER_STATUS_OK
* _and_ no bits.
*/
status = request_medium_bytes(msg_it);
* _and_ no bits.
*/
status = request_medium_bytes(msg_it);
-enum bt_msg_iter_status read_dscope_begin_state(
- struct bt_msg_iter *msg_it,
+enum ctf_msg_iter_status read_dscope_begin_state(
+ struct ctf_msg_iter *msg_it,
struct ctf_field_class *dscope_fc,
enum state done_state, enum state continue_state,
bt_field *dscope_field)
{
struct ctf_field_class *dscope_fc,
enum state done_state, enum state continue_state,
bt_field *dscope_field)
{
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status bfcr_status;
size_t consumed_bits;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status bfcr_status;
size_t consumed_bits;
"BFCR failed to start: msg-it-addr=%p, bfcr-addr=%p, "
"status=%s", msg_it, msg_it->bfcr,
bt_bfcr_status_string(bfcr_status));
"BFCR failed to start: msg-it-addr=%p, bfcr-addr=%p, "
"status=%s", msg_it, msg_it->bfcr,
bt_bfcr_status_string(bfcr_status));
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-enum bt_msg_iter_status read_dscope_continue_state(
- struct bt_msg_iter *msg_it, enum state done_state)
+enum ctf_msg_iter_status read_dscope_continue_state(
+ struct ctf_msg_iter *msg_it, enum state done_state)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status bfcr_status;
size_t consumed_bits;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status bfcr_status;
size_t consumed_bits;
msg_it, msg_it->bfcr);
status = buf_ensure_available_bits(msg_it);
msg_it, msg_it->bfcr);
status = buf_ensure_available_bits(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
if (status < 0) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot ensure that buffer has at least one byte: "
"msg-addr=%p, status=%s",
if (status < 0) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot ensure that buffer has at least one byte: "
"msg-addr=%p, status=%s",
- msg_it, bt_msg_iter_status_string(status));
+ msg_it, ctf_msg_iter_status_string(status));
} else {
BT_COMP_LOGT("Cannot ensure that buffer has at least one byte: "
"msg-addr=%p, status=%s",
} else {
BT_COMP_LOGT("Cannot ensure that buffer has at least one byte: "
"msg-addr=%p, status=%s",
- msg_it, bt_msg_iter_status_string(status));
+ msg_it, ctf_msg_iter_status_string(status));
"BFCR failed to continue: msg-it-addr=%p, bfcr-addr=%p, "
"status=%s", msg_it, msg_it->bfcr,
bt_bfcr_status_string(bfcr_status));
"BFCR failed to continue: msg-it-addr=%p, bfcr-addr=%p, "
"status=%s", msg_it, msg_it->bfcr,
bt_bfcr_status_string(bfcr_status));
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-void release_event_dscopes(struct bt_msg_iter *msg_it)
+void release_event_dscopes(struct ctf_msg_iter *msg_it)
{
msg_it->dscopes.event_common_context = NULL;
msg_it->dscopes.event_spec_context = NULL;
{
msg_it->dscopes.event_common_context = NULL;
msg_it->dscopes.event_spec_context = NULL;
-void release_all_dscopes(struct bt_msg_iter *msg_it)
+void release_all_dscopes(struct ctf_msg_iter *msg_it)
{
msg_it->dscopes.stream_packet_context = NULL;
{
msg_it->dscopes.stream_packet_context = NULL;
-enum bt_msg_iter_status switch_packet_state(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status switch_packet_state(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
/*
bt_self_component *self_comp = msg_it->self_comp;
/*
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot switch packet: current position is not a multiple of 8: "
"msg-it-addr=%p, cur=%zu", msg_it, msg_it->buf.at);
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot switch packet: current position is not a multiple of 8: "
"msg-it-addr=%p, cur=%zu", msg_it, msg_it->buf.at);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-enum bt_msg_iter_status read_packet_header_begin_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_packet_header_begin_state(
+ struct ctf_msg_iter *msg_it)
{
struct ctf_field_class *packet_header_fc = NULL;
bt_self_component *self_comp = msg_it->self_comp;
{
struct ctf_field_class *packet_header_fc = NULL;
bt_self_component *self_comp = msg_it->self_comp;
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
/*
* Make sure at least one bit is available for this packet. An
/*
* Make sure at least one bit is available for this packet. An
*/
status = buf_ensure_available_bits(msg_it);
switch (status) {
*/
status = buf_ensure_available_bits(msg_it);
switch (status) {
- case BT_MSG_ITER_STATUS_OK:
+ case CTF_MSG_ITER_STATUS_OK:
- case BT_MSG_ITER_STATUS_EOF:
- status = BT_MSG_ITER_STATUS_OK;
+ case CTF_MSG_ITER_STATUS_EOF:
+ status = CTF_MSG_ITER_STATUS_OK;
msg_it->state = STATE_CHECK_EMIT_MSG_STREAM_END;
goto end;
default:
msg_it->state = STATE_CHECK_EMIT_MSG_STREAM_END;
goto end;
default:
-enum bt_msg_iter_status read_packet_header_continue_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_packet_header_continue_state(
+ struct ctf_msg_iter *msg_it)
{
return read_dscope_continue_state(msg_it,
STATE_AFTER_TRACE_PACKET_HEADER);
}
static inline
{
return read_dscope_continue_state(msg_it,
STATE_AFTER_TRACE_PACKET_HEADER);
}
static inline
-enum bt_msg_iter_status set_current_stream_class(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status set_current_stream_class(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_stream_class *new_stream_class = NULL;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_stream_class *new_stream_class = NULL;
"Need exactly one stream class since there's "
"no stream class ID field: "
"msg-it-addr=%p", msg_it);
"Need exactly one stream class since there's "
"no stream class ID field: "
"msg-it-addr=%p", msg_it);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
"msg-it-addr=%p, stream-class-id=%" PRIu64 ", "
"trace-class-addr=%p",
msg_it, msg_it->cur_stream_class_id, msg_it->meta.tc);
"msg-it-addr=%p, stream-class-id=%" PRIu64 ", "
"trace-class-addr=%p",
msg_it, msg_it->cur_stream_class_id, msg_it->meta.tc);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
new_stream_class,
new_stream_class->id,
msg_it->meta.tc);
new_stream_class,
new_stream_class->id,
msg_it->meta.tc);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-enum bt_msg_iter_status set_current_stream(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status set_current_stream(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
bt_stream *stream = NULL;
bt_self_component *self_comp = msg_it->self_comp;
bt_stream *stream = NULL;
if (!stream) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"User function failed to return a stream object for the given stream class.");
if (!stream) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"User function failed to return a stream object for the given stream class.");
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
goto end;
}
if (msg_it->stream && stream != msg_it->stream) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"User function returned a different stream than the previous one for the same sequence of packets.");
goto end;
}
if (msg_it->stream && stream != msg_it->stream) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"User function returned a different stream than the previous one for the same sequence of packets.");
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-enum bt_msg_iter_status set_current_packet(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status set_current_packet(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
bt_packet *packet = NULL;
bt_self_component *self_comp = msg_it->self_comp;
bt_packet *packet = NULL;
error:
BT_PACKET_PUT_REF_AND_RESET(packet);
error:
BT_PACKET_PUT_REF_AND_RESET(packet);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
end:
BT_PACKET_MOVE_REF(msg_it->packet, packet);
end:
BT_PACKET_MOVE_REF(msg_it->packet, packet);
-enum bt_msg_iter_status after_packet_header_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status after_packet_header_state(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status;
+ enum ctf_msg_iter_status status;
status = set_current_stream_class(msg_it);
status = set_current_stream_class(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
-enum bt_msg_iter_status read_packet_context_begin_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_packet_context_begin_state(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *packet_context_fc;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *packet_context_fc;
* packet is created from a stream, and this API must be
* able to return the packet context properties without
* creating a stream
* packet is created from a stream, and this API must be
* able to return the packet context properties without
* creating a stream
- * (bt_msg_iter_get_packet_properties()).
+ * (ctf_msg_iter_get_packet_properties()).
*/
msg_it->packet_context_field =
bt_packet_context_field_create(
*/
msg_it->packet_context_field =
bt_packet_context_field_create(
if (!msg_it->packet_context_field) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot create packet context field wrapper from stream class.");
if (!msg_it->packet_context_field) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot create packet context field wrapper from stream class.");
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-enum bt_msg_iter_status read_packet_context_continue_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_packet_context_continue_state(
+ struct ctf_msg_iter *msg_it)
{
return read_dscope_continue_state(msg_it,
STATE_AFTER_STREAM_PACKET_CONTEXT);
}
static
{
return read_dscope_continue_state(msg_it,
STATE_AFTER_STREAM_PACKET_CONTEXT);
}
static
-enum bt_msg_iter_status set_current_packet_content_sizes(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status set_current_packet_content_sizes(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
if (msg_it->cur_exp_packet_total_size == -1) {
bt_self_component *self_comp = msg_it->self_comp;
if (msg_it->cur_exp_packet_total_size == -1) {
msg_it, msg_it->dscopes.stream_packet_context,
msg_it->cur_exp_packet_total_size,
msg_it->cur_exp_packet_content_size);
msg_it, msg_it->dscopes.stream_packet_context,
msg_it->cur_exp_packet_total_size,
msg_it->cur_exp_packet_content_size);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-enum bt_msg_iter_status after_packet_context_state(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status after_packet_context_state(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status;
+ enum ctf_msg_iter_status status;
status = set_current_packet_content_sizes(msg_it);
status = set_current_packet_content_sizes(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
-enum bt_msg_iter_status read_event_header_begin_state(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_header_begin_state(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_header_fc = NULL;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_header_fc = NULL;
"cur=%zu", msg_it,
msg_it->cur_exp_packet_content_size,
packet_at(msg_it));
"cur=%zu", msg_it,
msg_it->cur_exp_packet_content_size,
packet_at(msg_it));
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
*/
status = buf_ensure_available_bits(msg_it);
switch (status) {
*/
status = buf_ensure_available_bits(msg_it);
switch (status) {
- case BT_MSG_ITER_STATUS_OK:
+ case CTF_MSG_ITER_STATUS_OK:
- case BT_MSG_ITER_STATUS_EOF:
- status = BT_MSG_ITER_STATUS_OK;
+ case CTF_MSG_ITER_STATUS_EOF:
+ status = CTF_MSG_ITER_STATUS_OK;
msg_it->state = STATE_EMIT_MSG_PACKET_END_SINGLE;
goto end;
default:
msg_it->state = STATE_EMIT_MSG_PACKET_END_SINGLE;
goto end;
default:
-enum bt_msg_iter_status read_event_header_continue_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_header_continue_state(
+ struct ctf_msg_iter *msg_it)
{
return read_dscope_continue_state(msg_it,
STATE_AFTER_EVENT_HEADER);
}
static inline
{
return read_dscope_continue_state(msg_it,
STATE_AFTER_EVENT_HEADER);
}
static inline
-enum bt_msg_iter_status set_current_event_class(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status set_current_event_class(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_event_class *new_event_class = NULL;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_event_class *new_event_class = NULL;
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Need exactly one event class since there's no event class ID field: "
"msg-it-addr=%p", msg_it);
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Need exactly one event class since there's no event class ID field: "
"msg-it-addr=%p", msg_it);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
"trace-class-addr=%p",
msg_it, msg_it->meta.sc->id, msg_it->cur_event_class_id,
msg_it->meta.tc);
"trace-class-addr=%p",
msg_it, msg_it->meta.sc->id, msg_it->cur_event_class_id,
msg_it->meta.tc);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-enum bt_msg_iter_status set_current_event_message(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status set_current_event_message(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
bt_message *msg = NULL;
bt_self_component *self_comp = msg_it->self_comp;
bt_message *msg = NULL;
error:
BT_MESSAGE_PUT_REF_AND_RESET(msg);
error:
BT_MESSAGE_PUT_REF_AND_RESET(msg);
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
end:
BT_MESSAGE_MOVE_REF(msg_it->event_msg, msg);
end:
BT_MESSAGE_MOVE_REF(msg_it->event_msg, msg);
-enum bt_msg_iter_status after_event_header_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status after_event_header_state(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status;
+ enum ctf_msg_iter_status status;
status = set_current_event_class(msg_it);
status = set_current_event_class(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
}
status = set_current_event_message(msg_it);
}
status = set_current_event_message(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
-enum bt_msg_iter_status read_event_common_context_begin_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_common_context_begin_state(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_common_context_fc;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_common_context_fc;
-enum bt_msg_iter_status read_event_common_context_continue_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_common_context_continue_state(
+ struct ctf_msg_iter *msg_it)
{
return read_dscope_continue_state(msg_it,
STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN);
}
static
{
return read_dscope_continue_state(msg_it,
STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN);
}
static
-enum bt_msg_iter_status read_event_spec_context_begin_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_spec_context_begin_state(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_spec_context_fc;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_spec_context_fc;
-enum bt_msg_iter_status read_event_spec_context_continue_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_spec_context_continue_state(
+ struct ctf_msg_iter *msg_it)
{
return read_dscope_continue_state(msg_it,
STATE_DSCOPE_EVENT_PAYLOAD_BEGIN);
}
static
{
return read_dscope_continue_state(msg_it,
STATE_DSCOPE_EVENT_PAYLOAD_BEGIN);
}
static
-enum bt_msg_iter_status read_event_payload_begin_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_payload_begin_state(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_payload_fc;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class *event_payload_fc;
-enum bt_msg_iter_status read_event_payload_continue_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_event_payload_continue_state(
+ struct ctf_msg_iter *msg_it)
{
return read_dscope_continue_state(msg_it, STATE_EMIT_MSG_EVENT);
}
static
{
return read_dscope_continue_state(msg_it, STATE_EMIT_MSG_EVENT);
}
static
-enum bt_msg_iter_status skip_packet_padding_state(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status skip_packet_padding_state(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
size_t bits_to_skip;
const enum state next_state = STATE_SWITCH_PACKET;
size_t bits_to_skip;
const enum state next_state = STATE_SWITCH_PACKET;
BT_COMP_LOGD("Trying to skip %zu bits of padding: msg-it-addr=%p, size=%zu",
bits_to_skip, msg_it, bits_to_skip);
status = buf_ensure_available_bits(msg_it);
BT_COMP_LOGD("Trying to skip %zu bits of padding: msg-it-addr=%p, size=%zu",
bits_to_skip, msg_it, bits_to_skip);
status = buf_ensure_available_bits(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
-enum bt_msg_iter_status check_emit_msg_stream_beginning_state(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status check_emit_msg_stream_beginning_state(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
if (msg_it->set_stream) {
status = set_current_stream(msg_it);
if (msg_it->set_stream) {
status = set_current_stream(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
-enum bt_msg_iter_status check_emit_msg_discarded_events(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status check_emit_msg_discarded_events(
+ struct ctf_msg_iter *msg_it)
{
msg_it->state = STATE_EMIT_MSG_DISCARDED_EVENTS;
{
msg_it->state = STATE_EMIT_MSG_DISCARDED_EVENTS;
- return BT_MSG_ITER_STATUS_OK;
+ return CTF_MSG_ITER_STATUS_OK;
-enum bt_msg_iter_status check_emit_msg_discarded_packets(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status check_emit_msg_discarded_packets(
+ struct ctf_msg_iter *msg_it)
{
msg_it->state = STATE_EMIT_MSG_DISCARDED_PACKETS;
{
msg_it->state = STATE_EMIT_MSG_DISCARDED_PACKETS;
- return BT_MSG_ITER_STATUS_OK;
+ return CTF_MSG_ITER_STATUS_OK;
-enum bt_msg_iter_status check_emit_msg_stream_end(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status check_emit_msg_stream_end(
+ struct ctf_msg_iter *msg_it)
{
if (msg_it->emit_stream_end_msg) {
msg_it->state = STATE_EMIT_MSG_STREAM_END;
{
if (msg_it->emit_stream_end_msg) {
msg_it->state = STATE_EMIT_MSG_STREAM_END;
msg_it->state = STATE_DONE;
}
msg_it->state = STATE_DONE;
}
- return BT_MSG_ITER_STATUS_OK;
+ return CTF_MSG_ITER_STATUS_OK;
-enum bt_msg_iter_status handle_state(struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status handle_state(struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
const enum state state = msg_it->state;
BT_COMP_LOGT("Handling state: msg-it-addr=%p, state=%s",
const enum state state = msg_it->state;
BT_COMP_LOGT("Handling state: msg-it-addr=%p, state=%s",
BT_COMP_LOGT("Handled state: msg-it-addr=%p, status=%s, "
"prev-state=%s, cur-state=%s",
BT_COMP_LOGT("Handled state: msg-it-addr=%p, status=%s, "
"prev-state=%s, cur-state=%s",
- msg_it, bt_msg_iter_status_string(status),
+ msg_it, ctf_msg_iter_status_string(status),
state_string(state), state_string(msg_it->state));
return status;
}
BT_HIDDEN
state_string(state), state_string(msg_it->state));
return status;
}
BT_HIDDEN
-void bt_msg_iter_reset_for_next_stream_file(struct bt_msg_iter *msg_it)
+void ctf_msg_iter_reset_for_next_stream_file(struct ctf_msg_iter *msg_it)
{
BT_ASSERT(msg_it);
BT_COMP_LOGD("Resetting message iterator: addr=%p", msg_it);
{
BT_ASSERT(msg_it);
BT_COMP_LOGD("Resetting message iterator: addr=%p", msg_it);
* Resets the internal state of a CTF message iterator.
*/
BT_HIDDEN
* Resets the internal state of a CTF message iterator.
*/
BT_HIDDEN
-void bt_msg_iter_reset(struct bt_msg_iter *msg_it)
+void ctf_msg_iter_reset(struct ctf_msg_iter *msg_it)
- bt_msg_iter_reset_for_next_stream_file(msg_it);
+ ctf_msg_iter_reset_for_next_stream_file(msg_it);
msg_it->cur_stream_class_id = -1;
msg_it->cur_data_stream_id = -1;
msg_it->snapshots.discarded_events = UINT64_C(-1);
msg_it->cur_stream_class_id = -1;
msg_it->cur_data_stream_id = -1;
msg_it->snapshots.discarded_events = UINT64_C(-1);
-bt_field *borrow_next_field(struct bt_msg_iter *msg_it)
+bt_field *borrow_next_field(struct ctf_msg_iter *msg_it)
{
bt_field *next_field = NULL;
bt_field *base_field;
{
bt_field *next_field = NULL;
bt_field *base_field;
-void update_default_clock(struct bt_msg_iter *msg_it, uint64_t new_val,
+void update_default_clock(struct ctf_msg_iter *msg_it, uint64_t new_val,
uint64_t new_val_size)
{
uint64_t new_val_mask;
uint64_t new_val_size)
{
uint64_t new_val_mask;
enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
struct ctf_field_class *fc, void *data)
{
enum bt_bfcr_status bfcr_unsigned_int_cb(uint64_t value,
struct ctf_field_class *fc, void *data)
{
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
struct ctf_field_class *fc, void *data)
{
int ret;
struct ctf_field_class *fc, void *data)
{
int ret;
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *string_field = NULL;
bt_self_component *self_comp = msg_it->self_comp;
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *string_field = NULL;
{
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *field = NULL;
{
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *field = NULL;
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
struct ctf_field_class_int *int_fc = (void *) fc;
BT_COMP_LOGT("Signed integer function called from BFCR: "
struct ctf_field_class_int *int_fc = (void *) fc;
BT_COMP_LOGT("Signed integer function called from BFCR: "
{
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *field = NULL;
{
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *field = NULL;
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
bt_field_class_type type;
BT_COMP_LOGT("Floating point number function called from BFCR: "
bt_field_class_type type;
BT_COMP_LOGT("Floating point number function called from BFCR: "
struct ctf_field_class *fc, void *data)
{
bt_field *field = NULL;
struct ctf_field_class *fc, void *data)
{
bt_field *field = NULL;
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
BT_COMP_LOGT("String (beginning) function called from BFCR: "
"msg-it-addr=%p, bfcr-addr=%p, fc-addr=%p, "
BT_COMP_LOGT("String (beginning) function called from BFCR: "
"msg-it-addr=%p, bfcr-addr=%p, fc-addr=%p, "
{
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *field = NULL;
{
enum bt_bfcr_status status = BT_BFCR_STATUS_OK;
bt_field *field = NULL;
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
bt_self_component *self_comp = msg_it->self_comp;
int ret;
bt_self_component *self_comp = msg_it->self_comp;
int ret;
enum bt_bfcr_status bfcr_string_end_cb(
struct ctf_field_class *fc, void *data)
{
enum bt_bfcr_status bfcr_string_end_cb(
struct ctf_field_class *fc, void *data)
{
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
BT_COMP_LOGT("String (end) function called from BFCR: "
"msg-it-addr=%p, bfcr-addr=%p, fc-addr=%p, "
BT_COMP_LOGT("String (end) function called from BFCR: "
"msg-it-addr=%p, bfcr-addr=%p, fc-addr=%p, "
enum bt_bfcr_status bfcr_compound_begin_cb(
struct ctf_field_class *fc, void *data)
{
enum bt_bfcr_status bfcr_compound_begin_cb(
struct ctf_field_class *fc, void *data)
{
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
bt_field *field;
BT_COMP_LOGT("Compound (beginning) function called from BFCR: "
bt_field *field;
BT_COMP_LOGT("Compound (beginning) function called from BFCR: "
enum bt_bfcr_status bfcr_compound_end_cb(
struct ctf_field_class *fc, void *data)
{
enum bt_bfcr_status bfcr_compound_end_cb(
struct ctf_field_class *fc, void *data)
{
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
BT_COMP_LOGT("Compound (end) function called from BFCR: "
"msg-it-addr=%p, bfcr-addr=%p, fc-addr=%p, "
BT_COMP_LOGT("Compound (end) function called from BFCR: "
"msg-it-addr=%p, bfcr-addr=%p, fc-addr=%p, "
int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
{
bt_field *seq_field;
int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
{
bt_field *seq_field;
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class_sequence *seq_fc = (void *) fc;
int64_t length;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class_sequence *seq_fc = (void *) fc;
int64_t length;
int ret;
uint64_t i;
int64_t option_index = -1;
int ret;
uint64_t i;
int64_t option_index = -1;
- struct bt_msg_iter *msg_it = data;
+ struct ctf_msg_iter *msg_it = data;
struct ctf_field_class_variant *var_fc = (void *) fc;
struct ctf_named_field_class *selected_option = NULL;
bt_self_component *self_comp = msg_it->self_comp;
struct ctf_field_class_variant *var_fc = (void *) fc;
struct ctf_named_field_class *selected_option = NULL;
bt_self_component *self_comp = msg_it->self_comp;
-bt_message *create_msg_stream_beginning(struct bt_msg_iter *msg_it)
+bt_message *create_msg_stream_beginning(struct ctf_msg_iter *msg_it)
{
bt_self_component *self_comp = msg_it->self_comp;
bt_message *msg;
{
bt_self_component *self_comp = msg_it->self_comp;
bt_message *msg;
-bt_message *create_msg_stream_end(struct bt_msg_iter *msg_it)
+bt_message *create_msg_stream_end(struct ctf_msg_iter *msg_it)
{
bt_self_component *self_comp = msg_it->self_comp;
bt_message *msg;
{
bt_self_component *self_comp = msg_it->self_comp;
bt_message *msg;
-bt_message *create_msg_packet_beginning(struct bt_msg_iter *msg_it,
+bt_message *create_msg_packet_beginning(struct ctf_msg_iter *msg_it,
bool use_default_cs)
{
bt_self_component *self_comp = msg_it->self_comp;
bool use_default_cs)
{
bt_self_component *self_comp = msg_it->self_comp;
-bt_message *emit_delayed_packet_beg_msg(struct bt_msg_iter *msg_it)
+bt_message *emit_delayed_packet_beg_msg(struct ctf_msg_iter *msg_it)
{
bool packet_beg_ts_need_fix_up;
{
bool packet_beg_ts_need_fix_up;
-bt_message *create_msg_packet_end(struct bt_msg_iter *msg_it)
+bt_message *create_msg_packet_end(struct ctf_msg_iter *msg_it)
{
bt_message *msg;
bool update_default_cs = true;
{
bt_message *msg;
bool update_default_cs = true;
-bt_message *create_msg_discarded_events(struct bt_msg_iter *msg_it)
+bt_message *create_msg_discarded_events(struct ctf_msg_iter *msg_it)
{
bt_message *msg;
bt_self_component *self_comp = msg_it->self_comp;
{
bt_message *msg;
bt_self_component *self_comp = msg_it->self_comp;
-bt_message *create_msg_discarded_packets(struct bt_msg_iter *msg_it)
+bt_message *create_msg_discarded_packets(struct ctf_msg_iter *msg_it)
{
bt_message *msg;
bt_self_component *self_comp = msg_it->self_comp;
{
bt_message *msg;
bt_self_component *self_comp = msg_it->self_comp;
-struct bt_msg_iter *bt_msg_iter_create(struct ctf_trace_class *tc,
+struct ctf_msg_iter *ctf_msg_iter_create(struct ctf_trace_class *tc,
- struct bt_msg_iter_medium_ops medops, void *data,
+ struct ctf_msg_iter_medium_ops medops, void *data,
bt_logging_level log_level, bt_self_component *self_comp)
{
bt_logging_level log_level, bt_self_component *self_comp)
{
- struct bt_msg_iter *msg_it = NULL;
+ struct ctf_msg_iter *msg_it = NULL;
struct bt_bfcr_cbs cbs = {
.classes = {
.signed_int = bfcr_signed_int_cb,
struct bt_bfcr_cbs cbs = {
.classes = {
.signed_int = bfcr_signed_int_cb,
"trace-addr=%p, max-request-size=%zu, "
"data=%p, log-level=%s", tc, max_request_sz, data,
bt_common_logging_level_string(log_level));
"trace-addr=%p, max-request-size=%zu, "
"data=%p, log-level=%s", tc, max_request_sz, data,
bt_common_logging_level_string(log_level));
- msg_it = g_new0(struct bt_msg_iter, 1);
+ msg_it = g_new0(struct ctf_msg_iter, 1);
if (!msg_it) {
BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, log_level, self_comp,
"Failed to allocate one CTF plugin message iterator.");
if (!msg_it) {
BT_COMP_LOG_CUR_LVL(BT_LOG_ERROR, log_level, self_comp,
"Failed to allocate one CTF plugin message iterator.");
- bt_msg_iter_reset(msg_it);
+ ctf_msg_iter_reset(msg_it);
BT_COMP_LOGD("Created CTF plugin message iterator: "
"trace-addr=%p, max-request-size=%zu, "
"data=%p, msg-it-addr=%p, log-level=%s",
BT_COMP_LOGD("Created CTF plugin message iterator: "
"trace-addr=%p, max-request-size=%zu, "
"data=%p, msg-it-addr=%p, log-level=%s",
- bt_msg_iter_destroy(msg_it);
+ ctf_msg_iter_destroy(msg_it);
msg_it = NULL;
goto end;
}
msg_it = NULL;
goto end;
}
-void bt_msg_iter_destroy(struct bt_msg_iter *msg_it)
+void ctf_msg_iter_destroy(struct ctf_msg_iter *msg_it)
{
BT_PACKET_PUT_REF_AND_RESET(msg_it->packet);
BT_STREAM_PUT_REF_AND_RESET(msg_it->stream);
{
BT_PACKET_PUT_REF_AND_RESET(msg_it->packet);
BT_STREAM_PUT_REF_AND_RESET(msg_it->stream);
-enum bt_msg_iter_status bt_msg_iter_get_next_message(
- struct bt_msg_iter *msg_it,
+enum ctf_msg_iter_status ctf_msg_iter_get_next_message(
+ struct ctf_msg_iter *msg_it,
bt_self_message_iterator *self_msg_iter, bt_message **message)
{
bt_self_message_iterator *self_msg_iter, bt_message **message)
{
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
BT_ASSERT_DBG(msg_it);
bt_self_component *self_comp = msg_it->self_comp;
BT_ASSERT_DBG(msg_it);
while (true) {
status = handle_state(msg_it);
while (true) {
status = handle_state(msg_it);
- if (G_UNLIKELY(status == BT_MSG_ITER_STATUS_AGAIN)) {
- BT_COMP_LOGD_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
+ if (G_UNLIKELY(status == CTF_MSG_ITER_STATUS_AGAIN)) {
+ BT_COMP_LOGD_STR("Medium returned CTF_MSG_ITER_STATUS_AGAIN.");
- } else if (G_UNLIKELY(status != BT_MSG_ITER_STATUS_OK)) {
+ } else if (G_UNLIKELY(status != CTF_MSG_ITER_STATUS_OK)) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot handle state: msg-it-addr=%p, state=%s",
msg_it, state_string(msg_it->state));
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot handle state: msg-it-addr=%p, state=%s",
msg_it, state_string(msg_it->state));
if (G_UNLIKELY(msg_it->emit_delayed_packet_beginning_msg)) {
*message = emit_delayed_packet_beg_msg(msg_it);
if (!*message) {
if (G_UNLIKELY(msg_it->emit_delayed_packet_beginning_msg)) {
*message = emit_delayed_packet_beg_msg(msg_it);
if (!*message) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
*message = create_msg_discarded_events(msg_it);
if (!*message) {
*message = create_msg_discarded_events(msg_it);
if (!*message) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
*message = create_msg_discarded_packets(msg_it);
if (!*message) {
*message = create_msg_discarded_packets(msg_it);
if (!*message) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
}
goto end;
case STATE_EMIT_MSG_PACKET_BEGINNING:
status = set_current_packet(msg_it);
}
goto end;
case STATE_EMIT_MSG_PACKET_BEGINNING:
status = set_current_packet(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
/* create_msg_packet_beginning() logs errors */
*message = create_msg_packet_beginning(msg_it, false);
if (!*message) {
/* create_msg_packet_beginning() logs errors */
*message = create_msg_packet_beginning(msg_it, false);
if (!*message) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
*message = create_msg_packet_end(msg_it);
if (!*message) {
*message = create_msg_packet_end(msg_it);
if (!*message) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
*message = create_msg_stream_beginning(msg_it);
if (!*message) {
*message = create_msg_stream_beginning(msg_it);
if (!*message) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
*message = create_msg_stream_end(msg_it);
if (!*message) {
*message = create_msg_stream_end(msg_it);
if (!*message) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
}
goto end;
case STATE_DONE:
}
goto end;
case STATE_DONE:
- status = BT_MSG_ITER_STATUS_EOF;
+ status = CTF_MSG_ITER_STATUS_EOF;
goto end;
default:
/* Non-emitting state: continue */
goto end;
default:
/* Non-emitting state: continue */
-enum bt_msg_iter_status decode_until_state( struct bt_msg_iter *msg_it,
+enum ctf_msg_iter_status decode_until_state( struct ctf_msg_iter *msg_it,
enum state target_state_1, enum state target_state_2)
{
enum state target_state_1, enum state target_state_2)
{
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
BT_ASSERT_DBG(msg_it);
bt_self_component *self_comp = msg_it->self_comp;
BT_ASSERT_DBG(msg_it);
}
status = handle_state(msg_it);
}
status = handle_state(msg_it);
- if (G_UNLIKELY(status == BT_MSG_ITER_STATUS_AGAIN)) {
- BT_COMP_LOGD_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
+ if (G_UNLIKELY(status == CTF_MSG_ITER_STATUS_AGAIN)) {
+ BT_COMP_LOGD_STR("Medium returned CTF_MSG_ITER_STATUS_AGAIN.");
- } else if (G_UNLIKELY(status != BT_MSG_ITER_STATUS_OK)) {
+ } else if (G_UNLIKELY(status != CTF_MSG_ITER_STATUS_OK)) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot handle state: msg-it-addr=%p, state=%s",
msg_it, state_string(msg_it->state));
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot handle state: msg-it-addr=%p, state=%s",
msg_it, state_string(msg_it->state));
-enum bt_msg_iter_status read_packet_header_context_fields(
- struct bt_msg_iter *msg_it)
+enum ctf_msg_iter_status read_packet_header_context_fields(
+ struct ctf_msg_iter *msg_it)
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
status = decode_until_state(msg_it, STATE_EMIT_MSG_PACKET_BEGINNING, -1);
status = decode_until_state(msg_it, STATE_EMIT_MSG_PACKET_BEGINNING, -1);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
goto end;
}
ret = set_current_packet_content_sizes(msg_it);
if (ret) {
goto end;
}
ret = set_current_packet_content_sizes(msg_it);
if (ret) {
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
-void bt_msg_iter_set_medops_data(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_medops_data(struct ctf_msg_iter *msg_it,
void *medops_data)
{
BT_ASSERT(msg_it);
void *medops_data)
{
BT_ASSERT(msg_it);
-enum bt_msg_iter_status bt_msg_iter_seek(struct bt_msg_iter *msg_it,
+enum ctf_msg_iter_status ctf_msg_iter_seek(struct ctf_msg_iter *msg_it,
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
bt_self_component *self_comp = msg_it->self_comp;
bt_self_component *self_comp = msg_it->self_comp;
- enum bt_msg_iter_medium_status medium_status;
+ enum ctf_msg_iter_medium_status medium_status;
BT_ASSERT(msg_it);
if (offset < 0) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot seek to negative offset: offset=%jd",
(intmax_t) offset);
BT_ASSERT(msg_it);
if (offset < 0) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Cannot seek to negative offset: offset=%jd",
(intmax_t) offset);
- status = BT_MSG_ITER_STATUS_INVAL;
+ status = CTF_MSG_ITER_STATUS_INVAL;
goto end;
}
if (!msg_it->medium.medops.seek) {
goto end;
}
if (!msg_it->medium.medops.seek) {
- status = BT_MSG_ITER_STATUS_UNSUPPORTED;
+ status = CTF_MSG_ITER_STATUS_UNSUPPORTED;
BT_COMP_LOGD("Aborting seek as the iterator's underlying media does not implement seek support.");
goto end;
}
medium_status = msg_it->medium.medops.seek(
BT_COMP_LOGD("Aborting seek as the iterator's underlying media does not implement seek support.");
goto end;
}
medium_status = msg_it->medium.medops.seek(
- BT_MSG_ITER_SEEK_WHENCE_SET, offset, msg_it->medium.data);
- if (medium_status != BT_MSG_ITER_MEDIUM_STATUS_OK) {
- if (medium_status == BT_MSG_ITER_MEDIUM_STATUS_EOF) {
- status = BT_MSG_ITER_STATUS_EOF;
+ CTF_MSG_ITER_SEEK_WHENCE_SET, offset, msg_it->medium.data);
+ if (medium_status != CTF_MSG_ITER_MEDIUM_STATUS_OK) {
+ if (medium_status == CTF_MSG_ITER_MEDIUM_STATUS_EOF) {
+ status = CTF_MSG_ITER_STATUS_EOF;
- status = BT_MSG_ITER_STATUS_ERROR;
+ status = CTF_MSG_ITER_STATUS_ERROR;
- bt_msg_iter_reset(msg_it);
+ ctf_msg_iter_reset(msg_it);
msg_it->cur_packet_offset = offset;
end:
msg_it->cur_packet_offset = offset;
end:
-enum bt_msg_iter_status clock_snapshot_at_msg_iter_state(
- struct bt_msg_iter *msg_it, enum state target_state_1,
+enum ctf_msg_iter_status clock_snapshot_at_msg_iter_state(
+ struct ctf_msg_iter *msg_it, enum state target_state_1,
enum state target_state_2, uint64_t *clock_snapshot)
{
enum state target_state_2, uint64_t *clock_snapshot)
{
- enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK;
BT_ASSERT_DBG(msg_it);
BT_ASSERT_DBG(clock_snapshot);
status = decode_until_state(msg_it, target_state_1, target_state_2);
BT_ASSERT_DBG(msg_it);
BT_ASSERT_DBG(clock_snapshot);
status = decode_until_state(msg_it, target_state_1, target_state_2);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
-enum bt_msg_iter_status bt_msg_iter_curr_packet_first_event_clock_snapshot(
- struct bt_msg_iter *msg_it, uint64_t *first_clock_snapshot)
+enum ctf_msg_iter_status ctf_msg_iter_curr_packet_first_event_clock_snapshot(
+ struct ctf_msg_iter *msg_it, uint64_t *first_clock_snapshot)
{
return clock_snapshot_at_msg_iter_state(msg_it,
STATE_AFTER_EVENT_HEADER, -1, first_clock_snapshot);
}
BT_HIDDEN
{
return clock_snapshot_at_msg_iter_state(msg_it,
STATE_AFTER_EVENT_HEADER, -1, first_clock_snapshot);
}
BT_HIDDEN
-enum bt_msg_iter_status bt_msg_iter_curr_packet_last_event_clock_snapshot(
- struct bt_msg_iter *msg_it, uint64_t *last_clock_snapshot)
+enum ctf_msg_iter_status ctf_msg_iter_curr_packet_last_event_clock_snapshot(
+ struct ctf_msg_iter *msg_it, uint64_t *last_clock_snapshot)
{
return clock_snapshot_at_msg_iter_state(msg_it,
STATE_EMIT_MSG_PACKET_END_SINGLE,
{
return clock_snapshot_at_msg_iter_state(msg_it,
STATE_EMIT_MSG_PACKET_END_SINGLE,
-enum bt_msg_iter_status bt_msg_iter_get_packet_properties(
- struct bt_msg_iter *msg_it,
- struct bt_msg_iter_packet_properties *props)
+enum ctf_msg_iter_status ctf_msg_iter_get_packet_properties(
+ struct ctf_msg_iter *msg_it,
+ struct ctf_msg_iter_packet_properties *props)
- enum bt_msg_iter_status status;
+ enum ctf_msg_iter_status status;
BT_ASSERT_DBG(msg_it);
BT_ASSERT_DBG(props);
status = read_packet_header_context_fields(msg_it);
BT_ASSERT_DBG(msg_it);
BT_ASSERT_DBG(props);
status = read_packet_header_context_fields(msg_it);
- if (status != BT_MSG_ITER_STATUS_OK) {
+ if (status != CTF_MSG_ITER_STATUS_OK) {
-void bt_msg_iter_set_emit_stream_beginning_message(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_emit_stream_beginning_message(struct ctf_msg_iter *msg_it,
bool val)
{
msg_it->emit_stream_begin_msg = val;
}
BT_HIDDEN
bool val)
{
msg_it->emit_stream_begin_msg = val;
}
BT_HIDDEN
-void bt_msg_iter_set_emit_stream_end_message(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_emit_stream_end_message(struct ctf_msg_iter *msg_it,
bool val)
{
msg_it->emit_stream_end_msg = val;
}
BT_HIDDEN
bool val)
{
msg_it->emit_stream_end_msg = val;
}
BT_HIDDEN
-void bt_msg_iter_set_dry_run(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_dry_run(struct ctf_msg_iter *msg_it,
bool val)
{
msg_it->dry_run = val;
bool val)
{
msg_it->dry_run = val;
/**
* Medium operations status codes.
*/
/**
* Medium operations status codes.
*/
-enum bt_msg_iter_medium_status {
+enum ctf_msg_iter_medium_status {
/**
* End of file.
*
* The medium function called by the message iterator
* function reached the end of the file.
*/
/**
* End of file.
*
* The medium function called by the message iterator
* function reached the end of the file.
*/
- BT_MSG_ITER_MEDIUM_STATUS_EOF = 1,
+ CTF_MSG_ITER_MEDIUM_STATUS_EOF = 1,
/**
* There is no data available right now, try again later.
*/
/**
* There is no data available right now, try again later.
*/
- BT_MSG_ITER_MEDIUM_STATUS_AGAIN = 11,
+ CTF_MSG_ITER_MEDIUM_STATUS_AGAIN = 11,
/** Unsupported operation. */
/** Unsupported operation. */
- BT_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED = -3,
+ CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED = -3,
- BT_MSG_ITER_MEDIUM_STATUS_INVAL = -2,
+ CTF_MSG_ITER_MEDIUM_STATUS_INVAL = -2,
- BT_MSG_ITER_MEDIUM_STATUS_ERROR = -1,
+ CTF_MSG_ITER_MEDIUM_STATUS_ERROR = -1,
- BT_MSG_ITER_MEDIUM_STATUS_OK = 0,
+ CTF_MSG_ITER_MEDIUM_STATUS_OK = 0,
};
/**
* CTF message iterator API status code.
*/
};
/**
* CTF message iterator API status code.
*/
-enum bt_msg_iter_status {
+enum ctf_msg_iter_status {
/**
* End of file.
*
* The medium function called by the message iterator
* function reached the end of the file.
*/
/**
* End of file.
*
* The medium function called by the message iterator
* function reached the end of the file.
*/
- BT_MSG_ITER_STATUS_EOF = BT_MSG_ITER_MEDIUM_STATUS_EOF,
+ CTF_MSG_ITER_STATUS_EOF = CTF_MSG_ITER_MEDIUM_STATUS_EOF,
/**
* There is no data available right now, try again later.
*
* Some condition resulted in the
/**
* There is no data available right now, try again later.
*
* Some condition resulted in the
- * bt_msg_iter_medium_ops::request_bytes() user function not
+ * ctf_msg_iter_medium_ops::request_bytes() user function not
* having access to any data now. You should retry calling the
* last called message iterator function once the situation
* is resolved.
*/
* having access to any data now. You should retry calling the
* last called message iterator function once the situation
* is resolved.
*/
- BT_MSG_ITER_STATUS_AGAIN = BT_MSG_ITER_MEDIUM_STATUS_AGAIN,
+ CTF_MSG_ITER_STATUS_AGAIN = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN,
- BT_MSG_ITER_STATUS_INVAL = BT_MSG_ITER_MEDIUM_STATUS_INVAL,
+ CTF_MSG_ITER_STATUS_INVAL = CTF_MSG_ITER_MEDIUM_STATUS_INVAL,
/** Unsupported operation. */
/** Unsupported operation. */
- BT_MSG_ITER_STATUS_UNSUPPORTED = BT_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED,
+ CTF_MSG_ITER_STATUS_UNSUPPORTED = CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED,
- BT_MSG_ITER_STATUS_ERROR = BT_MSG_ITER_MEDIUM_STATUS_ERROR,
+ CTF_MSG_ITER_STATUS_ERROR = CTF_MSG_ITER_MEDIUM_STATUS_ERROR,
- BT_MSG_ITER_STATUS_OK = 0,
+ CTF_MSG_ITER_STATUS_OK = CTF_MSG_ITER_MEDIUM_STATUS_OK,
};
/**
* CTF message iterator seek operation directives.
*/
};
/**
* CTF message iterator seek operation directives.
*/
-enum bt_msg_iter_seek_whence {
+enum ctf_msg_iter_seek_whence {
/**
* Set the iterator's position to an absolute offset in the underlying
* medium.
*/
/**
* Set the iterator's position to an absolute offset in the underlying
* medium.
*/
- BT_MSG_ITER_SEEK_WHENCE_SET,
+ CTF_MSG_ITER_SEEK_WHENCE_SET,
* Those user functions are called by the message iterator
* functions to request medium actions.
*/
* Those user functions are called by the message iterator
* functions to request medium actions.
*/
-struct bt_msg_iter_medium_ops {
+struct ctf_msg_iter_medium_ops {
/**
* Returns the next byte buffer to be used by the binary file
* reader to deserialize binary data.
/**
* 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:
*
*
* This function must return one of the following statuses:
*
- * - <b>#BT_MSG_ITER_MEDIUM_STATUS_OK</b>: Everything
+ * - <b>#CTF_MSG_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.
* 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_MSG_ITER_MEDIUM_STATUS_AGAIN</b>: No data is
+ * - <b>#CTF_MSG_ITER_MEDIUM_STATUS_AGAIN</b>: No data is
* available right now. In this case, the message
* iterator function called by the user returns
* available right now. In this case, the message
* iterator function called by the user returns
- * #BT_MSG_ITER_STATUS_AGAIN, and it is the user's
+ * #CTF_MSG_ITER_STATUS_AGAIN, and it is the user's
* responsibility to make sure enough data becomes available
* before calling the \em same message iterator
* function again to continue the decoding process.
* responsibility to make sure enough data becomes available
* before calling the \em same message iterator
* function again to continue the decoding process.
- * - <b>#BT_MSG_ITER_MEDIUM_STATUS_EOF</b>: The end of
+ * - <b>#CTF_MSG_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 message
* iterator function called by the user returns
* the file was reached, and no more data will ever be
* available for this file. In this case, the message
* iterator function called by the user returns
- * #BT_MSG_ITER_STATUS_EOF. This must \em not be
+ * #CTF_MSG_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
* 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_MSG_ITER_MEDIUM_STATUS_EOF on the \em following
+ * #CTF_MSG_ITER_MEDIUM_STATUS_EOF on the \em following
- * - <b>#BT_MSG_ITER_MEDIUM_STATUS_ERROR</b>: A fatal
+ * - <b>#CTF_MSG_ITER_MEDIUM_STATUS_ERROR</b>: A fatal
* error occured during this operation. In this case, the
* message iterator function called by the user returns
* error occured during this operation. In this case, the
* message iterator function called by the user returns
- * #BT_MSG_ITER_STATUS_ERROR.
+ * #CTF_MSG_ITER_STATUS_ERROR.
- * If #BT_MSG_ITER_MEDIUM_STATUS_OK is not returned, the
+ * If #CTF_MSG_ITER_MEDIUM_STATUS_OK is not returned, the
* values of \p buffer_sz and \p buffer_addr are \em ignored by
* the caller.
*
* 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)
*/
* @param data User data
* @returns Status code (see description above)
*/
- enum bt_msg_iter_medium_status (* request_bytes)(size_t request_sz,
+ enum ctf_msg_iter_medium_status (* request_bytes)(size_t request_sz,
uint8_t **buffer_addr, size_t *buffer_sz, void *data);
/**
uint8_t **buffer_addr, size_t *buffer_sz, void *data);
/**
* to a given absolute or relative position, as indicated by
* the whence directive.
*
* to a given absolute or relative position, as indicated by
* the whence directive.
*
- * @param whence One of #bt_msg_iter_seek_whence values
+ * @param whence One of #ctf_msg_iter_seek_whence values
* @param offset Offset to use for the given directive
* @param data User data
* @param offset Offset to use for the given directive
* @param data User data
- * @returns One of #bt_msg_iter_medium_status values
+ * @returns One of #ctf_msg_iter_medium_status values
- enum bt_msg_iter_medium_status (* seek)(
- enum bt_msg_iter_seek_whence whence,
+ enum ctf_msg_iter_medium_status (* seek)(
+ enum ctf_msg_iter_seek_whence whence,
off_t offset, void *data);
/**
off_t offset, void *data);
/**
};
/** CTF message iterator. */
};
/** CTF message iterator. */
/**
* Creates a CTF message iterator.
/**
* Creates a CTF message iterator.
* @param trace Trace to read
* @param max_request_sz Maximum buffer size, in bytes, to
* request to
* @param trace Trace to read
* @param max_request_sz Maximum buffer size, in bytes, to
* request to
- * bt_msg_iter_medium_ops::request_bytes()
+ * ctf_msg_iter_medium_ops::request_bytes()
* at a time
* @param medops Medium operations
* @param medops_data User data (passed to medium operations)
* at a time
* @param medops Medium operations
* @param medops_data User data (passed to medium operations)
* success, or \c NULL on error
*/
BT_HIDDEN
* success, or \c NULL on error
*/
BT_HIDDEN
-struct bt_msg_iter *bt_msg_iter_create(struct ctf_trace_class *tc,
- size_t max_request_sz, struct bt_msg_iter_medium_ops medops,
+struct ctf_msg_iter *ctf_msg_iter_create(struct ctf_trace_class *tc,
+ size_t max_request_sz, struct ctf_msg_iter_medium_ops medops,
void *medops_data, bt_logging_level log_level,
bt_self_component *self_comp);
void *medops_data, bt_logging_level log_level,
bt_self_component *self_comp);
* @param msg_iter CTF message iterator
*/
BT_HIDDEN
* @param msg_iter CTF message iterator
*/
BT_HIDDEN
-void bt_msg_iter_destroy(struct bt_msg_iter *msg_iter);
+void ctf_msg_iter_destroy(struct ctf_msg_iter *msg_iter);
/**
* Returns the next message from a CTF message iterator.
*
/**
* Returns the next message from a CTF message iterator.
*
- * Upon successful completion, #BT_MSG_ITER_STATUS_OK is
+ * Upon successful completion, #CTF_MSG_ITER_STATUS_OK is
* returned, and the next message is written to \p msg.
* In this case, the caller is responsible for calling
* bt_message_put() on the returned message.
*
* returned, and the next message is written to \p msg.
* In this case, the caller is responsible for calling
* bt_message_put() on the returned message.
*
- * If this function returns #BT_MSG_ITER_STATUS_AGAIN, the caller
+ * If this function returns #CTF_MSG_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 msg_iter CTF message iterator
* @param message Returned message if the function's
* should make sure that data becomes available to its medium, and
* call this function again, until another status is returned.
*
* @param msg_iter CTF message iterator
* @param message Returned message if the function's
- * return value is #BT_MSG_ITER_STATUS_OK
- * @returns One of #bt_msg_iter_status values
+ * return value is #CTF_MSG_ITER_STATUS_OK
+ * @returns One of #ctf_msg_iter_status values
-enum bt_msg_iter_status bt_msg_iter_get_next_message(
- struct bt_msg_iter *msg_it,
+enum ctf_msg_iter_status ctf_msg_iter_get_next_message(
+ struct ctf_msg_iter *msg_it,
bt_self_message_iterator *msg_iter,
bt_message **message);
bt_self_message_iterator *msg_iter,
bt_message **message);
-struct bt_msg_iter_packet_properties {
+struct ctf_msg_iter_packet_properties {
int64_t exp_packet_total_size;
int64_t exp_packet_content_size;
uint64_t stream_class_id;
int64_t exp_packet_total_size;
int64_t exp_packet_content_size;
uint64_t stream_class_id;
-enum bt_msg_iter_status bt_msg_iter_get_packet_properties(
- struct bt_msg_iter *msg_it,
- struct bt_msg_iter_packet_properties *props);
+enum ctf_msg_iter_status ctf_msg_iter_get_packet_properties(
+ struct ctf_msg_iter *msg_it,
+ struct ctf_msg_iter_packet_properties *props);
-enum bt_msg_iter_status bt_msg_iter_curr_packet_first_event_clock_snapshot(
- struct bt_msg_iter *msg_it, uint64_t *first_event_cs);
+enum ctf_msg_iter_status ctf_msg_iter_curr_packet_first_event_clock_snapshot(
+ struct ctf_msg_iter *msg_it, uint64_t *first_event_cs);
-enum bt_msg_iter_status bt_msg_iter_curr_packet_last_event_clock_snapshot(
- struct bt_msg_iter *msg_it, uint64_t *last_event_cs);
+enum ctf_msg_iter_status ctf_msg_iter_curr_packet_last_event_clock_snapshot(
+ struct ctf_msg_iter *msg_it, uint64_t *last_event_cs);
-void bt_msg_iter_set_medops_data(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_medops_data(struct ctf_msg_iter *msg_it,
void *medops_data);
BT_HIDDEN
void *medops_data);
BT_HIDDEN
-enum bt_msg_iter_status bt_msg_iter_seek(
- struct bt_msg_iter *msg_it, off_t offset);
+enum ctf_msg_iter_status ctf_msg_iter_seek(
+ struct ctf_msg_iter *msg_it, off_t offset);
/*
* Resets the iterator so that the next requested medium bytes are
* assumed to be the first bytes of a new stream. Depending on
/*
* Resets the iterator so that the next requested medium bytes are
* assumed to be the first bytes of a new stream. Depending on
- * bt_msg_iter_set_emit_stream_beginning_message(), the first message
- * which this iterator emits after calling bt_msg_iter_reset() is of
- * type `BT_MESSAGE_TYPE_STREAM_BEGINNING`.
+ * ctf_msg_iter_set_emit_stream_beginning_message(), the first message
+ * which this iterator emits after calling ctf_msg_iter_reset() is of
+ * type `CTF_MESSAGE_TYPE_STREAM_BEGINNING`.
-void bt_msg_iter_reset(struct bt_msg_iter *msg_it);
+void ctf_msg_iter_reset(struct ctf_msg_iter *msg_it);
- * Like bt_msg_iter_reset(), but preserves stream-dependent state.
+ * Like ctf_msg_iter_reset(), but preserves stream-dependent state.
-void bt_msg_iter_reset_for_next_stream_file(struct bt_msg_iter *msg_it);
+void ctf_msg_iter_reset_for_next_stream_file(struct ctf_msg_iter *msg_it);
-void bt_msg_iter_set_emit_stream_beginning_message(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_emit_stream_beginning_message(struct ctf_msg_iter *msg_it,
-void bt_msg_iter_set_emit_stream_end_message(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_emit_stream_end_message(struct ctf_msg_iter *msg_it,
-void bt_msg_iter_set_dry_run(struct bt_msg_iter *msg_it,
+void ctf_msg_iter_set_dry_run(struct ctf_msg_iter *msg_it,
-const char *bt_msg_iter_medium_status_string(
- enum bt_msg_iter_medium_status status)
+const char *ctf_msg_iter_medium_status_string(
+ enum ctf_msg_iter_medium_status status)
- case BT_MSG_ITER_MEDIUM_STATUS_EOF:
+ case CTF_MSG_ITER_MEDIUM_STATUS_EOF:
- case BT_MSG_ITER_MEDIUM_STATUS_AGAIN:
+ case CTF_MSG_ITER_MEDIUM_STATUS_AGAIN:
- case BT_MSG_ITER_MEDIUM_STATUS_INVAL:
+ case CTF_MSG_ITER_MEDIUM_STATUS_INVAL:
- case BT_MSG_ITER_MEDIUM_STATUS_ERROR:
+ case CTF_MSG_ITER_MEDIUM_STATUS_ERROR:
- case BT_MSG_ITER_MEDIUM_STATUS_OK:
+ case CTF_MSG_ITER_MEDIUM_STATUS_OK:
return "OK";
default:
return "(unknown)";
return "OK";
default:
return "(unknown)";
-const char *bt_msg_iter_status_string(
- enum bt_msg_iter_status status)
+const char *ctf_msg_iter_status_string(
+ enum ctf_msg_iter_status status)
- case BT_MSG_ITER_STATUS_EOF:
+ case CTF_MSG_ITER_STATUS_EOF:
- case BT_MSG_ITER_STATUS_AGAIN:
+ case CTF_MSG_ITER_STATUS_AGAIN:
- case BT_MSG_ITER_STATUS_INVAL:
+ case CTF_MSG_ITER_STATUS_INVAL:
- case BT_MSG_ITER_STATUS_ERROR:
+ case CTF_MSG_ITER_STATUS_ERROR:
- case BT_MSG_ITER_STATUS_OK:
+ case CTF_MSG_ITER_STATUS_OK:
return "OK";
default:
return "(unknown)";
return "OK";
default:
return "(unknown)";
-enum bt_msg_iter_medium_status ds_file_mmap_next(
+enum ctf_msg_iter_medium_status ds_file_mmap_next(
struct ctf_fs_ds_file *ds_file)
{
struct ctf_fs_ds_file *ds_file)
{
- enum bt_msg_iter_medium_status ret =
- BT_MSG_ITER_MEDIUM_STATUS_OK;
+ enum ctf_msg_iter_medium_status ret =
+ CTF_MSG_ITER_MEDIUM_STATUS_OK;
/* Unmap old region */
if (ds_file->mmap_addr) {
/* 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) {
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_MSG_ITER_MEDIUM_STATUS_EOF;
+ ret = CTF_MSG_ITER_MEDIUM_STATUS_EOF;
goto end;
}
/* Map new region */
goto end;
}
/* Map new region */
goto end;
error:
ds_file_munmap(ds_file);
goto end;
error:
ds_file_munmap(ds_file);
- ret = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
+ ret = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
end:
return ret;
}
static
end:
return ret;
}
static
-enum bt_msg_iter_medium_status medop_request_bytes(
+enum ctf_msg_iter_medium_status medop_request_bytes(
size_t request_sz, uint8_t **buffer_addr,
size_t *buffer_sz, void *data)
{
size_t request_sz, uint8_t **buffer_addr,
size_t *buffer_sz, void *data)
{
- enum bt_msg_iter_medium_status status =
- BT_MSG_ITER_MEDIUM_STATUS_OK;
+ enum ctf_msg_iter_medium_status status =
+ CTF_MSG_ITER_MEDIUM_STATUS_OK;
struct ctf_fs_ds_file *ds_file = data;
if (request_sz == 0) {
struct ctf_fs_ds_file *ds_file = data;
if (request_sz == 0) {
if (ds_file->mmap_offset >= ds_file->file->size) {
BT_COMP_LOGD("Reached end of file \"%s\" (%p)",
ds_file->file->path->str, ds_file->file->fp);
if (ds_file->mmap_offset >= ds_file->file->size) {
BT_COMP_LOGD("Reached end of file \"%s\" (%p)",
ds_file->file->path->str, ds_file->file->fp);
- status = BT_MSG_ITER_MEDIUM_STATUS_EOF;
+ status = CTF_MSG_ITER_MEDIUM_STATUS_EOF;
goto end;
}
status = ds_file_mmap_next(ds_file);
switch (status) {
goto end;
}
status = ds_file_mmap_next(ds_file);
switch (status) {
- case BT_MSG_ITER_MEDIUM_STATUS_OK:
+ case CTF_MSG_ITER_MEDIUM_STATUS_OK:
- case BT_MSG_ITER_MEDIUM_STATUS_EOF:
+ case CTF_MSG_ITER_MEDIUM_STATUS_EOF:
goto end;
default:
BT_COMP_LOGE("Cannot memory-map next region of file \"%s\" (%p)",
goto end;
default:
BT_COMP_LOGE("Cannot memory-map next region of file \"%s\" (%p)",
- status = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
+ status = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
-enum bt_msg_iter_medium_status medop_seek(enum bt_msg_iter_seek_whence whence,
+enum ctf_msg_iter_medium_status medop_seek(enum ctf_msg_iter_seek_whence whence,
off_t offset, void *data)
{
off_t offset, void *data)
{
- enum bt_msg_iter_medium_status ret =
- BT_MSG_ITER_MEDIUM_STATUS_OK;
+ enum ctf_msg_iter_medium_status ret =
+ CTF_MSG_ITER_MEDIUM_STATUS_OK;
struct ctf_fs_ds_file *ds_file = data;
off_t offset_in_mapping, file_size = ds_file->file->size;
struct ctf_fs_ds_file *ds_file = data;
off_t offset_in_mapping, file_size = ds_file->file->size;
- if (whence != BT_MSG_ITER_SEEK_WHENCE_SET ||
+ if (whence != CTF_MSG_ITER_SEEK_WHENCE_SET ||
offset < 0 || offset > file_size) {
BT_COMP_LOGE("Invalid medium seek request: whence=%d, offset=%jd, "
"file-size=%jd", (int) whence, (intmax_t) offset,
(intmax_t) file_size);
offset < 0 || offset > file_size) {
BT_COMP_LOGE("Invalid medium seek request: whence=%d, offset=%jd, "
"file-size=%jd", (int) whence, (intmax_t) offset,
(intmax_t) file_size);
- ret = BT_MSG_ITER_MEDIUM_STATUS_INVAL;
+ ret = CTF_MSG_ITER_MEDIUM_STATUS_INVAL;
ds_file->mmap_len);
unmap_ret = ds_file_munmap(ds_file);
if (unmap_ret) {
ds_file->mmap_len);
unmap_ret = ds_file_munmap(ds_file);
if (unmap_ret) {
- ret = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
+ ret = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;
goto end;
}
goto map_requested_offset;
goto end;
}
goto map_requested_offset;
ds_file->mmap_offset = offset - offset_in_mapping;
ds_file->request_offset = offset_in_mapping;
ret = ds_file_mmap_next(ds_file);
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_MSG_ITER_MEDIUM_STATUS_OK) {
+ if (ret != CTF_MSG_ITER_MEDIUM_STATUS_OK) {
-struct bt_msg_iter_medium_ops ctf_fs_ds_file_medops = {
+struct ctf_msg_iter_medium_ops ctf_fs_ds_file_medops = {
.request_bytes = medop_request_bytes,
.borrow_stream = medop_borrow_stream,
.seek = medop_seek,
.request_bytes = medop_request_bytes,
.borrow_stream = medop_borrow_stream,
.seek = medop_seek,
size_t file_entry_count;
size_t i;
struct ctf_stream_class *sc;
size_t file_entry_count;
size_t i;
struct ctf_stream_class *sc;
- struct bt_msg_iter_packet_properties props;
+ struct ctf_msg_iter_packet_properties props;
BT_COMP_LOGI("Building index from .idx file of stream file %s",
ds_file->file->path->str);
BT_COMP_LOGI("Building index from .idx file of stream file %s",
ds_file->file->path->str);
- ret = bt_msg_iter_get_packet_properties(ds_file->msg_iter, &props);
+ ret = ctf_msg_iter_get_packet_properties(ds_file->msg_iter, &props);
if (ret) {
BT_COMP_LOGI_STR("Cannot read first packet's header and context fields.");
goto error;
if (ret) {
BT_COMP_LOGI_STR("Cannot read first packet's header and context fields.");
goto error;
static
int init_index_entry(struct ctf_fs_ds_index_entry *entry,
struct ctf_fs_ds_file *ds_file,
static
int init_index_entry(struct ctf_fs_ds_index_entry *entry,
struct ctf_fs_ds_file *ds_file,
- struct bt_msg_iter_packet_properties *props,
+ struct ctf_msg_iter_packet_properties *props,
off_t packet_size, off_t packet_offset)
{
int ret = 0;
off_t packet_size, off_t packet_offset)
{
int ret = 0;
{
int ret;
struct ctf_fs_ds_index *index = NULL;
{
int ret;
struct ctf_fs_ds_index *index = NULL;
- enum bt_msg_iter_status iter_status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status iter_status = CTF_MSG_ITER_STATUS_OK;
off_t current_packet_offset_bytes = 0;
BT_COMP_LOGI("Indexing stream file %s", ds_file->file->path->str);
off_t current_packet_offset_bytes = 0;
BT_COMP_LOGI("Indexing stream file %s", ds_file->file->path->str);
while (true) {
off_t current_packet_size_bytes;
struct ctf_fs_ds_index_entry *index_entry;
while (true) {
off_t current_packet_size_bytes;
struct ctf_fs_ds_index_entry *index_entry;
- struct bt_msg_iter_packet_properties props;
+ struct ctf_msg_iter_packet_properties props;
if (current_packet_offset_bytes < 0) {
BT_COMP_LOGE_STR("Cannot get the current packet's offset.");
if (current_packet_offset_bytes < 0) {
BT_COMP_LOGE_STR("Cannot get the current packet's offset.");
- iter_status = bt_msg_iter_seek(ds_file->msg_iter,
+ iter_status = ctf_msg_iter_seek(ds_file->msg_iter,
current_packet_offset_bytes);
current_packet_offset_bytes);
- if (iter_status != BT_MSG_ITER_STATUS_OK) {
+ if (iter_status != CTF_MSG_ITER_STATUS_OK) {
- iter_status = bt_msg_iter_get_packet_properties(
+ iter_status = ctf_msg_iter_get_packet_properties(
ds_file->msg_iter, &props);
ds_file->msg_iter, &props);
- if (iter_status != BT_MSG_ITER_STATUS_OK) {
+ if (iter_status != CTF_MSG_ITER_STATUS_OK) {
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
bt_self_message_iterator *pc_msg_iter,
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
bt_self_message_iterator *pc_msg_iter,
- struct bt_msg_iter *msg_iter,
+ struct ctf_msg_iter *msg_iter,
bt_stream *stream, const char *path,
bt_logging_level log_level)
{
bt_stream *stream, const char *path,
bt_logging_level log_level)
{
}
ds_file->msg_iter = msg_iter;
}
ds_file->msg_iter = msg_iter;
- bt_msg_iter_set_medops_data(ds_file->msg_iter, ds_file);
+ ctf_msg_iter_set_medops_data(ds_file->msg_iter, ds_file);
if (!ds_file->msg_iter) {
goto error;
}
if (!ds_file->msg_iter) {
goto error;
}
struct ctf_fs_ds_file *ds_file,
bt_message **msg)
{
struct ctf_fs_ds_file *ds_file,
bt_message **msg)
{
- enum bt_msg_iter_status msg_iter_status;
+ enum ctf_msg_iter_status msg_iter_status;
bt_component_class_message_iterator_next_method_status status;
bt_component_class_message_iterator_next_method_status status;
- msg_iter_status = bt_msg_iter_get_next_message(
+ msg_iter_status = ctf_msg_iter_get_next_message(
ds_file->msg_iter, ds_file->self_msg_iter, msg);
switch (msg_iter_status) {
ds_file->msg_iter, ds_file->self_msg_iter, msg);
switch (msg_iter_status) {
- case BT_MSG_ITER_STATUS_EOF:
+ case CTF_MSG_ITER_STATUS_EOF:
status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
break;
status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END;
break;
- case BT_MSG_ITER_STATUS_OK:
+ case CTF_MSG_ITER_STATUS_OK:
status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
break;
status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
break;
- case BT_MSG_ITER_STATUS_AGAIN:
+ case CTF_MSG_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.
*/
bt_common_abort();
/*
* 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.
*/
bt_common_abort();
- case BT_MSG_ITER_STATUS_INVAL:
- case BT_MSG_ITER_STATUS_ERROR:
+ case CTF_MSG_ITER_STATUS_INVAL:
+ case CTF_MSG_ITER_STATUS_ERROR:
default:
status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
break;
default:
status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
break;
bt_stream *stream;
/* Weak */
bt_stream *stream;
/* Weak */
- struct bt_msg_iter *msg_iter;
+ struct ctf_msg_iter *msg_iter;
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
bt_self_message_iterator *pc_msg_iter,
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
bt_self_message_iterator *pc_msg_iter,
- struct bt_msg_iter *msg_iter,
+ struct ctf_msg_iter *msg_iter,
bt_stream *stream, const char *path,
bt_logging_level log_level);
bt_stream *stream, const char *path,
bt_logging_level log_level);
BT_HIDDEN
void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index);
BT_HIDDEN
void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index);
-extern struct bt_msg_iter_medium_ops ctf_fs_ds_file_medops;
+extern struct ctf_msg_iter_medium_ops ctf_fs_ds_file_medops;
#endif /* CTF_FS_DS_FILE_H */
#endif /* CTF_FS_DS_FILE_H */
ctf_fs_ds_file_destroy(msg_iter_data->ds_file);
if (msg_iter_data->msg_iter) {
ctf_fs_ds_file_destroy(msg_iter_data->ds_file);
if (msg_iter_data->msg_iter) {
- bt_msg_iter_destroy(msg_iter_data->msg_iter);
+ ctf_msg_iter_destroy(msg_iter_data->msg_iter);
void set_msg_iter_emits_stream_beginning_end_messages(
struct ctf_fs_msg_iter_data *msg_iter_data)
{
void set_msg_iter_emits_stream_beginning_end_messages(
struct ctf_fs_msg_iter_data *msg_iter_data)
{
- bt_msg_iter_set_emit_stream_beginning_message(
+ ctf_msg_iter_set_emit_stream_beginning_message(
msg_iter_data->ds_file->msg_iter,
msg_iter_data->ds_file_info_index == 0);
msg_iter_data->ds_file->msg_iter,
msg_iter_data->ds_file_info_index == 0);
- bt_msg_iter_set_emit_stream_end_message(
+ ctf_msg_iter_set_emit_stream_end_message(
msg_iter_data->ds_file->msg_iter,
msg_iter_data->ds_file_info_index ==
msg_iter_data->ds_file_group->ds_file_infos->len - 1);
msg_iter_data->ds_file->msg_iter,
msg_iter_data->ds_file_info_index ==
msg_iter_data->ds_file_group->ds_file_infos->len - 1);
}
msg_iter_data->ds_file_info_index++;
}
msg_iter_data->ds_file_info_index++;
- bt_msg_iter_reset_for_next_stream_file(
+ ctf_msg_iter_reset_for_next_stream_file(
msg_iter_data->msg_iter);
set_msg_iter_emits_stream_beginning_end_messages(
msg_iter_data);
msg_iter_data->msg_iter);
set_msg_iter_emits_stream_beginning_end_messages(
msg_iter_data);
- bt_msg_iter_reset(msg_iter_data->msg_iter);
+ ctf_msg_iter_reset(msg_iter_data->msg_iter);
set_msg_iter_emits_stream_beginning_end_messages(msg_iter_data);
end:
set_msg_iter_emits_stream_beginning_end_messages(msg_iter_data);
end:
msg_iter_data->log_level = log_level;
msg_iter_data->self_comp = self_comp;
msg_iter_data->self_msg_iter = self_msg_iter;
msg_iter_data->log_level = log_level;
msg_iter_data->self_comp = self_comp;
msg_iter_data->self_msg_iter = self_msg_iter;
- msg_iter_data->msg_iter = bt_msg_iter_create(
+ msg_iter_data->msg_iter = ctf_msg_iter_create(
port_data->ds_file_group->ctf_fs_trace->metadata->tc,
bt_common_get_page_size(msg_iter_data->log_level) * 8,
ctf_fs_ds_file_medops, NULL, msg_iter_data->log_level,
port_data->ds_file_group->ctf_fs_trace->metadata->tc,
bt_common_get_page_size(msg_iter_data->log_level) * 8,
ctf_fs_ds_file_medops, NULL, msg_iter_data->log_level,
struct ctf_fs_ds_file *ds_file = NULL;
struct ctf_fs_ds_file_info *ds_file_info = NULL;
struct ctf_fs_ds_index *index = NULL;
struct ctf_fs_ds_file *ds_file = NULL;
struct ctf_fs_ds_file_info *ds_file_info = NULL;
struct ctf_fs_ds_index *index = NULL;
- struct bt_msg_iter *msg_iter = NULL;
+ struct ctf_msg_iter *msg_iter = NULL;
struct ctf_stream_class *sc = NULL;
struct ctf_stream_class *sc = NULL;
- struct bt_msg_iter_packet_properties props;
+ struct ctf_msg_iter_packet_properties props;
bt_logging_level log_level = ctf_fs_trace->log_level;
bt_self_component *self_comp = ctf_fs_trace->self_comp;
bt_self_component_class *self_comp_class = ctf_fs_trace->self_comp_class;
bt_logging_level log_level = ctf_fs_trace->log_level;
bt_self_component *self_comp = ctf_fs_trace->self_comp;
bt_self_component_class *self_comp_class = ctf_fs_trace->self_comp_class;
- msg_iter = bt_msg_iter_create(ctf_fs_trace->metadata->tc,
+ msg_iter = ctf_msg_iter_create(ctf_fs_trace->metadata->tc,
bt_common_get_page_size(log_level) * 8,
ctf_fs_ds_file_medops, NULL, log_level, self_comp);
if (!msg_iter) {
bt_common_get_page_size(log_level) * 8,
ctf_fs_ds_file_medops, NULL, log_level, self_comp);
if (!msg_iter) {
- ret = bt_msg_iter_get_packet_properties(ds_file->msg_iter, &props);
+ ret = ctf_msg_iter_get_packet_properties(ds_file->msg_iter, &props);
if (ret) {
BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(self_comp, self_comp_class,
"Cannot get stream file's first packet's header and context fields (`%s`).",
if (ret) {
BT_COMP_OR_COMP_CLASS_LOGE_APPEND_CAUSE(self_comp, self_comp_class,
"Cannot get stream file's first packet's header and context fields (`%s`).",
ctf_fs_ds_file_info_destroy(ds_file_info);
if (msg_iter) {
ctf_fs_ds_file_info_destroy(ds_file_info);
if (msg_iter) {
- bt_msg_iter_destroy(msg_iter);
+ ctf_msg_iter_destroy(msg_iter);
}
ctf_fs_ds_index_destroy(index);
}
ctf_fs_ds_index_destroy(index);
struct ctf_fs_ds_index_entry *index_entry,
enum target_event target_event, uint64_t *cs, int64_t *ts_ns)
{
struct ctf_fs_ds_index_entry *index_entry,
enum target_event target_event, uint64_t *cs, int64_t *ts_ns)
{
- enum bt_msg_iter_status iter_status = BT_MSG_ITER_STATUS_OK;
+ enum ctf_msg_iter_status iter_status = CTF_MSG_ITER_STATUS_OK;
struct ctf_fs_ds_file *ds_file = NULL;
struct ctf_fs_ds_file *ds_file = NULL;
- struct bt_msg_iter *msg_iter = NULL;
+ struct ctf_msg_iter *msg_iter = NULL;
bt_logging_level log_level = ctf_fs_trace->log_level;
bt_self_component *self_comp = ctf_fs_trace->self_comp;
int ret = 0;
bt_logging_level log_level = ctf_fs_trace->log_level;
bt_self_component *self_comp = ctf_fs_trace->self_comp;
int ret = 0;
BT_ASSERT(ctf_fs_trace->metadata);
BT_ASSERT(ctf_fs_trace->metadata->tc);
BT_ASSERT(ctf_fs_trace->metadata);
BT_ASSERT(ctf_fs_trace->metadata->tc);
- msg_iter = bt_msg_iter_create(ctf_fs_trace->metadata->tc,
+ msg_iter = ctf_msg_iter_create(ctf_fs_trace->metadata->tc,
bt_common_get_page_size(log_level) * 8, ctf_fs_ds_file_medops,
NULL, log_level, self_comp);
if (!msg_iter) {
bt_common_get_page_size(log_level) * 8, ctf_fs_ds_file_medops,
NULL, log_level, self_comp);
if (!msg_iter) {
- /* bt_msg_iter_create() logs errors. */
+ /* ctf_msg_iter_create() logs errors. */
* Turn on dry run mode to prevent the creation and usage of Babeltrace
* library objects (bt_field, bt_message_*, etc.).
*/
* Turn on dry run mode to prevent the creation and usage of Babeltrace
* library objects (bt_field, bt_message_*, etc.).
*/
- bt_msg_iter_set_dry_run(msg_iter, true);
+ ctf_msg_iter_set_dry_run(msg_iter, true);
/* Seek to the beginning of the target packet. */
/* Seek to the beginning of the target packet. */
- iter_status = bt_msg_iter_seek(ds_file->msg_iter, index_entry->offset);
+ iter_status = ctf_msg_iter_seek(ds_file->msg_iter, index_entry->offset);
- /* bt_msg_iter_seek() logs errors. */
+ /* ctf_msg_iter_seek() logs errors. */
* the first event. To extract the first event's clock
* snapshot.
*/
* the first event. To extract the first event's clock
* snapshot.
*/
- iter_status = bt_msg_iter_curr_packet_first_event_clock_snapshot(
+ iter_status = ctf_msg_iter_curr_packet_first_event_clock_snapshot(
ds_file->msg_iter, cs);
break;
case LAST_EVENT:
/* Decode the packet to extract the last event's clock snapshot. */
ds_file->msg_iter, cs);
break;
case LAST_EVENT:
/* Decode the packet to extract the last event's clock snapshot. */
- iter_status = bt_msg_iter_curr_packet_last_event_clock_snapshot(
+ iter_status = ctf_msg_iter_curr_packet_last_event_clock_snapshot(
ds_file->msg_iter, cs);
break;
default:
ds_file->msg_iter, cs);
break;
default:
ctf_fs_ds_file_destroy(ds_file);
}
if (msg_iter) {
ctf_fs_ds_file_destroy(ds_file);
}
if (msg_iter) {
- bt_msg_iter_destroy(msg_iter);
+ ctf_msg_iter_destroy(msg_iter);
size_t ds_file_info_index;
/* Owned by this */
size_t ds_file_info_index;
/* Owned by this */
- struct bt_msg_iter *msg_iter;
+ struct ctf_msg_iter *msg_iter;
#define STREAM_NAME_PREFIX "stream-"
static
#define STREAM_NAME_PREFIX "stream-"
static
-enum bt_msg_iter_medium_status medop_request_bytes(
+enum ctf_msg_iter_medium_status medop_request_bytes(
size_t request_sz, uint8_t **buffer_addr,
size_t *buffer_sz, void *data)
{
size_t request_sz, uint8_t **buffer_addr,
size_t *buffer_sz, void *data)
{
- enum bt_msg_iter_medium_status status =
- BT_MSG_ITER_MEDIUM_STATUS_OK;
+ enum ctf_msg_iter_medium_status status =
+ CTF_MSG_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;
struct lttng_live_stream_iterator *stream = data;
struct lttng_live_trace *trace = stream->trace;
struct lttng_live_session *session = trace->session;
uint64_t read_len;
if (stream->has_stream_hung_up) {
uint64_t read_len;
if (stream->has_stream_hung_up) {
- status = BT_MSG_ITER_MEDIUM_STATUS_EOF;
+ status = CTF_MSG_ITER_MEDIUM_STATUS_EOF;
goto end;
}
len_left = stream->base_offset + stream->len - stream->offset;
if (!len_left) {
stream->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA;
goto end;
}
len_left = stream->base_offset + stream->len - stream->offset;
if (!len_left) {
stream->state = LTTNG_LIVE_STREAM_ACTIVE_NO_DATA;
- status = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
+ status = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN;
return lttng_live_stream->stream;
}
return lttng_live_stream->stream;
}
-static struct bt_msg_iter_medium_ops medops = {
+static struct ctf_msg_iter_medium_ops medops = {
.request_bytes = medop_request_bytes,
.seek = NULL,
.borrow_stream = medop_borrow_stream,
.request_bytes = medop_request_bytes,
.seek = NULL,
.borrow_stream = medop_borrow_stream,
}
ctf_tc = ctf_metadata_decoder_borrow_ctf_trace_class(
trace->metadata->decoder);
}
ctf_tc = ctf_metadata_decoder_borrow_ctf_trace_class(
trace->metadata->decoder);
- stream_iter->msg_iter = bt_msg_iter_create(ctf_tc,
+ stream_iter->msg_iter = ctf_msg_iter_create(ctf_tc,
lttng_live->max_query_size, medops, stream_iter,
log_level, self_comp);
if (!stream_iter->msg_iter) {
lttng_live->max_query_size, medops, stream_iter,
log_level, self_comp);
if (!stream_iter->msg_iter) {
- bt_msg_iter_set_emit_stream_end_message(
+ ctf_msg_iter_set_emit_stream_end_message(
stream_iter->msg_iter, true);
stream_iter->msg_iter, true);
- bt_msg_iter_set_emit_stream_beginning_message(
+ ctf_msg_iter_set_emit_stream_beginning_message(
stream_iter->msg_iter, true);
}
}
stream_iter->msg_iter, true);
}
}
ctf_metadata_decoder_borrow_ctf_trace_class(
trace->metadata->decoder);
BT_ASSERT(!stream_iter->msg_iter);
ctf_metadata_decoder_borrow_ctf_trace_class(
trace->metadata->decoder);
BT_ASSERT(!stream_iter->msg_iter);
- stream_iter->msg_iter = bt_msg_iter_create(ctf_tc,
+ stream_iter->msg_iter = ctf_msg_iter_create(ctf_tc,
lttng_live->max_query_size, medops, stream_iter,
log_level, self_comp);
if (!stream_iter->msg_iter) {
lttng_live->max_query_size, medops, stream_iter,
log_level, self_comp);
if (!stream_iter->msg_iter) {
- bt_msg_iter_set_emit_stream_end_message(
+ ctf_msg_iter_set_emit_stream_end_message(
stream_iter->msg_iter, true);
stream_iter->msg_iter, true);
- bt_msg_iter_set_emit_stream_beginning_message(
+ ctf_msg_iter_set_emit_stream_beginning_message(
stream_iter->msg_iter, true);
}
stream_iter->buf = g_new0(uint8_t, lttng_live->max_query_size);
stream_iter->msg_iter, true);
}
stream_iter->buf = g_new0(uint8_t, lttng_live->max_query_size);
}
if (stream_iter->msg_iter) {
}
if (stream_iter->msg_iter) {
- bt_msg_iter_destroy(stream_iter->msg_iter);
+ ctf_msg_iter_destroy(stream_iter->msg_iter);
}
g_free(stream_iter->buf);
if (stream_iter->name) {
}
g_free(stream_iter->buf);
if (stream_iter->name) {
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = lttng_live_msg_iter->log_level;
bt_self_component *self_comp = lttng_live_msg_iter->self_comp;
enum lttng_live_iterator_status ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
bt_logging_level log_level = lttng_live_msg_iter->log_level;
bt_self_component *self_comp = lttng_live_msg_iter->self_comp;
- enum bt_msg_iter_status status;
+ enum ctf_msg_iter_status status;
uint64_t session_idx, trace_idx;
for (session_idx = 0; session_idx < lttng_live_msg_iter->sessions->len;
uint64_t session_idx, trace_idx;
for (session_idx = 0; session_idx < lttng_live_msg_iter->sessions->len;
- status = bt_msg_iter_get_next_message(lttng_live_stream->msg_iter,
+ status = ctf_msg_iter_get_next_message(lttng_live_stream->msg_iter,
lttng_live_msg_iter->self_msg_iter, message);
switch (status) {
lttng_live_msg_iter->self_msg_iter, message);
switch (status) {
- case BT_MSG_ITER_STATUS_EOF:
+ case CTF_MSG_ITER_STATUS_EOF:
ret = LTTNG_LIVE_ITERATOR_STATUS_END;
break;
ret = LTTNG_LIVE_ITERATOR_STATUS_END;
break;
- case BT_MSG_ITER_STATUS_OK:
+ case CTF_MSG_ITER_STATUS_OK:
ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
break;
ret = LTTNG_LIVE_ITERATOR_STATUS_OK;
break;
- case BT_MSG_ITER_STATUS_AGAIN:
+ case CTF_MSG_ITER_STATUS_AGAIN:
/*
* Continue immediately (end of packet). The next
* get_index may return AGAIN to delay the following
/*
* Continue immediately (end of packet). The next
* get_index may return AGAIN to delay the following
*/
ret = LTTNG_LIVE_ITERATOR_STATUS_CONTINUE;
break;
*/
ret = LTTNG_LIVE_ITERATOR_STATUS_CONTINUE;
break;
- case BT_MSG_ITER_STATUS_INVAL:
+ case CTF_MSG_ITER_STATUS_INVAL:
/* No argument provided by the user, so don't return INVAL. */
/* No argument provided by the user, so don't return INVAL. */
- case BT_MSG_ITER_STATUS_ERROR:
+ case CTF_MSG_ITER_STATUS_ERROR:
default:
ret = LTTNG_LIVE_ITERATOR_STATUS_ERROR;
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
default:
ret = LTTNG_LIVE_ITERATOR_STATUS_ERROR;
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
bt_self_component *self_comp = lttng_live_msg_iter->self_comp;
/*
* The viewer has hung up on us so we are closing the stream. The
bt_self_component *self_comp = lttng_live_msg_iter->self_comp;
/*
* The viewer has hung up on us so we are closing the stream. The
- * `bt_msg_iter` should simply realize that it needs to close the
+ * `ctf_msg_iter` should simply realize that it needs to close the
* stream properly by emitting the necessary stream end message.
*/
* stream properly by emitting the necessary stream end message.
*/
- enum bt_msg_iter_status status = bt_msg_iter_get_next_message(
+ enum ctf_msg_iter_status status = ctf_msg_iter_get_next_message(
stream_iter->msg_iter, lttng_live_msg_iter->self_msg_iter,
curr_msg);
stream_iter->msg_iter, lttng_live_msg_iter->self_msg_iter,
curr_msg);
- if (status == BT_MSG_ITER_STATUS_ERROR) {
+ if (status == CTF_MSG_ITER_STATUS_ERROR) {
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Error getting the next message from CTF message iterator");
live_status = LTTNG_LIVE_ITERATOR_STATUS_ERROR;
goto end;
}
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Error getting the next message from CTF message iterator");
live_status = LTTNG_LIVE_ITERATOR_STATUS_ERROR;
goto end;
}
- BT_ASSERT(status == BT_MSG_ITER_STATUS_OK);
+ BT_ASSERT(status == CTF_MSG_ITER_STATUS_OK);
* Since only a single iterator per viewer connection, we have
* only a single message iterator per stream.
*/
* Since only a single iterator per viewer connection, we have
* only a single message iterator per stream.
*/
- struct bt_msg_iter *msg_iter;
+ struct ctf_msg_iter *msg_iter;
uint64_t viewer_stream_id;
uint64_t viewer_stream_id;
struct lttng_live_stream_iterator *stream,
struct packet_index *index);
struct lttng_live_stream_iterator *stream,
struct packet_index *index);
-enum bt_msg_iter_medium_status lttng_live_get_stream_bytes(
+enum ctf_msg_iter_medium_status lttng_live_get_stream_bytes(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream, uint8_t *buf,
uint64_t offset, uint64_t req_len, uint64_t *recv_len);
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream, uint8_t *buf,
uint64_t offset, uint64_t req_len, uint64_t *recv_len);
-enum bt_msg_iter_medium_status lttng_live_get_stream_bytes(
+enum ctf_msg_iter_medium_status lttng_live_get_stream_bytes(
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream, uint8_t *buf,
uint64_t offset, uint64_t req_len, uint64_t *recv_len)
{
struct lttng_live_msg_iter *lttng_live_msg_iter,
struct lttng_live_stream_iterator *stream, uint8_t *buf,
uint64_t offset, uint64_t req_len, uint64_t *recv_len)
{
- enum bt_msg_iter_medium_status retstatus = BT_MSG_ITER_MEDIUM_STATUS_OK;
+ enum ctf_msg_iter_medium_status retstatus = CTF_MSG_ITER_MEDIUM_STATUS_OK;
struct lttng_viewer_trace_packet rp;
struct lttng_viewer_cmd cmd;
struct lttng_viewer_get_packet rq;
struct lttng_viewer_trace_packet rp;
struct lttng_viewer_cmd cmd;
struct lttng_viewer_get_packet rq;
case LTTNG_VIEWER_GET_PACKET_RETRY:
/* Unimplemented by relay daemon */
BT_COMP_LOGD("Received get_data_packet response: retry");
case LTTNG_VIEWER_GET_PACKET_RETRY:
/* Unimplemented by relay daemon */
BT_COMP_LOGD("Received get_data_packet response: retry");
- retstatus = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
+ retstatus = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN;
goto end;
case LTTNG_VIEWER_GET_PACKET_ERR:
if (flags & LTTNG_VIEWER_FLAG_NEW_METADATA) {
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)) {
}
if (flags & (LTTNG_VIEWER_FLAG_NEW_METADATA
| LTTNG_VIEWER_FLAG_NEW_STREAM)) {
- retstatus = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
+ retstatus = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN;
goto end;
}
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Received get_data_packet response: error");
goto error;
case LTTNG_VIEWER_GET_PACKET_EOF:
goto end;
}
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
"Received get_data_packet response: error");
goto error;
case LTTNG_VIEWER_GET_PACKET_EOF:
- retstatus = BT_MSG_ITER_MEDIUM_STATUS_EOF;
+ retstatus = CTF_MSG_ITER_MEDIUM_STATUS_EOF;
goto end;
default:
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
goto end;
default:
BT_COMP_LOGE_APPEND_CAUSE(self_comp,
error:
if (lttng_live_graph_is_canceled(lttng_live_msg_iter)) {
error:
if (lttng_live_graph_is_canceled(lttng_live_msg_iter)) {
- retstatus = BT_MSG_ITER_MEDIUM_STATUS_AGAIN;
+ retstatus = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN;
- retstatus = BT_MSG_ITER_MEDIUM_STATUS_ERROR;
+ retstatus = CTF_MSG_ITER_MEDIUM_STATUS_ERROR;