vfs: propagate I/O activity via 'wakeup_vfs_user'

This commit supplements the various I/O signal handlers of the VFS
plugins with calls of the new 'Vfs::Env::User::wakeup_vfs_user'
interface, which will subsequently replace the old 'Io_progress_handler'
(issue #4697).

Issue #4706
This commit is contained in:
Norman Feske 2022-12-21 14:51:48 +01:00 committed by Christian Helmuth
parent 767632e1af
commit bb904b9166
8 changed files with 45 additions and 13 deletions

View File

@ -438,7 +438,7 @@ struct Vfs::Block_file_system::Local_factory : File_system_factory
Genode::Io_signal_handler<Local_factory> _block_signal_handler {
_env.env().ep(), *this, &Local_factory::_handle_block_signal };
void _handle_block_signal() { }
void _handle_block_signal() { _env.user().wakeup_vfs_user(); }
Data_file_system _data_fs;

View File

@ -585,6 +585,7 @@ class Vfs::Fs_file_system : public File_system, private Remote_io
_congested_handles.dequeue_all([] (Fs_vfs_handle &handle) {
handle.io_progress_response(); });
_env.user().wakeup_vfs_user();
}
Genode::Io_signal_handler<Fs_file_system> _signal_handler {

View File

@ -29,6 +29,8 @@ class Vfs::Rom_file_system : public Single_file_system
Genode::Env &_env;
Vfs::Env::User &_vfs_user;
typedef String<64> Label;
Label const _label;
@ -125,6 +127,8 @@ class Vfs::Rom_file_system : public Single_file_system
{
_handle_registry.for_each([] (Registered_watch_handle &handle) {
handle.watch_response(); });
_vfs_user.wakeup_vfs_user();
}
Genode::Constructible<Genode::Io_signal_handler<Rom_file_system>>
@ -137,7 +141,7 @@ class Vfs::Rom_file_system : public Single_file_system
:
Single_file_system(Node_type::CONTINUOUS_FILE, name(),
Node_rwx::ro(), config),
_env(env.env()),
_env(env.env()), _vfs_user(env.user()),
/* use 'label' attribute if present, fall back to 'name' if not */
_label(config.attribute_value("label",

View File

@ -57,6 +57,7 @@ class Vfs::Nic_file_system::Nic_vfs_handle : public Single_vfs_handle
enum { BUF_SIZE = Uplink::Session::QUEUE_SIZE * PKT_SIZE };
Genode::Env &_env;
Vfs::Env::User &_vfs_user;
Nic::Packet_allocator _pkt_alloc;
Nic::Connection _nic;
bool _link_state;
@ -99,6 +100,7 @@ class Vfs::Nic_file_system::Nic_vfs_handle : public Single_vfs_handle
public:
Nic_vfs_handle(Genode::Env &env,
Vfs::Env::User &vfs_user,
Allocator &alloc,
Label const &label,
Net::Mac_address const &,
@ -107,6 +109,7 @@ class Vfs::Nic_file_system::Nic_vfs_handle : public Single_vfs_handle
int flags)
: Single_vfs_handle { ds, fs, alloc, flags },
_env(env),
_vfs_user(vfs_user),
_pkt_alloc(&alloc),
_nic(_env, &_pkt_alloc, BUF_SIZE, BUF_SIZE, label.string()),
_link_state(_nic.link_state())

View File

@ -41,6 +41,7 @@ class Genode::Uplink_client_base : Noncopyable
enum { BUF_SIZE = Uplink::Session::QUEUE_SIZE * PKT_SIZE };
Env &_env;
Vfs::Env::User &_vfs_user;
Allocator &_alloc;
Label const &_label;
Net::Mac_address _drv_mac_addr;
@ -63,6 +64,8 @@ class Genode::Uplink_client_base : Noncopyable
if (_custom_conn_rx_ready_to_ack_handler())
_custom_conn_rx_handle_ready_to_ack();
_vfs_user.wakeup_vfs_user();
}
void _conn_tx_handle_ack_avail()
@ -72,6 +75,8 @@ class Genode::Uplink_client_base : Noncopyable
while (_conn->tx()->ack_avail()) {
_conn->tx()->release_packet(_conn->tx()->get_acked_packet()); }
_vfs_user.wakeup_vfs_user();
}
void _conn_rx_handle_packet_avail()
@ -81,6 +86,8 @@ class Genode::Uplink_client_base : Noncopyable
if (_custom_conn_rx_packet_avail_handler())
_custom_conn_rx_handle_packet_avail();
_vfs_user.wakeup_vfs_user();
}
@ -203,11 +210,13 @@ class Genode::Uplink_client_base : Noncopyable
public:
Uplink_client_base(Env &env,
Vfs::Env::User &vfs_user,
Allocator &alloc,
Net::Mac_address const &drv_mac_addr,
Label const &label)
:
_env { env },
_vfs_user { vfs_user },
_alloc { alloc },
_label { label },
_drv_mac_addr { drv_mac_addr }

View File

