summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPankaj Raghav <pankydev8@gmail.com>2022-03-26 18:49:07 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-03-27 08:54:32 -0700
commit6d3a7fabeb2a20786017d8fefc7a3b26de1ae25e (patch)
treeba1e6916883e3cb844f303eaff1e6e6cb3d9920c
parent2786a71bc0d025075f1acc10f6e4439865418879 (diff)
downloadserenity-6d3a7fabeb2a20786017d8fefc7a3b26de1ae25e.zip
Kernel: Remove hardcoded values for block size in Ramdisk
Instead of using the hardcoded 512 in Ramdisk, retrieve the block size value from the AsyncBlockDeviceRequest struct.
-rw-r--r--Kernel/Storage/Ramdisk/Device.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Storage/Ramdisk/Device.cpp b/Kernel/Storage/Ramdisk/Device.cpp
index 4beb3a3083..9062926819 100644
--- a/Kernel/Storage/Ramdisk/Device.cpp
+++ b/Kernel/Storage/Ramdisk/Device.cpp
@@ -45,8 +45,8 @@ void RamdiskDevice::start_request(AsyncBlockDeviceRequest& request)
u8* base = m_region->vaddr().as_ptr();
size_t size = m_region->size();
- u8* offset = base + request.block_index() * 512;
- size_t length = request.block_count() * 512;
+ u8* offset = base + request.block_index() * request.block_size();
+ size_t length = request.buffer_size();
if ((offset + length > base + size) || (offset + length < base)) {
request.complete(AsyncDeviceRequest::Failure);