mirror of
https://github.com/wiiu-env/libmocha.git
synced 2024-11-18 01:19:24 +01:00
f3c45c52ad
Also some minor line changes to make em match a bit better!
29 lines
739 B
C++
29 lines
739 B
C++
#include "devoptab_fsa.h"
|
|
#include "logger.h"
|
|
#include <mutex>
|
|
|
|
int __fsa_fsync(struct _reent *r,
|
|
void *fd) {
|
|
FSError status;
|
|
|
|
if (!fd) {
|
|
r->_errno = EINVAL;
|
|
return -1;
|
|
}
|
|
|
|
auto *file = (__fsa_file_t *) fd;
|
|
auto *deviceData = (FSADeviceData *) r->deviceData;
|
|
|
|
std::lock_guard<MutexWrapper> lock(file->mutex);
|
|
|
|
status = FSAFlushFile(deviceData->clientHandle, file->fd);
|
|
if (status < 0) {
|
|
DEBUG_FUNCTION_LINE_ERR("FSAFlushFile(0x%08X, 0x%08X) (%s) failed: %s",
|
|
deviceData->clientHandle, file->fd, file->fullPath, FSAGetStatusStr(status));
|
|
r->_errno = __fsa_translate_error(status);
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|