diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-25 12:09:50 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-25 17:03:22 +0200 |
commit | d0d357edeb8527becced15e2784b92790d2b22c1 (patch) | |
tree | 64985dad8d48fe6b888a7d4faaf3b3cc18c6c7d5 /cpukit/score/src/heapgreedy.c | |
parent | heap: Free all delayed blocks during resize (diff) | |
download | rtems-d0d357edeb8527becced15e2784b92790d2b22c1.tar.bz2 |
heap: Add _Heap_Greedy_allocate_all_except_largest
Add rtems_workspace_greedy_allocate_all_except_largest() and
rtems_heap_greedy_allocate_all_except_largest().
Diffstat (limited to 'cpukit/score/src/heapgreedy.c')
-rw-r--r-- | cpukit/score/src/heapgreedy.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cpukit/score/src/heapgreedy.c b/cpukit/score/src/heapgreedy.c index 23eb4cdd3a..b5c61a4e64 100644 --- a/cpukit/score/src/heapgreedy.c +++ b/cpukit/score/src/heapgreedy.c @@ -75,6 +75,19 @@ Heap_Block *_Heap_Greedy_allocate( return blocks; } +Heap_Block *_Heap_Greedy_allocate_all_except_largest( + Heap_Control *heap, + uintptr_t *allocatable_size +) +{ + Heap_Information info; + + _Heap_Get_free_information( heap, &info ); + *allocatable_size = info.largest - HEAP_BLOCK_HEADER_SIZE + HEAP_ALLOC_BONUS; + + return _Heap_Greedy_allocate( heap, allocatable_size, 1 ); +} + void _Heap_Greedy_free( Heap_Control *heap, Heap_Block *blocks |