21#ifndef MBED_LFS2FILESYSTEM_H
22#define MBED_LFS2FILESYSTEM_H
24#include "FileSystem.h"
25#include "BlockDevice.h"
26#include "rtos/Mutex.h"
62 lfs2_size_t block_size = MBED_LFS2_BLOCK_SIZE,
63 uint32_t block_cycles = MBED_LFS2_BLOCK_CYCLES,
64 lfs2_size_t cache_size = MBED_LFS2_CACHE_SIZE,
65 lfs2_size_t lookahead = MBED_LFS2_LOOKAHEAD_SIZE);
94 lfs2_size_t block_size = MBED_LFS2_BLOCK_SIZE,
95 uint32_t block_cycles = MBED_LFS2_BLOCK_CYCLES,
96 lfs2_size_t cache_size = MBED_LFS2_CACHE_SIZE,
97 lfs2_size_t lookahead_size = MBED_LFS2_LOOKAHEAD_SIZE);
137 virtual int rename(
const char *path,
const char *newpath);
145 virtual int stat(
const char *path,
struct stat *st);
153 virtual int mkdir(
const char *path, mode_t mode);
173 virtual int file_open(mbed::fs_file_t *file,
const char *path,
int flags);
180 virtual int file_close(mbed::fs_file_t file);
189 virtual ssize_t file_read(mbed::fs_file_t file,
void *buffer,
size_t size);
198 virtual ssize_t file_write(mbed::fs_file_t file,
const void *buffer,
size_t size);
205 virtual int file_sync(mbed::fs_file_t file);
217 virtual off_t file_seek(mbed::fs_file_t file, off_t offset,
int whence);
224 virtual off_t file_tell(mbed::fs_file_t file);
231 virtual off_t file_size(mbed::fs_file_t file);
244 virtual int file_truncate(mbed::fs_file_t file, off_t length);
252 virtual int dir_open(mbed::fs_dir_t *dir,
const char *path);
259 virtual int dir_close(mbed::fs_dir_t dir);
267 virtual ssize_t dir_read(mbed::fs_dir_t dir,
struct dirent *ent);
275 virtual void dir_seek(mbed::fs_dir_t dir, off_t offset);
282 virtual off_t dir_tell(mbed::fs_dir_t dir);
288 virtual void dir_rewind(mbed::fs_dir_t dir);
303#ifndef MBED_NO_GLOBAL_USING_DIRECTIVE
A hardware device capable of writing and reading blocks.
LittleFileSystem2, 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.
virtual int stat(const char *path, struct stat *st)
Store information about the file in a stat structure.
LittleFileSystem2(const char *name=NULL, mbed::BlockDevice *bd=NULL, lfs2_size_t block_size=MBED_LFS2_BLOCK_SIZE, uint32_t block_cycles=MBED_LFS2_BLOCK_CYCLES, lfs2_size_t cache_size=MBED_LFS2_CACHE_SIZE, lfs2_size_t lookahead=MBED_LFS2_LOOKAHEAD_SIZE)
Lifetime of the LittleFileSystem2.
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.
static int format(mbed::BlockDevice *bd, lfs2_size_t block_size=MBED_LFS2_BLOCK_SIZE, uint32_t block_cycles=MBED_LFS2_BLOCK_CYCLES, lfs2_size_t cache_size=MBED_LFS2_CACHE_SIZE, lfs2_size_t lookahead_size=MBED_LFS2_LOOKAHEAD_SIZE)
Format a block device with the LittleFileSystem2.
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.