diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-04-24 15:27:32 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-25 09:38:27 +0200 |
commit | 8d6e9fad40d493e6f2027cec37212956294a591f (patch) | |
tree | 71816f325880a99ef5b623d9795f2eded3d69ca7 /Kernel/Net | |
parent | 0d5827f8652462715f6c2f91e2b91b2077547ae6 (diff) | |
download | serenity-8d6e9fad40d493e6f2027cec37212956294a591f.zip |
Kernel: Remove the now defunct `LOCKER(..)` macro.
Diffstat (limited to 'Kernel/Net')
-rw-r--r-- | Kernel/Net/IPv4Socket.cpp | 10 | ||||
-rw-r--r-- | Kernel/Net/LocalSocket.cpp | 12 | ||||
-rw-r--r-- | Kernel/Net/NetworkAdapter.cpp | 4 | ||||
-rw-r--r-- | Kernel/Net/NetworkTask.cpp | 6 | ||||
-rw-r--r-- | Kernel/Net/Routing.cpp | 4 | ||||
-rw-r--r-- | Kernel/Net/Socket.cpp | 8 | ||||
-rw-r--r-- | Kernel/Net/TCPSocket.cpp | 22 | ||||
-rw-r--r-- | Kernel/Net/UDPSocket.cpp | 10 |
8 files changed, 38 insertions, 38 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp index 3063ec1e3e..d202f7e1f6 100644 --- a/Kernel/Net/IPv4Socket.cpp +++ b/Kernel/Net/IPv4Socket.cpp @@ -53,13 +53,13 @@ IPv4Socket::IPv4Socket(int type, int protocol) if (m_buffer_mode == BufferMode::Bytes) { m_scratch_buffer = KBuffer::create_with_size(65536); } - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().set(this); } IPv4Socket::~IPv4Socket() { - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().remove(this); } @@ -108,7 +108,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr KResult IPv4Socket::listen(size_t backlog) { - LOCKER(lock()); + Locker locker(lock()); int rc = allocate_local_port_if_needed(); if (rc < 0) return EADDRINUSE; @@ -172,7 +172,7 @@ int IPv4Socket::allocate_local_port_if_needed() KResultOr<size_t> IPv4Socket::sendto(FileDescription&, const UserOrKernelBuffer& data, size_t data_length, [[maybe_unused]] int flags, Userspace<const sockaddr*> addr, socklen_t addr_length) { - LOCKER(lock()); + Locker locker(lock()); if (addr && addr_length != sizeof(sockaddr_in)) return EINVAL; @@ -357,7 +357,7 @@ KResultOr<size_t> IPv4Socket::recvfrom(FileDescription& description, UserOrKerne bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, KBuffer&& packet, const Time& packet_timestamp) { - LOCKER(lock()); + Locker locker(lock()); if (is_shut_down_for_reading()) return false; diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 6a73450b92..bb7b1cbe86 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -26,7 +26,7 @@ Lockable<InlineLinkedList<LocalSocket>>& LocalSocket::all_sockets() void LocalSocket::for_each(Function<void(const LocalSocket&)> callback) { - LOCKER(all_sockets().lock(), Lock::Mode::Shared); + Locker locker(all_sockets().lock(), Lock::Mode::Shared); for (auto& socket : all_sockets().resource()) callback(socket); } @@ -39,7 +39,7 @@ KResultOr<NonnullRefPtr<Socket>> LocalSocket::create(int type) LocalSocket::LocalSocket(int type) : Socket(AF_LOCAL, type, 0) { - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().append(this); auto current_process = Process::current(); @@ -59,7 +59,7 @@ LocalSocket::LocalSocket(int type) LocalSocket::~LocalSocket() { - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().remove(this); } @@ -182,7 +182,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka KResult LocalSocket::listen(size_t backlog) { - LOCKER(lock()); + Locker locker(lock()); if (type() != SOCK_STREAM) return EOPNOTSUPP; set_backlog(backlog); @@ -433,7 +433,7 @@ NonnullRefPtrVector<FileDescription>& LocalSocket::sendfd_queue_for(const FileDe KResult LocalSocket::sendfd(const FileDescription& socket_description, FileDescription& passing_description) { - LOCKER(lock()); + Locker locker(lock()); auto role = this->role(socket_description); if (role != Role::Connected && role != Role::Accepted) return EINVAL; @@ -447,7 +447,7 @@ KResult LocalSocket::sendfd(const FileDescription& socket_description, FileDescr KResultOr<NonnullRefPtr<FileDescription>> LocalSocket::recvfd(const FileDescription& socket_description) { - LOCKER(lock()); + Locker locker(lock()); auto role = this->role(socket_description); if (role != Role::Connected && role != Role::Accepted) return EINVAL; diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index 53a00a3b9b..658c694a67 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -28,14 +28,14 @@ static Lockable<HashTable<NetworkAdapter*>>& all_adapters() void NetworkAdapter::for_each(Function<void(NetworkAdapter&)> callback) { - LOCKER(all_adapters().lock()); + Locker locker(all_adapters().lock()); for (auto& it : all_adapters().resource()) callback(*it); } RefPtr<NetworkAdapter> NetworkAdapter::from_ipv4_address(const IPv4Address& address) { - LOCKER(all_adapters().lock()); + Locker locker(all_adapters().lock()); for (auto* adapter : all_adapters().resource()) { if (adapter->ipv4_address() == address) return adapter; diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 7f97f6cbfc..d3a13c27fd 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -196,7 +196,7 @@ void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet, { NonnullRefPtrVector<IPv4Socket> icmp_sockets; { - LOCKER(IPv4Socket::all_sockets().lock(), Lock::Mode::Shared); + Locker locker(IPv4Socket::all_sockets().lock(), Lock::Mode::Shared); for (auto* socket : IPv4Socket::all_sockets().resource()) { if (socket->protocol() != (unsigned)IPv4Protocol::ICMP) continue; @@ -330,7 +330,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp) return; } - LOCKER(socket->lock()); + Locker locker(socket->lock()); VERIFY(socket->type() == SOCK_STREAM); VERIFY(socket->local_port() == tcp_packet.destination_port()); @@ -361,7 +361,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp) dmesgln("handle_tcp: couldn't create client socket"); return; } - LOCKER(client->lock()); + Locker locker(client->lock()); dbgln_if(TCP_DEBUG, "handle_tcp: created new client socket with tuple {}", client->tuple().to_string()); client->set_sequence_number(1000); client->set_ack_number(tcp_packet.sequence_number() + payload_size + 1); diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp index c642e5bc8e..6f2f944fb6 100644 --- a/Kernel/Net/Routing.cpp +++ b/Kernel/Net/Routing.cpp @@ -104,7 +104,7 @@ Lockable<HashMap<IPv4Address, MACAddress>>& arp_table() void update_arp_table(const IPv4Address& ip_addr, const MACAddress& addr) { - LOCKER(arp_table().lock()); + Locker locker(arp_table().lock()); arp_table().resource().set(ip_addr, addr); s_arp_table_block_condition->unblock(ip_addr, addr); @@ -196,7 +196,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c return { adapter, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; { - LOCKER(arp_table().lock()); + Locker locker(arp_table().lock()); auto addr = arp_table().resource().get(next_hop_ip); if (addr.has_value()) { dbgln_if(ROUTING_DEBUG, "Routing: Using cached ARP entry for {} ({})", next_hop_ip, addr.value().to_string()); diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index 6c36f8ff1d..b7c48c73cc 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -51,7 +51,7 @@ void Socket::set_setup_state(SetupState new_setup_state) RefPtr<Socket> Socket::accept() { - LOCKER(m_lock); + Locker locker(m_lock); if (m_pending.is_empty()) return nullptr; dbgln_if(SOCKET_DEBUG, "Socket({}) de-queueing connection", this); @@ -69,7 +69,7 @@ RefPtr<Socket> Socket::accept() KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer) { dbgln_if(SOCKET_DEBUG, "Socket({}) queueing connection", this); - LOCKER(m_lock); + Locker locker(m_lock); if (m_pending.size() >= m_backlog) return ECONNREFUSED; m_pending.append(peer); @@ -240,7 +240,7 @@ KResultOr<size_t> Socket::write(FileDescription& description, u64, const UserOrK KResult Socket::shutdown(int how) { - LOCKER(lock()); + Locker locker(lock()); if (type() == SOCK_STREAM && !is_connected()) return ENOTCONN; if (m_role == Role::Listener) @@ -263,7 +263,7 @@ KResult Socket::stat(::stat& st) const void Socket::set_connected(bool connected) { - LOCKER(lock()); + Locker locker(lock()); if (m_connected == connected) return; m_connected = connected; diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index d7608cd5f5..ae06bffec7 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -20,7 +20,7 @@ namespace Kernel { void TCPSocket::for_each(Function<void(const TCPSocket&)> callback) { - LOCKER(sockets_by_tuple().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared); for (auto& it : sockets_by_tuple().resource()) callback(*it.value); } @@ -38,7 +38,7 @@ void TCPSocket::set_state(State new_state) m_role = Role::Connected; if (new_state == State::Closed) { - LOCKER(closing_sockets().lock()); + Locker locker(closing_sockets().lock()); closing_sockets().resource().remove(tuple()); } @@ -62,7 +62,7 @@ Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple() RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple) { - LOCKER(sockets_by_tuple().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared); auto exact_match = sockets_by_tuple().resource().get(tuple); if (exact_match.has_value()) @@ -90,7 +90,7 @@ RefPtr<TCPSocket> TCPSocket::create_client(const IPv4Address& new_local_address, { auto tuple = IPv4SocketTuple(new_local_address, new_local_port, new_peer_address, new_peer_port); - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); if (sockets_by_tuple().resource().contains(tuple)) return {}; @@ -131,7 +131,7 @@ TCPSocket::TCPSocket(int protocol) TCPSocket::~TCPSocket() { - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); sockets_by_tuple().resource().remove(tuple()); dbgln_if(TCP_SOCKET_DEBUG, "~TCPSocket in state {}", to_string(state())); @@ -190,7 +190,7 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload, tcp_packet.set_checksum(compute_tcp_checksum(local_address(), peer_address(), tcp_packet, payload_size)); if (tcp_packet.has_syn() || payload_size > 0) { - LOCKER(m_not_acked_lock); + Locker locker(m_not_acked_lock); m_not_acked.append({ m_sequence_number, move(buffer) }); send_outgoing_packets(); return KSuccess; @@ -218,7 +218,7 @@ void TCPSocket::send_outgoing_packets() auto now = kgettimeofday(); - LOCKER(m_not_acked_lock, Lock::Mode::Shared); + Locker locker(m_not_acked_lock, Lock::Mode::Shared); for (auto& packet : m_not_acked) { auto diff = now - packet.tx_time; if (diff <= Time::from_nanoseconds(500'000'000)) @@ -274,7 +274,7 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size) dbgln_if(TCP_SOCKET_DEBUG, "TCPSocket: receive_tcp_packet: {}", ack_number); int removed = 0; - LOCKER(m_not_acked_lock); + Locker locker(m_not_acked_lock); while (!m_not_acked.is_empty()) { auto& packet = m_not_acked.first(); @@ -349,7 +349,7 @@ KResult TCPSocket::protocol_bind() KResult TCPSocket::protocol_listen() { - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); if (sockets_by_tuple().resource().contains(tuple())) return EADDRINUSE; sockets_by_tuple().resource().set(tuple(), this); @@ -408,7 +408,7 @@ int TCPSocket::protocol_allocate_local_port() static const u16 ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port; u16 first_scan_port = first_ephemeral_port + get_good_random<u16>() % ephemeral_port_range_size; - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); for (u16 port = first_scan_port;;) { IPv4SocketTuple proposed_tuple(local_address(), port, peer_address(), peer_port()); @@ -468,7 +468,7 @@ KResult TCPSocket::close() set_state(State::LastAck); } - LOCKER(closing_sockets().lock()); + Locker locker(closing_sockets().lock()); closing_sockets().resource().set(tuple(), *this); return result; } diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp index 309823d626..fe6068974b 100644 --- a/Kernel/Net/UDPSocket.cpp +++ b/Kernel/Net/UDPSocket.cpp @@ -17,7 +17,7 @@ namespace Kernel { void UDPSocket::for_each(Function<void(const UDPSocket&)> callback) { - LOCKER(sockets_by_port().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_port().lock(), Lock::Mode::Shared); for (auto it : sockets_by_port().resource()) callback(*it.value); } @@ -33,7 +33,7 @@ SocketHandle<UDPSocket> UDPSocket::from_port(u16 port) { RefPtr<UDPSocket> socket; { - LOCKER(sockets_by_port().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_port().lock(), Lock::Mode::Shared); auto it = sockets_by_port().resource().find(port); if (it == sockets_by_port().resource().end()) return {}; @@ -50,7 +50,7 @@ UDPSocket::UDPSocket(int protocol) UDPSocket::~UDPSocket() { - LOCKER(sockets_by_port().lock()); + Locker locker(sockets_by_port().lock()); sockets_by_port().resource().remove(local_port()); } @@ -104,7 +104,7 @@ int UDPSocket::protocol_allocate_local_port() static const u16 ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port; u16 first_scan_port = first_ephemeral_port + get_good_random<u16>() % ephemeral_port_range_size; - LOCKER(sockets_by_port().lock()); + Locker locker(sockets_by_port().lock()); for (u16 port = first_scan_port;;) { auto it = sockets_by_port().resource().find(port); if (it == sockets_by_port().resource().end()) { @@ -123,7 +123,7 @@ int UDPSocket::protocol_allocate_local_port() KResult UDPSocket::protocol_bind() { - LOCKER(sockets_by_port().lock()); + Locker locker(sockets_by_port().lock()); if (sockets_by_port().resource().contains(local_port())) return EADDRINUSE; sockets_by_port().resource().set(local_port(), this); |