ctf plugin: add bt_ctf_notif_iter_get_packet_header_context_fields()
[babeltrace.git] / plugins / ctf / fs-src / data-stream.c
index 016e3fc5411713944ac016a7e833fddc5999e00c..851c094e5179e5e984ab7dff13cc1a0595dc714c 100644 (file)
@@ -42,7 +42,8 @@
 
 #define PRINT_ERR_STREAM       ctf_fs->error_fp
 #define PRINT_PREFIX           "ctf-fs-data-stream"
-#include "print.h"
+#define PRINT_DBG_CHECK                ctf_fs_debug
+#include "../print.h"
 
 static inline
 size_t remaining_mmap_bytes(struct ctf_fs_stream *stream)
@@ -349,74 +350,78 @@ end:
 
 BT_HIDDEN
 struct ctf_fs_stream *ctf_fs_stream_create(
-               struct ctf_fs_component *ctf_fs, const char *path)
+               struct ctf_fs_trace *ctf_fs_trace, const char *path)
 {
        int ret;
-       struct ctf_fs_stream *stream = g_new0(struct ctf_fs_stream, 1);
+       struct ctf_fs_stream *ctf_fs_stream = g_new0(struct ctf_fs_stream, 1);
 
-       if (!stream) {
+       if (!ctf_fs_stream) {
                goto error;
        }
 
-       stream->file = ctf_fs_file_create(ctf_fs);
-       if (!stream->file) {
+       ctf_fs_stream->file = ctf_fs_file_create(ctf_fs_trace->ctf_fs);
+       if (!ctf_fs_stream->file) {
                goto error;
        }
 
-       stream->cc_prio_map = bt_get(ctf_fs->cc_prio_map);
-       g_string_assign(stream->file->path, path);
-       ret = ctf_fs_file_open(ctf_fsstream->file, "rb");
+       ctf_fs_stream->cc_prio_map = bt_get(ctf_fs_trace->cc_prio_map);
+       g_string_assign(ctf_fs_stream->file->path, path);
+       ret = ctf_fs_file_open(ctf_fs_trace->ctf_fs, ctf_fs_stream->file, "rb");
        if (ret) {
                goto error;
        }
 
-       stream->notif_iter = bt_ctf_notif_iter_create(ctf_fs->metadata->trace,
-                       ctf_fs->page_size, medops, stream,
-                       ctf_fs->error_fp);
-       if (!stream->notif_iter) {
+       ctf_fs_stream->notif_iter = bt_ctf_notif_iter_create(
+               ctf_fs_trace->metadata->trace,
+               ctf_fs_trace->ctf_fs->page_size, medops, ctf_fs_stream,
+               ctf_fs_trace->ctf_fs->error_fp);
+       if (!ctf_fs_stream->notif_iter) {
                goto error;
        }
 
-       stream->mmap_max_len = ctf_fs->page_size * 2048;
-       ret = init_stream_index(stream);
+       ctf_fs_stream->mmap_max_len = ctf_fs_trace->ctf_fs->page_size * 2048;
+       ret = init_stream_index(ctf_fs_stream);
        if (ret) {
                goto error;
        }
+
        goto end;
+
 error:
        /* Do not touch "borrowed" file. */
-       ctf_fs_stream_destroy(stream);
-       stream = NULL;
+       ctf_fs_stream_destroy(ctf_fs_stream);
+       ctf_fs_stream = NULL;
+
 end:
-       return stream;
+       return ctf_fs_stream;
 }
 
 BT_HIDDEN
-void ctf_fs_stream_destroy(struct ctf_fs_stream *stream)
+void ctf_fs_stream_destroy(struct ctf_fs_stream *ctf_fs_stream)
 {
-       if (!stream) {
+       if (!ctf_fs_stream) {
                return;
        }
 
-       bt_put(stream->cc_prio_map);
+       bt_put(ctf_fs_stream->cc_prio_map);
 
-       if (stream->file) {
-               ctf_fs_file_destroy(stream->file);
+       if (ctf_fs_stream->file) {
+               ctf_fs_file_destroy(ctf_fs_stream->file);
        }
 
-       if (stream->stream) {
-               BT_PUT(stream->stream);
+       if (ctf_fs_stream->stream) {
+               BT_PUT(ctf_fs_stream->stream);
        }
 
-       if (stream->notif_iter) {
-               bt_ctf_notif_iter_destroy(stream->notif_iter);
+       if (ctf_fs_stream->notif_iter) {
+               bt_ctf_notif_iter_destroy(ctf_fs_stream->notif_iter);
        }
 
-       if (stream->index.entries) {
-               g_array_free(stream->index.entries, TRUE);
+       if (ctf_fs_stream->index.entries) {
+               g_array_free(ctf_fs_stream->index.entries, TRUE);
        }
 
-       g_free(stream);
+       g_free(ctf_fs_stream);
 }
 
 BT_HIDDEN
This page took 0.025725 seconds and 4 git commands to generate.