diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-12-06 14:23:26 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-12-06 14:23:26 +0000 |
commit | a89ae540c1d287d275943fd06692a44e9dbc8331 (patch) | |
tree | 74711aaa01d5604e4895588556f6f99c2ee2f6d2 /cpukit/score/include | |
parent | 2011-12-06 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-a89ae540c1d287d275943fd06692a44e9dbc8331.tar.bz2 |
2011-12-06 Sebastian Huber <sebastian.huber@embedded-brains.de>
* 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().
Diffstat (limited to 'cpukit/score/include')
-rw-r--r-- | cpukit/score/include/rtems/score/heap.h | 27 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/protectedheap.h | 9 |
2 files changed, 36 insertions, 0 deletions
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 @@ -522,6 +522,33 @@ bool _Heap_Walk( ); /** + * @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. */ diff --git a/cpukit/score/include/rtems/score/protectedheap.h b/cpukit/score/include/rtems/score/protectedheap.h index 01c736d6ae..84f7d60097 100644 --- a/cpukit/score/include/rtems/score/protectedheap.h +++ b/cpukit/score/include/rtems/score/protectedheap.h @@ -131,6 +131,15 @@ bool _Protected_heap_Free( Heap_Control *heap, void *addr ); bool _Protected_heap_Walk( Heap_Control *heap, int source, bool dump ); /** + * @brief See _Heap_Iterate(). + */ +void _Protected_heap_Iterate( + Heap_Control *heap, + Heap_Block_visitor visitor, + void *visitor_arg +); + +/** * @brief See _Heap_Get_information(). * * Returns @a true in case of success, and @a false otherwise. |