1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

pkg/littlefs2: hook up vfs_fsync()

This commit is contained in:
Benjamin Valentin 2022-02-07 16:07:37 +01:00
parent aac538ba7f
commit c55b264428

View File

@ -383,6 +383,22 @@ static off_t _lseek(vfs_file_t *filp, off_t off, int whence)
return littlefs_err_to_errno(ret);
}
static int _fsync(vfs_file_t *filp)
{
littlefs2_desc_t *fs = filp->mp->private_data;
lfs_file_t *fp = _get_lfs_file(filp);
mutex_lock(&fs->lock);
DEBUG("littlefs: fsync: filp=%p, fp=%p\n",
(void *)filp, (void *)fp);
int ret = lfs_file_sync(&fs->fs, fp);
mutex_unlock(&fs->lock);
return littlefs_err_to_errno(ret);
}
static int _stat(vfs_mount_t *mountp, const char *restrict path, struct stat *restrict buf)
{
littlefs2_desc_t *fs = mountp->private_data;
@ -525,6 +541,7 @@ static const vfs_file_ops_t littlefs_file_ops = {
.read = _read,
.write = _write,
.lseek = _lseek,
.fsync = _fsync,
};
static const vfs_dir_ops_t littlefs_dir_ops = {