mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +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:
parent
a15ed8743d
commit
5ce753b74d
31 changed files with 154 additions and 151 deletions
|
@ -107,18 +107,18 @@ InodeMetadata TmpFSInode::metadata() const
|
|||
return m_metadata;
|
||||
}
|
||||
|
||||
ErrorOr<void> TmpFSInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
ErrorOr<void> TmpFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
{
|
||||
MutexLocker locker(m_inode_lock, Mutex::Mode::Shared);
|
||||
|
||||
if (!is_directory())
|
||||
return ENOTDIR;
|
||||
|
||||
callback({ ".", identifier(), 0 });
|
||||
callback({ "..", m_parent, 0 });
|
||||
TRY(callback({ ".", identifier(), 0 }));
|
||||
TRY(callback({ "..", m_parent, 0 }));
|
||||
|
||||
for (auto& child : m_children) {
|
||||
callback({ child.name->view(), child.inode->identifier(), 0 });
|
||||
TRY(callback({ child.name->view(), child.inode->identifier(), 0 }));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue