1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:48:11 +00:00

Kernel/Storage: Unify all ATA devices

There's basically no real difference in software between a SATA harddisk
and IDE harddisk. The difference in the implementation is for the host
bus adapter protocol and registers layout.
Therefore, there's no point in putting a distinction in software to
these devices.

This change also greatly simplifies and removes stale APIs and removes
unnecessary parameters in constructor calls, which tighten things
further everywhere.
This commit is contained in:
Liav A 2021-08-27 17:13:03 +03:00 committed by Andreas Kling
parent 9f501d7e71
commit 741c871bc1
29 changed files with 352 additions and 276 deletions

View file

@ -13,10 +13,9 @@
namespace Kernel {
StorageDevice::StorageDevice(const StorageController& controller, int major, int minor, size_t sector_size, u64 max_addressable_block, NonnullOwnPtr<KString> device_name)
StorageDevice::StorageDevice(int major, int minor, size_t sector_size, u64 max_addressable_block, NonnullOwnPtr<KString> device_name)
: BlockDevice(major, minor, sector_size)
, m_storage_controller(controller)
, m_storage_device_name(move(device_name))
, m_early_storage_device_name(move(device_name))
, m_max_addressable_block(max_addressable_block)
{
}
@ -26,11 +25,6 @@ StringView StorageDevice::class_name() const
return "StorageDevice"sv;
}
NonnullRefPtr<StorageController> StorageDevice::controller() const
{
return m_storage_controller;
}
KResultOr<size_t> StorageDevice::read(OpenFileDescription&, u64 offset, UserOrKernelBuffer& outbuf, size_t len)
{
unsigned index = offset / block_size();
@ -183,9 +177,9 @@ KResultOr<size_t> StorageDevice::write(OpenFileDescription&, u64 offset, const U
return pos + remaining;
}
StringView StorageDevice::storage_name() const
StringView StorageDevice::early_storage_name() const
{
return m_storage_device_name->view();
return m_early_storage_device_name->view();
}
bool StorageDevice::can_write(const OpenFileDescription&, size_t offset) const