savemii/src/fatfs/extusb_devoptab/extusb_fs_fsync.c
2022-10-31 16:31:07 +01:00

26 lines
453 B
C

#include "extusb_devoptab.h"
#ifdef __cplusplus
extern "C" {
#endif
int __extusb_fs_fsync(struct _reent *r,
void *fd) {
if (!fd) {
r->_errno = EINVAL;
return -1;
}
__extusb_fs_file_t *file = (__extusb_fs_file_t *) fd;
FRESULT fr = f_sync(&file->fp);
if (fr != FR_OK) {
r->_errno = __extusb_fs_translate_error(fr);
return -1;
}
return 0;
}
#ifdef __cplusplus
}
#endif