mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 17:13:13 -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.
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#ifndef CORE_LIBS_PRX_LIBSCELIBCINTERNAL_INCLUDE_STATVFS_HPP
|
|
#define CORE_LIBS_PRX_LIBSCELIBCINTERNAL_INCLUDE_STATVFS_HPP
|
|
|
|
#include "prx/libkernel/File/include/KernelStatfs.hpp"
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
struct LibcStatvfs {
|
|
std::uint64_t f_bavail;
|
|
std::uint64_t f_bfree;
|
|
std::uint64_t f_blocks;
|
|
std::uint64_t f_favail;
|
|
std::uint64_t f_ffree;
|
|
std::uint64_t f_files;
|
|
std::uint64_t f_bsize;
|
|
std::uint64_t f_flag;
|
|
std::uint64_t f_frsize;
|
|
std::uint64_t f_fsid;
|
|
std::uint64_t f_namemax;
|
|
};
|
|
static_assert(sizeof(LibcStatvfs) == 88);
|
|
static_assert(offsetof(LibcStatvfs, f_bsize) == 48);
|
|
static_assert(offsetof(LibcStatvfs, f_namemax) == 80);
|
|
|
|
inline LibcStatvfs StatvfsFromStatfs(const KernelStatfs& volume) {
|
|
return LibcStatvfs{
|
|
static_cast<std::uint64_t>(volume.f_bavail), volume.f_bfree, volume.f_blocks,
|
|
static_cast<std::uint64_t>(volume.f_ffree), static_cast<std::uint64_t>(volume.f_ffree), volume.f_files,
|
|
volume.f_iosize, (volume.f_flags & 1) | ((volume.f_flags & 8) >> 2), volume.f_bsize,
|
|
0, volume.f_namemax
|
|
};
|
|
}
|
|
|
|
#endif
|