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