diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-08 15:39:26 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-08 15:39:26 +0100 |
commit | 3b2dcd5929316dae75147c84b243ae69a2101af5 (patch) | |
tree | e121ba2b1c6cb6fcdfd6d36c0392e3c15066ec17 /VirtualFileSystem | |
parent | 862f108cb5cf0c3708f245aaf9620c674f371fa0 (diff) | |
download | serenity-3b2dcd5929316dae75147c84b243ae69a2101af5.zip |
Add a VMO pointer to VNode.
This way, if anyone tries to map an already mapped file, we share the VMO.
Diffstat (limited to 'VirtualFileSystem')
-rw-r--r-- | VirtualFileSystem/VirtualFileSystem.cpp | 3 | ||||
-rw-r--r-- | VirtualFileSystem/VirtualFileSystem.h | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/VirtualFileSystem/VirtualFileSystem.cpp b/VirtualFileSystem/VirtualFileSystem.cpp index da482bd9fa..31cdf58d2e 100644 --- a/VirtualFileSystem/VirtualFileSystem.cpp +++ b/VirtualFileSystem/VirtualFileSystem.cpp @@ -180,6 +180,7 @@ auto VirtualFileSystem::allocateNode() -> RetainPtr<Node> ASSERT(node->retainCount == 0); node->retainCount = 1; node->m_vfs = this; + node->m_vmo = nullptr; return adopt(*node); } @@ -197,6 +198,8 @@ void VirtualFileSystem::freeNode(Node* node) m_device2vnode.remove(encodedDevice(node->m_characterDevice->major(), node->m_characterDevice->minor())); node->m_characterDevice = nullptr; } + node->m_vfs = nullptr; + node->m_vmo = nullptr; m_nodeFreeList.append(move(node)); } diff --git a/VirtualFileSystem/VirtualFileSystem.h b/VirtualFileSystem/VirtualFileSystem.h index 2f30223d72..a9afa9c33f 100644 --- a/VirtualFileSystem/VirtualFileSystem.h +++ b/VirtualFileSystem/VirtualFileSystem.h @@ -65,12 +65,16 @@ public: VirtualFileSystem* vfs() { return m_vfs; } const VirtualFileSystem* vfs() const { return m_vfs; } + void* vmo() { return m_vmo; } + void set_vmo(void* vmo) { m_vmo = vmo; } + private: friend class VirtualFileSystem; VirtualFileSystem* m_vfs { nullptr }; unsigned retainCount { 0 }; CharacterDevice* m_characterDevice { nullptr }; mutable InodeMetadata m_cachedMetadata; + void* m_vmo { nullptr }; }; static VirtualFileSystem& the() PURE; |