Simple VFS layer
This commit is contained in:
28
kernel/fs/kvfs/kvfs.h
Normal file
28
kernel/fs/kvfs/kvfs.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef FS_KVFS_KVFS_H_
|
||||
#define FS_KVFS_KVFS_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct VfsMountPoint;
|
||||
|
||||
#define KVFS_NODE_KEY_MAX 128
|
||||
#define KVFS_NODES_MAX 256
|
||||
#define KVFS_BUFFER_SIZE (1024 * 2)
|
||||
|
||||
typedef struct {
|
||||
bool taken;
|
||||
uint8_t key_[KVFS_NODE_KEY_MAX];
|
||||
uint8_t *buffer;
|
||||
SpinLock spinlock;
|
||||
} KvfsNode;
|
||||
|
||||
typedef struct {
|
||||
KvfsNode nodes[KVFS_NODES_MAX];
|
||||
} Kvfs;
|
||||
|
||||
int32_t kvfs_read(struct VfsMountPoint *vmp, const char *key, uint8_t *const buffer, size_t n);
|
||||
int32_t kvfs_write(struct VfsMountPoint *vmp, const char *key, const uint8_t *const buffer, size_t n);
|
||||
int32_t kvfs_remove(struct VfsMountPoint *vmp, const char *key);
|
||||
bool kvfs_check(void);
|
||||
|
||||
#endif // FS_KVFS_KVFS_H_
|
Reference in New Issue
Block a user