summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/FileSystem.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-18 12:41:27 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-18 18:26:54 +0200
commiteeaba41d130eb6c677a12c8618833990470c2cde (patch)
tree53eed1303649dd474b38e2ac405b2666660cad7e /Kernel/FileSystem/FileSystem.cpp
parent8abf5048b82c03ff03153fb355d9bc5c06c04a72 (diff)
downloadserenity-eeaba41d130eb6c677a12c8618833990470c2cde.zip
Kernel: Add DirectoryEntryView for VFS directory traversal
Unlike DirectoryEntry (which is used when constructing directories), DirectoryEntryView does not manage storage for file names. Names are just StringViews. This is much more suited to the directory traversal API and makes it easier to implement this in file system classes since they no longer need to create temporary name copies while traversing.
Diffstat (limited to 'Kernel/FileSystem/FileSystem.cpp')
-rw-r--r--Kernel/FileSystem/FileSystem.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp
index 817bf09c6b..20952c2deb 100644
--- a/Kernel/FileSystem/FileSystem.cpp
+++ b/Kernel/FileSystem/FileSystem.cpp
@@ -85,6 +85,13 @@ FS::DirectoryEntry::DirectoryEntry(const char* n, size_t nl, InodeIdentifier i,
name[nl] = '\0';
}
+FS::DirectoryEntryView::DirectoryEntryView(const StringView& n, InodeIdentifier i, u8 ft)
+ : name(n)
+ , inode(i)
+ , file_type(ft)
+{
+}
+
void FS::sync()
{
Inode::sync();