IOS/FS: Implement GetNandStats().

This commit is contained in:
Admiral H. Curtiss 2023-03-31 20:07:04 +02:00
parent 8295d6d415
commit 5c05155828
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
1 changed files with 10 additions and 9 deletions

View File

@ -764,17 +764,18 @@ static u64 ComputeUsedClusters(const File::FSTEntry& parent_entry)
Result<NandStats> HostFileSystem::GetNandStats() Result<NandStats> HostFileSystem::GetNandStats()
{ {
WARN_LOG_FMT(IOS_FS, "GET STATS - returning static values for now"); const auto root_stats = GetDirectoryStats("/");
if (!root_stats)
return root_stats.Error(); // TODO: is this right? can this fail on hardware?
// TODO: scrape the real amounts from somewhere...
NandStats stats{}; NandStats stats{};
stats.cluster_size = 0x4000; stats.cluster_size = CLUSTER_SIZE;
stats.free_clusters = 0x5DEC; stats.free_clusters = USABLE_CLUSTERS - root_stats->used_clusters;
stats.used_clusters = 0x1DD4; stats.used_clusters = root_stats->used_clusters;
stats.bad_clusters = 0x10; stats.bad_clusters = 0;
stats.reserved_clusters = 0x02F0; stats.reserved_clusters = RESERVED_CLUSTERS;
stats.free_inodes = 0x146B; stats.free_inodes = TOTAL_INODES - root_stats->used_inodes;
stats.used_inodes = 0x0394; stats.used_inodes = root_stats->used_inodes;
return stats; return stats;
} }