tap-driver.sh: flush stdout after each test result
[babeltrace.git] / plugins / ctf / fs-src / data-stream-file.h
index e5bc7c76591d06b339046e6a140c18b840b9a411..feeef675257f1f23bc4762b7bbfc1237bd4ac6f8 100644 (file)
 #include <stdio.h>
 #include <stdbool.h>
 #include <glib.h>
-#include <babeltrace/babeltrace-internal.h>
-#include <babeltrace/ctf-ir/trace.h>
+#include <babeltrace2/babeltrace-internal.h>
+#include <babeltrace2/babeltrace.h>
 
-#include "../common/notif-iter/notif-iter.h"
+#include "../common/msg-iter/msg-iter.h"
 #include "lttng-index.h"
 
 struct ctf_fs_component;
@@ -37,34 +37,80 @@ struct ctf_fs_file;
 struct ctf_fs_trace;
 struct ctf_fs_ds_file;
 
-struct index_entry {
-       uint64_t offset; /* in bytes. */
-       uint64_t packet_size; /* in bytes. */
-       /* relative to the packet context field's mapped clock. */
-       uint64_t timestamp_begin, timestamp_end;
+struct ctf_fs_ds_file_info {
+       /* Owned by this. */
+       GString *path;
+
+       /* Guaranteed to be set, as opposed to the index. */
+       int64_t begin_ns;
 };
 
-struct index {
-       GArray *entries; /* Array of struct index_entry. */
+struct ctf_fs_metadata;
+
+struct ctf_fs_ds_file {
+       /* Weak */
+       struct ctf_fs_metadata *metadata;
+
+       /* Weak */
+       bt_self_message_iterator *pc_msg_iter;
+
+       /* Owned by this */
+       struct ctf_fs_file *file;
+
+       /* Owned by this */
+       bt_stream *stream;
+
+       /* Weak */
+       struct bt_msg_iter *msg_iter;
+
+       void *mmap_addr;
+
+       /*
+        * Max length of chunk to mmap() when updating the current mapping.
+        * This value must be page-aligned.
+        */
+       size_t mmap_max_len;
+
+       /* Length of the current mapping. Never exceeds the file's length. */
+       size_t mmap_len;
+
+       /* Offset in the file where the current mapping starts. */
+       off_t mmap_offset;
+
+       /*
+        * Offset, in the current mapping, of the address to return on the next
+        * request.
+        */
+       off_t request_offset;
+
+       bool end_reached;
 };
 
 BT_HIDDEN
 struct ctf_fs_ds_file *ctf_fs_ds_file_create(
                struct ctf_fs_trace *ctf_fs_trace,
-               struct bt_ctf_stream *stream, const char *path,
-               bool build_index);
+               bt_self_message_iterator *pc_msg_iter,
+               struct bt_msg_iter *msg_iter,
+               bt_stream *stream, const char *path);
 
 BT_HIDDEN
-int ctf_fs_ds_file_get_packet_header_context_fields(
-               struct ctf_fs_trace *ctf_fs_trace, const char *path,
-               struct bt_ctf_field **packet_header_field,
-               struct bt_ctf_field **packet_context_field);
+void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
 
 BT_HIDDEN
-void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
+bt_self_message_iterator_status ctf_fs_ds_file_next(
+               struct ctf_fs_ds_file *ds_file,
+               bt_message **msg);
 
 BT_HIDDEN
-struct bt_notification_iterator_next_return ctf_fs_ds_file_next(
-               struct ctf_fs_ds_file *stream);
+struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(
+               struct ctf_fs_ds_file *ds_file);
+
+BT_HIDDEN
+struct ctf_fs_ds_index *ctf_fs_ds_index_create();
+
+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;
 
 #endif /* CTF_FS_DS_FILE_H */
This page took 0.024617 seconds and 4 git commands to generate.