kmalloc: add kmalloc_remove_arena() function

This commit is contained in:
Lephe 2024-02-04 22:10:01 +01:00
parent 542b4f0a81
commit e50769c824
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 14 additions and 0 deletions

View File

@ -108,6 +108,11 @@ void kmalloc_init_arena(kmalloc_arena_t *a, bool enable_statistics);
success, false if the maximum number of arenas has been reached. */
bool kmalloc_add_arena(kmalloc_arena_t *arena);
/* kmalloc_remove_arena(): Remove an arena from the heap source
Removes an arena from the heap source. The arena should certainly be empty,
although this function will not check that. */
void kmalloc_remove_arena(kmalloc_arena_t *arena);
//---
// Internal functions
//---

View File

@ -184,3 +184,12 @@ bool kmalloc_add_arena(kmalloc_arena_t *arena)
}
return false;
}
void kmalloc_remove_arena(kmalloc_arena_t *arena)
{
for(int i = 0; i < KMALLOC_ARENA_MAX; i++)
{
if(arenas[i] == arena)
arenas[i] = NULL;
}
}