Kernel: Enable early-returns from VFS::for_each_mount

This commit is contained in:
Ben Wiederhake 2021-10-29 23:28:25 +02:00 committed by Andreas Kling
commit 88ca12f037
Notes: sideshowbarker 2024-07-18 01:43:09 +09:00
4 changed files with 19 additions and 15 deletions

View file

@ -351,7 +351,8 @@ private:
virtual KResult try_generate(KBufferBuilder& builder) override
{
JsonArraySerializer array { builder };
VirtualFileSystem::the().for_each_mount([&array](auto& mount) {
KResult result = KSuccess;
VirtualFileSystem::the().for_each_mount([&array, &result](auto& mount) {
auto& fs = mount.guest_fs();
auto fs_object = array.add_object();
fs_object.add("class_name", fs.class_name());
@ -368,6 +369,8 @@ private:
fs_object.add("source", static_cast<const FileBackedFileSystem&>(fs).file_description().absolute_path());
else
fs_object.add("source", "none");
return IterationDecision::Continue;
});
array.finish();
return KSuccess;