diff --git a/repos/os/include/vfs/single_file_system.h b/repos/os/include/vfs/single_file_system.h index 8aeb26560..7410dc387 100644 --- a/repos/os/include/vfs/single_file_system.h +++ b/repos/os/include/vfs/single_file_system.h @@ -48,6 +48,11 @@ class Vfs::Single_file_system : public File_system virtual Write_result write(char const *src, file_size count, file_size &out_count) = 0; + virtual Sync_result sync() + { + return SYNC_OK; + } + virtual bool read_ready() = 0; }; @@ -275,6 +280,17 @@ class Vfs::Single_file_system : public File_system { return FTRUNCATE_ERR_NO_PERM; } + + Sync_result complete_sync(Vfs_handle *vfs_handle) + { + Single_vfs_handle *handle = + static_cast(vfs_handle); + + if (handle) + return handle->sync(); + + return SYNC_ERR_INVALID; + } }; #endif /* _INCLUDE__VFS__SINGLE_FILE_SYSTEM_H_ */ diff --git a/repos/os/src/lib/vfs/log_file_system.h b/repos/os/src/lib/vfs/log_file_system.h index 3e9eb18fc..a9e9c46ef 100644 --- a/repos/os/src/lib/vfs/log_file_system.h +++ b/repos/os/src/lib/vfs/log_file_system.h @@ -122,16 +122,17 @@ class Vfs::Log_file_system : public Single_file_system count -= curr_count; src += curr_count; } - return WRITE_OK; } bool read_ready() override { return false; } - void sync() + Sync_result sync() override { if (_line_pos > 0) _flush(); + + return SYNC_OK; } }; @@ -167,12 +168,6 @@ class Vfs::Log_file_system : public Single_file_system catch (Genode::Out_of_ram) { return OPEN_ERR_OUT_OF_RAM; } catch (Genode::Out_of_caps) { return OPEN_ERR_OUT_OF_CAPS; } } - - Sync_result complete_sync(Vfs_handle *vfs_handle) - { - static_cast(vfs_handle)->sync(); - return SYNC_OK; - } }; #endif /* _INCLUDE__VFS__LOG_FILE_SYSTEM_H_ */