mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
os/include/block: API transition (fix 'deprecated' warnings)
...and adaptation of the users of 'Block::Driver', 'Block::Root' and 'Block::Session_component' to the modified interface. Issue #1987
This commit is contained in:
parent
fb744e7423
commit
344f6f9e53
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -38,6 +38,8 @@ class Signal_helper
|
||||
Genode::Signal_transmitter &sender() { return _sender; }
|
||||
Genode::Parent &parent() { return _env.parent(); }
|
||||
Genode::Env &env() { return _env; }
|
||||
Genode::Ram_session &ram() { return _env.ram(); }
|
||||
Genode::Region_map &rm() { return _env.rm(); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -138,8 +138,8 @@ class Storage_device : public Genode::List<Storage_device>::Element,
|
||||
|
||||
public:
|
||||
|
||||
Storage_device(struct scsi_device *sdev)
|
||||
: Block::Driver(), _sdev(sdev)
|
||||
Storage_device(Genode::Ram_session &ram, struct scsi_device *sdev)
|
||||
: Block::Driver(ram), _sdev(sdev)
|
||||
{
|
||||
/* read device capacity */
|
||||
_capacity();
|
||||
@ -186,7 +186,8 @@ struct Factory : Block::Driver_factory
|
||||
{
|
||||
Storage_device device;
|
||||
|
||||
Factory(struct scsi_device *sdev) : device(sdev) {}
|
||||
Factory(Genode::Ram_session &ram, struct scsi_device *sdev)
|
||||
: device(ram, sdev) {}
|
||||
|
||||
Block::Driver *create() { return &device; }
|
||||
void destroy(Block::Driver *driver) { }
|
||||
@ -215,7 +216,7 @@ void scsi_add_device(struct scsi_device *sdev)
|
||||
using namespace Genode;
|
||||
static bool announce = false;
|
||||
|
||||
static struct Factory factory(sdev);
|
||||
static struct Factory factory(_signal->ram(), sdev);
|
||||
device = &factory.device;
|
||||
|
||||
/*
|
||||
@ -223,7 +224,8 @@ void scsi_add_device(struct scsi_device *sdev)
|
||||
*/
|
||||
if (!announce) {
|
||||
PREPARE_WORK(&delayed, ack_packet);
|
||||
static Block::Root root(_signal->ep(), Lx::Malloc::mem(), factory);
|
||||
static Block::Root root(_signal->ep(), Lx::Malloc::mem(),
|
||||
_signal->rm(), factory);
|
||||
_signal->parent().announce(_signal->ep().rpc_ep().manage(&root));
|
||||
announce = true;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 Genode Labs GmbH
|
||||
* Copyright (C) 2014-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -37,8 +37,9 @@ class Driver : public Block::Driver
|
||||
|
||||
public:
|
||||
|
||||
Driver(Server::Entrypoint &ep)
|
||||
Driver(Server::Entrypoint &ep, Genode::Ram_session &ram)
|
||||
:
|
||||
Block::Driver(ram),
|
||||
_blk_sz(0), _blk_cnt(0), _cgd_device(0)
|
||||
{
|
||||
try {
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2014 Genode Labs GmbH
|
||||
* Copyright (C) 2014-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -27,21 +27,22 @@ struct Main
|
||||
|
||||
struct Factory : Block::Driver_factory
|
||||
{
|
||||
Genode::Entrypoint &ep;
|
||||
Genode::Heap &heap;
|
||||
Genode::Entrypoint &ep;
|
||||
Genode::Ram_session &ram;
|
||||
Genode::Heap &heap;
|
||||
|
||||
Factory(Genode::Entrypoint &ep, Genode::Heap &heap)
|
||||
: ep(ep), heap(heap) { }
|
||||
Factory(Genode::Entrypoint &ep, Genode::Ram_session &ram, Genode::Heap &heap)
|
||||
: ep(ep), ram(ram), heap(heap) { }
|
||||
|
||||
Block::Driver *create() {
|
||||
return new (&heap) Driver(ep); }
|
||||
return new (&heap) Driver(ep, ram); }
|
||||
|
||||
void destroy(Block::Driver *driver) {
|
||||
Genode::destroy(&heap, driver); }
|
||||
|
||||
} factory { env.ep(), heap };
|
||||
} factory { env.ep(), env.ram(), heap };
|
||||
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
|
||||
Main(Genode::Env &env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2010-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -32,8 +32,10 @@ class Driver : public Block::Driver
|
||||
|
||||
public:
|
||||
|
||||
Driver(Heap &heap, size_t block_size, ::String &uri)
|
||||
: _block_size(block_size), _http(heap, uri) {}
|
||||
Driver(Heap &heap, Ram_session &ram,
|
||||
size_t block_size, ::String &uri)
|
||||
: Block::Driver(ram),
|
||||
_block_size(block_size), _http(heap, uri) {}
|
||||
|
||||
|
||||
/*******************************
|
||||
@ -88,7 +90,7 @@ class Factory : public Block::Driver_factory
|
||||
}
|
||||
|
||||
Block::Driver *create() {
|
||||
return new (&_heap) Driver(_heap, _blk_sz, _uri); }
|
||||
return new (&_heap) Driver(_heap, _env.ram(), _blk_sz, _uri); }
|
||||
|
||||
void destroy(Block::Driver *driver) {
|
||||
Genode::destroy(&_heap, driver); }
|
||||
@ -100,7 +102,7 @@ struct Main
|
||||
Env &env;
|
||||
Heap heap { env.ram(), env.rm() };
|
||||
Factory factory { env, heap };
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
|
||||
Main(Env &env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -177,9 +177,10 @@ class Block::Session_component : public Block::Session_component_base,
|
||||
*/
|
||||
Session_component(Driver_factory &driver_factory,
|
||||
Genode::Entrypoint &ep,
|
||||
Genode::Region_map &rm,
|
||||
size_t buf_size)
|
||||
: Session_component_base(driver_factory, buf_size),
|
||||
Driver_session(_rq_ds, ep.rpc_ep()),
|
||||
Driver_session(rm, _rq_ds, ep.rpc_ep()),
|
||||
_rq_phys(Dataspace_client(_rq_ds).phys_addr()),
|
||||
_sink_ack(ep, *this, &Session_component::_signal),
|
||||
_sink_submit(ep, *this, &Session_component::_signal),
|
||||
@ -250,6 +251,7 @@ class Block::Root : public Genode::Root_component<Block::Session_component,
|
||||
|
||||
Driver_factory &_driver_factory;
|
||||
Genode::Entrypoint &_ep;
|
||||
Genode::Region_map &_rm;
|
||||
|
||||
protected:
|
||||
|
||||
@ -282,7 +284,7 @@ class Block::Root : public Genode::Root_component<Block::Session_component,
|
||||
}
|
||||
|
||||
return new (md_alloc()) Session_component(_driver_factory,
|
||||
_ep, tx_buf_size);
|
||||
_ep, _rm, tx_buf_size);
|
||||
}
|
||||
|
||||
public:
|
||||
@ -292,14 +294,16 @@ class Block::Root : public Genode::Root_component<Block::Session_component,
|
||||
*
|
||||
* \param ep entrypoint handling this root component
|
||||
* \param md_alloc allocator to allocate session components
|
||||
* \param rm region map
|
||||
* \param driver_factory factory to create and destroy driver backend
|
||||
*/
|
||||
Root(Genode::Entrypoint &ep,
|
||||
Allocator &md_alloc,
|
||||
Genode::Region_map &rm,
|
||||
Driver_factory &driver_factory)
|
||||
:
|
||||
Root_component(ep, md_alloc),
|
||||
_driver_factory(driver_factory), _ep(ep)
|
||||
_driver_factory(driver_factory), _ep(ep), _rm(rm)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -83,6 +83,8 @@ class Block::Driver
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Ram_session &_ram_session;
|
||||
|
||||
Driver_session_base *_session = nullptr;
|
||||
|
||||
public:
|
||||
@ -93,6 +95,12 @@ class Block::Driver
|
||||
class Io_error : public ::Genode::Exception { };
|
||||
class Request_congestion : public ::Genode::Exception { };
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Driver(Genode::Ram_session &ram_session)
|
||||
: _ram_session(ram_session) { }
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
@ -201,7 +209,7 @@ class Block::Driver
|
||||
*/
|
||||
virtual Genode::Ram_dataspace_capability
|
||||
alloc_dma_buffer(Genode::size_t size) {
|
||||
return Genode::env()->ram_session()->alloc(size); }
|
||||
return _ram_session.alloc(size); }
|
||||
|
||||
/**
|
||||
* Free buffer which is suitable for DMA.
|
||||
@ -209,7 +217,7 @@ class Block::Driver
|
||||
* Note: has to be overriden by DMA-capable devices
|
||||
*/
|
||||
virtual void free_dma_buffer(Genode::Ram_dataspace_capability c) {
|
||||
return Genode::env()->ram_session()->free(c); }
|
||||
return _ram_session.free(c); }
|
||||
|
||||
/**
|
||||
* Synchronize with device.
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -69,7 +69,7 @@ struct Ahci
|
||||
hba.init();
|
||||
|
||||
/* search for devices */
|
||||
scan_ports(env.rm());
|
||||
scan_ports(env.rm(), env.ram());
|
||||
}
|
||||
|
||||
bool atapi(unsigned sig)
|
||||
@ -114,7 +114,7 @@ struct Ahci
|
||||
log("64-bit support: ", hba.supports_64bit() ? "yes" : "no");
|
||||
}
|
||||
|
||||
void scan_ports(Genode::Region_map &rm)
|
||||
void scan_ports(Genode::Region_map &rm, Genode::Ram_session &ram)
|
||||
{
|
||||
Genode::log("number of ports: ", hba.port_count(), " "
|
||||
"pi: ", Genode::Hex(hba.read<Hba::Pi>()));
|
||||
@ -150,13 +150,13 @@ struct Ahci
|
||||
switch (sig) {
|
||||
|
||||
case ATA_SIG:
|
||||
ports[i] = new (&alloc) Ata_driver(alloc, port, root,
|
||||
ports[i] = new (&alloc) Ata_driver(alloc, port, ram, root,
|
||||
ready_count);
|
||||
break;
|
||||
|
||||
case ATAPI_SIG:
|
||||
case ATAPI_SIG_QEMU:
|
||||
ports[i] = new (&alloc) Atapi_driver(port, root,
|
||||
ports[i] = new (&alloc) Atapi_driver(port, ram, root,
|
||||
ready_count);
|
||||
break;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -796,9 +796,10 @@ struct Port_driver : Port, Block::Driver
|
||||
Ahci_root &root;
|
||||
unsigned &sem;
|
||||
|
||||
Port_driver(Port &port, Ahci_root &root, unsigned &sem)
|
||||
: Port(port), root(root), sem(sem) {
|
||||
sem++; }
|
||||
Port_driver(Port &port, Genode::Ram_session &ram, Ahci_root &root,
|
||||
unsigned &sem)
|
||||
: Port(port), Block::Driver(ram),
|
||||
root(root), sem(sem) { sem++; }
|
||||
|
||||
virtual void handle_irq() = 0;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -189,8 +189,9 @@ struct Ata_driver : Port_driver
|
||||
Block::Packet_descriptor pending[32];
|
||||
|
||||
Ata_driver(Genode::Allocator &alloc,
|
||||
Port &port, Ahci_root &root, unsigned &sem)
|
||||
: Port_driver(port, root, sem), alloc(alloc)
|
||||
Port &port, Genode::Ram_session &ram,
|
||||
Ahci_root &root, unsigned &sem)
|
||||
: Port_driver(port, ram, root, sem), alloc(alloc)
|
||||
{
|
||||
Port::init();
|
||||
identify_device();
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -24,8 +24,8 @@ struct Atapi_driver : Port_driver
|
||||
unsigned sense_tries = 0;
|
||||
Block::Packet_descriptor pending;
|
||||
|
||||
Atapi_driver(Port &port, Ahci_root &root, unsigned &sem)
|
||||
: Port_driver(port, root, sem)
|
||||
Atapi_driver(Port &port, Genode::Ram_session &ram, Ahci_root &root, unsigned &sem)
|
||||
: Port_driver(port, ram, root, sem)
|
||||
{
|
||||
Port::init();
|
||||
Port::write<Cmd::Atapi>(1);
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
* Copyright (C) 2016-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -55,8 +55,9 @@ class Session_component : public Block::Session_component
|
||||
|
||||
Session_component(Block::Driver_factory &driver_factory,
|
||||
Genode::Entrypoint &ep,
|
||||
Genode::Region_map &rm,
|
||||
Genode::size_t buf_size)
|
||||
: Block::Session_component(driver_factory, ep, buf_size) { }
|
||||
: Block::Session_component(driver_factory, ep, rm, buf_size) { }
|
||||
|
||||
Block::Driver_factory &factory() { return _driver_factory; }
|
||||
};
|
||||
@ -137,7 +138,7 @@ class Block::Root_multiple_clients : public Root_component< ::Session_component>
|
||||
|
||||
Block::Factory *factory = new (&_alloc) Block::Factory(num);
|
||||
::Session_component *session = new (&_alloc)
|
||||
::Session_component(*factory, _env.ep(), tx_buf_size);
|
||||
::Session_component(*factory, _env.ep(), _env.rm(), tx_buf_size);
|
||||
log("session opened at device ", num, " for '", label, "'");
|
||||
return session;
|
||||
}
|
||||
|
@ -30,6 +30,9 @@ class Sd_card::Driver_base : public Block::Driver,
|
||||
{
|
||||
public:
|
||||
|
||||
Driver_base(Genode::Ram_session &ram)
|
||||
: Block::Driver(ram) { }
|
||||
|
||||
/*******************
|
||||
** Block::Driver **
|
||||
*******************/
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -43,7 +43,7 @@ struct Main
|
||||
|
||||
} factory { env, heap };
|
||||
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
|
||||
Main(Genode::Env &env) : env(env)
|
||||
{
|
||||
|
@ -19,7 +19,10 @@ using namespace Genode;
|
||||
using namespace Sd_card;
|
||||
|
||||
|
||||
Driver::Driver(Env &env) : Attached_mmio(MSH_BASE, MSH_SIZE), _env(env)
|
||||
Driver::Driver(Env &env)
|
||||
:
|
||||
Driver_base(env.ram()),
|
||||
Attached_mmio(MSH_BASE, MSH_SIZE), _env(env)
|
||||
{
|
||||
_irq.sigh(_irq_handler);
|
||||
_irq.ack_irq();
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2015-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -235,6 +235,7 @@ void Driver::write_dma(Block::sector_t blk_nr,
|
||||
|
||||
Driver::Driver(Env &env)
|
||||
:
|
||||
Driver_base(env.ram()),
|
||||
Attached_mmio(Board_base::SDHC_MMIO_BASE, Board_base::SDHC_MMIO_SIZE),
|
||||
_env(env)
|
||||
{
|
||||
|
@ -372,6 +372,7 @@ Csd Driver::_read_csd()
|
||||
|
||||
Driver::Driver(Env &env)
|
||||
:
|
||||
Driver_base(env.ram()),
|
||||
Attached_mmio(MMCHS1_MMIO_BASE, MMCHS1_MMIO_SIZE), _ep(env.ep())
|
||||
{
|
||||
_irq.sigh(_irq_handler);
|
||||
|
@ -138,7 +138,8 @@ void Driver::_write_data(unsigned length,
|
||||
}
|
||||
|
||||
|
||||
Driver::Driver(Env &env) : Attached_mmio(PL180_PHYS, PL180_SIZE), _timer(env)
|
||||
Driver::Driver(Env &env) : Block::Driver(env.ram()),
|
||||
Attached_mmio(PL180_PHYS, PL180_SIZE), _timer(env)
|
||||
{
|
||||
enum { POWER_UP = 2, POWER_ON = 3 };
|
||||
|
||||
|
@ -23,6 +23,7 @@ using namespace Sd_card;
|
||||
|
||||
Driver::Driver(Env &env)
|
||||
:
|
||||
Driver_base(env.ram()),
|
||||
Attached_mmio(Board_base::SDHCI_BASE, Board_base::SDHCI_SIZE),
|
||||
_ram(env.ram())
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Genode Labs GmbH
|
||||
* Copyright (C) 2016-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -710,6 +710,7 @@ struct Usb::Block_driver : Usb::Completion,
|
||||
Block_driver(Env &env, Genode::Allocator &alloc,
|
||||
Genode::Signal_context_capability sigh)
|
||||
:
|
||||
Block::Driver(env.ram()),
|
||||
env(env), ep(env.ep()), announce_sigh(sigh), alloc(&alloc),
|
||||
device(&alloc, usb, ep)
|
||||
{
|
||||
@ -817,7 +818,7 @@ struct Usb::Main
|
||||
};
|
||||
|
||||
Factory factory { env, heap, announce_dispatcher };
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
|
||||
Main(Env &env) : env(env) { }
|
||||
};
|
||||
|
@ -334,7 +334,8 @@ class Driver : public Block::Driver
|
||||
* \param ep server entrypoint
|
||||
*/
|
||||
Driver(Genode::Env &env, Genode::Heap &heap)
|
||||
: _env(env),
|
||||
: Block::Driver(env.ram()),
|
||||
_env(env),
|
||||
_r_slab(&heap),
|
||||
_alloc(&heap, CACHE_BLK_SIZE),
|
||||
_blk(_env, &_alloc, Block::Session::TX_QUEUE_SIZE*CACHE_BLK_SIZE),
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -70,7 +70,7 @@ struct Main
|
||||
Genode::Env &env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
Factory<Lru_policy> factory { env, heap };
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
Genode::Signal_handler<Main> resource_dispatcher {
|
||||
env.ep(), *this, &Main::resource_handler };
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2010-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -72,7 +72,7 @@ class Ram_blk : public Block::Driver
|
||||
*/
|
||||
Ram_blk(Env &env, Allocator &alloc,
|
||||
const char *name, size_t block_size)
|
||||
:
|
||||
: Block::Driver(env.ram()),
|
||||
_env(env), _alloc(&alloc),
|
||||
_rom_ds(new (_alloc) Attached_rom_dataspace(_env, name)),
|
||||
_size(_rom_ds->size()),
|
||||
@ -89,7 +89,7 @@ class Ram_blk : public Block::Driver
|
||||
* Construct empty RAM dataspace
|
||||
*/
|
||||
Ram_blk(Env &env, size_t size, size_t block_size)
|
||||
:
|
||||
: Block::Driver(env.ram()),
|
||||
_env(env),
|
||||
_size(size),
|
||||
_block_size(block_size),
|
||||
@ -194,7 +194,7 @@ struct Main
|
||||
Genode::destroy(&alloc, driver); }
|
||||
} factory { env, heap, config_rom.xml() };
|
||||
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
|
||||
Main(Env &env) : env(env)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2010-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -36,7 +36,8 @@ class Rom_blk : public Block::Driver
|
||||
using String = Genode::String<64UL>;
|
||||
|
||||
Rom_blk(Env &env, String &name, size_t blk_sz)
|
||||
: _env(env), _rom(env, name.string()), _blk_sz(blk_sz) {}
|
||||
: Block::Driver(env.ram()), _env(env), _rom(env, name.string()),
|
||||
_blk_sz(blk_sz) {}
|
||||
|
||||
|
||||
/****************************
|
||||
@ -116,7 +117,7 @@ struct Main
|
||||
Genode::destroy(&heap, driver); }
|
||||
} factory { env, heap };
|
||||
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
|
||||
Main(Env &env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013-2016 Genode Labs GmbH
|
||||
* Copyright (C) 2013-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -36,7 +36,8 @@ class Driver : public Block::Driver
|
||||
public:
|
||||
|
||||
Driver(Genode::Env &env, Genode::size_t number, Genode::size_t size)
|
||||
: _number(number), _size(size),
|
||||
: Block::Driver(env.ram()),
|
||||
_number(number), _size(size),
|
||||
_blk_ds(env.ram().alloc(number*size)),
|
||||
_blk_buf(env.rm().attach(_blk_ds)) {}
|
||||
|
||||
@ -123,7 +124,7 @@ struct Main
|
||||
void destroy(Block::Driver *driver) { }
|
||||
} factory { env, heap };
|
||||
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
Timer::Connection timer { env };
|
||||
Genode::Signal_handler<Driver> dispatcher { env.ep(), *factory.driver,
|
||||
&Driver::handler };
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2010-2013 Genode Labs GmbH
|
||||
* Copyright (C) 2010-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU General Public License version 2.
|
||||
@ -33,8 +33,9 @@ class Driver : public Block::Driver
|
||||
|
||||
public:
|
||||
|
||||
Driver()
|
||||
: _fb_mode(_fb.mode()),
|
||||
Driver(Genode::Ram_session &ram)
|
||||
: Block::Driver(ram),
|
||||
_fb_mode(_fb.mode()),
|
||||
_fb_cap(_fb.dataspace()),
|
||||
_fb_dsc(_fb_cap),
|
||||
_fb_addr(Genode::env()->rm_session()->attach(_fb_cap)),
|
||||
@ -99,11 +100,13 @@ class Driver : public Block::Driver
|
||||
|
||||
struct Factory : Block::Driver_factory
|
||||
{
|
||||
Genode::Heap &heap;
|
||||
Genode::Ram_session &ram;
|
||||
Genode::Heap &heap;
|
||||
|
||||
Factory(Genode::Heap &heap) : heap(heap) {}
|
||||
Factory(Genode::Ram_session &ram, Genode::Heap &heap)
|
||||
: ram(ram), heap(heap) {}
|
||||
|
||||
Block::Driver *create() { return new (&heap) Driver(); }
|
||||
Block::Driver *create() { return new (&heap) Driver(ram); }
|
||||
|
||||
void destroy(Block::Driver *driver) { Genode::destroy(&heap, driver); }
|
||||
};
|
||||
@ -113,8 +116,8 @@ struct Main
|
||||
{
|
||||
Genode::Env &env;
|
||||
Genode::Heap heap { env.ram(), env.rm() };
|
||||
struct Factory factory { heap };
|
||||
Block::Root root { env.ep(), heap, factory };
|
||||
struct Factory factory { env.ram(), heap };
|
||||
Block::Root root { env.ep(), heap, env.rm(), factory };
|
||||
|
||||
Main(Genode::Env &env) : env(env) {
|
||||
env.parent().announce(env.ep().manage(root)); }
|
||||
|
Loading…
Reference in New Issue
Block a user