From 69d6145f5a899d265247d95f70d324ae144a2aeb Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 12 Dec 2018 21:22:19 +0100 Subject: [PATCH] os: don't hide tx_cap from block-session interface The 'tx_cap' RPC function is only used at session-creation time. For this reason, it was not listed in the "official" RPC interface in 'block_session.h'. However, this makes the interface more obscure than it needs to be. So this patch promotes it to a regular RPC function. Issue #3092 --- repos/os/include/block_session/block_session.h | 7 ++++++- repos/os/include/block_session/client.h | 6 +++++- repos/os/include/block_session/rpc_object.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/repos/os/include/block_session/block_session.h b/repos/os/include/block_session/block_session.h index b137223ccb..6adbbc1af2 100644 --- a/repos/os/include/block_session/block_session.h +++ b/repos/os/include/block_session/block_session.h @@ -162,6 +162,11 @@ struct Block::Session : public Genode::Session */ virtual Tx::Source *tx() { return 0; } + /** + * Return capability for packet-transmission channel + */ + virtual Genode::Capability tx_cap() = 0; + /******************* ** RPC interface ** @@ -169,7 +174,7 @@ struct Block::Session : public Genode::Session GENODE_RPC(Rpc_info, void, info, Block::sector_t *, Genode::size_t *, Operations *); - GENODE_RPC(Rpc_tx_cap, Genode::Capability, _tx_cap); + GENODE_RPC(Rpc_tx_cap, Genode::Capability, tx_cap); GENODE_RPC(Rpc_sync, void, sync); GENODE_RPC_INTERFACE(Rpc_info, Rpc_tx_cap, Rpc_sync); }; diff --git a/repos/os/include/block_session/client.h b/repos/os/include/block_session/client.h index 9b5bc74d44..633ffe15a4 100644 --- a/repos/os/include/block_session/client.h +++ b/repos/os/include/block_session/client.h @@ -41,7 +41,7 @@ class Block::Session_client : public Genode::Rpc_client Genode::Region_map &rm) : Genode::Rpc_client(session), - _tx(call(), rm, tx_buffer_alloc) + _tx(tx_cap(), rm, tx_buffer_alloc) { } @@ -56,9 +56,13 @@ class Block::Session_client : public Genode::Rpc_client } Tx *tx_channel() { return &_tx; } + Tx::Source *tx() { return _tx.source(); } + void sync() override { call(); } + Genode::Capability tx_cap() override { return call(); } + /* * Wrapper for alloc_packet, allocates 2KB aligned packets */ diff --git a/repos/os/include/block_session/rpc_object.h b/repos/os/include/block_session/rpc_object.h index 062672bde2..76b8168fc5 100644 --- a/repos/os/include/block_session/rpc_object.h +++ b/repos/os/include/block_session/rpc_object.h @@ -57,7 +57,7 @@ class Block::Session_rpc_object : public Genode::Rpc_object _tx_cap() { return _tx.cap(); } + Genode::Capability tx_cap() override { return _tx.cap(); } Tx::Sink *tx_sink() { return _tx.sink(); } };