block_session: extend interface with sync() call
To support components, which implement the block session's server side rpc object, and which doesn't write data to their device backend immediately, an additional synchronization call is needed. Thereby, clients like for instance a file system can tell these components, when a synchronization is required. Ref #113
This commit is contained in:
parent
44c7d64fb3
commit
50d73e7890
|
@ -92,6 +92,8 @@ namespace Block {
|
|||
ops->set_operation(Packet_descriptor::WRITE);
|
||||
}
|
||||
|
||||
void sync() {}
|
||||
|
||||
void complete(Packet_descriptor &packet, bool success)
|
||||
{
|
||||
packet.succeeded(success);
|
||||
|
|
|
@ -178,6 +178,8 @@ namespace Block {
|
|||
ops->set_operation(Packet_descriptor::READ);
|
||||
}
|
||||
|
||||
void sync() {}
|
||||
|
||||
/**
|
||||
* Signal indicating that transmit thread is ready
|
||||
*/
|
||||
|
|
|
@ -142,6 +142,8 @@ namespace Block {
|
|||
ops->set_operation(Packet_descriptor::READ);
|
||||
ops->set_operation(Packet_descriptor::WRITE);
|
||||
}
|
||||
|
||||
void sync() { _driver.sync(); }
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -98,6 +98,11 @@ namespace Block {
|
|||
* Allocate buffer which is suitable for DMA.
|
||||
*/
|
||||
virtual Genode::Ram_dataspace_capability alloc_dma_buffer(Genode::size_t) = 0;
|
||||
|
||||
/**
|
||||
* Synchronize with with device.
|
||||
*/
|
||||
virtual void sync() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -129,6 +129,11 @@ namespace Block {
|
|||
Genode::size_t *blk_size,
|
||||
Operations *ops) = 0;
|
||||
|
||||
/**
|
||||
* Synchronize with block device, like ensuring data to be written
|
||||
*/
|
||||
virtual void sync() = 0;
|
||||
|
||||
/**
|
||||
* Request packet-transmission channel
|
||||
*/
|
||||
|
@ -146,7 +151,8 @@ namespace Block {
|
|||
|
||||
GENODE_RPC(Rpc_info, void, info, Genode::size_t *, Genode::size_t *, Operations *);
|
||||
GENODE_RPC(Rpc_tx_cap, Genode::Capability<Tx>, _tx_cap);
|
||||
GENODE_RPC_INTERFACE(Rpc_info, Rpc_tx_cap);
|
||||
GENODE_RPC(Rpc_sync, void, sync);
|
||||
GENODE_RPC_INTERFACE(Rpc_info, Rpc_tx_cap, Rpc_sync);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ namespace Block {
|
|||
|
||||
Tx *tx_channel() { return &_tx; }
|
||||
Tx::Source *tx() { return _tx.source(); }
|
||||
void sync() { call<Rpc_sync>(); }
|
||||
|
||||
/*
|
||||
* Wrapper for alloc_packet, allocates 2KB aligned packets
|
||||
|
|
|
@ -78,6 +78,8 @@ class Ahci_driver_base : public Block::Driver
|
|||
|
||||
Ram_dataspace_capability alloc_dma_buffer(size_t size) {
|
||||
return _device->alloc_dma_buffer(size); }
|
||||
|
||||
void sync() {}
|
||||
};
|
||||
|
||||
#endif /* _AHCI_DRIVER_BASE_H_ */
|
||||
|
|
|
@ -159,6 +159,8 @@ namespace Block {
|
|||
ops->set_operation(Packet_descriptor::WRITE);
|
||||
}
|
||||
|
||||
void sync() {}
|
||||
|
||||
Ata::Device* device() { return _device; };
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,6 +125,8 @@ class Block::Exynos5_driver : public Block::Driver
|
|||
|
||||
Ram_dataspace_capability alloc_dma_buffer(size_t size) {
|
||||
return Genode::env()->ram_session()->alloc(size, false); }
|
||||
|
||||
void sync() {}
|
||||
};
|
||||
|
||||
#endif /* _DRIVER_H_ */
|
||||
|
|
|
@ -118,6 +118,8 @@ class Block::Omap4_driver : public Block::Driver
|
|||
|
||||
Ram_dataspace_capability alloc_dma_buffer(size_t size) {
|
||||
return Genode::env()->ram_session()->alloc(size, false); }
|
||||
|
||||
void sync() {}
|
||||
};
|
||||
|
||||
#endif /* _DRIVER_H_ */
|
||||
|
|
|
@ -135,6 +135,8 @@ class Sd_card : public Block::Driver
|
|||
{
|
||||
return Genode::env()->ram_session()->alloc(size, false);
|
||||
}
|
||||
|
||||
void sync() {}
|
||||
};
|
||||
|
||||
#endif /* _SD_CARD_H_ */
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Partition {
|
|||
Partition *partition(int num) { return (num < MAX_PARTITIONS) ? _part_list[num] : 0; }
|
||||
size_t blk_size() { return _blk_size; }
|
||||
inline unsigned long max_packets() { return (MAX_PACKET_SIZE / _blk_size); }
|
||||
|
||||
void sync() { _blk.sync(); }
|
||||
|
||||
/**
|
||||
* Partition table entry format
|
||||
|
|
|
@ -137,6 +137,8 @@ namespace Block {
|
|||
ops->set_operation(Packet_descriptor::WRITE);
|
||||
}
|
||||
|
||||
void sync() { Partition::sync(); }
|
||||
|
||||
Partition::Partition *partition() { return _partition; }
|
||||
};
|
||||
|
||||
|
|
|
@ -72,6 +72,11 @@ namespace Partition {
|
|||
* Returns block size of back end
|
||||
*/
|
||||
Genode::size_t blk_size();
|
||||
|
||||
/**
|
||||
* Synchronize with backend device
|
||||
*/
|
||||
void sync();
|
||||
}
|
||||
|
||||
#endif /* _PART_BLK_H_ */
|
||||
|
|
|
@ -173,6 +173,8 @@ namespace Block {
|
|||
*blk_size = _block_size;
|
||||
ops->set_operation(Block::Packet_descriptor::READ);
|
||||
}
|
||||
|
||||
void sync() {}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -153,6 +153,8 @@ namespace Block {
|
|||
ops->set_operation(Packet_descriptor::WRITE);
|
||||
}
|
||||
|
||||
void sync() {}
|
||||
|
||||
/** Signal that transmit thread is ready */
|
||||
void tx_ready() { _startup_sema.up(); }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue