vfs,fat: add fsync to VFS interface, implement it for fatfs

This commit is contained in:
Ivan Grokhotkov
2017-10-17 14:00:01 +08:00
parent 90bf40587e
commit 502c3d0243
3 changed files with 36 additions and 0 deletions
+14
View File
@@ -534,3 +534,17 @@ int ioctl(int fd, int cmd, ...)
va_end(args);
return ret;
}
int fsync(int fd)
{
const vfs_entry_t* vfs = get_vfs_for_fd(fd);
struct _reent* r = __getreent();
if (vfs == NULL) {
__errno_r(r) = EBADF;
return -1;
}
int local_fd = translate_fd(vfs, fd);
int ret;
CHECK_AND_CALL(ret, r, vfs, fsync, local_fd);
return ret;
}