Sort includes in C++ files
[babeltrace.git] / src / plugins / ctf / fs-src / data-stream-file.hpp
CommitLineData
e98a2d6e 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
e98a2d6e 3 *
0235b0db 4 * Copyright (C) 2016 Philippe Proulx <pproulx@efficios.com>
e98a2d6e
PP
5 */
6
0235b0db
MJ
7#ifndef CTF_FS_DS_FILE_H
8#define CTF_FS_DS_FILE_H
9
e98a2d6e 10#include <glib.h>
c802cacb
SM
11#include <stdbool.h>
12#include <stdio.h>
13
3fadfbc0 14#include <babeltrace2/babeltrace.h>
e98a2d6e 15
c802cacb
SM
16#include "common/macros.h"
17
087cd0f5
SM
18#include "../common/msg-iter/msg-iter.hpp"
19#include "lttng-index.hpp"
b6c3dcb2
JG
20
21struct ctf_fs_component;
22struct ctf_fs_file;
1a9f7075 23struct ctf_fs_trace;
94cf822e 24struct ctf_fs_ds_file;
f6e68e70
SM
25struct ctf_fs_ds_file_group;
26struct ctf_fs_ds_group_medops_data;
b6c3dcb2 27
4164020e
SM
28struct ctf_fs_ds_file_info
29{
30 /* Owned by this. */
31 GString *path;
97ade20b 32
4164020e
SM
33 /* Guaranteed to be set, as opposed to the index. */
34 int64_t begin_ns;
97ade20b
JG
35};
36
44c440bc
PP
37struct ctf_fs_metadata;
38
4164020e
SM
39struct ctf_fs_ds_file
40{
41 bt_logging_level log_level;
98903a3e 42
4164020e
SM
43 /* Weak */
44 bt_self_component *self_comp;
4c65a157 45
4164020e
SM
46 /* Weak */
47 struct ctf_fs_metadata *metadata;
5c563278 48
4164020e
SM
49 /* Owned by this */
50 struct ctf_fs_file *file;
97ade20b 51
4164020e
SM
52 /* Owned by this */
53 bt_stream *stream;
97ade20b 54
4164020e 55 void *mmap_addr;
97ade20b 56
4164020e
SM
57 /*
58 * Max length of chunk to mmap() when updating the current mapping.
59 * This value must be page-aligned.
60 */
61 size_t mmap_max_len;
97ade20b 62
4164020e
SM
63 /* Length of the current mapping. Never exceeds the file's length. */
64 size_t mmap_len;
97ade20b 65
4164020e
SM
66 /* Offset in the file where the current mapping starts. */
67 off_t mmap_offset_in_file;
97ade20b 68
4164020e
SM
69 /*
70 * Offset, in the current mapping, of the address to return on the next
71 * request.
72 */
73 off_t request_offset_in_mapping;
b6c3dcb2 74};
e98a2d6e 75
76edbcf1
SM
76struct ctf_fs_ds_file *ctf_fs_ds_file_create(struct ctf_fs_trace *ctf_fs_trace, bt_stream *stream,
77 const char *path, bt_logging_level log_level);
e98a2d6e 78
94cf822e 79void ctf_fs_ds_file_destroy(struct ctf_fs_ds_file *stream);
e98a2d6e 80
4164020e
SM
81struct ctf_fs_ds_index *ctf_fs_ds_file_build_index(struct ctf_fs_ds_file *ds_file,
82 struct ctf_fs_ds_file_info *ds_file_info,
83 struct ctf_msg_iter *msg_iter);
97ade20b 84
4c65a157 85struct ctf_fs_ds_index *ctf_fs_ds_index_create(bt_logging_level log_level,
4164020e 86 bt_self_component *self_comp);
7ed5243a 87
97ade20b
JG
88void ctf_fs_ds_index_destroy(struct ctf_fs_ds_index *index);
89
f6e68e70
SM
90/*
91 * Medium operations to iterate on a single ctf_fs_ds_file.
92 *
93 * The data pointer when using this must be a pointer to the ctf_fs_ds_file.
94 */
18a1979b 95extern struct ctf_msg_iter_medium_ops ctf_fs_ds_file_medops;
6de92955 96
f6e68e70
SM
97/*
98 * Medium operations to iterate on the packet of a ctf_fs_ds_group.
99 *
100 * The iteration is done based on the index of the group.
101 *
102 * The data pointer when using these medops must be a pointer to a ctf_fs_ds
103 * group_medops_data structure.
104 */
105extern struct ctf_msg_iter_medium_ops ctf_fs_ds_group_medops;
106
f6e68e70 107enum ctf_msg_iter_medium_status ctf_fs_ds_group_medops_data_create(
4164020e
SM
108 struct ctf_fs_ds_file_group *ds_file_group, bt_self_message_iterator *self_msg_iter,
109 bt_logging_level log_level, struct ctf_fs_ds_group_medops_data **out);
f6e68e70 110
f6e68e70
SM
111void ctf_fs_ds_group_medops_data_reset(struct ctf_fs_ds_group_medops_data *data);
112
4164020e 113void ctf_fs_ds_group_medops_data_destroy(struct ctf_fs_ds_group_medops_data *data);
f6e68e70 114
94cf822e 115#endif /* CTF_FS_DS_FILE_H */
This page took 0.094679 seconds and 4 git commands to generate.