mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:37:35 +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
|
@ -18,7 +18,7 @@ class Console
|
|||
friend VirtIO::ConsolePort;
|
||||
|
||||
public:
|
||||
Console(PCI::Address);
|
||||
static NonnullRefPtr<Console> must_create(PCI::Address address);
|
||||
virtual ~Console() override = default;
|
||||
|
||||
virtual StringView purpose() const override { return class_name(); }
|
||||
|
@ -30,6 +30,7 @@ public:
|
|||
|
||||
private:
|
||||
virtual StringView class_name() const override { return "VirtIOConsole"; }
|
||||
explicit Console(PCI::Address);
|
||||
enum class ControlEvent : u16 {
|
||||
DeviceReady = 0,
|
||||
DeviceAdd = 1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue