Skip to content

Commit 22bcb88

Browse files
XuNeoxiaoxiang781216
authored andcommitted
fs_heap: add memalign interface
So the share memory can use it to malloc aligned memory. Signed-off-by: xuxingliang <[email protected]>
1 parent 32784b0 commit 22bcb88

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

fs/fs_heap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ FAR void *fs_heap_realloc(FAR void *oldmem, size_t size)
6868
return mm_realloc(g_fs_heap, oldmem, size);
6969
}
7070

71+
FAR void *fs_heap_memalign(size_t alignment, size_t size)
72+
{
73+
return mm_memalign(g_fs_heap, alignment, size);
74+
}
75+
7176
void fs_heap_free(FAR void *mem)
7277
{
7378
mm_free(g_fs_heap, mem);

fs/fs_heap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ FAR void *fs_heap_zalloc(size_t size) malloc_like1(1);
4343
FAR void *fs_heap_malloc(size_t size) malloc_like1(1);
4444
size_t fs_heap_malloc_size(FAR void *mem);
4545
FAR void *fs_heap_realloc(FAR void *oldmem, size_t size) realloc_like(2);
46+
FAR void *fs_heap_memalign(size_t alignment, size_t size) malloc_like1(3);
4647
void fs_heap_free(FAR void *mem);
4748
FAR char *fs_heap_strdup(FAR const char *s) malloc_like;
4849
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, ...)
5455
# define fs_heap_malloc kmm_malloc
5556
# define fs_heap_malloc_size kmm_malloc_size
5657
# define fs_heap_realloc kmm_realloc
58+
# define fs_heap_memalign kmm_memalign
5759
# define fs_heap_free kmm_free
5860
# define fs_heap_strdup strdup
5961
# define fs_heap_strndup strndup

0 commit comments

Comments
 (0)