diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-08 02:17:26 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-08 02:20:03 +0100 |
commit | 88ea152b2425338ad0ad9a199590f396590f7b5a (patch) | |
tree | 168518e8f49cf651273aac98a8e85285ea058664 /Kernel/Devices | |
parent | 6be880bd10dce91114706704aa8f1f27bbdce89f (diff) | |
download | serenity-88ea152b2425338ad0ad9a199590f396590f7b5a.zip |
Kernel: Merge unnecessary DiskDevice class into BlockDevice
Diffstat (limited to 'Kernel/Devices')
-rw-r--r-- | Kernel/Devices/BXVGADevice.h | 2 | ||||
-rw-r--r-- | Kernel/Devices/BlockDevice.cpp | 30 | ||||
-rw-r--r-- | Kernel/Devices/BlockDevice.h | 8 | ||||
-rw-r--r-- | Kernel/Devices/DiskDevice.cpp | 56 | ||||
-rw-r--r-- | Kernel/Devices/DiskDevice.h | 52 | ||||
-rw-r--r-- | Kernel/Devices/DiskPartition.cpp | 24 | ||||
-rw-r--r-- | Kernel/Devices/DiskPartition.h | 12 | ||||
-rw-r--r-- | Kernel/Devices/EBRPartitionTable.cpp | 2 | ||||
-rw-r--r-- | Kernel/Devices/EBRPartitionTable.h | 5 | ||||
-rw-r--r-- | Kernel/Devices/FloppyDiskDevice.cpp | 12 | ||||
-rw-r--r-- | Kernel/Devices/FloppyDiskDevice.h | 9 | ||||
-rw-r--r-- | Kernel/Devices/GPTPartitionTable.cpp | 2 | ||||
-rw-r--r-- | Kernel/Devices/GPTPartitionTable.h | 5 | ||||
-rw-r--r-- | Kernel/Devices/MBRPartitionTable.cpp | 2 | ||||
-rw-r--r-- | Kernel/Devices/MBRPartitionTable.h | 5 | ||||
-rw-r--r-- | Kernel/Devices/MBVGADevice.h | 2 | ||||
-rw-r--r-- | Kernel/Devices/PATADiskDevice.cpp | 12 | ||||
-rw-r--r-- | Kernel/Devices/PATADiskDevice.h | 6 |
18 files changed, 67 insertions, 179 deletions
diff --git a/Kernel/Devices/BXVGADevice.h b/Kernel/Devices/BXVGADevice.h index 9c0791fc7c..84bbd0dea4 100644 --- a/Kernel/Devices/BXVGADevice.h +++ b/Kernel/Devices/BXVGADevice.h @@ -47,6 +47,8 @@ private: virtual bool can_write(const FileDescription&) const override { return true; } virtual ssize_t read(FileDescription&, u8*, ssize_t) override { return -EINVAL; } virtual ssize_t write(FileDescription&, const u8*, ssize_t) override { return -EINVAL; } + virtual bool read_blocks(unsigned, u16, u8*) override { return false; } + virtual bool write_blocks(unsigned, u16, const u8*) override { return false; } void set_register(u16 index, u16 value); u32 find_framebuffer_address(); diff --git a/Kernel/Devices/BlockDevice.cpp b/Kernel/Devices/BlockDevice.cpp index cdecc67fec..2ad857240b 100644 --- a/Kernel/Devices/BlockDevice.cpp +++ b/Kernel/Devices/BlockDevice.cpp @@ -29,3 +29,33 @@ BlockDevice::~BlockDevice() { } + +bool BlockDevice::read_block(unsigned index, u8* buffer) const +{ + return const_cast<BlockDevice*>(this)->read_blocks(index, 1, buffer); +} + +bool BlockDevice::write_block(unsigned index, const u8* data) +{ + return write_blocks(index, 1, data); +} + +bool BlockDevice::read_raw(u32 offset, unsigned length, u8* out) const +{ + ASSERT((offset % block_size()) == 0); + ASSERT((length % block_size()) == 0); + u32 first_block = offset / block_size(); + u32 end_block = (offset + length) / block_size(); + return const_cast<BlockDevice*>(this)->read_blocks(first_block, end_block - first_block, out); +} + +bool BlockDevice::write_raw(u32 offset, unsigned length, const u8* in) +{ + ASSERT((offset % block_size()) == 0); + ASSERT((length % block_size()) == 0); + u32 first_block = offset / block_size(); + u32 end_block = (offset + length) / block_size(); + ASSERT(first_block <= 0xffffffff); + ASSERT(end_block <= 0xffffffff); + return write_blocks(first_block, end_block - first_block, in); +} diff --git a/Kernel/Devices/BlockDevice.h b/Kernel/Devices/BlockDevice.h index fd8c2fb495..6b639cbc63 100644 --- a/Kernel/Devices/BlockDevice.h +++ b/Kernel/Devices/BlockDevice.h @@ -35,6 +35,14 @@ public: size_t block_size() const { return m_block_size; } virtual bool is_seekable() const override { return true; } + bool read_block(unsigned index, u8*) const; + bool write_block(unsigned index, const u8*); + bool read_raw(u32 offset, unsigned length, u8*) const; + bool write_raw(u32 offset, unsigned length, const u8*); + + virtual bool read_blocks(unsigned index, u16 count, u8*) = 0; + virtual bool write_blocks(unsigned index, u16 count, const u8*) = 0; + protected: BlockDevice(unsigned major, unsigned minor, size_t block_size = PAGE_SIZE) : Device(major, minor) diff --git a/Kernel/Devices/DiskDevice.cpp b/Kernel/Devices/DiskDevice.cpp deleted file mode 100644 index 9e57368b1d..0000000000 --- a/Kernel/Devices/DiskDevice.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <Kernel/Devices/DiskDevice.h> - -DiskDevice::DiskDevice(int major, int minor, size_t block_size) - : BlockDevice(major, minor, block_size) -{ -} - -DiskDevice::~DiskDevice() -{ -} - -bool DiskDevice::read(DiskOffset offset, unsigned length, u8* out) const -{ - ASSERT((offset % block_size()) == 0); - ASSERT((length % block_size()) == 0); - u32 first_block = offset / block_size(); - u32 end_block = (offset + length) / block_size(); - return const_cast<DiskDevice*>(this)->read_blocks(first_block, end_block - first_block, out); -} - -bool DiskDevice::write(DiskOffset offset, unsigned length, const u8* in) -{ - ASSERT((offset % block_size()) == 0); - ASSERT((length % block_size()) == 0); - u32 first_block = offset / block_size(); - u32 end_block = (offset + length) / block_size(); - ASSERT(first_block <= 0xffffffff); - ASSERT(end_block <= 0xffffffff); - return write_blocks(first_block, end_block - first_block, in); -} diff --git a/Kernel/Devices/DiskDevice.h b/Kernel/Devices/DiskDevice.h deleted file mode 100644 index e95365ee09..0000000000 --- a/Kernel/Devices/DiskDevice.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#pragma once - -#include <AK/RefCounted.h> -#include <AK/Types.h> -#include <Kernel/Devices/BlockDevice.h> - -// FIXME: Support 64-bit DiskOffset -typedef u32 DiskOffset; - -class DiskDevice : public BlockDevice { -public: - virtual ~DiskDevice() override; - - virtual bool read_block(unsigned index, u8*) const = 0; - virtual bool write_block(unsigned index, const u8*) = 0; - bool read(DiskOffset, unsigned length, u8*) const; - bool write(DiskOffset, unsigned length, const u8*); - - virtual bool read_blocks(unsigned index, u16 count, u8*) = 0; - virtual bool write_blocks(unsigned index, u16 count, const u8*) = 0; - - virtual bool is_disk_device() const override { return true; }; - -protected: - DiskDevice(int major, int minor, size_t block_size = 512); -}; diff --git a/Kernel/Devices/DiskPartition.cpp b/Kernel/Devices/DiskPartition.cpp index a5e40b076d..a763b062ba 100644 --- a/Kernel/Devices/DiskPartition.cpp +++ b/Kernel/Devices/DiskPartition.cpp @@ -28,13 +28,13 @@ // #define OFFD_DEBUG -NonnullRefPtr<DiskPartition> DiskPartition::create(DiskDevice& device, unsigned block_offset, unsigned block_limit) +NonnullRefPtr<DiskPartition> DiskPartition::create(BlockDevice& device, unsigned block_offset, unsigned block_limit) { return adopt(*new DiskPartition(device, block_offset, block_limit)); } -DiskPartition::DiskPartition(DiskDevice& device, unsigned block_offset, unsigned block_limit) - : DiskDevice(100, 0, device.block_size()) +DiskPartition::DiskPartition(BlockDevice& device, unsigned block_offset, unsigned block_limit) + : BlockDevice(100, 0, device.block_size()) , m_device(device) , m_block_offset(block_offset) , m_block_limit(block_limit) @@ -45,24 +45,6 @@ DiskPartition::~DiskPartition() { } -bool DiskPartition::read_block(unsigned index, u8* out) const -{ -#ifdef OFFD_DEBUG - kprintf("DiskPartition::read_block %u (really: %u)\n", index, m_block_offset + index); -#endif - - return m_device->read_block(m_block_offset + index, out); -} - -bool DiskPartition::write_block(unsigned index, const u8* data) -{ -#ifdef OFFD_DEBUG - kprintf("DiskPartition::write_block %u (really: %u)\n", index, m_block_offset + index); -#endif - - return m_device->write_block(m_block_offset + index, data); -} - bool DiskPartition::read_blocks(unsigned index, u16 count, u8* out) { #ifdef OFFD_DEBUG diff --git a/Kernel/Devices/DiskPartition.h b/Kernel/Devices/DiskPartition.h index c2d77aa18a..f7258d07e0 100644 --- a/Kernel/Devices/DiskPartition.h +++ b/Kernel/Devices/DiskPartition.h @@ -27,15 +27,13 @@ #pragma once #include <AK/RefPtr.h> -#include <Kernel/Devices/DiskDevice.h> +#include <Kernel/Devices/BlockDevice.h> -class DiskPartition final : public DiskDevice { +class DiskPartition final : public BlockDevice { public: - static NonnullRefPtr<DiskPartition> create(DiskDevice&, unsigned block_offset, unsigned block_limit); + static NonnullRefPtr<DiskPartition> create(BlockDevice&, unsigned block_offset, unsigned block_limit); virtual ~DiskPartition(); - virtual bool read_block(unsigned index, u8* out) const override; - virtual bool write_block(unsigned index, const u8*) override; virtual bool read_blocks(unsigned index, u16 count, u8*) override; virtual bool write_blocks(unsigned index, u16 count, const u8*) override; @@ -48,9 +46,9 @@ public: private: virtual const char* class_name() const override; - DiskPartition(DiskDevice&, unsigned block_offset, unsigned block_limit); + DiskPartition(BlockDevice&, unsigned block_offset, unsigned block_limit); - NonnullRefPtr<DiskDevice> m_device; + NonnullRefPtr<BlockDevice> m_device; unsigned m_block_offset; unsigned m_block_limit; }; diff --git a/Kernel/Devices/EBRPartitionTable.cpp b/Kernel/Devices/EBRPartitionTable.cpp index a5fbb04462..23f3bb9b05 100644 --- a/Kernel/Devices/EBRPartitionTable.cpp +++ b/Kernel/Devices/EBRPartitionTable.cpp @@ -29,7 +29,7 @@ #define EBR_DEBUG -EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<DiskDevice> device) +EBRPartitionTable::EBRPartitionTable(NonnullRefPtr<BlockDevice> device) : m_device(move(device)) { } diff --git a/Kernel/Devices/EBRPartitionTable.h b/Kernel/Devices/EBRPartitionTable.h index 9245fc7626..564c8c9e9c 100644 --- a/Kernel/Devices/EBRPartitionTable.h +++ b/Kernel/Devices/EBRPartitionTable.h @@ -28,7 +28,6 @@ #include <AK/RefPtr.h> #include <AK/Vector.h> -#include <Kernel/Devices/DiskDevice.h> #include <Kernel/Devices/DiskPartition.h> #include <Kernel/Devices/MBRPartitionTable.h> @@ -44,7 +43,7 @@ struct [[gnu::packed]] EBRPartitionExtension class EBRPartitionTable { public: - explicit EBRPartitionTable(NonnullRefPtr<DiskDevice>); + explicit EBRPartitionTable(NonnullRefPtr<BlockDevice>); ~EBRPartitionTable(); bool initialize(); @@ -52,7 +51,7 @@ public: private: int index_of_ebr_container() const; - NonnullRefPtr<DiskDevice> m_device; + NonnullRefPtr<BlockDevice> m_device; const MBRPartitionHeader& header() const; const EBRPartitionExtension& ebr_extension() const; diff --git a/Kernel/Devices/FloppyDiskDevice.cpp b/Kernel/Devices/FloppyDiskDevice.cpp index d0486f925c..3e9e4a3128 100644 --- a/Kernel/Devices/FloppyDiskDevice.cpp +++ b/Kernel/Devices/FloppyDiskDevice.cpp @@ -110,7 +110,7 @@ const char* FloppyDiskDevice::class_name() const FloppyDiskDevice::FloppyDiskDevice(FloppyDiskDevice::DriveType type) : IRQHandler(IRQ_FLOPPY_DRIVE) - , DiskDevice(89, (type == FloppyDiskDevice::DriveType::Master) ? 0 : 1, BYTES_PER_SECTOR) + , BlockDevice(89, (type == FloppyDiskDevice::DriveType::Master) ? 0 : 1, BYTES_PER_SECTOR) , m_io_base_addr((type == FloppyDiskDevice::DriveType::Master) ? 0x3F0 : 0x370) { initialize(); @@ -120,16 +120,6 @@ FloppyDiskDevice::~FloppyDiskDevice() { } -bool FloppyDiskDevice::read_block(unsigned index, u8* data) const -{ - return const_cast<FloppyDiskDevice*>(this)->read_blocks(index, 1, data); -} - -bool FloppyDiskDevice::write_block(unsigned index, const u8* data) -{ - return write_sectors_with_dma(index, 1, data); -} - bool FloppyDiskDevice::read_blocks(unsigned index, u16 count, u8* data) { return read_sectors_with_dma(index, count, data); diff --git a/Kernel/Devices/FloppyDiskDevice.h b/Kernel/Devices/FloppyDiskDevice.h index 2942f94227..e975fd789f 100644 --- a/Kernel/Devices/FloppyDiskDevice.h +++ b/Kernel/Devices/FloppyDiskDevice.h @@ -98,7 +98,7 @@ #pragma once #include <AK/RefPtr.h> -#include <Kernel/Devices/DiskDevice.h> +#include <Kernel/Devices/BlockDevice.h> #include <Kernel/IRQHandler.h> #include <Kernel/Lock.h> #include <Kernel/VM/PhysicalAddress.h> @@ -120,8 +120,9 @@ struct FloppyControllerCommand { // uses the Intel 82077A controller. More about this controller can // be found here: http://www.buchty.net/casio/files/82077.pdf // -class FloppyDiskDevice final : public IRQHandler - , public DiskDevice { +class FloppyDiskDevice final + : public IRQHandler + , public BlockDevice { AK_MAKE_ETERNAL static constexpr u8 SECTORS_PER_CYLINDER = 18; @@ -160,8 +161,6 @@ public: virtual ~FloppyDiskDevice() override; // ^DiskDevice - virtual bool read_block(unsigned index, u8*) const override; - virtual bool write_block(unsigned index, const u8*) override; virtual bool read_blocks(unsigned index, u16 count, u8*) override; virtual bool write_blocks(unsigned index, u16 count, const u8*) override; diff --git a/Kernel/Devices/GPTPartitionTable.cpp b/Kernel/Devices/GPTPartitionTable.cpp index 1929a6cff7..925d510052 100644 --- a/Kernel/Devices/GPTPartitionTable.cpp +++ b/Kernel/Devices/GPTPartitionTable.cpp @@ -29,7 +29,7 @@ #define GPT_DEBUG -GPTPartitionTable::GPTPartitionTable(DiskDevice& device) +GPTPartitionTable::GPTPartitionTable(BlockDevice& device) : m_device(move(device)) { } diff --git a/Kernel/Devices/GPTPartitionTable.h b/Kernel/Devices/GPTPartitionTable.h index 9ec4ac3ea5..5a86fc00d5 100644 --- a/Kernel/Devices/GPTPartitionTable.h +++ b/Kernel/Devices/GPTPartitionTable.h @@ -29,7 +29,6 @@ #include <AK/RefPtr.h> #include <AK/Types.h> #include <AK/Vector.h> -#include <Kernel/Devices/DiskDevice.h> #include <Kernel/Devices/DiskPartition.h> #define GPT_SIGNATURE2 0x54524150 @@ -73,14 +72,14 @@ struct [[gnu::packed]] GPTPartitionHeader class GPTPartitionTable { public: - explicit GPTPartitionTable(DiskDevice&); + explicit GPTPartitionTable(BlockDevice&); ~GPTPartitionTable(); bool initialize(); RefPtr<DiskPartition> partition(unsigned index); private: - NonnullRefPtr<DiskDevice> m_device; + NonnullRefPtr<BlockDevice> m_device; const GPTPartitionHeader& header() const; diff --git a/Kernel/Devices/MBRPartitionTable.cpp b/Kernel/Devices/MBRPartitionTable.cpp index 8880533698..4f3b865eba 100644 --- a/Kernel/Devices/MBRPartitionTable.cpp +++ b/Kernel/Devices/MBRPartitionTable.cpp @@ -29,7 +29,7 @@ #define MBR_DEBUG -MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<DiskDevice> device) +MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<BlockDevice> device) : m_device(move(device)) { } diff --git a/Kernel/Devices/MBRPartitionTable.h b/Kernel/Devices/MBRPartitionTable.h index 61adddf19c..a4c2419cc7 100644 --- a/Kernel/Devices/MBRPartitionTable.h +++ b/Kernel/Devices/MBRPartitionTable.h @@ -28,7 +28,6 @@ #include <AK/RefPtr.h> #include <AK/Vector.h> -#include <Kernel/Devices/DiskDevice.h> #include <Kernel/Devices/DiskPartition.h> #define MBR_SIGNATURE 0xaa55 @@ -62,7 +61,7 @@ class MBRPartitionTable { AK_MAKE_ETERNAL public: - explicit MBRPartitionTable(NonnullRefPtr<DiskDevice>); + explicit MBRPartitionTable(NonnullRefPtr<BlockDevice>); ~MBRPartitionTable(); bool initialize(); @@ -71,7 +70,7 @@ public: RefPtr<DiskPartition> partition(unsigned index); private: - NonnullRefPtr<DiskDevice> m_device; + NonnullRefPtr<BlockDevice> m_device; const MBRPartitionHeader& header() const; diff --git a/Kernel/Devices/MBVGADevice.h b/Kernel/Devices/MBVGADevice.h index 67607e1e7b..a5cec28107 100644 --- a/Kernel/Devices/MBVGADevice.h +++ b/Kernel/Devices/MBVGADevice.h @@ -47,6 +47,8 @@ private: virtual bool can_write(const FileDescription&) const override { return true; } virtual ssize_t read(FileDescription&, u8*, ssize_t) override { return -EINVAL; } virtual ssize_t write(FileDescription&, const u8*, ssize_t) override { return -EINVAL; } + virtual bool read_blocks(unsigned, u16, u8*) override { return false; } + virtual bool write_blocks(unsigned, u16, const u8*) override { return false; } size_t framebuffer_size_in_bytes() const { return m_framebuffer_pitch * m_framebuffer_height; } diff --git a/Kernel/Devices/PATADiskDevice.cpp b/Kernel/Devices/PATADiskDevice.cpp index 1ab70af9f1..6182ab6e88 100644 --- a/Kernel/Devices/PATADiskDevice.cpp +++ b/Kernel/Devices/PATADiskDevice.cpp @@ -33,7 +33,7 @@ NonnullRefPtr<PATADiskDevice> PATADiskDevice::create(PATAChannel& channel, Drive } PATADiskDevice::PATADiskDevice(PATAChannel& channel, DriveType type, int major, int minor) - : DiskDevice(major, minor) + : BlockDevice(major, minor, 512) , m_drive_type(type) , m_channel(channel) { @@ -55,11 +55,6 @@ bool PATADiskDevice::read_blocks(unsigned index, u16 count, u8* out) return read_sectors(index, count, out); } -bool PATADiskDevice::read_block(unsigned index, u8* out) const -{ - return const_cast<PATADiskDevice*>(this)->read_blocks(index, 1, out); -} - bool PATADiskDevice::write_blocks(unsigned index, u16 count, const u8* data) { if (m_channel.m_bus_master_base && m_channel.m_dma_enabled.resource()) @@ -71,11 +66,6 @@ bool PATADiskDevice::write_blocks(unsigned index, u16 count, const u8* data) return true; } -bool PATADiskDevice::write_block(unsigned index, const u8* data) -{ - return write_blocks(index, 1, data); -} - void PATADiskDevice::set_drive_geometry(u16 cyls, u16 heads, u16 spt) { m_cylinders = cyls; diff --git a/Kernel/Devices/PATADiskDevice.h b/Kernel/Devices/PATADiskDevice.h index 086c6d8467..54cbb6f9c5 100644 --- a/Kernel/Devices/PATADiskDevice.h +++ b/Kernel/Devices/PATADiskDevice.h @@ -30,13 +30,13 @@ // #pragma once -#include <Kernel/Devices/DiskDevice.h> +#include <Kernel/Devices/BlockDevice.h> #include <Kernel/IRQHandler.h> #include <Kernel/Lock.h> class PATAChannel; -class PATADiskDevice final : public DiskDevice { +class PATADiskDevice final : public BlockDevice { AK_MAKE_ETERNAL public: // Type of drive this IDEDiskDevice is on the ATA channel. @@ -53,8 +53,6 @@ public: virtual ~PATADiskDevice() override; // ^DiskDevice - virtual bool read_block(unsigned index, u8*) const override; - virtual bool write_block(unsigned index, const u8*) override; virtual bool read_blocks(unsigned index, u16 count, u8*) override; virtual bool write_blocks(unsigned index, u16 count, const u8*) override; |