1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

Kernel: Refactor storage stack with u64 as number of blocks

This commit is contained in:
Jean-Baptiste Boric 2021-03-16 20:23:16 +01:00 committed by Andreas Kling
parent aeef14ae28
commit 9a3aa7eb0b
10 changed files with 26 additions and 38 deletions

View file

@ -33,16 +33,13 @@
namespace Kernel {
UNMAP_AFTER_INIT NonnullRefPtr<PATADiskDevice> PATADiskDevice::create(const IDEController& controller, IDEChannel& channel, DriveType type, InterfaceType interface_type, u16 cylinders, u16 heads, u16 spt, u16 capabilities)
UNMAP_AFTER_INIT NonnullRefPtr<PATADiskDevice> PATADiskDevice::create(const IDEController& controller, IDEChannel& channel, DriveType type, InterfaceType interface_type, u16 capabilities, u64 max_addressable_block)
{
return adopt(*new PATADiskDevice(controller, channel, type, interface_type, cylinders, heads, spt, capabilities));
return adopt(*new PATADiskDevice(controller, channel, type, interface_type, capabilities, max_addressable_block));
}
UNMAP_AFTER_INIT PATADiskDevice::PATADiskDevice(const IDEController& controller, IDEChannel& channel, DriveType type, InterfaceType interface_type, u16 cylinders, u16 heads, u16 spt, u16 capabilities)
: StorageDevice(controller, 512, 0)
, m_cylinders(cylinders)
, m_heads(heads)
, m_sectors_per_track(spt)
UNMAP_AFTER_INIT PATADiskDevice::PATADiskDevice(const IDEController& controller, IDEChannel& channel, DriveType type, InterfaceType interface_type, u16 capabilities, u64 max_addressable_block)
: StorageDevice(controller, 512, max_addressable_block)
, m_capabilities(capabilities)
, m_channel(channel)
, m_drive_type(type)
@ -70,11 +67,6 @@ String PATADiskDevice::device_name() const
return String::formatted("hd{:c}", 'a' + minor());
}
size_t PATADiskDevice::max_addressable_block() const
{
return m_cylinders * m_heads * m_sectors_per_track;
}
bool PATADiskDevice::is_slave() const
{
return m_drive_type == DriveType::Slave;