Kernel: Rewrite basically all current disk io stuff

This is a big commit that was kinda hard to split to smaller ones.

Essentially we now look at all the mass storage devices from PCI
and initialize (P)ATA devices. This doesn't provide any more functionality
but better abstractions and everything doesn't have to be on its old
default port that might be different for modern computers.
This commit is contained in:
Bananymous
2023-02-26 03:00:29 +02:00
parent 048a2ebb95
commit ee5d02aa70
13 changed files with 570 additions and 475 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include <BAN/String.h>
#include <kernel/DiskIO.h>
#include <kernel/Storage/StorageDevice.h>
#include <kernel/FS/FileSystem.h>
namespace Kernel
@@ -156,12 +156,12 @@ namespace Kernel
class Ext2FS : public FileSystem
{
public:
static BAN::ErrorOr<Ext2FS*> create(DiskDevice::Partition&);
static BAN::ErrorOr<Ext2FS*> create(StorageDevice::Partition&);
virtual const BAN::RefCounted<Inode> root_inode() const override { return m_root_inode; }
private:
Ext2FS(DiskDevice::Partition& partition)
Ext2FS(StorageDevice::Partition& partition)
: m_partition(partition)
{}
@@ -177,7 +177,7 @@ namespace Kernel
const Ext2::Inode& ext2_root_inode() const;
private:
DiskDevice::Partition& m_partition;
StorageDevice::Partition& m_partition;
BAN::RefCounted<Inode> m_root_inode;

View File

@@ -1,6 +1,7 @@
#pragma once
#include <kernel/FS/FileSystem.h>
#include <kernel/Storage/StorageController.h>
namespace Kernel
{
@@ -8,7 +9,7 @@ namespace Kernel
class VirtualFileSystem : public FileSystem
{
public:
static void initialize(BAN::RefCounted<Inode> root_inode);
static BAN::ErrorOr<void> initialize();
static VirtualFileSystem& get();
static bool is_initialized();
@@ -17,12 +18,13 @@ namespace Kernel
BAN::ErrorOr<BAN::RefCounted<Inode>> from_absolute_path(BAN::StringView);
private:
VirtualFileSystem(BAN::RefCounted<Inode> root_inode)
: m_root_inode(root_inode)
{}
VirtualFileSystem() = default;
BAN::ErrorOr<void> initialize_impl();
private:
BAN::RefCounted<Inode> m_root_inode;
BAN::Vector<StorageController*> m_storage_controllers;
};
}