mirror of
https://github.com/apache/nuttx.git
synced 2026-08-20 21:18:23 +00:00
mm/tlsf: Register mem procfs in mm_initialize
follow up this change:
commit 268d66173d
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date: Sat Jul 3 21:25:14 2021 +0800
mm: Move procfs_register_meminfo into common place
to avoid the code duplication and ensure the consistent behaviour
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ifd9f6ff67f0cb6de54d733f929474154830dc46b
This commit is contained in:
parent
69cb1d7086
commit
4adf7ad09d
1 changed files with 16 additions and 3 deletions
|
|
@ -33,9 +33,9 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/fs/procfs.h>
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/mm/mm.h>
|
||||
#include <nuttx/pgalloc.h>
|
||||
|
||||
#include "tlsf/tlsf.h"
|
||||
|
||||
|
|
@ -92,6 +92,10 @@ struct mm_heap_impl_s
|
|||
#else
|
||||
struct mm_delaynode_s *mm_delaylist[1];
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
|
||||
struct procfs_meminfo_entry_s mm_procfs;
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -777,8 +781,8 @@ bool mm_heapmember(FAR struct mm_heap_s *heap, FAR void *mem)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void mm_initialize(FAR struct mm_heap_s *heap, FAR void *heapstart,
|
||||
size_t heapsize)
|
||||
void mm_initialize(FAR struct mm_heap_s *heap, FAR const char *name,
|
||||
FAR void *heapstart, size_t heapsize)
|
||||
{
|
||||
FAR struct mm_heap_impl_s *impl;
|
||||
|
||||
|
|
@ -812,6 +816,15 @@ void mm_initialize(FAR struct mm_heap_s *heap, FAR void *heapstart,
|
|||
/* Add the initial region of memory to the heap */
|
||||
|
||||
mm_addregion(heap, heapstart, heapsize);
|
||||
|
||||
#if defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_MEMINFO)
|
||||
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
|
||||
impl->mm_procfs.name = name;
|
||||
impl->mm_procfs.mallinfo = (FAR void *)mm_mallinfo;
|
||||
impl->mm_procfs.user_data = heap;
|
||||
procfs_register_meminfo(&impl->mm_procfs);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue