block: extend interface of generic driver class

To support read-only devices like CDROMs, or rom_blk the supported
block operations have to be stated by specific the device driver.

Ref #966
This commit is contained in:
Stefan Kalkowski
2013-11-23 00:24:44 +01:00
committed by Norman Feske
parent 5a4cb7fcfb
commit 0c8a4f9f3a
6 changed files with 40 additions and 3 deletions

View File

@@ -136,8 +136,7 @@ class Block::Session_component : public Block::Session_rpc_object
{
*blk_count = _driver.block_count();
*blk_size = _driver.block_size();
ops->set_operation(Packet_descriptor::READ);
ops->set_operation(Packet_descriptor::WRITE);
*ops = _driver.ops();
}
void sync() { _driver.sync(); }

View File

@@ -19,7 +19,7 @@
#include <base/stdint.h>
#include <ram_session/ram_session.h>
#include <block_session/block_session.h>
namespace Block {
@@ -43,6 +43,11 @@ namespace Block {
*/
virtual Genode::size_t block_count() = 0;
/**
* Request operations supported by the device
*/
virtual Session::Operations ops() = 0;
/**
* Read from medium
*