diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-18 17:42:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-18 18:26:54 +0200 |
commit | 108263314af7198c2751c0db098f613e4718751a (patch) | |
tree | 56ab101cf0f68336bbf349c610040086e8631dc2 /Kernel | |
parent | c096cb9352705f1aebcab72e9ce1a06136083921 (diff) | |
download | serenity-108263314af7198c2751c0db098f613e4718751a.zip |
TmpFS: Stop using FS::DirectoryEntry in TmpFSInode
The list of children can just be a bunch of { name, inode }.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/FileSystem/TmpFS.cpp | 11 | ||||
-rw-r--r-- | Kernel/FileSystem/TmpFS.h | 2 |
2 files changed, 5 insertions, 8 deletions
diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index 0b43302315..04ac98d33d 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -135,8 +135,8 @@ KResult TmpFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry callback({ "..", m_parent, 0 }); for (auto& it : m_children) { - auto& entry = it.value.entry; - callback({ { entry.name, entry.name_length }, entry.inode, entry.file_type }); + auto& entry = it.value; + callback({ entry.name, entry.inode->identifier(), 0 }); } return KSuccess; } @@ -218,7 +218,7 @@ RefPtr<Inode> TmpFSInode::lookup(StringView name) auto it = m_children.find(name); if (it == m_children.end()) return {}; - return it->value.inode; + return fs().get_inode(it->value.inode->identifier()); } KResultOr<size_t> TmpFSInode::directory_entry_count() const @@ -295,10 +295,7 @@ KResult TmpFSInode::add_child(Inode& child, const StringView& name, mode_t) ASSERT(is_directory()); ASSERT(child.fsid() == fsid()); - String owned_name = name; - FS::DirectoryEntry entry = { owned_name.characters(), owned_name.length(), child.identifier(), 0 }; - - m_children.set(owned_name, { entry, static_cast<TmpFSInode&>(child) }); + m_children.set(name, { name, static_cast<TmpFSInode&>(child) }); did_add_child(name); return KSuccess; } diff --git a/Kernel/FileSystem/TmpFS.h b/Kernel/FileSystem/TmpFS.h index cb126ae591..bb77e6b946 100644 --- a/Kernel/FileSystem/TmpFS.h +++ b/Kernel/FileSystem/TmpFS.h @@ -104,7 +104,7 @@ private: Optional<KBuffer> m_content; struct Child { - FS::DirectoryEntry entry; + String name; NonnullRefPtr<TmpFSInode> inode; }; HashMap<String, Child> m_children; |