Barrelfish
Functions
bulk_allocator.c File Reference

Unidirectional bulk data transfer via shared memory. More...

Functions

errval_t bulk_alloc_init (struct bulk_allocator *alloc, size_t buffer_count, size_t buffer_size, struct bulk_pool_constraints *constraints)
 
errval_t bulk_alloc_init_from_cap (struct bulk_allocator *alloc, size_t buffer_size, struct capref *frame)
 
errval_t bulk_alloc_free (struct bulk_allocator *alloc)
 
struct bulk_bufferbulk_alloc_new_buffer (struct bulk_allocator *alloc)
 
errval_t bulk_alloc_return_buffer (struct bulk_allocator *alloc, struct bulk_buffer *buffer)
 

Detailed Description

Unidirectional bulk data transfer via shared memory.

Function Documentation

errval_t bulk_alloc_free ( struct bulk_allocator *  alloc)

Frees up the bulk allocator and it's pool.

Parameters
allochandle to a bulk allocator to be freed
errval_t bulk_alloc_init ( struct bulk_allocator *  alloc,
size_t  buffer_count,
size_t  buffer_size,
struct bulk_pool_constraints *  constraints 
)

initializes a new bulk allocator with a pool and allocates memory for it.

Parameters
allocpointer to an unused allocator handle
buffer_countthe number of buffers to allocate
buffer_sizethe size of a single buffer
constraintsmemory requirements for this pool or NULL if none
errval_t bulk_alloc_init_from_cap ( struct bulk_allocator *  alloc,
size_t  buffer_size,
struct capref frame 
)

creates a new allocator based on the supplied capability. It creates as many buffers as possible of size buffer_size that fit into the capability.

Parameters
allocan unused allocator handle
buffer_sizethe size of a single buffer
framecapability for backing the bulk pool
struct bulk_buffer* bulk_alloc_new_buffer ( struct bulk_allocator *  alloc)

Gets a new bulk buffer from the allocator.

Parameters
allocthe allocator handle to allocate the buffer from
Returns
pointer to a bulk_buffer on success NULL if there are no buffer left
errval_t bulk_alloc_return_buffer ( struct bulk_allocator *  alloc,
struct bulk_buffer buffer 
)

returns a buffer back to the allocator. The pools must match.

Parameters
allocthe allocator to hand the buffer back
bufferthe buffer to hand back to the allocator