Kernel/LibC: Implement super basic select

This does not really even block but it works... :D
This commit is contained in:
2024-02-12 17:26:33 +02:00
parent f50b4be162
commit 3fc1edede0
34 changed files with 285 additions and 41 deletions

View File

@@ -24,6 +24,11 @@ namespace Kernel
virtual dev_t rdev() const override { return m_rdev; }
virtual BAN::StringView name() const override { return m_name; }
protected:
virtual bool can_read_impl() const override { return false; }
virtual bool can_write_impl() const override { return false; }
virtual bool has_error_impl() const override { return false; }
private:
NVMeController(PCI::Device& pci_device);
virtual BAN::ErrorOr<void> initialize() override;

View File

@@ -46,6 +46,10 @@ namespace Kernel
protected:
virtual BAN::ErrorOr<size_t> read_impl(off_t, BAN::ByteSpan) override;
virtual bool can_read_impl() const override { return true; }
virtual bool can_write_impl() const override { return true; }
virtual bool has_error_impl() const override { return false; }
private:
const dev_t m_rdev;
};

View File

@@ -39,6 +39,10 @@ namespace Kernel
virtual BAN::ErrorOr<void> write_sectors_impl(uint64_t lba, uint64_t sector_count, BAN::ConstByteSpan) = 0;
void add_disk_cache();
virtual bool can_read_impl() const override { return true; }
virtual bool can_write_impl() const override { return true; }
virtual bool has_error_impl() const override { return false; }
private:
SpinLock m_lock;
BAN::Optional<DiskCache> m_disk_cache;