mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:18:11 +00:00
Kernel: Remove the assumption of 512 block size in read/write_block
Devices such as NVMe can have blocks bigger that 512. Use the m_block_size variable in read/write_block function instead of the hardcoded 512 block size.
This commit is contained in:
parent
caecb6ba72
commit
cf44d71edf
1 changed files with 2 additions and 2 deletions
|
@ -30,7 +30,7 @@ BlockDevice::~BlockDevice()
|
|||
|
||||
bool BlockDevice::read_block(u64 index, UserOrKernelBuffer& buffer)
|
||||
{
|
||||
auto read_request_or_error = try_make_request<AsyncBlockDeviceRequest>(AsyncBlockDeviceRequest::Read, index, 1, buffer, 512);
|
||||
auto read_request_or_error = try_make_request<AsyncBlockDeviceRequest>(AsyncBlockDeviceRequest::Read, index, 1, buffer, m_block_size);
|
||||
if (read_request_or_error.is_error()) {
|
||||
dbgln("BlockDevice::read_block({}): try_make_request failed", index);
|
||||
return false;
|
||||
|
@ -56,7 +56,7 @@ bool BlockDevice::read_block(u64 index, UserOrKernelBuffer& buffer)
|
|||
|
||||
bool BlockDevice::write_block(u64 index, const UserOrKernelBuffer& buffer)
|
||||
{
|
||||
auto write_request_or_error = try_make_request<AsyncBlockDeviceRequest>(AsyncBlockDeviceRequest::Write, index, 1, buffer, 512);
|
||||
auto write_request_or_error = try_make_request<AsyncBlockDeviceRequest>(AsyncBlockDeviceRequest::Write, index, 1, buffer, m_block_size);
|
||||
if (write_request_or_error.is_error()) {
|
||||
dbgln("BlockDevice::write_block({}): try_make_request failed", index);
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue