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>
6 * SPDX-License-Identifier: GPL-2.0-only
16 #include "ctf-index.hpp"
17 #include <common/fs-handle.hpp>
18 #include <common/trace-chunk.hpp>
20 struct lttng_index_file {
21 struct fs_handle *file;
25 struct lttng_trace_chunk *trace_chunk;
30 * create and open have refcount of 1. Use put to decrement the
31 * refcount. Destroys when reaching 0. Use "get" to increment refcount.
33 enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk(
34 struct lttng_trace_chunk *chunk,
35 const char *channel_path, const char *stream_name,
36 uint64_t stream_file_size, uint64_t stream_count,
37 uint32_t index_major, uint32_t index_minor,
38 bool unlink_existing_file, struct lttng_index_file **file);
40 enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk_read_only(
41 struct lttng_trace_chunk *chunk,
42 const char *channel_path, const char *stream_name,
43 uint64_t stream_file_size, uint64_t stream_file_index,
44 uint32_t index_major, uint32_t index_minor,
45 bool expect_no_file, struct lttng_index_file **file);
47 int lttng_index_file_write(const struct lttng_index_file *index_file,
48 const struct ctf_packet_index *element);
49 int lttng_index_file_read(const struct lttng_index_file *index_file,
50 struct ctf_packet_index *element);
52 void lttng_index_file_get(struct lttng_index_file *index_file);
53 void lttng_index_file_put(struct lttng_index_file *index_file);