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