#pragma once #include "fs/VFS.h" #include class MountInode : public VFS::Inode, public LinkedListNode { public: static Result> create(SharedPtr source, SharedPtr fs); void set_fs(SharedPtr fs) { m_mountee = fs; } Result> find(const char* name) const override { return m_mount_root_inode->find(name); } Option get(usize index) const override { return m_mount_root_inode->get(index); } Result read(u8*, usize, usize) const override { return err(EISDIR); } Result write(const u8*, usize, usize) override { return err(EISDIR); } Result truncate(usize) override { return err(EISDIR); } bool blocking() const override { return false; } usize size() const override { return 0; } mode_t mode() const override { return m_mount_root_inode->mode(); } u32 uid() const override { return m_mount_root_inode->uid(); } u32 gid() const override { return m_mount_root_inode->gid(); } nlink_t nlinks() const override { return m_mount_root_inode->nlinks(); } Result chmod(mode_t mode) override { return m_mount_root_inode->chmod(mode); } Result chown(u32 uid, u32 gid) override { return m_mount_root_inode->chown(uid, gid); } VFS::FileSystem* fs() const override { return m_mountee.ptr(); } usize inode_number() const override { return m_mount_root_inode->inode_number(); } VFS::InodeType type() const override { return VFS::InodeType::Directory; } void did_link() override { m_mount_root_inode->did_link(); } void did_unlink() override { m_mount_root_inode->did_unlink(); } usize entries() const override { return m_mount_root_inode->entries(); } bool is_mountpoint() const override { return true; } SharedPtr source() const { return m_source; } Result remove_entry(const char* name) override { return m_mount_root_inode->remove_entry(name); } Result> create_file(const char* name) override { return m_mount_root_inode->create_file(name); } Result> create_subdirectory(const char* name) override { return m_mount_root_inode->create_subdirectory(name); } Result add_entry(SharedPtr inode, const char* name) override { return m_mount_root_inode->add_entry(inode, name); } Result replace_entry(SharedPtr inode, const char* name) override { return m_mount_root_inode->replace_entry(inode, name); } virtual ~MountInode(); private: SharedPtr m_source; SharedPtr m_mountee; SharedPtr m_mount_root_inode; MountInode() = default; }; extern LinkedList g_mounts;