summaryrefslogtreecommitdiff
path: root/VirtualFileSystem/SyntheticFileSystem.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-13 00:17:30 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-13 00:17:30 +0100
commit19b9401487e87dcbb43b52c6fe194e3b0e49f842 (patch)
tree6a5a7d5625920176d6846f58b17832871f656110 /VirtualFileSystem/SyntheticFileSystem.cpp
parent5e8e554f948a43d758eee6c0e56ee237f4dc1db1 (diff)
downloadserenity-19b9401487e87dcbb43b52c6fe194e3b0e49f842.zip
Reduce kmalloc() traffic in directory iteration.
Pass the file name in a stack-allocated buffer instead of using an AK::String when iterating directories. This dramatically reduces the amount of cycles spent traversing the filesystem.
Diffstat (limited to 'VirtualFileSystem/SyntheticFileSystem.cpp')
-rw-r--r--VirtualFileSystem/SyntheticFileSystem.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/VirtualFileSystem/SyntheticFileSystem.cpp b/VirtualFileSystem/SyntheticFileSystem.cpp
index dd1c0c0de3..676aff6b80 100644
--- a/VirtualFileSystem/SyntheticFileSystem.cpp
+++ b/VirtualFileSystem/SyntheticFileSystem.cpp
@@ -147,11 +147,11 @@ bool SyntheticFileSystem::enumerateDirectoryInode(InodeIdentifier inode, Functio
if (!synInode.metadata.isDirectory())
return false;
- callback({ ".", synInode.metadata.inode });
- callback({ "..", synInode.parent });
+ callback({ ".", 1, synInode.metadata.inode, 2 });
+ callback({ "..", 2, synInode.parent, 2 });
for (auto& child : synInode.children)
- callback({ child->name, child->metadata.inode });
+ callback({ child->name.characters(), child->name.length(), child->metadata.inode, child->metadata.isDirectory() ? (byte)2 : (byte)1 });
return true;
}