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
13 #include "ctf-index.hpp"
15 #include <common/fs-handle.hpp>
16 #include <common/trace-chunk.hpp>
21 struct lttng_index_file {
22 struct fs_handle *file;
26 struct lttng_trace_chunk *trace_chunk;
31 * create and open have refcount of 1. Use put to decrement the
32 * refcount. Destroys when reaching 0. Use "get" to increment refcount.
34 enum lttng_trace_chunk_status
35 lttng_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,
42 bool unlink_existing_file,
43 struct lttng_index_file **file);
45 enum lttng_trace_chunk_status
46 lttng_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,
54 struct lttng_index_file **file);
56 int lttng_index_file_write(const struct lttng_index_file *index_file,
57 const struct ctf_packet_index *element);
58 int lttng_index_file_read(const struct lttng_index_file *index_file,
59 struct ctf_packet_index *element);
61 void lttng_index_file_get(struct lttng_index_file *index_file);
62 void lttng_index_file_put(struct lttng_index_file *index_file);