fs/xxfs:Replace kmm with fs heap

Summary:
  1.Add configuration to allocate memory from the specified section
  2.Replace all memory operations (kmm_) in the vfs with
    fs_heap_. When FS_HEAPSIZE > 0, memory is requested for the file system by specifying a configured heap location. By default (i.e. FS_HEAPSIZE=0) fs_heap_ is equivalent to kmm_

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1
2024-09-09 20:28:16 +08:00
committed by archer
parent e0df067d3c
commit 96206cbf9d
82 changed files with 568 additions and 449 deletions
+6 -5
View File
@@ -42,6 +42,7 @@
#include <nuttx/signal.h>
#include "inode/inode.h"
#include "fs_heap.h"
/****************************************************************************
* Private Types
@@ -201,10 +202,10 @@ static int epoll_do_close(FAR struct file *filep)
list_for_every_entry_safe(&eph->extend, epn, tmp, epoll_node_t, node)
{
list_delete(&epn->node);
kmm_free(epn);
fs_heap_free(epn);
}
kmm_free(eph);
fs_heap_free(eph);
}
return ret;
@@ -224,7 +225,7 @@ static int epoll_do_create(int size, int flags)
int i;
size = size <= 0 ? 1 : size;
eph = kmm_zalloc(sizeof(epoll_head_t) + sizeof(epoll_node_t) * size);
eph = fs_heap_zalloc(sizeof(epoll_head_t) + sizeof(epoll_node_t) * size);
if (eph == NULL)
{
set_errno(ENOMEM);
@@ -257,7 +258,7 @@ static int epoll_do_create(int size, int flags)
if (fd < 0)
{
nxmutex_destroy(&eph->lock);
kmm_free(eph);
fs_heap_free(eph);
set_errno(-fd);
return ERROR;
}
@@ -535,7 +536,7 @@ int epoll_ctl(int epfd, int op, int fd, FAR struct epoll_event *ev)
* list.
*/
extend = kmm_zalloc(sizeof(*extend) +
extend = fs_heap_zalloc(sizeof(*extend) +
2 * sizeof(epoll_node_t) * eph->size);
if (extend == NULL)
{