2 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
4 * SPDX-License-Identifier: GPL-2.0-only
8 #ifndef _COMMON_INDEX_ALLOCATOR_H
9 #define _COMMON_INDEX_ALLOCATOR_H
13 struct lttng_index_allocator
;
15 enum lttng_index_allocator_status
{
16 LTTNG_INDEX_ALLOCATOR_STATUS_OK
,
17 LTTNG_INDEX_ALLOCATOR_STATUS_EMPTY
,
18 LTTNG_INDEX_ALLOCATOR_STATUS_ERROR
,
21 struct lttng_index_allocator
*lttng_index_allocator_create(
22 uint64_t index_count
);
24 uint64_t lttng_index_allocator_get_index_count(
25 struct lttng_index_allocator
*allocator
);
27 enum lttng_index_allocator_status
lttng_index_allocator_alloc(
28 struct lttng_index_allocator
*allocator
,
31 enum lttng_index_allocator_status
lttng_index_allocator_release(
32 struct lttng_index_allocator
*allocator
, uint64_t index
);
34 void lttng_index_allocator_destroy(struct lttng_index_allocator
*allocator
);
36 #endif /* _COMMON_INDEX_ALLOCATOR_H */