intrte_fbarray_init(structrte_fbarray*arr,constchar*name,unsignedintlen,unsignedintelt_sz)
Set up rte_fbarray structure and allocate underlying resources.
Call this function to correctly set up rte_fbarray and allocate underlying files that will be backing the
data in the current process. Note that in order to use and share rte_fbarray between multiple processes,
data pointed to by arr pointer must itself be allocated in shared memory.
Parametersarr Valid pointer to allocated rte_fbarray structure.
name Unique name to be assigned to this array.
len Number of elements initially available in the array.
elt_sz Size of each element.
Returns
• 0 on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_attach(structrte_fbarray*arr)
Attach to a file backing an already allocated and correctly set up rte_fbarray structure.
Call this function to attach to file that will be backing the data in the current process. The structure
must have been previously correctly set up with a call to rte_fbarray_init().Callstorte_fbarray_attach()areusuallymeanttobeperformedinamultiprocessingscenario,withdatapointedtobyarrpointerallocatedinsharedmemory.Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
Returns
• 0 on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_destroy(structrte_fbarray*arr)
Deallocate resources for an already allocated and correctly set up rte_fbarray structure, and remove the
underlying file.
Call this function to deallocate all resources associated with an rte_fbarray structure within the
current process. This will also zero-fill data pointed to by arr pointer and remove the underlying file
backing the data, so it is expected that by the time this function is called, all other processes have
detached from this rte_fbarray.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
Returns
• 0 on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_detach(structrte_fbarray*arr)
Deallocate resources for an already allocated and correctly set up rte_fbarray structure.
Call this function to deallocate all resources associated with an rte_fbarray structure within current
process.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
Returns
• 0 on success.
• -1 on failure, with rte_errno indicating reason for failure.
void*rte_fbarray_get(conststructrte_fbarray*arr,unsignedintidx)
Get pointer to element residing at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
idx Index of an element to get a pointer to.
Returns
• non-NULL pointer on success.
• NULL on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_idx(conststructrte_fbarray*arr,constvoid*elt)
Find index of a specified element within the array.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
elt Pointer to element to find index to.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_set_used(structrte_fbarray*arr,unsignedintidx)
Mark specified element as used.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
idx Element index to mark as used.
Returns
• 0 on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_set_free(structrte_fbarray*arr,unsignedintidx)
Mark specified element as free.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
idx Element index to mark as free.
Returns
• 0 on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_is_used(structrte_fbarray*arr,unsignedintidx)
Check whether element at specified index is marked as used.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
idx Element index to check as used.
Returns
• 1 if element is used.
• 0 if element is unused.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_next_free(structrte_fbarray*arr,unsignedintstart)
Find index of next free element, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_next_used(structrte_fbarray*arr,unsignedintstart)
Find index of next used element, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_next_n_free(structrte_fbarray*arr,unsignedintstart,unsignedintn)
Find index of next chunk of n free elements, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
n Number of free elements to look for.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_next_n_used(structrte_fbarray*arr,unsignedintstart,unsignedintn)
Find index of next chunk of n used elements, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
n Number of used elements to look for.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_contig_free(structrte_fbarray*arr,unsignedintstart)
Find how many more free entries there are, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_contig_used(structrte_fbarray*arr,unsignedintstart)
Find how many more used entries there are, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_prev_free(structrte_fbarray*arr,unsignedintstart)
Find index of previous free element, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_prev_used(structrte_fbarray*arr,unsignedintstart)
Find index of previous used element, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_prev_n_free(structrte_fbarray*arr,unsignedintstart,unsignedintn)
Find lowest start index of chunk of n free elements, down from specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
n Number of free elements to look for.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_prev_n_used(structrte_fbarray*arr,unsignedintstart,unsignedintn)
Find lowest start index of chunk of n used elements, down from specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
n Number of used elements to look for.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_rev_contig_free(structrte_fbarray*arr,unsignedintstart)
Find how many more free entries there are before specified index (like rte_fbarray_find_contig_free but
going in reverse).
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_rev_contig_used(structrte_fbarray*arr,unsignedintstart)
Find how many more used entries there are before specified index (like rte_fbarray_find_contig_used but
going in reverse).
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_biggest_free(structrte_fbarray*arr,unsignedintstart)
Find index of biggest chunk of free elements, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_biggest_used(structrte_fbarray*arr,unsignedintstart)
Find index of biggest chunk of used elements, starting at specified index.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_rev_biggest_free(structrte_fbarray*arr,unsignedintstart)
Find index of biggest chunk of free elements before a specified index (like
rte_fbarray_find_biggest_free, but going in reverse).
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
intrte_fbarray_find_rev_biggest_used(structrte_fbarray*arr,unsignedintstart)
Find index of biggest chunk of used elements before a specified index (like
rte_fbarray_find_biggest_used, but going in reverse).
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
start Element index to start search from.
Returns
• non-negative integer on success.
• -1 on failure, with rte_errno indicating reason for failure.
voidrte_fbarray_dump_metadata(structrte_fbarray*arr,FILE*f)
Dump rte_fbarray metadata.
Parametersarr Valid pointer to allocated and correctly set up rte_fbarray structure.
f File object to dump information into.