core.ds.cfifols¶
Dynamic list of contiguous FIFO queue pointers.
Overview¶
core.ds.cfifols implements a growable ordered list of PCFIFOQueue pointers. It is used to group and manage a variable number of related contiguous FIFO queues under a single handle. The list stores only pointer references; the referenced queues are owned and managed by the caller unless CFIFOLS_FreeAll is used.
Dependencies¶
memory.heap—kalloc,kfreecore.ds.types—TCFIFOList,PCFIFOListcore.ds.cfifo—CFIFO_Free(used byCFIFOLS_FreeAll)core.util—memcpy,memsetarch.x86.util— architecture utilitiesio.syslog— test output (implementation only)core.strings— test output formatting (implementation only)
Functions and Procedures¶
CFIFOLS_New¶
Creates a new contiguous FIFO list withInitialCapacity pointer slots. The slot buffer grows automatically when the capacity is exceeded.
CFIFOLS_Add¶
Appends the queue pointerQueue to the end of the list. Grows the slot buffer by doubling if capacity is exhausted.
CFIFOLS_Get¶
Returns the queue pointer at zero-basedIndex. Returns nil if Index is out of range.
CFIFOLS_Remove¶
Removes the pointer atIndex by shifting subsequent entries left. The referenced queue is not freed; ownership is retained by the caller. Returns false if Index is out of range.
CFIFOLS_Count¶
Returns the number of queue pointers currently in the list.CFIFOLS_IsEmpty¶
Returnstrue if the list holds no pointers.
CFIFOLS_Free¶
Frees the pointer slot buffer and the list structure. Does not free the referenced queues.CFIFOLS_FreeAll¶
CallsCFIFO_Free on every queue in the list, then frees the slot buffer and the list structure.
UnitTest¶
Runs the CFIFOLS test suite and logs a pass/fail summary to syslog under the'CFIFOLS' channel.
Notes¶
CFIFOLS_Remove shifts remaining entries using memcpy, which is safe because the destination is always at a lower address than the source.
The list does not track queue ownership; callers must decide whether to use CFIFOLS_Free (preserving queues) or CFIFOLS_FreeAll (destroying queues).