vfs: implement 'sync' in Block VFS plugin

Fixes #3659.
This commit is contained in:
Josef Söntgen 2020-02-18 14:43:11 +01:00 committed by Norman Feske
parent 2495a86aff
commit a71ef16423
1 changed files with 28 additions and 0 deletions

View File

@ -319,6 +319,34 @@ class Vfs::Block_file_system : public Single_file_system
}
Sync_result sync() override
{
/*
* Just in case bail if we cannot submit the packet.
* (Since the plugin operates in a synchronous fashion
* that should not happen.)
*/
if (!_tx_source->ready_to_submit()) {
Genode::error("vfs_block: could not sync blocks");
return SYNC_ERR_INVALID;
}
Block::Packet_descriptor p =
Block::Session::sync_all_packet_descriptor(
_block.info(), Block::Session::Tag { 0 });
_tx_source->submit_packet(p);
p = _tx_source->get_acked_packet();
_tx_source->release_packet(p);
if (!p.succeeded()) {
Genode::error("vfs_block: syncing blocks failed");
return SYNC_ERR_INVALID;
}
return SYNC_OK;
}
bool read_ready() override { return true; }
};