mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 11:55:24 +00:00
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
This commit is contained in:
parent
8ece236635
commit
d815322efe
@ -127,7 +127,7 @@ struct Block::Connection : Genode::Connection<Session>, 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>, 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>, 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>, 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<JOB>::_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); });
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user