blob: 3254d6d4278554d422ae603ac4c3cf0def699247 [file]
/* SPDX-License-Identifier: GPL-2.0-only */
// Copyright (c) 2026 Jarkko Sakkinen
#ifndef UCELLS_IDS_H
#define UCELLS_IDS_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
struct id_block_slot;
struct id_block_lease {
uint32_t first_id;
uint32_t owner_uid;
};
struct id_block_pool {
uint16_t max_per_user;
struct id_block_slot *slots;
size_t next_cursor;
};
int id_block_pool_init(struct id_block_pool *pool);
void id_block_pool_destroy(struct id_block_pool *pool);
int id_block_allocate(struct id_block_pool *pool, uint32_t owner_uid,
struct id_block_lease *out);
void id_block_release(struct id_block_pool *pool,
const struct id_block_lease *lease, bool retire);
#endif