mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 03:58:12 +00:00
FileSystem/FATFS: Convert internal FAT inode attributes to dirent types
This commit is contained in:
parent
a961447dbd
commit
1d2f1abf97
2 changed files with 15 additions and 0 deletions
|
@ -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;
|
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 ~FATFS() override = default;
|
||||||
virtual StringView class_name() const override { return "FATFS"sv; }
|
virtual StringView class_name() const override { return "FATFS"sv; }
|
||||||
virtual Inode& root_inode() override;
|
virtual Inode& root_inode() override;
|
||||||
|
virtual u8 internal_file_type_to_directory_entry_type(DirectoryEntryView const& entry) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ErrorOr<void> initialize_while_locked() override;
|
virtual ErrorOr<void> initialize_while_locked() override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue