Manage int IDs via id_alloc
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m31s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m31s
This commit is contained in:
21
kernel/id/id_alloc.h
Normal file
21
kernel/id/id_alloc.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef _KERNEL_ID_ID_ALLOC_H
|
||||
#define _KERNEL_ID_ID_ALLOC_H
|
||||
|
||||
#include <libk/bm.h>
|
||||
#include <libk/std.h>
|
||||
#include <sync/spin_lock.h>
|
||||
|
||||
struct id_alloc {
|
||||
struct bm bm;
|
||||
spin_lock_t lock;
|
||||
};
|
||||
|
||||
int id_alloc (struct id_alloc* ida);
|
||||
|
||||
void id_free (struct id_alloc* ida, int id);
|
||||
|
||||
bool id_alloc_init (struct id_alloc* ida, size_t nbits);
|
||||
|
||||
void id_alloc_fini (struct id_alloc* ida);
|
||||
|
||||
#endif // _KERNEL_ID_ID_ALLOC_H
|
||||
Reference in New Issue
Block a user