2019-08-07 19:06:17 +03:00
|
|
|
#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);
|
|
|
|
|
2019-12-29 14:28:32 +03:00
|
|
|
size_t amount_dirty() const;
|
2019-12-29 14:45:58 +03:00
|
|
|
size_t amount_clean() const;
|
2019-12-29 14:28:32 +03:00
|
|
|
|
2019-12-29 15:16:53 +03:00
|
|
|
int release_all_clean_pages();
|
|
|
|
|
2019-08-07 19:06:17 +03:00
|
|
|
private:
|
2020-01-03 17:40:03 +03:00
|
|
|
explicit InodeVMObject(Inode&, size_t);
|
2019-08-07 19:06:17 +03:00
|
|
|
explicit InodeVMObject(const InodeVMObject&);
|
|
|
|
|
|
|
|
InodeVMObject& operator=(const InodeVMObject&) = delete;
|
|
|
|
InodeVMObject& operator=(InodeVMObject&&) = delete;
|
|
|
|
InodeVMObject(InodeVMObject&&) = delete;
|
|
|
|
|
|
|
|
virtual bool is_inode() const override { return true; }
|
|
|
|
|
2019-12-29 15:16:53 +03:00
|
|
|
int release_all_clean_pages_impl();
|
|
|
|
|
2019-08-07 19:06:17 +03:00
|
|
|
NonnullRefPtr<Inode> m_inode;
|
2019-12-29 14:28:32 +03:00
|
|
|
Bitmap m_dirty_pages;
|
2019-08-07 19:06:17 +03:00
|
|
|
};
|