1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +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

@ -60,7 +60,7 @@ ErrorOr<size_t> DevTmpFSInode::read_bytes(off_t, size_t, UserOrKernelBuffer&, Op
VERIFY_NOT_REACHED();
}
ErrorOr<void> DevTmpFSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const
ErrorOr<void> DevTmpFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const
{
VERIFY_NOT_REACHED();
}
@ -210,14 +210,14 @@ DevTmpFSDirectoryInode::~DevTmpFSDirectoryInode()
{
}
ErrorOr<void> DevTmpFSDirectoryInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
ErrorOr<void> DevTmpFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{
MutexLocker locker(m_inode_lock);
callback({ ".", identifier(), 0 });
callback({ "..", identifier(), 0 });
TRY(callback({ ".", identifier(), 0 }));
TRY(callback({ "..", identifier(), 0 }));
for (auto& node : m_nodes) {
InodeIdentifier identifier = { fsid(), node.index() };
callback({ node.name(), identifier, 0 });
TRY(callback({ node.name(), identifier, 0 }));
}
return {};
}