1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:38:12 +00:00

Net: Make NetworkAdapter reference-counted

The idea behind WeakPtr<NetworkAdapter> was to support hot-pluggable
network adapters, but on closer thought, that's super impractical so
let's not go down that road.
This commit is contained in:
Andreas Kling 2020-02-08 00:19:46 +01:00
parent f3a5985bb2
commit a3f39fe789
7 changed files with 19 additions and 19 deletions

View file

@ -128,7 +128,7 @@ void E1000NetworkAdapter::detect(const PCI::Address& address)
if (id != qemu_bochs_vbox_id)
return;
u8 irq = PCI::get_interrupt_line(address);
new E1000NetworkAdapter(address, irq);
(void)adopt(*new E1000NetworkAdapter(address, irq)).leak_ref();
}
E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address pci_address, u8 irq)
@ -376,7 +376,7 @@ void E1000NetworkAdapter::send_raw(const u8* data, size_t length)
#endif
auto& descriptor = m_tx_descriptors[tx_current];
ASSERT(length <= 8192);
auto *vptr = (void*)(descriptor.addr + 0xc0000000);
auto* vptr = (void*)(descriptor.addr + 0xc0000000);
memcpy(vptr, data, length);
descriptor.length = length;
descriptor.status = 0;