From d0d357edeb8527becced15e2784b92790d2b22c1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 25 Jun 2013 12:09:50 +0200 Subject: heap: Add _Heap_Greedy_allocate_all_except_largest Add rtems_workspace_greedy_allocate_all_except_largest() and rtems_heap_greedy_allocate_all_except_largest(). --- cpukit/rtems/include/rtems/rtems/support.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cpukit/rtems/include/rtems/rtems/support.h') diff --git a/cpukit/rtems/include/rtems/rtems/support.h b/cpukit/rtems/include/rtems/rtems/support.h index 1f3cd3da76..335b8c02fa 100644 --- a/cpukit/rtems/include/rtems/rtems/support.h +++ b/cpukit/rtems/include/rtems/rtems/support.h @@ -99,7 +99,7 @@ bool rtems_workspace_free( /** * @brief Greedy allocate that empties the workspace. * - * Afterward the heap has at most @a block_count allocateable blocks of sizes + * Afterwards the heap has at most @a block_count allocatable blocks of sizes * specified by @a block_sizes. The @a block_sizes must point to an array with * @a block_count members. All other blocks are used. * @@ -110,11 +110,25 @@ void *rtems_workspace_greedy_allocate( size_t block_count ); +/** + * @brief Greedy allocate all blocks except the largest free block. + * + * Afterwards the heap has at most one allocatable block. This block is the + * largest free block if it exists. The allocatable size of this block is + * stored in @a allocatable_size. All other blocks are used. + * + * @see rtems_workspace_greedy_free(). + */ +void *rtems_workspace_greedy_allocate_all_except_largest( + uintptr_t *allocatable_size +); + /** * @brief Frees space of a greedy allocation. * * The @a opaque argument must be the return value of - * rtems_workspace_greedy_allocate(). + * rtems_workspace_greedy_allocate() or + * rtems_workspace_greedy_allocate_all_except_largest(). */ void rtems_workspace_greedy_free( void *opaque ); -- cgit v1.2.3