1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37: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

30
Kernel/VM/InodeVMObject.h Normal file
View file

@ -0,0 +1,30 @@
#pragma once
#include <Kernel/UnixTypes.h>
#include <Kernel/VM/VMObject.h>
class InodeVMObject final : public VMObject {
public:
virtual ~InodeVMObject() override;
static NonnullRefPtr<InodeVMObject> create_with_inode(Inode&);
virtual NonnullRefPtr<VMObject> clone() override;
Inode& inode() { return *m_inode; }
const Inode& inode() const { return *m_inode; }
void inode_contents_changed(Badge<Inode>, off_t, ssize_t, const u8*);
void inode_size_changed(Badge<Inode>, size_t old_size, size_t new_size);
private:
explicit InodeVMObject(Inode&);
explicit InodeVMObject(const InodeVMObject&);
InodeVMObject& operator=(const InodeVMObject&) = delete;
InodeVMObject& operator=(InodeVMObject&&) = delete;
InodeVMObject(InodeVMObject&&) = delete;
virtual bool is_inode() const override { return true; }
NonnullRefPtr<Inode> m_inode;
};