1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

Kernel: Convert Vector<OwnPtr> to NonnullOwnPtrVector.

This commit is contained in:
Andreas Kling 2019-07-24 09:15:33 +02:00
parent 2196f17c10
commit 394168c0ca
2 changed files with 7 additions and 7 deletions

View file

@ -82,8 +82,8 @@ bool VFS::mount_root(NonnullRefPtr<FS>&& file_system)
auto VFS::find_mount_for_host(InodeIdentifier inode) -> Mount* auto VFS::find_mount_for_host(InodeIdentifier inode) -> Mount*
{ {
for (auto& mount : m_mounts) { for (auto& mount : m_mounts) {
if (mount->host() == inode) if (mount.host() == inode)
return mount.ptr(); return &mount;
} }
return nullptr; return nullptr;
} }
@ -91,8 +91,8 @@ auto VFS::find_mount_for_host(InodeIdentifier inode) -> Mount*
auto VFS::find_mount_for_guest(InodeIdentifier inode) -> Mount* auto VFS::find_mount_for_guest(InodeIdentifier inode) -> Mount*
{ {
for (auto& mount : m_mounts) { for (auto& mount : m_mounts) {
if (mount->guest() == inode) if (mount.guest() == inode)
return mount.ptr(); return &mount;
} }
return nullptr; return nullptr;
} }
@ -608,7 +608,7 @@ Device* VFS::get_device(unsigned major, unsigned minor)
void VFS::for_each_mount(Function<void(const Mount&)> callback) const void VFS::for_each_mount(Function<void(const Mount&)> callback) const
{ {
for (auto& mount : m_mounts) { for (auto& mount : m_mounts) {
callback(*mount); callback(mount);
} }
} }

View file

@ -4,9 +4,9 @@
#include <AK/Badge.h> #include <AK/Badge.h>
#include <AK/Function.h> #include <AK/Function.h>
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <AK/NonnullOwnPtrVector.h>
#include <AK/OwnPtr.h> #include <AK/OwnPtr.h>
#include <AK/RefPtr.h> #include <AK/RefPtr.h>
#include <AK/Vector.h>
#include <Kernel/FileSystem/FileSystem.h> #include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/InodeIdentifier.h> #include <Kernel/FileSystem/InodeIdentifier.h>
#include <Kernel/FileSystem/InodeMetadata.h> #include <Kernel/FileSystem/InodeMetadata.h>
@ -106,7 +106,7 @@ private:
Mount* find_mount_for_guest(InodeIdentifier); Mount* find_mount_for_guest(InodeIdentifier);
RefPtr<Inode> m_root_inode; RefPtr<Inode> m_root_inode;
Vector<OwnPtr<Mount>> m_mounts; NonnullOwnPtrVector<Mount> m_mounts;
HashMap<u32, Device*> m_devices; HashMap<u32, Device*> m_devices;
RefPtr<Custody> m_root_custody; RefPtr<Custody> m_root_custody;