1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:48:11 +00:00
serenity/Kernel/VM/VMObject.cpp
Andreas Kling 6bdb81ad87 Kernel: Split VMObject into two classes: Anonymous- and InodeVMObject
InodeVMObject is a VMObject with an underlying Inode in the filesystem.
AnonymousVMObject has no Inode.

I'm happy that InodeVMObject::inode() can now return Inode& instead of
VMObject::inode() return Inode*. :^)
2019-08-07 18:09:32 +02:00

24 lines
605 B
C++

#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/FileSystem/Inode.h>
#include <Kernel/VM/MemoryManager.h>
#include <Kernel/VM/VMObject.h>
VMObject::VMObject(const VMObject& other)
: m_size(other.m_size)
, m_physical_pages(other.m_physical_pages)
{
MM.register_vmo(*this);
}
VMObject::VMObject(size_t size, ShouldFillPhysicalPages should_fill_physical_pages)
: m_size(size)
{
MM.register_vmo(*this);
if (should_fill_physical_pages == ShouldFillPhysicalPages::Yes)
m_physical_pages.resize(page_count());
}
VMObject::~VMObject()
{
MM.unregister_vmo(*this);
}