mirror of
https://github.com/devkitPro/wut.git
synced 2026-03-22 01:44:41 -05:00
Some checks failed
C/C++ CI / ubuntu-latest (push) Has been cancelled
`find . -regex '.*\.\(cpp\|hpp\|cu\|cuh\|c\|h\)' -exec clang-format -style=file -i {} \;`
38 lines
972 B
C++
38 lines
972 B
C++
#include <mutex>
|
|
#include "devoptab_fsa.h"
|
|
|
|
int
|
|
__wut_fsa_fstat(struct _reent *r,
|
|
void *fd,
|
|
struct stat *st)
|
|
{
|
|
FSError status;
|
|
FSAStat fsStat;
|
|
__wut_fsa_file_t *file;
|
|
__wut_fsa_device_t *deviceData;
|
|
|
|
if (!fd || !st) {
|
|
r->_errno = EINVAL;
|
|
return -1;
|
|
}
|
|
|
|
file = (__wut_fsa_file_t *)fd;
|
|
deviceData = (__wut_fsa_device_t *)r->deviceData;
|
|
|
|
std::scoped_lock lock(file->mutex);
|
|
|
|
status = FSAGetStatFile(deviceData->clientHandle, file->fd, &fsStat);
|
|
if (status < 0) {
|
|
WUT_DEBUG_REPORT("FSAGetStatFile(0x%08X, 0x%08X, %p) (%s) failed: %s\n",
|
|
deviceData->clientHandle, file->fd, &fsStat,
|
|
file->fullPath, FSAGetStatusStr(status));
|
|
r->_errno = __wut_fsa_translate_error(status);
|
|
return -1;
|
|
}
|
|
|
|
ino_t ino = __wut_fsa_hashstring(file->fullPath);
|
|
__wut_fsa_translate_stat(deviceData->clientHandle, &fsStat, ino, st);
|
|
|
|
return 0;
|
|
}
|