summaryrefslogtreecommitdiff
path: root/Kernel/VM/InodeVMObject.h
blob: e4e44cff7fa75e1b4b035c4ee1a8550fcad6a89c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#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);

    size_t amount_dirty() const;
    size_t amount_clean() const;

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;
    Bitmap m_dirty_pages;
};