unified: Add k_mem_map_num_free_get()
Complements existing k_mem_map_num_used_get(). Change-Id: Ie69c0a8e30007e365820448bde48303718369904 Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This commit is contained in:
parent
c19dd50093
commit
c001aa8ef6
2 changed files with 17 additions and 0 deletions
|
@ -142,3 +142,4 @@ The following memory map APIs are provided by :file:`kernel.h`:
|
|||
* :cpp:func:`k_mem_map_alloc()`
|
||||
* :cpp:func:`k_mem_map_free()`
|
||||
* :cpp:func:`k_mem_map_num_used_get()`
|
||||
* :cpp:func:`k_mem_map_num_free_get()`
|
||||
|
|
|
@ -1225,6 +1225,22 @@ static inline int k_mem_map_num_used_get(struct k_mem_map *map)
|
|||
return map->num_used;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the number of unused memory blocks
|
||||
*
|
||||
* This routine gets the current number of unused memory blocks in the
|
||||
* specified pool. It should be used for stats purposes only as that value
|
||||
* may potentially be out-of-date by the time it is used.
|
||||
*
|
||||
* @param map Memory map to query
|
||||
*
|
||||
* @return Number of unused memory blocks
|
||||
*/
|
||||
static inline int k_mem_map_num_free_get(struct k_mem_map *map)
|
||||
{
|
||||
return map->num_blocks - map->num_used;
|
||||
}
|
||||
|
||||
/* memory pools */
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue