mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
Kernel: Use ProtectedValue for VirtualFileSystem::m_mounts
This is what VirtualFileSystem::m_lock was actually guarding, and wrapping it in a ProtectedValue makes it so much more obvious how it all works. :^)
This commit is contained in:
parent
7089135a07
commit
29a58459ab
2 changed files with 56 additions and 51 deletions
|
@ -20,6 +20,7 @@
|
|||
#include <Kernel/FileSystem/UnveilNode.h>
|
||||
#include <Kernel/Forward.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Locking/ProtectedValue.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -65,7 +66,6 @@ public:
|
|||
KResult mknod(StringView path, mode_t, dev_t, Custody& base);
|
||||
KResultOr<NonnullRefPtr<Custody>> open_directory(StringView path, Custody& base);
|
||||
|
||||
size_t mount_count() const { return m_mounts.size(); }
|
||||
void for_each_mount(Function<void(const Mount&)>) const;
|
||||
|
||||
InodeIdentifier root_inode_id() const;
|
||||
|
@ -90,11 +90,10 @@ private:
|
|||
Mount* find_mount_for_host(InodeIdentifier);
|
||||
Mount* find_mount_for_guest(InodeIdentifier);
|
||||
|
||||
Mutex m_lock { "VFSLock" };
|
||||
|
||||
RefPtr<Inode> m_root_inode;
|
||||
Vector<Mount, 16> m_mounts;
|
||||
RefPtr<Custody> m_root_custody;
|
||||
|
||||
ProtectedValue<Vector<Mount, 16>> m_mounts;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue