From 19958eafcf17cd49976258d3ef3f5f840a8510b4 Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Fri, 4 Feb 2022 17:34:42 +0100 Subject: [PATCH] vfs: add notify_read_ready() to Single_vfs_handle The Single_file_system now forwards the `File_io_service::notify_read_ready` method to the handle as it already did for most of the other methods. genodelabs/genode#4394 --- repos/os/include/vfs/single_file_system.h | 13 +++++++++++++ repos/os/src/lib/vfs/terminal_file_system.h | 17 ++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/repos/os/include/vfs/single_file_system.h b/repos/os/include/vfs/single_file_system.h index 5b3b55244a..43fec22000 100644 --- a/repos/os/include/vfs/single_file_system.h +++ b/repos/os/include/vfs/single_file_system.h @@ -49,6 +49,8 @@ class Vfs::Single_file_system : public File_system } virtual bool read_ready() = 0; + + virtual bool notify_read_ready() { return true; } }; struct Single_vfs_dir_handle : Single_vfs_handle @@ -286,6 +288,17 @@ class Vfs::Single_file_system : public File_system return false; } + bool notify_read_ready(Vfs_handle *vfs_handle) override + { + Single_vfs_handle *handle = + static_cast(vfs_handle); + + if (handle) + return handle->notify_read_ready(); + + return false; + } + Ftruncate_result ftruncate(Vfs_handle *, file_size) override { return FTRUNCATE_ERR_NO_PERM; diff --git a/repos/os/src/lib/vfs/terminal_file_system.h b/repos/os/src/lib/vfs/terminal_file_system.h index f9026203d4..1da78b64df 100644 --- a/repos/os/src/lib/vfs/terminal_file_system.h +++ b/repos/os/src/lib/vfs/terminal_file_system.h @@ -137,6 +137,12 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system bool read_ready() override { return !_read_buffer.empty(); } + bool notify_read_ready() override + { + notifying = true; + return true; + } + Read_result read(char *dst, file_size count, file_size &out_count) override { @@ -249,17 +255,6 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system ** File I/O service interface ** ********************************/ - bool notify_read_ready(Vfs_handle *vfs_handle) override - { - Terminal_vfs_handle *handle = - static_cast(vfs_handle); - if (!handle) - return false; - - handle->notifying = true; - return true; - } - Ftruncate_result ftruncate(Vfs_handle *, file_size) override { return FTRUNCATE_OK;