summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorbrapru <brapru@pm.me>2021-09-03 10:33:07 -0400
committerAndreas Kling <kling@serenityos.org>2021-09-03 23:18:50 +0200
commitbad23e3f8cc9c66d818ddb2f7bbe7bddce5c09e2 (patch)
tree529793400f51b3b4df28f91a67593551db2c38d1 /Kernel
parentad5bd209baf96d0a7002a50040a4092d544b865f (diff)
downloadserenity-bad23e3f8cc9c66d818ddb2f7bbe7bddce5c09e2.zip
Kernel: Convert Routing to east-const style
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Net/Routing.cpp22
-rw-r--r--Kernel/Net/Routing.h4
2 files changed, 13 insertions, 13 deletions
diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp
index 3f5c335818..57e2c2afbf 100644
--- a/Kernel/Net/Routing.cpp
+++ b/Kernel/Net/Routing.cpp
@@ -28,7 +28,7 @@ public:
virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
- bool unblock(bool from_add_blocker, const IPv4Address& ip_addr, const MACAddress& addr)
+ bool unblock(bool from_add_blocker, IPv4Address const& ip_addr, MACAddress const& addr)
{
if (m_ip_addr != ip_addr)
return false;
@@ -46,17 +46,17 @@ public:
return true;
}
- const IPv4Address& ip_addr() const { return m_ip_addr; }
+ IPv4Address const& ip_addr() const { return m_ip_addr; }
private:
- const IPv4Address m_ip_addr;
+ IPv4Address const m_ip_addr;
Optional<MACAddress>& m_addr;
bool m_did_unblock { false };
};
class ARPTableBlockerSet final : public Thread::BlockerSet {
public:
- void unblock(const IPv4Address& ip_addr, const MACAddress& addr)
+ void unblock(IPv4Address const& ip_addr, MACAddress const& addr)
{
BlockerSet::unblock_all_blockers_whose_conditions_are_met([&](auto& b, void*, bool&) {
VERIFY(b.blocker_type() == Thread::Blocker::Type::Routing);
@@ -70,7 +70,7 @@ protected:
{
VERIFY(b.blocker_type() == Thread::Blocker::Type::Routing);
auto& blocker = static_cast<ARPTableBlocker&>(b);
- auto val = arp_table().with_shared([&](const auto& table) -> auto {
+ auto val = arp_table().with_shared([&](auto const& table) -> auto {
return table.get(blocker.ip_addr());
});
if (!val.has_value())
@@ -94,7 +94,7 @@ bool ARPTableBlocker::setup_blocker()
void ARPTableBlocker::will_unblock_immediately_without_blocking(UnblockImmediatelyReason)
{
- auto addr = arp_table().with_shared([&](const auto& table) -> auto {
+ auto addr = arp_table().with_shared([&](auto const& table) -> auto {
return table.get(ip_addr());
});
@@ -110,7 +110,7 @@ MutexProtected<HashMap<IPv4Address, MACAddress>>& arp_table()
return *s_arp_table;
}
-void update_arp_table(const IPv4Address& ip_addr, const MACAddress& addr, UpdateArp update)
+void update_arp_table(IPv4Address const& ip_addr, MACAddress const& addr, UpdateArp update)
{
arp_table().with_exclusive([&](auto& table) {
if (update == UpdateArp::Set)
@@ -121,7 +121,7 @@ void update_arp_table(const IPv4Address& ip_addr, const MACAddress& addr, Update
s_arp_table_blocker_set->unblock(ip_addr, addr);
if constexpr (ARP_DEBUG) {
- arp_table().with_shared([&](const auto& table) {
+ arp_table().with_shared([&](auto const& table) {
dmesgln("ARP table ({} entries):", table.size());
for (auto& it : table)
dmesgln("{} :: {}", it.value.to_string(), it.key.to_string());
@@ -139,7 +139,7 @@ static MACAddress multicast_ethernet_address(IPv4Address const& address)
return MACAddress { 0x01, 0x00, 0x5e, (u8)(address[1] & 0x7f), address[2], address[3] };
}
-RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, const RefPtr<NetworkAdapter> through)
+RoutingDecision route_to(IPv4Address const& target, IPv4Address const& source, RefPtr<NetworkAdapter> const through)
{
auto matches = [&](auto& adapter) {
if (!through)
@@ -147,7 +147,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
return through == adapter;
};
- auto if_matches = [&](auto& adapter, const auto& mac) -> RoutingDecision {
+ auto if_matches = [&](auto& adapter, auto const& mac) -> RoutingDecision {
if (!matches(adapter))
return { nullptr, {} };
return { adapter, mac };
@@ -232,7 +232,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c
return { adapter, multicast_ethernet_address(target) };
{
- auto addr = arp_table().with_shared([&](const auto& table) -> auto {
+ auto addr = arp_table().with_shared([&](auto const& table) -> auto {
return table.get(next_hop_ip);
});
if (addr.has_value()) {
diff --git a/Kernel/Net/Routing.h b/Kernel/Net/Routing.h
index eeb7a12c7b..5ec2e706c9 100644
--- a/Kernel/Net/Routing.h
+++ b/Kernel/Net/Routing.h
@@ -24,8 +24,8 @@ enum class UpdateArp {
Delete,
};
-void update_arp_table(const IPv4Address&, const MACAddress&, UpdateArp update);
-RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, const RefPtr<NetworkAdapter> through = nullptr);
+void update_arp_table(IPv4Address const&, MACAddress const&, UpdateArp update);
+RoutingDecision route_to(IPv4Address const& target, IPv4Address const& source, RefPtr<NetworkAdapter> const through = nullptr);
MutexProtected<HashMap<IPv4Address, MACAddress>>& arp_table();