tap-driver.sh: flush stdout after each test result
[babeltrace.git] / plugins / ctf / fs-sink / fs-sink-trace.c
index c6989ccc0929fee1c65d95430f4376caff6d8ed9..400b21d7e7a4ff625aca44605cf31861c93a88b9 100644 (file)
 #define BT_LOG_TAG "PLUGIN-CTF-FS-SINK-TRACE"
 #include "logging.h"
 
-#include <babeltrace/babeltrace.h>
+#include <babeltrace2/babeltrace.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <glib.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/ctfser-internal.h>
+#include <babeltrace2/assert-internal.h>
+#include <babeltrace2/ctfser-internal.h>
 
 #include "translate-trace-ir-to-ctf-ir.h"
 #include "translate-ctf-ir-to-tsdl.h"
@@ -166,20 +166,22 @@ int append_lttng_trace_path_ust_uid(GString *path, const bt_trace_class *tc)
        int ret;
 
        v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_buffering_id");
-       if (!v || !bt_value_is_integer(v)) {
+       if (!v || !bt_value_is_signed_integer(v)) {
                BT_LOGD_STR("Couldn't get environment value: name=\"tracer_buffering_id\"");
                goto error;
        }
 
-       g_string_append_printf(path, G_DIR_SEPARATOR_S "%" PRId64, bt_value_integer_get(v));
+       g_string_append_printf(path, G_DIR_SEPARATOR_S "%" PRId64,
+               bt_value_signed_integer_get(v));
 
        v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "isa_length");
-       if (!v || !bt_value_is_integer(v)) {
+       if (!v || !bt_value_is_signed_integer(v)) {
                BT_LOGD_STR("Couldn't get environment value: name=\"isa_length\"");
                goto error;
        }
 
-       g_string_append_printf(path, G_DIR_SEPARATOR_S "%" PRIu64 "-bit", bt_value_integer_get(v));
+       g_string_append_printf(path, G_DIR_SEPARATOR_S "%" PRIu64 "-bit",
+               bt_value_signed_integer_get(v));
 
        ret = 0;
        goto end;
@@ -207,12 +209,12 @@ int append_lttng_trace_path_ust_pid(GString *path, const bt_trace_class *tc)
        g_string_append_printf(path, G_DIR_SEPARATOR_S "%s", bt_value_string_get(v));
 
        v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "vpid");
-       if (!v || !bt_value_is_integer(v)) {
+       if (!v || !bt_value_is_signed_integer(v)) {
                BT_LOGD_STR("Couldn't get environment value: name=\"vpid\"");
                goto error;
        }
 
-       g_string_append_printf(path, "-%" PRId64, bt_value_integer_get(v));
+       g_string_append_printf(path, "-%" PRId64, bt_value_signed_integer_get(v));
 
        v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "vpid_datetime");
        if (!v || !bt_value_is_string(v)) {
@@ -273,20 +275,20 @@ GString *make_lttng_trace_path_rel(const struct fs_sink_trace *trace)
        }
 
        v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_major");
-       if (!v || !bt_value_is_integer(v)) {
+       if (!v || !bt_value_is_signed_integer(v)) {
                BT_LOGD_STR("Couldn't get environment value: name=\"tracer_major\"");
                goto error;
        }
 
-       tracer_major = bt_value_integer_get(v);
+       tracer_major = bt_value_signed_integer_get(v);
 
        v = bt_trace_class_borrow_environment_entry_value_by_name_const(tc, "tracer_minor");
-       if (!v || !bt_value_is_integer(v)) {
+       if (!v || !bt_value_is_signed_integer(v)) {
                BT_LOGD_STR("Couldn't get environment value: name=\"tracer_minor\"");
                goto error;
        }
 
-       tracer_minor = bt_value_integer_get(v);
+       tracer_minor = bt_value_signed_integer_get(v);
 
        if (!(tracer_major >= 3 || (tracer_major == 2 && tracer_minor >= 11))) {
                BT_LOGD("Unsupported LTTng version for automatic trace path: major=%" PRId64 ", minor=%" PRId64,
@@ -487,6 +489,8 @@ void fs_sink_trace_destroy(struct fs_sink_trace *trace)
        tsdl = g_string_new(NULL);
        BT_ASSERT(tsdl);
        translate_trace_class_ctf_ir_to_tsdl(trace->tc, tsdl);
+
+       BT_ASSERT(trace->metadata_path);
        fh = fopen(trace->metadata_path->str, "wb");
        if (!fh) {
                BT_LOGF_ERRNO("In trace destruction listener: "
@@ -512,10 +516,8 @@ void fs_sink_trace_destroy(struct fs_sink_trace *trace)
                trace->path = NULL;
        }
 
-       if (trace->metadata_path) {
-               g_string_free(trace->metadata_path, TRUE);
-               trace->metadata_path = NULL;
-       }
+       g_string_free(trace->metadata_path, TRUE);
+       trace->metadata_path = NULL;
 
        fs_sink_ctf_trace_class_destroy(trace->tc);
        trace->tc = NULL;
This page took 0.0247309999999999 seconds and 4 git commands to generate.