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

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*. :^)
This commit is contained in:
Andreas Kling 2019-08-07 18:06:17 +02:00
parent cb2d572a14
commit 6bdb81ad87
16 changed files with 286 additions and 200 deletions

View file

@ -1,7 +1,8 @@
#pragma once
#include <Kernel/VM/MemoryManager.h>
#include <AK/OwnPtr.h>
#include <Kernel/VM/AnonymousVMObject.h>
#include <Kernel/VM/MemoryManager.h>
struct SharedBuffer {
private:
@ -15,10 +16,11 @@ private:
unsigned count { 0 };
Region* region { nullptr };
};
public:
SharedBuffer(int id, int size)
: m_shared_buffer_id(id)
, m_vmo(VMObject::create_anonymous(size))
, m_vmo(AnonymousVMObject::create_with_size(size))
{
#ifdef SHARED_BUFFER_DEBUG
dbgprintf("Created shared buffer %d of size %d\n", m_shared_buffer_id, size);
@ -47,7 +49,7 @@ public:
int m_shared_buffer_id { -1 };
bool m_writable { true };
bool m_global { false };
NonnullRefPtr<VMObject> m_vmo;
NonnullRefPtr<AnonymousVMObject> m_vmo;
Vector<Reference, 2> m_refs;
unsigned m_total_refs { 0 };
};