mm: Remove mm_heap_impl_s struct

it's more simple to make mm_heap_s opaque outside of mm

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5c8e435f6baba6d22b10c5f7e8d9191104fb5af2
This commit is contained in:
Xiang Xiao
2021-07-03 22:16:25 +08:00
committed by David Sidrane
parent 441b03c61c
commit 76cdd5c329
47 changed files with 271 additions and 308 deletions
+7 -10
View File
@@ -46,7 +46,6 @@
int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
{
FAR struct mm_heap_impl_s *heap_impl;
FAR struct mm_allocnode_s *node;
FAR struct mm_allocnode_s *prev;
size_t mxordblk = 0;
@@ -61,13 +60,11 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
#endif
DEBUGASSERT(info);
DEBUGASSERT(MM_IS_VALID(heap));
heap_impl = heap->mm_impl;
/* Visit each region */
#if CONFIG_MM_REGIONS > 1
for (region = 0; region < heap_impl->mm_nregions; region++)
for (region = 0; region < heap->mm_nregions; region++)
#endif
{
prev = NULL;
@@ -78,8 +75,8 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
mm_takesemaphore(heap);
for (node = heap_impl->mm_heapstart[region];
node < heap_impl->mm_heapend[region];
for (node = heap->mm_heapstart[region];
node < heap->mm_heapend[region];
node = (FAR struct mm_allocnode_s *)
((FAR char *)node + node->size))
{
@@ -122,8 +119,8 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
}
minfo("region=%d node=%p heapend=%p\n",
region, node, heap_impl->mm_heapend[region]);
DEBUGASSERT(node == heap_impl->mm_heapend[region]);
region, node, heap->mm_heapend[region]);
DEBUGASSERT(node == heap->mm_heapend[region]);
mm_givesemaphore(heap);
@@ -131,9 +128,9 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info)
}
#undef region
DEBUGASSERT(uordblks + fordblks == heap_impl->mm_heapsize);
DEBUGASSERT(uordblks + fordblks == heap->mm_heapsize);
info->arena = heap_impl->mm_heapsize;
info->arena = heap->mm_heapsize;
info->ordblks = ordblks;
info->aordblks = aordblks;
info->mxordblk = mxordblk;