From d815322efe814558463ebe062d8009536ed97585 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 12 Apr 2022 15:17:22 +0200 Subject: [PATCH] os: simplify split block operations This patch changes the meaning of the 'offset' parameter of the 'produce_write_content' and 'consume_read_result' hook functions. The value used to reflect the absolute byte position but in practice, a job-relative byte offset is desired. Issue #4474 --- repos/os/include/block_session/connection.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/os/include/block_session/connection.h b/repos/os/include/block_session/connection.h index dfdbce8847..5b6a9c9e07 100644 --- a/repos/os/include/block_session/connection.h +++ b/repos/os/include/block_session/connection.h @@ -127,7 +127,7 @@ struct Block::Connection : Genode::Connection, Session_client Operation const operation = job._curr_operation(); size_t const block_size = job._connection._info.block_size; - fn(operation.block_number * block_size, + fn(job._position * block_size, Genode::min(job._payload.bytes, operation.count * block_size)); } @@ -142,7 +142,7 @@ struct Block::Connection : Genode::Connection, Session_client Packet_descriptor const p(_curr_operation(), _payload, tag); if (_operation.type == Operation::Type::WRITE) - _with_offset_and_length(job, [&] (seek_off_t offset, size_t length) { + _with_offset_and_length(job, [&] (off_t offset, size_t length) { policy.produce_write_content(job, offset, tx.packet_content(p), length); }); @@ -306,7 +306,7 @@ struct Block::Connection : Genode::Connection, Session_client * communication buffer shared with the server) * \param length size of 'dst' buffer in bytes */ - void produce_write_content(Job &, seek_off_t offset, + void produce_write_content(Job &, off_t offset, char *dst, size_t length); /** @@ -316,7 +316,7 @@ struct Block::Connection : Genode::Connection, Session_client * \param src pointer to received data * \param length number of bytes received */ - void consume_read_result(Job &, seek_off_t offset, + void consume_read_result(Job &, off_t offset, char const *src, size_t length); /** @@ -372,7 +372,7 @@ bool Block::Connection::_try_process_ack(POLICY &policy, Tx::Source &tx) _tags.template apply<_JOB>(id, [&] (_JOB &job) { if (type == Operation::Type::READ) - Job::_with_offset_and_length(job, [&] (seek_off_t offset, size_t length) { + Job::_with_offset_and_length(job, [&] (off_t offset, size_t length) { policy.consume_read_result(job, offset, tx.packet_content(p), length); });