From 60175631df30c7b205c6f965364f96cbf0e027f8 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sat, 3 Dec 2022 16:25:40 +0100 Subject: [PATCH] vfs/lwip: remove obsolete mutexes Issue #4697 --- .../libports/src/lib/vfs/lwip/lwip_genode_init.h | 2 -- repos/libports/src/lib/vfs/lwip/nic_netif.h | 1 - repos/libports/src/lib/vfs/lwip/sys_arch.cc | 7 ------- repos/libports/src/lib/vfs/lwip/vfs.cc | 15 --------------- 4 files changed, 25 deletions(-) diff --git a/repos/libports/src/lib/vfs/lwip/lwip_genode_init.h b/repos/libports/src/lib/vfs/lwip/lwip_genode_init.h index e89a26099d..caf734ce82 100644 --- a/repos/libports/src/lib/vfs/lwip/lwip_genode_init.h +++ b/repos/libports/src/lib/vfs/lwip/lwip_genode_init.h @@ -19,8 +19,6 @@ namespace Lwip { void genode_init(Genode::Allocator &heap, ::Timer::Connection &timer); - - Genode::Mutex &mutex(); } #endif diff --git a/repos/libports/src/lib/vfs/lwip/nic_netif.h b/repos/libports/src/lib/vfs/lwip/nic_netif.h index 13d11dc5fc..70b1394e19 100644 --- a/repos/libports/src/lib/vfs/lwip/nic_netif.h +++ b/repos/libports/src/lib/vfs/lwip/nic_netif.h @@ -142,7 +142,6 @@ class Lwip::Nic_netif void handle_rx_packets() { - Genode::Mutex::Guard guard { Lwip::mutex() }; auto &rx = *_nic.rx(); while (rx.packet_avail() && rx.ready_to_ack()) { diff --git a/repos/libports/src/lib/vfs/lwip/sys_arch.cc b/repos/libports/src/lib/vfs/lwip/sys_arch.cc index 64bbe009a8..8c29a74e6e 100644 --- a/repos/libports/src/lib/vfs/lwip/sys_arch.cc +++ b/repos/libports/src/lib/vfs/lwip/sys_arch.cc @@ -38,7 +38,6 @@ namespace Lwip { { void check_timeouts(Genode::Duration) { - Genode::Mutex::Guard guard { Lwip::mutex() }; sys_check_timeouts(); } @@ -65,12 +64,6 @@ namespace Lwip { lwip_init(); } - - Genode::Mutex &mutex() - { - static Genode::Mutex _lwip_mutex; - return _lwip_mutex; - } } diff --git a/repos/libports/src/lib/vfs/lwip/vfs.cc b/repos/libports/src/lib/vfs/lwip/vfs.cc index 03b1d5a3aa..585568f21e 100644 --- a/repos/libports/src/lib/vfs/lwip/vfs.cc +++ b/repos/libports/src/lib/vfs/lwip/vfs.cc @@ -906,7 +906,6 @@ class Lwip::Udp_socket_dir final : char *dst, file_size count, file_size &out_count) override { - Genode::Mutex::Guard guard { Lwip::mutex() }; Read_result result = Read_result::READ_ERR_INVALID; switch(handle.kind) { @@ -992,8 +991,6 @@ class Lwip::Udp_socket_dir final : char const *src, file_size count, file_size &out_count) override { - Genode::Mutex::Guard guard { Lwip::mutex() }; - switch (handle.kind) { case Lwip_file_handle::DATA: { @@ -1304,8 +1301,6 @@ class Lwip::Tcp_socket_dir final : char *dst, file_size count, file_size &out_count) override { - Genode::Mutex::Guard g { Lwip::mutex() }; - switch (handle.kind) { case Lwip_file_handle::DATA: @@ -1398,9 +1393,7 @@ class Lwip::Tcp_socket_dir final : handle.kind = Lwip_file_handle::LOCATION; /* read the location of the new socket directory */ - Lwip::mutex().release(); Read_result result = handle.read(dst, count, out_count); - Lwip::mutex().acquire(); return result; } @@ -1464,7 +1457,6 @@ class Lwip::Tcp_socket_dir final : char const *src, file_size count, file_size &out_count) override { - Genode::Mutex::Guard guard { Lwip::mutex() }; if (_pcb == NULL) { /* socket is closed */ return Write_result::WRITE_ERR_IO; @@ -1732,7 +1724,6 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory typedef Genode::Fifo Handle_queue; Handle_queue blocked_handles { }; - Genode::Mutex blocked_handles_mutex { }; Vfs_netif(Vfs::Env &vfs_env, Genode::Xml_node config) @@ -1751,8 +1742,6 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory Handle_element *elem = new (handle.alloc()) Handle_element(handle); - Genode::Mutex::Guard guard(blocked_handles_mutex); - blocked_handles.enqueue(*elem); } @@ -1767,8 +1756,6 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory nameserver_handles.for_each([&] (Lwip_nameserver_handle &h) { h.io_progress_response(); }); - Genode::Mutex::Guard guard(blocked_handles_mutex); - blocked_handles.dequeue_all([] (Handle_element &elem) { Vfs_handle &handle = elem.object(); destroy(elem.object().alloc(), &elem); @@ -1778,8 +1765,6 @@ class Lwip::File_system final : public Vfs::File_system, public Lwip::Directory void drop(Vfs_handle &handle) { - Genode::Mutex::Guard guard(blocked_handles_mutex); - blocked_handles.for_each([&] (Handle_element &elem) { if (&elem.object() == &handle) { blocked_handles.remove(elem);