Tests: flt.lttng-utils.debug-info: update debug-info tests
[babeltrace.git] / src / plugins / ctf / fs-src / fs.c
index da5a1eb6d9bdd1e54895ab6fbc734a7e48fa03f2..d9493e6639e290170642bd2b9dc2dbc352392247 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "common/common.h"
 #include <babeltrace2/babeltrace.h>
-#include "compat/uuid.h"
+#include "common/uuid.h"
 #include <glib.h>
 #include "common/assert.h"
 #include <inttypes.h>
@@ -42,6 +42,7 @@
 #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"
 
@@ -260,7 +261,7 @@ bt_component_class_message_iterator_init_method_status ctf_fs_iterator_init(
        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_COMPONENT_CLASS_MESSAGE_ITERATOR_NEXT_METHOD_STATUS_MEMORY_ERROR;
+               ret = BT_COMPONENT_CLASS_MESSAGE_ITERATOR_INIT_METHOD_STATUS_MEMORY_ERROR;
                goto error;
        }
 
@@ -426,9 +427,9 @@ gchar *ctf_fs_make_port_name(struct ctf_fs_ds_file_group *ds_file_group)
 
        /* For the trace, use the uuid if present, else the path. */
        if (ds_file_group->ctf_fs_trace->metadata->tc->is_uuid_set) {
-               char uuid_str[BABELTRACE_UUID_STR_LEN];
+               char uuid_str[BT_UUID_STR_LEN + 1];
 
-               bt_uuid_unparse(ds_file_group->ctf_fs_trace->metadata->tc->uuid, uuid_str);
+               bt_uuid_to_str(ds_file_group->ctf_fs_trace->metadata->tc->uuid, uuid_str);
                g_string_assign(name, uuid_str);
        } else {
                g_string_assign(name, ds_file_group->ctf_fs_trace->path->str);
@@ -495,9 +496,7 @@ error:
        ret = -1;
 
 end:
-       if (port_name) {
-               g_free(port_name);
-       }
+       g_free(port_name);
 
        port_data_destroy(port_data);
        return ret;
@@ -900,7 +899,7 @@ int create_ds_file_groups(struct ctf_fs_trace *ctf_fs_trace)
        while ((basename = g_dir_read_name(dir))) {
                struct ctf_fs_file *file;
 
-               if (!strcmp(basename, CTF_FS_METADATA_FILENAME)) {
+               if (strcmp(basename, CTF_FS_METADATA_FILENAME) == 0) {
                        /* Ignore the metadata stream. */
                        BT_COMP_LOGI("Ignoring metadata file `%s" G_DIR_SEPARATOR_S "%s`",
                                ctf_fs_trace->path->str, basename);
@@ -980,7 +979,6 @@ int set_trace_name(bt_trace *trace, const char *name_suffix,
                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;
 
@@ -995,8 +993,8 @@ int set_trace_name(bt_trace *trace, const char *name_suffix,
         * 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));
 
@@ -1077,6 +1075,12 @@ struct ctf_fs_trace *ctf_fs_trace_create(bt_self_component *self_comp,
        }
 
        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) {
@@ -1315,6 +1319,9 @@ int ctf_fs_component_create_ctf_fs_traces_one_root(
        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;
        }
 
@@ -1571,7 +1578,7 @@ int merge_ctf_fs_traces(struct ctf_fs_trace **traces, unsigned int num_traces)
        struct ctf_fs_trace *winner;
        guint i;
        int ret = 0;
-       char uuid_str[BABELTRACE_UUID_STR_LEN];
+       char uuid_str[BT_UUID_STR_LEN + 1];
 
        BT_ASSERT(num_traces >= 2);
 
@@ -1617,7 +1624,7 @@ int merge_ctf_fs_traces(struct ctf_fs_trace **traces, unsigned int num_traces)
        }
 
        /* Use the string representation of the UUID as the trace name. */
-       bt_uuid_unparse(winner->metadata->tc->uuid, uuid_str);
+       bt_uuid_to_str(winner->metadata->tc->uuid, uuid_str);
        g_string_printf(winner->name, "%s", uuid_str);
 
 end:
@@ -1990,10 +1997,10 @@ bt_component_class_query_method_status ctf_fs_query(
        bt_component_class_query_method_status status =
                BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK;
 
-       if (!strcmp(object, "metadata-info")) {
+       if (strcmp(object, "metadata-info") == 0) {
                status = metadata_info_query(comp_class, params, log_level,
                        result);
-       } else if (!strcmp(object, "trace-info")) {
+       } else if (strcmp(object, "trace-info") == 0) {
                status = trace_info_query(comp_class, params, log_level,
                        result);
        } else {
This page took 0.026106 seconds and 4 git commands to generate.