mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
FileSystem/FATFS: Convert internal FAT inode attributes to dirent types
This commit is contained in:
parent
a961447dbd
commit
1d2f1abf97
Notes:
sideshowbarker
2024-07-16 22:54:10 +09:00
Author: https://github.com/tajmorton Commit: https://github.com/SerenityOS/serenity/commit/1d2f1abf97 Pull-request: https://github.com/SerenityOS/serenity/pull/19898 Reviewed-by: https://github.com/ADKaster ✅
@ -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 New Issue
Block a user