Working port of Little FS
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "spinlock/spinlock.h"
|
||||
#include "fs/kvfs/kvfs.h"
|
||||
#include "fs/portlfs/portlfs.h"
|
||||
#include "storedev/storedev.h"
|
||||
|
||||
#define VFS_MOUNTPOINT_LABEL_MAX 128
|
||||
@ -13,10 +14,17 @@
|
||||
|
||||
enum {
|
||||
VFS_KVFS,
|
||||
VFS_LITTLEFS,
|
||||
};
|
||||
|
||||
static const char *vfs_strings[] = {
|
||||
"KVFS"
|
||||
"KVFS",
|
||||
"Little FS",
|
||||
};
|
||||
|
||||
enum {
|
||||
VFS_CREATE_DIR,
|
||||
VFS_CREATE_FILE,
|
||||
};
|
||||
|
||||
typedef struct VfsMountPoint {
|
||||
@ -28,11 +36,13 @@ typedef struct VfsMountPoint {
|
||||
int32_t (*read)(struct VfsMountPoint *vmp, const char *path, uint8_t *const buffer, size_t n, size_t off);
|
||||
int32_t (*write)(struct VfsMountPoint *vmp, const char *path, const uint8_t *const buffer, size_t n, size_t off);
|
||||
int32_t (*remove)(struct VfsMountPoint *vmp, const char *path);
|
||||
int32_t (*create)(struct VfsMountPoint *vmp, const char *path, int32_t type);
|
||||
int32_t (*cleanup)(struct VfsMountPoint *vmp);
|
||||
bool (*check)(void);
|
||||
|
||||
union {
|
||||
Kvfs kvfs;
|
||||
LittleFs littlefs;
|
||||
} fs;
|
||||
SpinLock spinlock;
|
||||
} VfsMountPoint;
|
||||
@ -48,6 +58,7 @@ void vfs_init(void);
|
||||
int32_t vfs_read(char *mountpoint, const char *path, uint8_t *const buffer, size_t n, size_t off);
|
||||
int32_t vfs_write(char *mountpoint, const char *path, const uint8_t *const buffer, size_t n, size_t off);
|
||||
int32_t vfs_remove(char *mountpoint, const char *path);
|
||||
int32_t vfs_create(char *mountpoint, const char *path, int32_t type);
|
||||
int32_t vfs_unmount(char *mountpoint);
|
||||
|
||||
#endif // VFS_VFS_H_
|
||||
|
Reference in New Issue
Block a user