diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-08-31 23:44:55 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-01 18:06:14 +0200 |
commit | 668c4299000e013852bd07e5df81750db672d607 (patch) | |
tree | f65ddce4c981fa983a3c54d2de90a3d2c15b8cc4 /Kernel/Storage | |
parent | f3baa5d8c915285ea109cf12553e497adb7051ca (diff) | |
download | serenity-668c4299000e013852bd07e5df81750db672d607.zip |
Kernel: Convert UserOrKernelBuffer callbacks to use AK::Bytes
Diffstat (limited to 'Kernel/Storage')
-rw-r--r-- | Kernel/Storage/IDEChannel.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Kernel/Storage/IDEChannel.cpp b/Kernel/Storage/IDEChannel.cpp index b5933b7a60..46286c7c4f 100644 --- a/Kernel/Storage/IDEChannel.cpp +++ b/Kernel/Storage/IDEChannel.cpp @@ -478,10 +478,10 @@ bool IDEChannel::ata_do_read_sector() dbgln_if(PATA_DEBUG, "IDEChannel::ata_do_read_sector"); auto& request = *m_current_request; auto out_buffer = request.buffer().offset(m_current_request_block_index * 512); - auto result = request.write_to_buffer_buffered<512>(out_buffer, 512, [&](u8* buffer, size_t buffer_bytes) { - for (size_t i = 0; i < buffer_bytes; i += sizeof(u16)) - *(u16*)&buffer[i] = IO::in16(m_io_group.io_base().offset(ATA_REG_DATA).get()); - return buffer_bytes; + auto result = request.write_to_buffer_buffered<512>(out_buffer, 512, [&](Bytes bytes) { + for (size_t i = 0; i < bytes.size(); i += sizeof(u16)) + *(u16*)bytes.offset_pointer(i) = IO::in16(m_io_group.io_base().offset(ATA_REG_DATA).get()); + return bytes.size(); }); if (result.is_error()) { // TODO: Do we need to abort the PATA read if this wasn't the last block? @@ -520,10 +520,10 @@ void IDEChannel::ata_do_write_sector() auto in_buffer = request.buffer().offset(m_current_request_block_index * 512); dbgln_if(PATA_DEBUG, "IDEChannel: Writing 512 bytes (part {}) (status={:#02x})...", m_current_request_block_index, status); - auto result = request.read_from_buffer_buffered<512>(in_buffer, 512, [&](u8 const* buffer, size_t buffer_bytes) { - for (size_t i = 0; i < buffer_bytes; i += sizeof(u16)) - IO::out16(m_io_group.io_base().offset(ATA_REG_DATA).get(), *(const u16*)&buffer[i]); - return buffer_bytes; + auto result = request.read_from_buffer_buffered<512>(in_buffer, 512, [&](ReadonlyBytes readonly_bytes) { + for (size_t i = 0; i < readonly_bytes.size(); i += sizeof(u16)) + IO::out16(m_io_group.io_base().offset(ATA_REG_DATA).get(), *(const u16*)readonly_bytes.offset(i)); + return readonly_bytes.size(); }); if (result.is_error()) complete_current_request(AsyncDeviceRequest::MemoryFault); |