fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
[lttng-tools.git] / src / common / index / index.hpp
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
c9e313bc 13#include "ctf-index.hpp"
28f23191 14
c9e313bc
SM
15#include <common/fs-handle.hpp>
16#include <common/trace-chunk.hpp>
309167d2 17
28f23191
JG
18#include <inttypes.h>
19#include <urcu/ref.h>
20
f8f3885c 21struct lttng_index_file {
8bb66c3c 22 struct fs_handle *file;
f8f3885c
MD
23 uint32_t major;
24 uint32_t minor;
25 uint32_t element_len;
c35f9726 26 struct lttng_trace_chunk *trace_chunk;
f8f3885c
MD
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 */
28f23191
JG
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);
3ff5c5db 55
f8f3885c 56int lttng_index_file_write(const struct lttng_index_file *index_file,
28f23191 57 const struct ctf_packet_index *element);
f8f3885c 58int lttng_index_file_read(const struct lttng_index_file *index_file,
28f23191 59 struct ctf_packet_index *element);
f8f3885c
MD
60
61void lttng_index_file_get(struct lttng_index_file *index_file);
62void lttng_index_file_put(struct lttng_index_file *index_file);
309167d2
JD
63
64#endif /* _INDEX_H */
This page took 0.080081 seconds and 4 git commands to generate.