Barrelfish
Data Structures | Functions
slot_alloc.h File Reference

Slot allocator. More...

Data Structures

struct  cnode_meta
 Meta data for single_slot_allocator. More...
 

Functions

errval_t two_level_slot_alloc_init (struct multi_slot_allocator *ret)
 Initializer that uses memory.
 
errval_t two_level_slot_alloc_init_raw (struct multi_slot_allocator *ret, struct capref initial_cap, struct cnoderef initial_cnode, struct capref reserve_cap, struct cnoderef reserve_cnode, void *head_buf, void *reserve_buf, size_t bufsize)
 Initializer that does not allocate any space. More...
 
struct slot_allocator * get_default_slot_allocator (void)
 Returns the default slot allocator for the caller.
 
errval_t slot_alloc (struct capref *ret)
 Default slot allocator. More...
 
errval_t slot_alloc_root (struct capref *ret)
 Root slot allocator functions. More...
 
errval_t slot_free (struct capref ret)
 Default slot free. More...
 
errval_t range_slot_alloc (struct range_slot_allocator *alloc, cslot_t nslots, struct capref *ret)
 Allocate slots out of a cnode. More...
 
errval_t range_slot_free (struct range_slot_allocator *alloc, struct capref cap, cslot_t nslots)
 Free slots belonging to the cnode. More...
 
errval_t range_slot_alloc_init (struct range_slot_allocator *ret, cslot_t nslots, cslot_t *retslots)
 Constructor for a new instance of a single cnode cspace_allocator. More...
 

Detailed Description

Slot allocator.

Function Documentation

errval_t range_slot_alloc ( struct range_slot_allocator *  alloc,
cslot_t  nslots,
struct capref ret 
)

Allocate slots out of a cnode.

Parameters
allocPointer to the metadata
nslotsNumber of slots to allocate
retPointer used to return the allocated slot
errval_t range_slot_alloc_init ( struct range_slot_allocator *  ret,
cslot_t  nslots,
cslot_t *  retslots 
)

Constructor for a new instance of a single cnode cspace_allocator.

Parameters
retInstance of the allocator created
nslotsDesired number of slots the cnode should have
ret_slotsNumber of slots actually used
errval_t range_slot_free ( struct range_slot_allocator *  alloc,
struct capref  cap,
cslot_t  nslots 
)

Free slots belonging to the cnode.

Parameters
allocPointer to the metadata
capSlot to start freeing from
nslotsNumber of slots to free
errval_t slot_alloc ( struct capref ret)

Default slot allocator.

Parameters
retPointer to the cap to return the allocated slot in

Allocates one slot from the default allocator

errval_t slot_alloc_root ( struct capref ret)

Root slot allocator functions.

Root slot allocator functions.

Parameters
retPointer to the cap to return the allocated slot in

Allocates one slot from the root slot allocator

errval_t slot_free ( struct capref  ret)

Default slot free.

Parameters
retThe cap to free

Frees the passed in slot.

errval_t two_level_slot_alloc_init_raw ( struct multi_slot_allocator *  ret,
struct capref  initial_cap,
struct cnoderef  initial_cnode,
struct capref  reserve_cap,
struct cnoderef  reserve_cnode,
void *  head_buf,
void *  reserve_buf,
size_t  bufsize 
)

Initializer that does not allocate any space.

#slot_alloc_init duplicates some of the code below, modify it if making changes here.

XXX: top_buf head_buf and reserve_buf each point to a separate buffer of size bufsize bytes which can be used for backing storage. bufsize evidently needs to be >= sizeof(struct cnode_meta) * nslots / 2. Don't ask me why! -AB