lib: fs: add library for implementing a filesystem service
This commit is contained in:
35
lib/libfs/allocator.c
Normal file
35
lib/libfs/allocator.c
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <fs/allocator.h>
|
||||
|
||||
void *fs_alloc(struct fs_allocator *alloc, size_t count)
|
||||
{
|
||||
if (alloc->fs_alloc) {
|
||||
return alloc->fs_alloc(alloc, count);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *fs_calloc(struct fs_allocator *alloc, size_t count, size_t sz)
|
||||
{
|
||||
if (alloc->fs_calloc) {
|
||||
return alloc->fs_calloc(alloc, count, sz);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *fs_realloc(struct fs_allocator *alloc, void *p, size_t count)
|
||||
{
|
||||
if (alloc->fs_realloc) {
|
||||
return alloc->fs_realloc(alloc, p, count);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void fs_free(struct fs_allocator *alloc, void *p)
|
||||
{
|
||||
if (alloc->fs_free) {
|
||||
alloc->fs_free(alloc, p);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user