@ -87,6 +87,7 @@ class Vfs::Uplink_file_system::Uplink_vfs_handle : public Single_vfs_handle,
public:
Uplink_vfs_handle(Genode::Env &env,
Vfs::Env::User &vfs_user,
Allocator &alloc,
Label const &label,
Net::Mac_address const &mac,
@ -94,7 +95,7 @@ class Vfs::Uplink_file_system::Uplink_vfs_handle : public Single_vfs_handle,
File_io_service &fs,
int flags)
: Single_vfs_handle { ds, fs, alloc, flags },
Uplink_client_base { env, alloc, mac, label }
Uplink_client_base { env, vfs_user, alloc, mac, label }
{ _drv_handle_link_state(true); }
bool notify_read_ready() override

View File

@ -124,12 +124,14 @@ class Vfs::Tap_file_system::Data_file_system : public FS
Label const &_label;
Net::Mac_address const &_default_mac;
Genode::Env &_env;
Vfs::Env::User &_vfs_user;
Device_update_handler &_device_update_handler;
Handle_registry _handle_registry { };
public:
Data_file_system(Genode::Env & env,
Vfs::Env::User & vfs_user,
Name const & name,
Label const & label,
Net::Mac_address const & mac,
@ -137,7 +139,7 @@ class Vfs::Tap_file_system::Data_file_system : public FS
:
FS(name.string()),
_name(name), _label(label), _default_mac(mac), _env(env),
_device_update_handler(handler)
_vfs_user(vfs_user), _device_update_handler(handler)
{ }
/* must only be called if handle has been opened */
@ -180,8 +182,8 @@ class Vfs::Tap_file_system::Data_file_system : public FS
try {
*out_handle = new (alloc)
Registered_handle(_handle_registry, _env, alloc, _label.string(),
_default_mac, *this, *this, flags);
Registered_handle(_handle_registry, _env, _vfs_user, alloc,
_label.string(), _default_mac, *this, *this, flags);
_device_update_handler.device_state_changed();
return Open_result::OPEN_OK;
}
@ -206,7 +208,8 @@ struct Vfs::Tap_file_system::Local_factory : File_system_factory,
Net::Mac_address const _default_mac;
Vfs::Env &_env;
Data_file_system<FS> _data_fs { _env.env(), _name, _label, _default_mac, *this };
Data_file_system<FS> _data_fs { _env.env(), _env.user(), _name, _label,
_default_mac, *this };
struct Info
{

View File

@ -58,6 +58,8 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
Genode::Entrypoint &_ep;
Vfs::Env::User &_vfs_user;
Terminal::Connection &_terminal;
Interrupt_handler &_interrupt_handler;
@ -110,6 +112,7 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
struct Terminal_vfs_handle : Single_vfs_handle
{
Terminal::Connection &_terminal;
Vfs::Env::User &_vfs_user;
Read_buffer &_read_buffer;
Interrupt_handler &_interrupt_handler;
@ -119,6 +122,7 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
bool blocked = false;
Terminal_vfs_handle(Terminal::Connection &terminal,
Vfs::Env::User &vfs_user,
Read_buffer &read_buffer,
Interrupt_handler &interrupt_handler,
Directory_service &ds,
@ -129,6 +133,7 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
:
Single_vfs_handle(ds, fs, alloc, flags),
_terminal(terminal),
_vfs_user(vfs_user),
_read_buffer(read_buffer),
_interrupt_handler(interrupt_handler),
_raw(raw)
@ -211,11 +216,14 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
handle.read_ready_response();
}
});
_vfs_user.wakeup_vfs_user();
}
public:
Data_file_system(Genode::Entrypoint &ep,
Vfs::Env::User &vfs_user,
Terminal::Connection &terminal,
Name const &name,
Interrupt_handler &interrupt_handler,
@ -223,7 +231,7 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
:
Single_file_system(Node_type::TRANSACTIONAL_FILE, name.string(),
Node_rwx::rw(), Genode::Xml_node("<data/>")),
_name(name), _ep(ep), _terminal(terminal),
_name(name), _ep(ep), _vfs_user(vfs_user), _terminal(terminal),
_interrupt_handler(interrupt_handler),
_raw(raw)
{
@ -243,9 +251,9 @@ class Vfs::Terminal_file_system::Data_file_system : public Single_file_system
try {
*out_handle = new (alloc)
Registered_handle(_handle_registry, _terminal, _read_buffer,
_interrupt_handler, *this, *this, alloc, flags,
_raw);
Registered_handle(_handle_registry, _terminal, _vfs_user,
_read_buffer, _interrupt_handler,
*this, *this, alloc, flags, _raw);
return OPEN_OK;
}
catch (Genode::Out_of_ram) { return OPEN_ERR_OUT_OF_RAM; }
@ -274,11 +282,13 @@ struct Vfs::Terminal_file_system::Local_factory : File_system_factory,
Genode::Env &_env;
Vfs::Env::User &_vfs_user;
Terminal::Connection _terminal { _env, _label.string() };
bool const _raw;
Data_file_system _data_fs { _env.ep(), _terminal, _name, *this, _raw };
Data_file_system _data_fs { _env.ep(), _vfs_user, _terminal, _name, *this, _raw };
struct Info
{
@ -336,6 +346,7 @@ struct Vfs::Terminal_file_system::Local_factory : File_system_factory,
_label(config.attribute_value("label", Label(""))),
_name(name(config)),
_env(env.env()),
_vfs_user(env.user()),
_raw(config.attribute_value("raw", false))
{
_terminal.size_changed_sigh(_size_changed_handler);