os: extentend File_system interface with sync RPC

Users of a File_system_session might want to force a file system
to flush or rather to synchronize its internal cache. A concret
default implementation is provided because not all file systems
maintain an internal cache and are not required to synchronize
caches.

Fixes #1007.
This commit is contained in:
Josef Söntgen 2013-12-16 16:46:00 +01:00 committed by Norman Feske
parent 944be1b4e6
commit 1c67e3bb43
2 changed files with 17 additions and 1 deletions

View File

@ -104,6 +104,11 @@ namespace File_system {
{
call<Rpc_sigh>(node, sigh);
}
void sync()
{
call<Rpc_sync>();
}
};
}

View File

@ -280,6 +280,15 @@ namespace File_system {
*/
virtual void sigh(Node_handle, Signal_context_capability sigh) = 0;
/**
* Synchronize file system
*
* This is only needed by file systems that maintain an internal
* cache, which needs to be flushed on certain occasions. Therefore,
* the default implementation just serves as a reminder.
*/
virtual void sync() { PWRN("sync() not implemented!"); }
/*******************
** RPC interface **
@ -317,6 +326,7 @@ namespace File_system {
GENODE_RPC_THROW(Rpc_sigh, void, sigh,
GENODE_TYPE_LIST(Invalid_handle),
Node_handle, Signal_context_capability);
GENODE_RPC(Rpc_sync, void, sync);
/*
* Manual type-list definition, needed because the RPC interface
@ -335,8 +345,9 @@ namespace File_system {
Meta::Type_tuple<Rpc_truncate,
Meta::Type_tuple<Rpc_move,
Meta::Type_tuple<Rpc_sigh,
Meta::Type_tuple<Rpc_sync,
Meta::Empty>
> > > > > > > > > > > Rpc_functions;
> > > > > > > > > > > > Rpc_functions;
};
}