diff options
author | Ben Wiederhake <BenWiederhake.GitHub@gmx.de> | 2021-10-29 23:28:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-31 12:06:28 +0100 |
commit | 88ca12f037ffd9aedc884331c927f08d57e047cd (patch) | |
tree | ef64d03e51c2b62d4d53c0416e58fe7cc8a0a192 /Kernel/Syscalls/statvfs.cpp | |
parent | 735da58d44383389b9aacfdb03f4fa945ce8d665 (diff) | |
download | serenity-88ca12f037ffd9aedc884331c927f08d57e047cd.zip |
Kernel: Enable early-returns from VFS::for_each_mount
Diffstat (limited to 'Kernel/Syscalls/statvfs.cpp')
-rw-r--r-- | Kernel/Syscalls/statvfs.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Kernel/Syscalls/statvfs.cpp b/Kernel/Syscalls/statvfs.cpp index ed2a70dfa9..8764f98a9b 100644 --- a/Kernel/Syscalls/statvfs.cpp +++ b/Kernel/Syscalls/statvfs.cpp @@ -38,19 +38,19 @@ KResultOr<FlatPtr> Process::do_statvfs(StringView path, statvfs* buf) while (current_custody) { VirtualFileSystem::the().for_each_mount([&kernelbuf, ¤t_custody](auto& mount) { - if (current_custody) { - if (¤t_custody->inode() == &mount.guest()) { - int mountflags = mount.flags(); - int flags = 0; - if (mountflags & MS_RDONLY) - flags = flags | ST_RDONLY; - if (mountflags & MS_NOSUID) - flags = flags | ST_NOSUID; - - kernelbuf.f_flag = flags; - current_custody = nullptr; - } + if (¤t_custody->inode() == &mount.guest()) { + int mountflags = mount.flags(); + int flags = 0; + if (mountflags & MS_RDONLY) + flags = flags | ST_RDONLY; + if (mountflags & MS_NOSUID) + flags = flags | ST_NOSUID; + + kernelbuf.f_flag = flags; + current_custody = nullptr; + return IterationDecision::Break; } + return IterationDecision::Continue; }); if (current_custody) { |