Revert ram_alloc_set prototype

Rather than changing the prototype of an existing function, we should
create a new function and make the old function a wrapper around that.
This commit is contained in:
Jan Schär 2022-03-24 18:28:31 +01:00
parent 24cfb539fa
commit c835aa477b
4 changed files with 10 additions and 4 deletions

View File

@ -32,7 +32,8 @@ errval_t ram_alloc_aligned(struct capref *ret, size_t size, size_t alignment);
errval_t ram_alloc(struct capref *retcap, size_t size);
errval_t ram_free(struct capref cap);
errval_t ram_available(genpaddr_t *available, genpaddr_t *total);
errval_t ram_alloc_set(ram_alloc_func_t local_allocator, ram_free_func_t local_free);
errval_t ram_alloc_set(ram_alloc_func_t local_allocator);
errval_t ram_alloc_set_with_free(ram_alloc_func_t local_allocator, ram_free_func_t local_free);
void ram_set_affinity(uint64_t minbase, uint64_t maxlimit);
void ram_get_affinity(uint64_t *minbase, uint64_t *maxlimit);
void ram_alloc_init(void);

View File

@ -123,7 +123,7 @@ errval_t barrelfish_init_onthread(struct spawn_domain_params *params)
// Initialize ram_alloc state
ram_alloc_init();
/* All domains use smallcn to initialize */
err = ram_alloc_set(ram_alloc_fixed, NULL);
err = ram_alloc_set(ram_alloc_fixed);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_RAM_ALLOC_SET);
}

View File

@ -142,7 +142,12 @@ void ram_alloc_init(void)
* If local_allocator is NULL, it will be initialized to the default
* remote allocator.
*/
errval_t ram_alloc_set(ram_alloc_func_t local_allocator, ram_free_func_t local_free)
errval_t ram_alloc_set(ram_alloc_func_t local_allocator)
{
return ram_alloc_set_with_free(local_allocator, NULL);
}
errval_t ram_alloc_set_with_free(ram_alloc_func_t local_allocator, ram_free_func_t local_free)
{
struct ram_alloc_state *ram_alloc_state = get_ram_alloc_state();

View File

@ -71,7 +71,7 @@ errval_t initialize_ram_alloc(void)
// Initialize the generic RAM allocator to use our local allocator.
// We do this here, because mm_add allocates memory for the slab allocator,
// and that uses ram_alloc.
err = ram_alloc_set(aos_ram_alloc_aligned, aos_ram_free);
err = ram_alloc_set_with_free(aos_ram_alloc_aligned, aos_ram_free);
if (err_is_fail(err)) {
return err_push(err, LIB_ERR_RAM_ALLOC_SET);
}