.gitignore: ignore local vscode workspace settings file
[lttng-tools.git] / src / common / index / index.hpp
... / ...
CommitLineData
1/*
2 * Copyright (C) 2013 Julien Desfossez <jdesfossez@efficios.com>
3 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
4 * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-only
7 *
8 */
9
10#ifndef _INDEX_H
11#define _INDEX_H
12
13#include "ctf-index.hpp"
14
15#include <common/fs-handle.hpp>
16#include <common/trace-chunk.hpp>
17
18#include <inttypes.h>
19#include <urcu/ref.h>
20
21struct lttng_index_file {
22 struct fs_handle *file;
23 uint32_t major;
24 uint32_t minor;
25 uint32_t element_len;
26 struct lttng_trace_chunk *trace_chunk;
27 struct urcu_ref ref;
28};
29
30/*
31 * create and open have refcount of 1. Use put to decrement the
32 * refcount. Destroys when reaching 0. Use "get" to increment refcount.
33 */
34enum lttng_trace_chunk_status
35lttng_index_file_create_from_trace_chunk(struct lttng_trace_chunk *chunk,
36 const char *channel_path,
37 const char *stream_name,
38 uint64_t stream_file_size,
39 uint64_t stream_count,
40 uint32_t index_major,
41 uint32_t index_minor,
42 bool unlink_existing_file,
43 struct lttng_index_file **file);
44
45enum lttng_trace_chunk_status
46lttng_index_file_create_from_trace_chunk_read_only(struct lttng_trace_chunk *chunk,
47 const char *channel_path,
48 const char *stream_name,
49 uint64_t stream_file_size,
50 uint64_t stream_file_index,
51 uint32_t index_major,
52 uint32_t index_minor,
53 bool expect_no_file,
54 struct lttng_index_file **file);
55
56int lttng_index_file_write(const struct lttng_index_file *index_file,
57 const struct ctf_packet_index *element);
58int lttng_index_file_read(const struct lttng_index_file *index_file,
59 struct ctf_packet_index *element);
60
61void lttng_index_file_get(struct lttng_index_file *index_file);
62void lttng_index_file_put(struct lttng_index_file *index_file);
63
64#endif /* _INDEX_H */
This page took 0.023199 seconds and 4 git commands to generate.