Fix: hide symbols erroneously exported in 2.13.5
[lttng-tools.git] / src / common / index-allocator.h
CommitLineData
246611b0
FD
1/*
2 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8#ifndef _COMMON_INDEX_ALLOCATOR_H
9#define _COMMON_INDEX_ALLOCATOR_H
10
a79b0028 11#include <common/macros.h>
246611b0
FD
12#include <inttypes.h>
13
14struct lttng_index_allocator;
15
16enum lttng_index_allocator_status {
17 LTTNG_INDEX_ALLOCATOR_STATUS_OK,
18 LTTNG_INDEX_ALLOCATOR_STATUS_EMPTY,
19 LTTNG_INDEX_ALLOCATOR_STATUS_ERROR,
20};
21
22/*
23 * Create an index allocator of `index_count` slots.
24 */
a79b0028 25LTTNG_HIDDEN
246611b0
FD
26struct lttng_index_allocator *lttng_index_allocator_create(
27 uint64_t index_count);
28
29/*
30 * Get the number of indexes currently in use.
31 */
a79b0028 32LTTNG_HIDDEN
246611b0
FD
33uint64_t lttng_index_allocator_get_index_count(
34 struct lttng_index_allocator *allocator);
35
36/*
37 * Allocate (i.e. reserve) a slot.
38 */
a79b0028 39LTTNG_HIDDEN
246611b0
FD
40enum lttng_index_allocator_status lttng_index_allocator_alloc(
41 struct lttng_index_allocator *allocator,
42 uint64_t *index);
43
44/*
45 * Release a slot by index. The slot will be re-used by the index allocator
46 * in future 'alloc' calls.
47 */
a79b0028 48LTTNG_HIDDEN
246611b0
FD
49enum lttng_index_allocator_status lttng_index_allocator_release(
50 struct lttng_index_allocator *allocator, uint64_t index);
51
52/*
53 * Destroy an index allocator.
54 */
a79b0028 55LTTNG_HIDDEN
246611b0
FD
56void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator);
57
58#endif /* _COMMON_INDEX_ALLOCATOR_H */
This page took 0.031451 seconds and 4 git commands to generate.