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

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.
This commit is contained in:
Pankaj Raghav 2022-03-26 18:49:07 +01:00 committed by Brian Gianforcaro
parent 2786a71bc0
commit 6d3a7fabeb

View file

@ -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);