From 7d1fd0b0a3aab15af0d35b74f150d54e93d2c4e2 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 6 Jul 2020 10:42:54 +0200 Subject: [PATCH] lwip: use Mutex Issue #3801 --- repos/libports/include/lwip/genode_init.h | 2 +- repos/libports/include/lwip/nic_netif.h | 2 +- repos/libports/src/lib/lwip/platform/printf.cc | 1 - repos/libports/src/lib/lwip/platform/sys_arch.cc | 8 ++++---- repos/libports/src/lib/vfs/lwip/vfs.cc | 12 ++++++------ 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/repos/libports/include/lwip/genode_init.h b/repos/libports/include/lwip/genode_init.h index e315e9f43..2b20729b0 100644 --- a/repos/libports/include/lwip/genode_init.h +++ b/repos/libports/include/lwip/genode_init.h @@ -20,7 +20,7 @@ namespace Lwip { void genode_init(Genode::Allocator &heap, Genode::Timeout_scheduler &timer); - Genode::Lock &lock(); + Genode::Mutex &mutex(); } #endif diff --git a/repos/libports/include/lwip/nic_netif.h b/repos/libports/include/lwip/nic_netif.h index b6579bbfd..5a57af2ec 100644 --- a/repos/libports/include/lwip/nic_netif.h +++ b/repos/libports/include/lwip/nic_netif.h @@ -141,7 +141,7 @@ class Lwip::Nic_netif void handle_rx_packets() { - Genode::Lock::Guard g { Lwip::lock() }; + 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/lwip/platform/printf.cc b/repos/libports/src/lib/lwip/platform/printf.cc index da5026ada..38d93d694 100644 --- a/repos/libports/src/lib/lwip/platform/printf.cc +++ b/repos/libports/src/lib/lwip/platform/printf.cc @@ -13,7 +13,6 @@ /* Genode includes */ #include -#include #include extern "C" { diff --git a/repos/libports/src/lib/lwip/platform/sys_arch.cc b/repos/libports/src/lib/lwip/platform/sys_arch.cc index 2963b1480..03e26d320 100644 --- a/repos/libports/src/lib/lwip/platform/sys_arch.cc +++ b/repos/libports/src/lib/lwip/platform/sys_arch.cc @@ -38,7 +38,7 @@ namespace Lwip { { void check_timeouts(Genode::Duration) { - Genode::Lock::Guard g{ Lwip::lock() }; + Genode::Mutex::Guard guard { Lwip::mutex() }; sys_check_timeouts(); } @@ -66,10 +66,10 @@ namespace Lwip { lwip_init(); } - Genode::Lock &lock() + Genode::Mutex &mutex() { - static Genode::Lock _lwip_lock; - return _lwip_lock; + 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 0aeef5662..7b0e000e3 100644 --- a/repos/libports/src/lib/vfs/lwip/vfs.cc +++ b/repos/libports/src/lib/vfs/lwip/vfs.cc @@ -902,7 +902,7 @@ class Lwip::Udp_socket_dir final : char *dst, file_size count, file_size &out_count) override { - Genode::Lock::Guard g { Lwip::lock() }; + Genode::Mutex::Guard guard { Lwip::mutex() }; Read_result result = Read_result::READ_ERR_INVALID; switch(handle.kind) { @@ -988,7 +988,7 @@ class Lwip::Udp_socket_dir final : char const *src, file_size count, file_size &out_count) override { - Genode::Lock::Guard g { Lwip::lock() }; + Genode::Mutex::Guard g { Lwip::mutex() }; switch(handle.kind) { @@ -1291,7 +1291,7 @@ class Lwip::Tcp_socket_dir final : char *dst, file_size count, file_size &out_count) override { - Genode::Lock::Guard g { Lwip::lock() }; + Genode::Mutex::Guard g { Lwip::mutex() }; switch(handle.kind) { @@ -1377,9 +1377,9 @@ class Lwip::Tcp_socket_dir final : handle.kind = Lwip_file_handle::LOCATION; /* read the location of the new socket directory */ - Lwip::lock().unlock(); + Lwip::mutex().release(); Read_result result = handle.read(dst, count, out_count); - Lwip::lock().lock(); + Lwip::mutex().acquire(); return result; } @@ -1443,7 +1443,7 @@ class Lwip::Tcp_socket_dir final : char const *src, file_size count, file_size &out_count) override { - Genode::Lock::Guard g { Lwip::lock() }; + Genode::Mutex::Guard guard { Lwip::mutex() }; if (_pcb == NULL) { /* socket is closed */ return Write_result::WRITE_ERR_IO;