mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-14 11:53:21 +00:00
FileSystem/FATFS: Convert internal FAT inode attributes to dirent types
This commit is contained in:
parent
a961447dbd
commit
1d2f1abf97
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
virtual ~FATFS() override = default;
|
||||
virtual StringView class_name() const override { return "FATFS"sv; }
|
||||
virtual Inode& root_inode() override;
|
||||
virtual u8 internal_file_type_to_directory_entry_type(DirectoryEntryView const& entry) const override;
|
||||
|
||||
private:
|
||||
virtual ErrorOr<void> initialize_while_locked() override;
|
||||
|
|
Loading…
Reference in a new issue