mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Kernel: Enable early-returns from VFS::for_each_mount
This commit is contained in:
parent
735da58d44
commit
88ca12f037
Notes:
sideshowbarker
2024-07-18 01:43:09 +09:00
Author: https://github.com/BenWiederhake
Commit: 88ca12f037
Pull-request: https://github.com/SerenityOS/serenity/pull/10707
4 changed files with 19 additions and 15 deletions
|
@ -724,11 +724,12 @@ KResult VirtualFileSystem::rmdir(StringView path, Custody& base)
|
|||
return parent_inode.remove_child(KLexicalPath::basename(path));
|
||||
}
|
||||
|
||||
void VirtualFileSystem::for_each_mount(Function<void(Mount const&)> callback) const
|
||||
void VirtualFileSystem::for_each_mount(Function<IterationDecision(Mount const&)> callback) const
|
||||
{
|
||||
m_mounts.with_shared([&](auto& mounts) {
|
||||
for (auto& mount : mounts) {
|
||||
callback(mount);
|
||||
if (callback(mount) == IterationDecision::Break)
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue