#include "data-stream-file.h"
#include "file.h"
#include "../common/metadata/decoder.h"
+#include "../common/metadata/ctf-meta-configure-ir-trace.h"
#include "../common/msg-iter/msg-iter.h"
#include "query.h"
}
static
-bt_self_message_iterator_status ctf_fs_iterator_next_one(
+bt_component_class_message_iterator_next_method_status ctf_fs_iterator_next_one(
struct ctf_fs_msg_iter_data *msg_iter_data,
const bt_message **out_msg)
{
- bt_self_message_iterator_status status;
+ bt_component_class_message_iterator_next_method_status status;
BT_ASSERT(msg_iter_data->ds_file);
status = ctf_fs_ds_file_next(msg_iter_data->ds_file, &msg);
switch (status) {
- case BT_SELF_MESSAGE_ITERATOR_STATUS_OK:
+ case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK:
*out_msg = msg;
msg = NULL;
goto end;
- case BT_SELF_MESSAGE_ITERATOR_STATUS_END:
+ case BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_END:
{
int ret;
*/
ret = msg_iter_data_set_current_ds_file(msg_iter_data);
if (ret) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_ERROR;
goto end;
}
}
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_next(
+bt_component_class_message_iterator_next_method_status ctf_fs_iterator_next(
bt_self_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_next_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
struct ctf_fs_msg_iter_data *msg_iter_data =
bt_self_message_iterator_get_data(iterator);
uint64_t i = 0;
- while (i < capacity && status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ while (i < capacity &&
+ status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
status = ctf_fs_iterator_next_one(msg_iter_data, &msgs[i]);
- if (status == BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status == BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK) {
i++;
}
}
if (i > 0) {
/*
* Even if ctf_fs_iterator_next_one() returned something
- * else than BT_SELF_MESSAGE_ITERATOR_STATUS_OK, we
+ * else than BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK, we
* accumulated message objects in the output
* message array, so we need to return
- * BT_SELF_MESSAGE_ITERATOR_STATUS_OK so that they are
+ * BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK so that they are
* transfered to downstream. This other status occurs
* again the next time muxer_msg_iter_do_next() is
* called, possibly without any accumulated
* message, in which case we'll return it.
*/
*count = i;
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_OK;
}
return status;
}
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_seek_beginning(
- bt_self_message_iterator *it)
+bt_component_class_message_iterator_seek_beginning_method_status
+ctf_fs_iterator_seek_beginning(bt_self_message_iterator *it)
{
struct ctf_fs_msg_iter_data *msg_iter_data =
bt_self_message_iterator_get_data(it);
- bt_self_message_iterator_status status =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_seek_beginning_method_status status =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_OK;
BT_ASSERT(msg_iter_data);
if (ctf_fs_iterator_reset(msg_iter_data)) {
- status = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ status = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_SEEK_BEGINNING_METHOD_STATUS_ERROR;
}
return status;
}
BT_HIDDEN
-bt_self_message_iterator_status ctf_fs_iterator_init(
+bt_component_class_message_iterator_init_method_status ctf_fs_iterator_init(
bt_self_message_iterator *self_msg_iter,
bt_self_component_source *self_comp_src,
bt_self_component_port_output *self_port)
{
struct ctf_fs_port_data *port_data;
struct ctf_fs_msg_iter_data *msg_iter_data = NULL;
- bt_self_message_iterator_status ret =
- BT_SELF_MESSAGE_ITERATOR_STATUS_OK;
+ bt_component_class_message_iterator_init_method_status ret =
+ BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK;
bt_logging_level log_level;
bt_self_component *self_comp;
self_comp = port_data->ctf_fs->self_comp;
msg_iter_data = g_new0(struct ctf_fs_msg_iter_data, 1);
if (!msg_iter_data) {
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
self_comp);
if (!msg_iter_data->msg_iter) {
BT_COMP_LOGE_STR("Cannot create a CTF message iterator.");
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_NOMEM;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
goto error;
}
msg_iter_data->ds_file_group = port_data->ds_file_group;
if (ctf_fs_iterator_reset(msg_iter_data)) {
- ret = BT_SELF_MESSAGE_ITERATOR_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_ERROR;
goto error;
}
bt_self_message_iterator_set_data(self_msg_iter,
msg_iter_data);
- if (ret != BT_SELF_MESSAGE_ITERATOR_STATUS_OK) {
+ if (ret != BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_OK) {
goto error;
}
bt_logging_level log_level, bt_self_component *self_comp)
{
int ret = 0;
- const bt_trace_class *tc = bt_trace_borrow_class_const(trace);
const bt_value *val;
GString *name;
* Check if we have a trace environment string value named `hostname`.
* If so, use it as the trace name's prefix.
*/
- val = bt_trace_class_borrow_environment_entry_value_by_name_const(
- tc, "hostname");
+ val = bt_trace_borrow_environment_entry_value_by_name_const(
+ trace, "hostname");
if (val && bt_value_is_string(val)) {
g_string_append(name, bt_value_string_get(val));
}
if (ctf_fs_trace->trace) {
+ ret = ctf_trace_class_configure_ir_trace(
+ ctf_fs_trace->metadata->tc, ctf_fs_trace->trace);
+ if (ret) {
+ goto error;
+ }
+
ret = set_trace_name(ctf_fs_trace->trace, name, log_level,
self_comp);
if (ret) {
if (!trace_paths) {
BT_COMP_LOGE("No CTF traces recursively found in `%s`.",
path_param);
+ (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(
+ ctf_fs->self_comp,
+ "No CTF traces recursively found in `%s`.", path_param);
goto error;
}
}
BT_HIDDEN
-bt_self_component_status ctf_fs_init(
+bt_component_class_init_method_status ctf_fs_init(
bt_self_component_source *self_comp,
const bt_value *params, __attribute__((unused)) void *init_method_data)
{
struct ctf_fs_component *ctf_fs;
- bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
+ bt_component_class_init_method_status ret =
+ BT_COMPONENT_CLASS_INIT_METHOD_STATUS_OK;
ctf_fs = ctf_fs_create(self_comp, params);
if (!ctf_fs) {
- ret = BT_SELF_COMPONENT_STATUS_ERROR;
+ ret = BT_COMPONENT_CLASS_INIT_METHOD_STATUS_ERROR;
}
return ret;
}
BT_HIDDEN
-bt_query_status ctf_fs_query(
+bt_component_class_query_method_status ctf_fs_query(
bt_self_component_class_source *comp_class,
const bt_query_executor *query_exec,
const char *object, const bt_value *params,
bt_logging_level log_level,
const bt_value **result)
{
- bt_query_status status = BT_QUERY_STATUS_OK;
+ bt_component_class_query_method_status status =
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
if (!strcmp(object, "metadata-info")) {
status = metadata_info_query(comp_class, params, log_level,
result);
} else {
BT_LOGE("Unknown query object `%s`", object);
- status = BT_QUERY_STATUS_INVALID_OBJECT;
+ status = BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_INVALID_OBJECT;
goto end;
}
end: