#pragma once #include #include #include namespace Kernel { class RamInode; class RamFileSystem final : public FileSystem { public: static BAN::ErrorOr create(size_t size, mode_t, uid_t, gid_t); ~RamFileSystem() = default; virtual BAN::RefPtr root_inode() override { return m_inodes[m_root_inode]; } BAN::ErrorOr add_inode(BAN::RefPtr); BAN::ErrorOr> get_inode(ino_t); blksize_t blksize() const { return m_blksize; } ino_t next_ino() { return m_next_ino++; } private: RamFileSystem() = default; private: SpinLock m_lock; size_t m_size { 0 }; BAN::HashMap> m_inodes; ino_t m_root_inode; const blksize_t m_blksize = PAGE_SIZE; ino_t m_next_ino { 1 }; }; }