Add a basic read-only implementation for the Ext2 filesystem #29

Merged
apio merged 14 commits from ext2 into main 2023-07-01 15:38:00 +00:00
6 changed files with 17 additions and 0 deletions
Showing only changes of commit 34e1ef36b1 - Show all commits

View File

@ -222,6 +222,7 @@ namespace VFS
g_root_inode = new_root_inode;
TRY(new_root_parent_inode->replace_entry(((MountInode*)g_root_inode.ptr())->source(), new_root_path.chars()));
((MountInode*)g_root_inode.ptr())->set_source({});
g_root_inode->fs()->reset_mount_dir();
return {};
}

View File

@ -36,6 +36,8 @@ namespace VFS
virtual Result<void> set_mount_dir(SharedPtr<Inode> parent) = 0;
virtual Result<void> reset_mount_dir() = 0;
virtual bool is_readonly() const
{
return false;

View File

@ -125,4 +125,9 @@ namespace Ext2
{
return m_root_inode->replace_entry(inode, "..");
}
Result<void> FileSystem::reset_mount_dir()
{
return m_root_inode->replace_entry(m_root_inode, "..");
}
}

View File

@ -149,6 +149,8 @@ namespace Ext2
Result<void> set_mount_dir(SharedPtr<VFS::Inode>) override;
Result<void> reset_mount_dir() override;
bool is_readonly() const override
{
return true;

View File

@ -72,6 +72,11 @@ namespace TmpFS
return m_root_inode->replace_entry(parent, "..");
}
Result<void> FileSystem::reset_mount_dir()
{
return m_root_inode->replace_entry(m_root_inode, "..");
}
void FileSystem::set_root(SharedPtr<VFS::Inode> root)
{
m_root_inode = root;

View File

@ -20,6 +20,8 @@ namespace TmpFS
Result<void> set_mount_dir(SharedPtr<VFS::Inode> parent) override;
Result<void> reset_mount_dir() override;
static Result<SharedPtr<VFS::FileSystem>> create();
dev_t host_device_id() const override