Kernel/FATFS: Cache the cluster list and don't cache the InodeMetadata

Caching the cluster list allows us to fill the two fields in the
InodeMetadata. While at it, don't cache the metadata as when we
have write support having to keep both InodeMetadata and FATEntry
correct is going to get very annoying.
This commit is contained in:
Undefine
2024-01-16 21:24:45 +01:00
committed by Tim Schumacher
parent d4badfac72
commit 33f00a7efb
4 changed files with 55 additions and 54 deletions

View File

@@ -354,6 +354,23 @@ u32 FATFS::cluster_number(KBuffer const& fat_sector, u32 entry_cluster_number, u
return cluster;
}
u32 FATFS::end_of_chain_marker() const
{
// Returns the end of chain entry for the given file system.
// Any FAT entry of this value or greater signifies the end
// of the chain has been reached for a given entry.
switch (m_fat_version) {
case FATVersion::FAT12:
return 0xFF8;
case FATVersion::FAT16:
return 0xFFF8;
case FATVersion::FAT32:
return 0x0FFFFFF8;
default:
VERIFY_NOT_REACHED();
}
}
ErrorOr<u32> FATFS::fat_read(u32 cluster)
{
dbgln_if(FAT_DEBUG, "FATFS: Reading FAT entry for cluster {}", cluster);