From a89ae540c1d287d275943fd06692a44e9dbc8331 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 6 Dec 2011 14:23:26 +0000 Subject: 2011-12-06 Sebastian Huber * score/src/heapiterate.c, score/src/pheapiterate.c: New files. * score/Makefile.am: Reflect changes above. * score/include/rtems/score/heap.h: Declare _Heap_Iterate() and define Heap_Block_visitor. * score/include/rtems/score/protectedheap.h: Declare _Protected_heap_Iterate(). * score/src/heapgetinfo.c: Use _Heap_Iterate(). --- cpukit/score/include/rtems/score/heap.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'cpukit/score/include/rtems/score/heap.h') diff --git a/cpukit/score/include/rtems/score/heap.h b/cpukit/score/include/rtems/score/heap.h index 6eee1c745b..1996fb80ff 100644 --- a/cpukit/score/include/rtems/score/heap.h +++ b/cpukit/score/include/rtems/score/heap.h @@ -521,6 +521,33 @@ bool _Heap_Walk( bool dump ); +/** + * @brief Heap block visitor. + * + * @see _Heap_Iterate(). + * + * @retval true Stop the iteration. + * @retval false Continue the iteration. + */ +typedef bool (*Heap_Block_visitor)( + const Heap_Block *block, + uintptr_t block_size, + bool block_is_used, + void *visitor_arg +); + +/** + * @brief Iterates over all blocks of the heap. + * + * For each block the @a visitor with the argument @a visitor_arg will be + * called. + */ +void _Heap_Iterate( + Heap_Control *heap, + Heap_Block_visitor visitor, + void *visitor_arg +); + /** * @brief Returns information about used and free blocks for the heap @a heap * in @a info. -- cgit v1.2.3