diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-18 13:47:18 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-18 14:29:27 +0200 |
commit | 61e17ed5907c190276b37cfbb7091f76e4506d1e (patch) | |
tree | c6a7b7855bb2ad518d10b400af11df12e5f58537 /Kernel/FileSystem/TmpFS.h | |
parent | b748f11f2dceb81c50192eda2d43b225f05c282a (diff) | |
download | serenity-61e17ed5907c190276b37cfbb7091f76e4506d1e.zip |
Kernel/TmpFS: Use IntrusiveList and KString for OOM safety
This patch moves TmpFS to using OOM-safe data types for storing
directory children.
Diffstat (limited to 'Kernel/FileSystem/TmpFS.h')
-rw-r--r-- | Kernel/FileSystem/TmpFS.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Kernel/FileSystem/TmpFS.h b/Kernel/FileSystem/TmpFS.h index c57a5e23ec..20e2ca51d2 100644 --- a/Kernel/FileSystem/TmpFS.h +++ b/Kernel/FileSystem/TmpFS.h @@ -75,18 +75,23 @@ private: TmpFSInode(TmpFS& fs, InodeMetadata metadata, InodeIdentifier parent); static RefPtr<TmpFSInode> create(TmpFS&, InodeMetadata metadata, InodeIdentifier parent); static RefPtr<TmpFSInode> create_root(TmpFS&); - void notify_watchers(); + struct Child { + NonnullOwnPtr<KString> name; + NonnullRefPtr<TmpFSInode> inode; + IntrusiveListNode<Child> list_node {}; + using List = IntrusiveList<Child, RawPtr<Child>, &Child::list_node>; + }; + + Child* find_child_by_name(StringView); + InodeMetadata m_metadata; InodeIdentifier m_parent; OwnPtr<KBuffer> m_content; - struct Child { - String name; - NonnullRefPtr<TmpFSInode> inode; - }; - HashMap<String, Child> m_children; + + Child::List m_children; }; } |