mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-21 08:12:09 -05:00
fstatvfs kept the guest struct statvfs and the sfs2svfs conversion from the kernel's statfs to itself. Both move to include/Statvfs.hpp so that statvfs can convert a volume the same way without opening the path. Nothing changes for fstatvfs.
23 lines
751 B
C++
23 lines
751 B
C++
#include "prx/libc/include/general/VabiMacros.hpp"
|
|
#include "prx/libSceLibcInternal/include/Statvfs.hpp"
|
|
#include <cstring>
|
|
|
|
extern "C" int APS5_VABI _fstatfs_nid_postfix(int, KernelStatfs*);
|
|
extern "C" int* APS5_VABI __error_nid_postfix();
|
|
|
|
extern "C" int APS5_VABI fstatvfs_nid_postfix(int descriptor, LibcStatvfs* output) {
|
|
int* const error = __error_nid_postfix();
|
|
const int saved = *error;
|
|
KernelStatfs volume{};
|
|
const int status = _fstatfs_nid_postfix(descriptor, &volume);
|
|
if (status != 0) return status;
|
|
if (output == nullptr) {
|
|
*error = 14;
|
|
return -1;
|
|
}
|
|
const LibcStatvfs result = StatvfsFromStatfs(volume);
|
|
std::memcpy(output, &result, sizeof(result));
|
|
*error = saved;
|
|
return 0;
|
|
}
|