diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-18 12:41:27 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-18 18:26:54 +0200 |
commit | eeaba41d130eb6c677a12c8618833990470c2cde (patch) | |
tree | 53eed1303649dd474b38e2ac405b2666660cad7e /Kernel/FileSystem/FileSystem.cpp | |
parent | 8abf5048b82c03ff03153fb355d9bc5c06c04a72 (diff) | |
download | serenity-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.cpp | 7 |
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(); |