1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

Kernel/TmpFS: Use IntrusiveList and KString for OOM safety

This patch moves TmpFS to using OOM-safe data types for storing
directory children.
This commit is contained in:
Andreas Kling 2021-07-18 13:47:18 +02:00
parent b748f11f2d
commit 61e17ed590
2 changed files with 43 additions and 21 deletions

View file

@ -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;
};
}