diff --git a/repos/os/include/vfs/file_io_service.h b/repos/os/include/vfs/file_io_service.h index 28b42fc5fd..ab90e4be6e 100644 --- a/repos/os/include/vfs/file_io_service.h +++ b/repos/os/include/vfs/file_io_service.h @@ -175,7 +175,7 @@ struct Vfs::File_io_service : Interface ** Sync ** **********/ - enum Sync_result { SYNC_QUEUED, SYNC_OK }; + enum Sync_result { SYNC_QUEUED, SYNC_ERR_INVALID, SYNC_OK }; /** * Queue sync operation diff --git a/repos/os/include/vfs/print.h b/repos/os/include/vfs/print.h index 8f7bc1d281..cb5f80581f 100644 --- a/repos/os/include/vfs/print.h +++ b/repos/os/include/vfs/print.h @@ -187,6 +187,7 @@ static inline void print(Genode::Output &output, Vfs::File_io_service::Sync_resu switch (r) { CASE_PRINT(SYNC_OK); CASE_PRINT(SYNC_QUEUED); + CASE_PRINT(SYNC_ERR_INVALID); } #undef CASE_PRINT diff --git a/repos/os/src/lib/vfs/fs_file_system.h b/repos/os/src/lib/vfs/fs_file_system.h index 0339e2937e..8b6adaa0cd 100644 --- a/repos/os/src/lib/vfs/fs_file_system.h +++ b/repos/os/src/lib/vfs/fs_file_system.h @@ -211,12 +211,15 @@ class Vfs::Fs_file_system : public File_system ::File_system::Session::Tx::Source &source = *_fs.tx(); + Sync_result result = packet.succeeded() + ? SYNC_OK : SYNC_ERR_INVALID; + queued_sync_state = Handle_state::Queued_state::IDLE; queued_sync_packet = ::File_system::Packet_descriptor(); source.release_packet(packet); - return SYNC_OK; + return result; } }; diff --git a/repos/os/src/server/vfs/main.cc b/repos/os/src/server/vfs/main.cc index a979e15dec..d05185a5c6 100644 --- a/repos/os/src/server/vfs/main.cc +++ b/repos/os/src/server/vfs/main.cc @@ -227,8 +227,7 @@ class Vfs_server::Session_component : public File_system::Session_rpc_object, */ try { _apply(packet.handle(), [&] (Io_node &node) { - node.sync(); - succeeded = true; + succeeded = node.sync(); }); } catch (Operation_incomplete) { throw Not_ready(); diff --git a/repos/os/src/server/vfs/node.h b/repos/os/src/server/vfs/node.h index 2b499af113..c02d22b575 100644 --- a/repos/os/src/server/vfs/node.h +++ b/repos/os/src/server/vfs/node.h @@ -270,7 +270,7 @@ class Vfs_server::Io_node : public Vfs_server::Node, bool notify_read_ready() const { return _notify_read_ready; } - void sync() + bool sync() { typedef Vfs::File_io_service::Sync_result Result; Result out_result = Result::SYNC_OK; @@ -288,7 +288,10 @@ class Vfs_server::Io_node : public Vfs_server::Node, switch (out_result) { case Result::SYNC_OK: op_state = Op_state::IDLE; - return; + return true; + + case Result::SYNC_ERR_INVALID: + return false; case Result::SYNC_QUEUED: op_state = Op_state::SYNC_QUEUED; @@ -299,6 +302,7 @@ class Vfs_server::Io_node : public Vfs_server::Node, case Op_state::READ_QUEUED: throw Operation_incomplete(); } + return false; } };