diff options
author | Anton Kling <anton@kling.gg> | 2024-04-27 15:26:39 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-04-27 15:26:39 +0200 |
commit | 02c27583a539c4e8073509536d328581cf1ba346 (patch) | |
tree | 67c8de59e04b118116f039e724be3ee9268b507f /kernel/lib/relist.h | |
parent | 7ab3153f92f38223157c4c1f4af1c30e33c94a76 (diff) |
Kernel: Make file descriptor numbers reusable.
Instead of using the "append only" list it now uses "relist" which
allows for indexes to be removed.
Diffstat (limited to 'kernel/lib/relist.h')
-rw-r--r-- | kernel/lib/relist.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/lib/relist.h b/kernel/lib/relist.h new file mode 100644 index 0000000..96625ba --- /dev/null +++ b/kernel/lib/relist.h @@ -0,0 +1,19 @@ +#ifndef RELIST_H +#define RELIST_H +#include <typedefs.h> + +struct relist { + void **entries; + u32 bitmap_capacity; + u64 *bitmap; +}; + +void relist_init(struct relist *list); +void relist_reset(struct relist *list); +void relist_free(struct relist *list); +int relist_clone(struct relist *in, struct relist *out); +int relist_add(struct relist *list, void *value, u32 *index); +int relist_set(struct relist *list, u32 index, void *value); +int relist_get(const struct relist *list, u32 index, void **out); +int relist_remove(struct relist *list, u32 index); +#endif |