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/libcsupport/include/rtems/malloc.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cpukit/libcsupport/include/rtems') diff --git a/cpukit/libcsupport/include/rtems/malloc.h b/cpukit/libcsupport/include/rtems/malloc.h index c428bcffb2..25a2e4ea50 100644 --- a/cpukit/libcsupport/include/rtems/malloc.h +++ b/cpukit/libcsupport/include/rtems/malloc.h @@ -224,7 +224,7 @@ rtems_status_code rtems_heap_extend( /** * @brief Greedy allocate that empties the heap. * - * Afterward the heap has at most @a block_count allocatable 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. * @@ -235,11 +235,25 @@ void *rtems_heap_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_heap_greedy_free(). + */ +void *rtems_heap_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_heap_greedy_allocate(). + * rtems_heap_greedy_allocate() or + * rtems_heap_greedy_allocate_all_except_largest(). */ void rtems_heap_greedy_free( void *opaque ); -- cgit v1.2.3