RTEMS 6.1-rc1
Files | Data Structures | Typedefs | Functions
Freechain Handler

This group contains the Freechain Handler implementation. More...

Files

file  freechain.h
 This header file provides interfaces of the Freechain Handler which are used by the implementation and the Application Configuration.
 
file  freechainimpl.h
 This header file provides interfaces of the Barrier Handler which are only used by the implementation.
 
file  freechain.c
 This source file contains the implementation of _Freechain_Extend(), _Freechain_Get(), and _Freechain_Put().
 

Data Structures

struct  Freechain_Control
 The freechain control. More...
 

Typedefs

typedef void *(* Freechain_Allocator) (size_t size)
 Allocator function.
 

Functions

void * _Freechain_Extend (Freechain_Control *freechain, Freechain_Allocator allocator, size_t number_nodes_to_extend, size_t node_size)
 Extend the freechain with new nodes. More...
 
void * _Freechain_Get (Freechain_Control *freechain, Freechain_Allocator allocator, size_t number_nodes_to_extend, size_t node_size)
 Gets a node from the freechain. More...
 
void _Freechain_Put (Freechain_Control *freechain, void *node)
 Puts a node back onto the freechain. More...
 

Detailed Description

This group contains the Freechain Handler implementation.

This handler encapsulates functionality related to the management of free nodes of a user-defined size. If the chain of free nodes is empty during an allocation request, it can be dynamically extended.

Function Documentation

◆ _Freechain_Extend()

void * _Freechain_Extend ( Freechain_Control freechain,
Freechain_Allocator  allocator,
size_t  number_nodes_to_extend,
size_t  node_size 
)

Extend the freechain with new nodes.

Parameters
freechainThe freechain control.
allocatorThe allocator function.
number_nodes_to_extendThe number of nodes to extend.
node_sizeThe node size.
Return values
NULLThe extend operation failed.
nodesPointer to the new nodes.

◆ _Freechain_Get()

void * _Freechain_Get ( Freechain_Control freechain,
Freechain_Allocator  allocator,
size_t  number_nodes_to_extend,
size_t  node_size 
)

Gets a node from the freechain.

Parameters
[in,out]freechainThe freechain control.
allocatorThe allocator function.
number_nodes_to_extendThe number of nodes in the case an extend is necessary due to an empty freechain.
[in]node_sizeThe node size.
Return values
NULLThe freechain is empty and the extend operation failed.
pointerPointer to a node. The node ownership passes to the caller.

◆ _Freechain_Put()

void _Freechain_Put ( Freechain_Control freechain,
void *  node 
)

Puts a node back onto the freechain.

Parameters
[in,out]freechainThe freechain control.
[out]nodeThe node to put back. The node may be NULL, in this case the function does nothing.