fs_heap: add memalign interface

So the share memory can use it to malloc aligned memory.
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
xuxingliang 2024-10-15 20:10:06 +08:00 committed by Xiang Xiao
parent 32784b0898
commit 22bcb88687
2 changed files with 7 additions and 0 deletions

View File

@ -68,6 +68,11 @@ FAR void *fs_heap_realloc(FAR void *oldmem, size_t size)
return mm_realloc(g_fs_heap, oldmem, size);
}
FAR void *fs_heap_memalign(size_t alignment, size_t size)
{
return mm_memalign(g_fs_heap, alignment, size);
}
void fs_heap_free(FAR void *mem)
{
mm_free(g_fs_heap, mem);

View File

@ -43,6 +43,7 @@ FAR void *fs_heap_zalloc(size_t size) malloc_like1(1);
FAR void *fs_heap_malloc(size_t size) malloc_like1(1);
size_t fs_heap_malloc_size(FAR void *mem);
FAR void *fs_heap_realloc(FAR void *oldmem, size_t size) realloc_like(2);
FAR void *fs_heap_memalign(size_t alignment, size_t size) malloc_like1(3);
void fs_heap_free(FAR void *mem);
FAR char *fs_heap_strdup(FAR const char *s) malloc_like;
FAR char *fs_heap_strndup(FAR const char *s, size_t size) malloc_like;
@ -54,6 +55,7 @@ int fs_heap_asprintf(FAR char **strp, FAR const char *fmt, ...)
# define fs_heap_malloc kmm_malloc
# define fs_heap_malloc_size kmm_malloc_size
# define fs_heap_realloc kmm_realloc
# define fs_heap_memalign kmm_memalign
# define fs_heap_free kmm_free
# define fs_heap_strdup strdup
# define fs_heap_strndup strndup