mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +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
Notes:
sideshowbarker
2024-07-17 20:02:16 +09:00
Author: https://github.com/Panky-codes Commit: https://github.com/SerenityOS/serenity/commit/cf44d71edfe Pull-request: https://github.com/SerenityOS/serenity/pull/12198 Reviewed-by: https://github.com/IdanHo
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…
Reference in a new issue