mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
Kernel/VirtIO: Don't expose constructors as public method
This leads to a bad pattern where anyone could create an RNG or a Console object. Instead, let's just use the common pattern of a static method to instantiate a new object and return it wrapped by a NonnullRefPtr.
This commit is contained in:
parent
01ae614727
commit
8e90a4fd1c
5 changed files with 16 additions and 5 deletions
|
@ -12,6 +12,11 @@ namespace Kernel::VirtIO {
|
|||
|
||||
unsigned Console::next_device_id = 0;
|
||||
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<Console> Console::must_create(PCI::Address address)
|
||||
{
|
||||
return adopt_ref_if_nonnull(new Console(address)).release_nonnull();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT Console::Console(PCI::Address address)
|
||||
: VirtIO::Device(address)
|
||||
, m_device_id(next_device_id++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue