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
This commit is contained in:
Norman Feske 2018-12-12 21:22:19 +01:00
parent aa66b5d62f
commit 69d6145f5a
3 changed files with 12 additions and 3 deletions

View File

@ -162,6 +162,11 @@ struct Block::Session : public Genode::Session
*/ */
virtual Tx::Source *tx() { return 0; } virtual Tx::Source *tx() { return 0; }
/**
* Return capability for packet-transmission channel
*/
virtual Genode::Capability<Tx> tx_cap() = 0;
/******************* /*******************
** RPC interface ** ** RPC interface **
@ -169,7 +174,7 @@ struct Block::Session : public Genode::Session
GENODE_RPC(Rpc_info, void, info, Block::sector_t *, GENODE_RPC(Rpc_info, void, info, Block::sector_t *,
Genode::size_t *, Operations *); Genode::size_t *, Operations *);
GENODE_RPC(Rpc_tx_cap, Genode::Capability<Tx>, _tx_cap); GENODE_RPC(Rpc_tx_cap, Genode::Capability<Tx>, tx_cap);
GENODE_RPC(Rpc_sync, void, sync); GENODE_RPC(Rpc_sync, void, sync);
GENODE_RPC_INTERFACE(Rpc_info, Rpc_tx_cap, Rpc_sync); GENODE_RPC_INTERFACE(Rpc_info, Rpc_tx_cap, Rpc_sync);
}; };

View File

@ -41,7 +41,7 @@ class Block::Session_client : public Genode::Rpc_client<Session>
Genode::Region_map &rm) Genode::Region_map &rm)
: :
Genode::Rpc_client<Session>(session), Genode::Rpc_client<Session>(session),
_tx(call<Rpc_tx_cap>(), rm, tx_buffer_alloc) _tx(tx_cap(), rm, tx_buffer_alloc)
{ } { }
@ -56,9 +56,13 @@ class Block::Session_client : public Genode::Rpc_client<Session>
} }
Tx *tx_channel() { return &_tx; } Tx *tx_channel() { return &_tx; }
Tx::Source *tx() { return _tx.source(); } Tx::Source *tx() { return _tx.source(); }
void sync() override { call<Rpc_sync>(); } void sync() override { call<Rpc_sync>(); }
Genode::Capability<Tx> tx_cap() override { return call<Rpc_tx_cap>(); }
/* /*
* Wrapper for alloc_packet, allocates 2KB aligned packets * Wrapper for alloc_packet, allocates 2KB aligned packets
*/ */

View File

@ -57,7 +57,7 @@ class Block::Session_rpc_object : public Genode::Rpc_object<Session, Session_rpc
* This method is called by the client via an RPC call at session * This method is called by the client via an RPC call at session
* construction time. * construction time.
*/ */
Genode::Capability<Tx> _tx_cap() { return _tx.cap(); } Genode::Capability<Tx> tx_cap() override { return _tx.cap(); }
Tx::Sink *tx_sink() { return _tx.sink(); } Tx::Sink *tx_sink() { return _tx.sink(); }
}; };