1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

Kernel: Make Inode::traverse_as_directory() callback return ErrorOr

This allows us to propagate errors from inside the callback with TRY().
This commit is contained in:
Andreas Kling 2021-11-10 15:42:39 +01:00
parent a15ed8743d
commit 5ce753b74d
31 changed files with 154 additions and 151 deletions

View file

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