1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 17:35:08 +00:00

FileSystem/FATFS: Convert internal FAT inode attributes to dirent types

This commit is contained in:
Taj Morton 2023-07-08 23:00:54 -07:00 committed by Andrew Kaster
parent a961447dbd
commit 1d2f1abf97
2 changed files with 15 additions and 0 deletions

View file

@ -91,4 +91,18 @@ BlockBasedFileSystem::BlockIndex FATFS::first_block_of_cluster(u32 cluster) cons
return ((cluster - first_data_cluster) * boot_record()->sectors_per_cluster) + m_first_data_sector;
}
u8 FATFS::internal_file_type_to_directory_entry_type(DirectoryEntryView const& entry) const
{
FATAttributes attrib = static_cast<FATAttributes>(entry.file_type);
if (has_flag(attrib, FATAttributes::Directory)) {
return DT_DIR;
} else if (has_flag(attrib, FATAttributes::VolumeID)) {
return DT_UNKNOWN;
} else {
// ReadOnly, Hidden, System, Archive, LongFileName.
return DT_REG;
}
return DT_UNKNOWN;
}
}