lib: fs: add library for implementing a filesystem service

This commit is contained in:
2026-03-06 20:17:23 +00:00
parent c4fd252f86
commit 5658e27445
15 changed files with 1506 additions and 0 deletions

35
lib/libfs/allocator.c Normal file
View 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);
}
}