18#ifndef MBED_LFSFILESYSTEM_H
19#define MBED_LFSFILESYSTEM_H
21#include "filesystem/FileSystem.h"
22#include "blockdevice/BlockDevice.h"
23#include "rtos/Mutex.h"
24#include "littlefs/lfs.h"
61 lfs_size_t read_size = MBED_LFS_READ_SIZE,
62 lfs_size_t prog_size = MBED_LFS_PROG_SIZE,
63 lfs_size_t block_size = MBED_LFS_BLOCK_SIZE,
64 lfs_size_t lookahead = MBED_LFS_LOOKAHEAD);
92 lfs_size_t read_size = MBED_LFS_READ_SIZE,
93 lfs_size_t prog_size = MBED_LFS_PROG_SIZE,
94 lfs_size_t block_size = MBED_LFS_BLOCK_SIZE,
95 lfs_size_t lookahead = MBED_LFS_LOOKAHEAD);
135 virtual int rename(
const char *path,
const char *newpath);
143 virtual int stat(
const char *path,
struct stat *st);
151 virtual int mkdir(
const char *path, mode_t mode);
171 virtual int file_open(mbed::fs_file_t *file,
const char *path,
int flags);
178 virtual int file_close(mbed::fs_file_t file);
187 virtual ssize_t file_read(mbed::fs_file_t file,
void *buffer,
size_t size);
196 virtual ssize_t file_write(mbed::fs_file_t file,
const void *buffer,
size_t size);
203 virtual int file_sync(mbed::fs_file_t file);
215 virtual off_t file_seek(mbed::fs_file_t file, off_t offset,
int whence);
222 virtual off_t file_tell(mbed::fs_file_t file);
229 virtual off_t file_size(mbed::fs_file_t file);
242 virtual int file_truncate(mbed::fs_file_t file, off_t length);
250 virtual int dir_open(mbed::fs_dir_t *dir,
const char *path);
257 virtual int dir_close(mbed::fs_dir_t dir);
265 virtual ssize_t dir_read(mbed::fs_dir_t dir,
struct dirent *ent);
273 virtual void dir_seek(mbed::fs_dir_t dir, off_t offset);
280 virtual off_t dir_tell(mbed::fs_dir_t dir);
286 virtual void dir_rewind(mbed::fs_dir_t dir);
295 const lfs_size_t _read_size;
296 const lfs_size_t _prog_size;
297 const lfs_size_t _block_size;
298 const lfs_size_t _lookahead;
309#ifndef MBED_NO_GLOBAL_USING_DIRECTIVE
A hardware device capable of writing and reading blocks.
LittleFileSystem, a little file system.
virtual int mkdir(const char *path, mode_t mode)
Create a directory in the file system.
virtual int reformat(mbed::BlockDevice *bd)
Reformat a file system.
static int format(mbed::BlockDevice *bd, lfs_size_t read_size=MBED_LFS_READ_SIZE, lfs_size_t prog_size=MBED_LFS_PROG_SIZE, lfs_size_t block_size=MBED_LFS_BLOCK_SIZE, lfs_size_t lookahead=MBED_LFS_LOOKAHEAD)
Format a block device with the LittleFileSystem.
virtual int stat(const char *path, struct stat *st)
Store information about the file in a stat structure.
virtual int remove(const char *path)
Remove a file from the file system.
virtual int unmount()
Unmount a file system from the underlying block device.
virtual int statvfs(const char *path, struct statvfs *buf)
Store information about the mounted file system in a statvfs structure.
LittleFileSystem(const char *name=NULL, mbed::BlockDevice *bd=NULL, lfs_size_t read_size=MBED_LFS_READ_SIZE, lfs_size_t prog_size=MBED_LFS_PROG_SIZE, lfs_size_t block_size=MBED_LFS_BLOCK_SIZE, lfs_size_t lookahead=MBED_LFS_LOOKAHEAD)
Lifetime of the LittleFileSystem.
virtual int rename(const char *path, const char *newpath)
Rename a file in the file system.
virtual int mount(mbed::BlockDevice *bd)
Mount a file system to a block device.
The Mutex class is used to synchronize the execution of threads.