diff --git a/Kernel/FileSystem/FATFS/FileSystem.cpp b/Kernel/FileSystem/FATFS/FileSystem.cpp index 9f3c996bf2..bcec7c5492 100644 --- a/Kernel/FileSystem/FATFS/FileSystem.cpp +++ b/Kernel/FileSystem/FATFS/FileSystem.cpp @@ -237,7 +237,7 @@ ErrorOr FATFS::initialize_while_locked() } root_entry.attributes = FATAttributes::Directory; - m_root_inode = TRY(FATInode::create(*this, root_entry)); + m_root_inode = TRY(FATInode::create(*this, root_entry, { 0, 1 })); return {}; } diff --git a/Kernel/FileSystem/FATFS/Inode.cpp b/Kernel/FileSystem/FATFS/Inode.cpp index b21be9b32f..a86d642ba6 100644 --- a/Kernel/FileSystem/FATFS/Inode.cpp +++ b/Kernel/FileSystem/FATFS/Inode.cpp @@ -11,15 +11,16 @@ namespace Kernel { -ErrorOr> FATInode::create(FATFS& fs, FATEntry entry, Vector const& lfn_entries) +ErrorOr> FATInode::create(FATFS& fs, FATEntry entry, FATEntryLocation inode_metadata_location, Vector const& lfn_entries) { auto filename = TRY(compute_filename(entry, lfn_entries)); - return adopt_nonnull_ref_or_enomem(new (nothrow) FATInode(fs, entry, move(filename))); + return adopt_nonnull_ref_or_enomem(new (nothrow) FATInode(fs, entry, inode_metadata_location, move(filename))); } -FATInode::FATInode(FATFS& fs, FATEntry entry, NonnullOwnPtr filename) +FATInode::FATInode(FATFS& fs, FATEntry entry, FATEntryLocation inode_metadata_location, NonnullOwnPtr filename) : Inode(fs, first_cluster(fs.m_fat_version)) , m_entry(entry) + , m_inode_metadata_location(inode_metadata_location) , m_filename(move(filename)) { dbgln_if(FAT_DEBUG, "FATFS: Creating inode {} with filename \"{}\"", index(), m_filename); @@ -160,9 +161,15 @@ ErrorOr> FATInode::traverse(Function(RefPtr> create(FATFS&, FATEntry, Vector const& = {}); + static ErrorOr> create(FATFS&, FATEntry, FATEntryLocation inode_metadata_location, Vector const& = {}); FATFS& fs() { return static_cast(Inode::fs()); } FATFS const& fs() const { return static_cast(Inode::fs()); } private: - FATInode(FATFS&, FATEntry, NonnullOwnPtr filename); + FATInode(FATFS&, FATEntry, FATEntryLocation inode_metadata_location, NonnullOwnPtr filename); // Returns cluster number value that indicates the end of the chain // has been reached. Any cluster value >= this value indicates this @@ -73,6 +78,7 @@ private: Vector m_block_list; FATEntry m_entry; + FATEntryLocation m_inode_metadata_location; NonnullOwnPtr m_filename; InodeMetadata m_metadata; };