mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 16:02:53 +00:00
Kernel: Convert network adapter names to Kernel::KString
Another step of incremental progress of removing `AK::String` from the kernel, to harden against OOM.
This commit is contained in:
parent
33a9f908a6
commit
2770433d30
Notes:
sideshowbarker
2024-07-18 03:15:20 +09:00
Author: https://github.com/bgianfo
Commit: 2770433d30
Pull-request: https://github.com/SerenityOS/serenity/pull/10239
Reviewed-by: https://github.com/supercomputer7
16 changed files with 64 additions and 68 deletions
|
@ -13,14 +13,17 @@ static bool s_loopback_initialized = false;
|
|||
|
||||
RefPtr<LoopbackAdapter> LoopbackAdapter::try_create()
|
||||
{
|
||||
return adopt_ref_if_nonnull(new LoopbackAdapter());
|
||||
auto interface_name = KString::try_create("loop"sv);
|
||||
if (interface_name.is_error())
|
||||
return {};
|
||||
return adopt_ref_if_nonnull(new LoopbackAdapter(interface_name.release_value()));
|
||||
}
|
||||
|
||||
LoopbackAdapter::LoopbackAdapter()
|
||||
LoopbackAdapter::LoopbackAdapter(NonnullOwnPtr<KString> interface_name)
|
||||
: NetworkAdapter(move(interface_name))
|
||||
{
|
||||
VERIFY(!s_loopback_initialized);
|
||||
s_loopback_initialized = true;
|
||||
set_loopback_name();
|
||||
set_mtu(65536);
|
||||
set_mac_address({ 19, 85, 2, 9, 0x55, 0xaa });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue