lib/mm/mm.c
errval_t mm_init(struct mm *mm, enum objtype objtype,
                 slab_refill_func_t slab_refill_func,
                 slot_alloc_t slot_alloc_func,
                 slot_refill_t slot_refill_func,
                 void *slot_alloc_inst)
{
	assert(mm != NULL);

	mm->slot_alloc = slot_alloc_func;
	mm->slot_refill = slot_refill_func;
	mm->objtype = objtype;
	mm->slot_alloc_inst = slot_alloc_inst;
	mm->head = NULL;
	mm->refillingslabs = false;

	if(slab_refill_func == NULL){
	        slab_refill_func = slab_default_refill;
	}
	
	slab_init(&mm->slabs, sizeof(struct mmnode), slab_refill_func);
	struct slot_prealloc *sp = (struct slot_prealloc*) mm->slot_alloc_inst;
	sp->mm = mm;			

	debug_printf("MM Initialized\n");
	return SYS_ERR_OK;

}
/**
 * Initialize the memory manager.
 *
 * \param  mm               The mm struct to initialize.
 * \param  objtype          The cap type this manager should deal with.
 * \param  slab_refill_func Custom function for refilling the slab allocator.
 * \param  slot_alloc_func  Function for allocating capability slots.
 * \param  slot_refill_func Function for refilling (making) new slots.
 * \param  slot_alloc_inst  Pointer to a slot allocator instance (typically passed to the alloc and refill functions).
 */
Initialize the memory manager.
\param  mm               The mm struct to initialize.
\param  objtype          The cap type this manager should deal with.
\param  slab_refill_func Custom function for refilling the slab allocator.
\param  slot_alloc_func  Function for allocating capability slots.
\param  slot_refill_func Function for refilling (making) new slots.
\param  slot_alloc_inst  Pointer to a slot allocator instance (typically passed to the alloc and refill functions).
Initialize the memory manager . \ param mm The mm struct to initialize . \ param objtype The cap type this manager should deal with . \ param slab_refill_func Custom function for refilling the slab allocator . \ param slot_alloc_func Function for allocating capability slots . \ param slot_refill_func Function for refilling ( making ) new slots . \ param slot_alloc_inst Pointer to a slot allocator instance ( typically passed to the alloc and refill functions ) .
errval_t mm_init(struct mm *mm, enum objtype objtype,
                 slab_refill_func_t slab_refill_func,
                 slot_alloc_t slot_alloc_func,
                 slot_refill_t slot_refill_func,
                 void *slot_alloc_inst)
{
	assert(mm != NULL);
	mm->slot_alloc = slot_alloc_func;
	mm->slot_refill = slot_refill_func;
	mm->objtype = objtype;
	mm->slot_alloc_inst = slot_alloc_inst;
	mm->head = NULL;
	mm->refillingslabs = false;
	if(slab_refill_func == NULL){
	        slab_refill_func = slab_default_refill;
	}
	slab_init(&mm->slabs, sizeof(struct mmnode), slab_refill_func);
	struct slot_prealloc *sp = (struct slot_prealloc*) mm->slot_alloc_inst;
	sp->mm = mm;			
	debug_printf("MM Initialized\n");
	return SYS_ERR_OK;
}
errval_t mm_init ( struct mm * mm , enum objtype objtype , slab_refill_func_t slab_refill_func , slot_alloc_t slot_alloc_func , slot_refill_t slot_refill_func , void * slot_alloc_inst ) { assert ( mm != NULL ) ; mm -> slot_alloc = slot_alloc_func ; mm -> slot_refill = slot_refill_func ; mm -> objtype = objtype ; mm -> slot_alloc_inst = slot_alloc_inst ; mm -> head = NULL ; mm -> refillingslabs = false ; if ( slab_refill_func == NULL ) { slab_refill_func = slab_default_refill ; } slab_init ( & mm -> slabs , sizeof ( struct mmnode ) , slab_refill_func ) ; struct slot_prealloc * sp = ( struct slot_prealloc * ) mm -> slot_alloc_inst ; sp -> mm = mm ; debug_printf ( " \n " ) ; return SYS_ERR_OK ; }
Initialize the memory manager.
Initialize the memory manager .