Skip to content

Commit

Permalink
Merge pull request #389 from Wuerfel21/W21-fflush
Browse files Browse the repository at this point in the history
Implement fflush for FAT VFS
  • Loading branch information
totalspectrum committed Jun 2, 2023
2 parents 0559bd7 + 61f07e4 commit 3262021
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion include/filesys/fatfs/fatfs.cc
Expand Up @@ -420,6 +420,24 @@ int v_open(vfs_file_t *fil, const char *name, int flags)
return 0;
}

int v_flush(vfs_file_t *fil) {
FAT_FIL *vf = fil->vfsdata;
FIL *f = &vf->fil;
int result;

if (!f) {
return _seterror(EBADF);
}
#ifdef DEBUG
__builtin_printf("v_flush() ");
#endif
result = f_sync(f);
#ifdef DEBUG
__builtin_printf("result=%d\n", result);
#endif
return _set_dos_error(result);
}

/* initialize (do first mount) */
/* for now this is a dummy function, but eventually some of the work
* in _vfs_open_sdcardx could be done here
Expand Down Expand Up @@ -449,7 +467,7 @@ static struct vfs fat_vfs =
&v_lseek,

&v_ioctl,
0, /* no flush function */
&v_flush,
0, /* vfs_data */
0, /* reserved2 */

Expand Down

0 comments on commit 3262021

Please sign in to comment.