summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/Plan9FileSystem.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-10 15:42:39 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-10 21:58:58 +0100
commit5ce753b74d669aa240cae310ed41984158205f21 (patch)
treefbe1297544534d9605d3f99d0066d8cf2451d04d /Kernel/FileSystem/Plan9FileSystem.cpp
parenta15ed8743d03c6c683f19447be20ca7dac768485 (diff)
downloadserenity-5ce753b74d669aa240cae310ed41984158205f21.zip
Kernel: Make Inode::traverse_as_directory() callback return ErrorOr
This allows us to propagate errors from inside the callback with TRY().
Diffstat (limited to 'Kernel/FileSystem/Plan9FileSystem.cpp')
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp
index 95439a9356..c543ada187 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -828,7 +828,7 @@ ErrorOr<void> Plan9FSInode::flush_metadata()
return {};
}
-ErrorOr<void> Plan9FSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
+ErrorOr<void> Plan9FSInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{
// TODO: Should we synthesize "." and ".." here?
@@ -873,8 +873,13 @@ ErrorOr<void> Plan9FSInode::traverse_as_directory(Function<bool(FileSystem::Dire
u8 type;
StringView name;
decoder >> qid >> offset >> type >> name;
- callback({ name, { fsid(), fs().allocate_fid() }, 0 });
+ result = callback({ name, { fsid(), fs().allocate_fid() }, 0 });
+ if (result.is_error())
+ break;
}
+
+ if (result.is_error())
+ break;
}
Plan9FS::Message close_message { fs(), Plan9FS::Message::Type::Tclunk };