forked from Bananymous/banan-os
Kernel: Shell can now mount partitions
This commit is contained in:
@@ -137,6 +137,8 @@ namespace Kernel
|
||||
virtual dev_t dev() const override { return 0; }
|
||||
virtual dev_t rdev() const override { return 0; }
|
||||
|
||||
virtual InodeType inode_type() const override { return InodeType::Ext2; }
|
||||
|
||||
virtual BAN::StringView name() const override { return m_name; }
|
||||
|
||||
virtual BAN::ErrorOr<size_t> read(size_t, void*, size_t) override;
|
||||
|
||||
@@ -48,6 +48,12 @@ namespace Kernel
|
||||
mode_t mode;
|
||||
};
|
||||
|
||||
enum class InodeType
|
||||
{
|
||||
Device,
|
||||
Ext2,
|
||||
};
|
||||
|
||||
public:
|
||||
virtual ~Inode() {}
|
||||
|
||||
@@ -67,6 +73,8 @@ namespace Kernel
|
||||
virtual dev_t dev() const = 0;
|
||||
virtual dev_t rdev() const = 0;
|
||||
|
||||
virtual InodeType inode_type() const = 0;
|
||||
|
||||
virtual BAN::StringView name() const = 0;
|
||||
|
||||
virtual BAN::ErrorOr<BAN::RefPtr<Inode>> read_directory_inode(BAN::StringView) { if (!mode().ifdir()) return BAN::Error::from_errno(ENOTDIR); ASSERT_NOT_REACHED(); }
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Kernel
|
||||
|
||||
virtual BAN::RefPtr<Inode> root_inode() override { return m_root_fs->root_inode(); }
|
||||
|
||||
BAN::ErrorOr<void> mount(FileSystem*, BAN::StringView);
|
||||
BAN::ErrorOr<void> mount(BAN::StringView, BAN::StringView);
|
||||
|
||||
struct File
|
||||
{
|
||||
@@ -27,6 +27,10 @@ namespace Kernel
|
||||
};
|
||||
BAN::ErrorOr<File> file_from_absolute_path(BAN::StringView);
|
||||
|
||||
private:
|
||||
VirtualFileSystem() = default;
|
||||
BAN::ErrorOr<void> mount(FileSystem*, BAN::StringView);
|
||||
|
||||
struct MountPoint
|
||||
{
|
||||
File host;
|
||||
@@ -34,9 +38,6 @@ namespace Kernel
|
||||
};
|
||||
MountPoint* mount_point_for_inode(BAN::RefPtr<Inode>);
|
||||
|
||||
private:
|
||||
VirtualFileSystem() = default;
|
||||
|
||||
private:
|
||||
FileSystem* m_root_fs = nullptr;
|
||||
BAN::Vector<MountPoint> m_mount_points;
|
||||
|
||||
Reference in New Issue
Block a user