Remove extern "C" from internal headers
[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
11#include <inttypes.h>
4bd69c5f 12#include <lttng/lttng-export.h>
246611b0
FD
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 */
b66cbf17
SM
25extern "C" LTTNG_EXPORT
26struct lttng_index_allocator *lttng_index_allocator_create(
246611b0
FD
27 uint64_t index_count);
28
29/*
30 * Get the number of indexes currently in use.
31 */
b66cbf17
SM
32extern "C" LTTNG_EXPORT
33uint64_t lttng_index_allocator_get_index_count(
246611b0
FD
34 struct lttng_index_allocator *allocator);
35
36/*
37 * Allocate (i.e. reserve) a slot.
38 */
b66cbf17
SM
39extern "C" LTTNG_EXPORT
40enum lttng_index_allocator_status lttng_index_allocator_alloc(
246611b0
FD
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 */
b66cbf17
SM
48extern "C" LTTNG_EXPORT
49enum lttng_index_allocator_status lttng_index_allocator_release(
246611b0
FD
50 struct lttng_index_allocator *allocator, uint64_t index);
51
52/*
53 * Destroy an index allocator.
54 */
b66cbf17
SM
55extern "C" LTTNG_EXPORT
56void lttng_index_allocator_destroy(struct lttng_index_allocator *allocator);
7966af57 57
246611b0 58#endif /* _COMMON_INDEX_ALLOCATOR_H */
This page took 0.026815 seconds and 4 git commands to generate.