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
This commit is contained in:
Johannes Schlatow 2022-02-04 17:34:42 +01:00 committed by Christian Helmuth
parent f33916e2dc
commit 19958eafcf
2 changed files with 19 additions and 11 deletions

View File

@ -49,6 +49,8 @@ class Vfs::Single_file_system : public File_system
} }
virtual bool read_ready() = 0; virtual bool read_ready() = 0;
virtual bool notify_read_ready() { return true; }
}; };
struct Single_vfs_dir_handle : Single_vfs_handle struct Single_vfs_dir_handle : Single_vfs_handle
@ -286,6 +288,17 @@ class Vfs::Single_file_system : public File_system
return false; return false;
} }
bool notify_read_ready(Vfs_handle *vfs_handle) override
{
Single_vfs_handle *handle =
static_cast<Single_vfs_handle*>(vfs_handle);
if (handle)
return handle->notify_read_ready();
return false;
}
Ftruncate_result ftruncate(Vfs_handle *, file_size) override Ftruncate_result ftruncate(Vfs_handle *, file_size) override
{ {
return FTRUNCATE_ERR_NO_PERM; return FTRUNCATE_ERR_NO_PERM;

View File

@ -137,6 +137,12 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
bool read_ready() override { bool read_ready() override {
return !_read_buffer.empty(); } return !_read_buffer.empty(); }
bool notify_read_ready() override
{
notifying = true;
return true;
}
Read_result read(char *dst, file_size count, Read_result read(char *dst, file_size count,
file_size &out_count) override 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 ** ** File I/O service interface **
********************************/ ********************************/
bool notify_read_ready(Vfs_handle *vfs_handle) override
{
Terminal_vfs_handle *handle =
static_cast<Terminal_vfs_handle*>(vfs_handle);
if (!handle)
return false;
handle->notifying = true;
return true;
}
Ftruncate_result ftruncate(Vfs_handle *, file_size) override Ftruncate_result ftruncate(Vfs_handle *, file_size) override
{ {
return FTRUNCATE_OK; return FTRUNCATE_OK;