liblttng-ctl: hide MI trigger command variables
[lttng-tools.git] / src / common / index / index.h
CommitLineData
309167d2 1/*
ab5be9fa
MJ
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>
309167d2 5 *
ab5be9fa 6 * SPDX-License-Identifier: GPL-2.0-only
309167d2 7 *
309167d2
JD
8 */
9
10#ifndef _INDEX_H
11#define _INDEX_H
12
13#include <inttypes.h>
f8f3885c 14#include <urcu/ref.h>
309167d2 15
50adc264 16#include "ctf-index.h"
8bb66c3c
JG
17#include <common/fs-handle.h>
18#include <common/trace-chunk.h>
309167d2 19
f8f3885c 20struct lttng_index_file {
8bb66c3c 21 struct fs_handle *file;
f8f3885c
MD
22 uint32_t major;
23 uint32_t minor;
24 uint32_t element_len;
c35f9726 25 struct lttng_trace_chunk *trace_chunk;
f8f3885c
MD
26 struct urcu_ref ref;
27};
28
29/*
30 * create and open have refcount of 1. Use put to decrement the
31 * refcount. Destroys when reaching 0. Use "get" to increment refcount.
32 */
3ff5c5db 33enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk(
d2956687 34 struct lttng_trace_chunk *chunk,
ebb29c10 35 const char *channel_path, const char *stream_name,
d2956687
JG
36 uint64_t stream_file_size, uint64_t stream_count,
37 uint32_t index_major, uint32_t index_minor,
3ff5c5db
MD
38 bool unlink_existing_file, struct lttng_index_file **file);
39
40enum lttng_trace_chunk_status lttng_index_file_create_from_trace_chunk_read_only(
ebb29c10
JG
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,
3ff5c5db
MD
44 uint32_t index_major, uint32_t index_minor,
45 bool expect_no_file, struct lttng_index_file **file);
46
f8f3885c
MD
47int lttng_index_file_write(const struct lttng_index_file *index_file,
48 const struct ctf_packet_index *element);
49int lttng_index_file_read(const struct lttng_index_file *index_file,
50 struct ctf_packet_index *element);
51
52void lttng_index_file_get(struct lttng_index_file *index_file);
53void lttng_index_file_put(struct lttng_index_file *index_file);
309167d2
JD
54
55#endif /* _INDEX_H */
This page took 0.074498 seconds and 5 git commands to generate.