20 #ifndef MBED_LFSFILESYSTEM_H 21 #define MBED_LFSFILESYSTEM_H 23 #include "FileSystem.h" 24 #include "BlockDevice.h" 25 #include "PlatformMutex.h" 60 lfs_size_t read_size = MBED_LFS_READ_SIZE,
61 lfs_size_t prog_size = MBED_LFS_PROG_SIZE,
62 lfs_size_t block_size = MBED_LFS_BLOCK_SIZE,
63 lfs_size_t lookahead = MBED_LFS_LOOKAHEAD);
91 lfs_size_t read_size = MBED_LFS_READ_SIZE,
92 lfs_size_t prog_size = MBED_LFS_PROG_SIZE,
93 lfs_size_t block_size = MBED_LFS_BLOCK_SIZE,
94 lfs_size_t lookahead = MBED_LFS_LOOKAHEAD);
126 virtual int remove(
const char *path);
134 virtual int rename(
const char *path,
const char *newpath);
142 virtual int stat(
const char *path,
struct stat *st);
150 virtual int mkdir(
const char *path, mode_t mode);
170 virtual int file_open(mbed::fs_file_t *file,
const char *path,
int flags);
177 virtual int file_close(mbed::fs_file_t file);
186 virtual ssize_t file_read(mbed::fs_file_t file,
void *buffer,
size_t size);
195 virtual ssize_t file_write(mbed::fs_file_t file,
const void *buffer,
size_t size);
202 virtual int file_sync(mbed::fs_file_t file);
214 virtual off_t file_seek(mbed::fs_file_t file, off_t offset,
int whence);
221 virtual off_t file_tell(mbed::fs_file_t file);
228 virtual off_t file_size(mbed::fs_file_t file);
241 virtual int file_truncate(mbed::fs_file_t file, off_t length);
249 virtual int dir_open(mbed::fs_dir_t *dir,
const char *path);
256 virtual int dir_close(mbed::fs_dir_t dir);
264 virtual ssize_t dir_read(mbed::fs_dir_t dir,
struct dirent *ent);
272 virtual void dir_seek(mbed::fs_dir_t dir, off_t offset);
279 virtual off_t dir_tell(mbed::fs_dir_t dir);
285 virtual void dir_rewind(mbed::fs_dir_t dir);
294 const lfs_size_t _read_size;
295 const lfs_size_t _prog_size;
296 const lfs_size_t _block_size;
297 const lfs_size_t _lookahead;
306 #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE virtual int reformat(mbed::BlockDevice *bd)
Reformat a file system.
virtual int mount(mbed::BlockDevice *bd)
Mount a file system to a block device.
A hardware device capable of writing and reading blocks.
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.
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 rename(const char *path, const char *newpath)
Rename a file in the file system.
virtual int unmount()
Unmount a file system from the underlying block device.
virtual int stat(const char *path, struct stat *st)
Store information about the file in a stat structure.
virtual int mkdir(const char *path, mode_t mode)
Create a directory in the file system.
LittleFileSystem, a little file system.
virtual int statvfs(const char *path, struct statvfs *buf)
Store information about the mounted file system in a statvfs structure.