summaryrefslogtreecommitdiff
path: root/Kernel/Devices/DiskPartition.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-21 16:45:52 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-21 16:48:59 +0200
commit5de483cfbb7c004914480a283bd27720a64ebb83 (patch)
treea7dcbe603ffa6d2af262554c5117fc17a5a34545 /Kernel/Devices/DiskPartition.cpp
parent52366e3f02a267297837d06c185da539030aab20 (diff)
downloadserenity-5de483cfbb7c004914480a283bd27720a64ebb83.zip
Kernel: Move DiskDevice::block_size() up to BlockDevice
All block devices should have a block size, after all. This defaults to PAGE_SIZE if no size is specified.
Diffstat (limited to 'Kernel/Devices/DiskPartition.cpp')
-rw-r--r--Kernel/Devices/DiskPartition.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/Kernel/Devices/DiskPartition.cpp b/Kernel/Devices/DiskPartition.cpp
index 562ca39e6e..e49521a3db 100644
--- a/Kernel/Devices/DiskPartition.cpp
+++ b/Kernel/Devices/DiskPartition.cpp
@@ -2,14 +2,14 @@
// #define OFFD_DEBUG
-NonnullRefPtr<DiskPartition> DiskPartition::create(NonnullRefPtr<DiskDevice> device, unsigned block_offset)
+NonnullRefPtr<DiskPartition> DiskPartition::create(DiskDevice& device, unsigned block_offset)
{
- return adopt(*new DiskPartition(move(device), block_offset));
+ return adopt(*new DiskPartition(device, block_offset));
}
-DiskPartition::DiskPartition(NonnullRefPtr<DiskDevice> device, unsigned block_offset)
- : DiskDevice(100, 0)
- , m_device(move(device))
+DiskPartition::DiskPartition(DiskDevice& device, unsigned block_offset)
+ : DiskDevice(100, 0, device.block_size())
+ , m_device(device)
, m_block_offset(block_offset)
{
}
@@ -18,11 +18,6 @@ DiskPartition::~DiskPartition()
{
}
-unsigned DiskPartition::block_size() const
-{
- return m_device->block_size();
-}
-
bool DiskPartition::read_block(unsigned index, u8* out) const
{
#ifdef OFFD_DEBUG