mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +00:00
Kernel: Make VirtIO::ConsolePort construction OOM-fallible
This commit is contained in:
parent
94a39db31d
commit
ac4583660b
2 changed files with 16 additions and 6 deletions
|
@ -24,7 +24,8 @@ class Console;
|
|||
class ConsolePort
|
||||
: public CharacterDevice {
|
||||
public:
|
||||
explicit ConsolePort(unsigned port, VirtIO::Console&);
|
||||
static ErrorOr<NonnullRefPtr<ConsolePort>> try_create(unsigned port, VirtIO::Console&);
|
||||
|
||||
void handle_queue_update(Badge<VirtIO::Console>, u16 queue_index);
|
||||
|
||||
void set_open(Badge<VirtIO::Console>, bool state) { m_open = state; }
|
||||
|
@ -35,6 +36,8 @@ public:
|
|||
private:
|
||||
constexpr static size_t RINGBUFFER_SIZE = 2 * PAGE_SIZE;
|
||||
|
||||
ConsolePort(unsigned port, VirtIO::Console& console, NonnullOwnPtr<Memory::RingBuffer> receive_buffer, NonnullOwnPtr<Memory::RingBuffer> transmit_buffer);
|
||||
|
||||
virtual StringView class_name() const override { return "VirtIOConsolePort"sv; }
|
||||
|
||||
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||
|
@ -47,8 +50,8 @@ private:
|
|||
u16 m_receive_queue {};
|
||||
u16 m_transmit_queue {};
|
||||
|
||||
OwnPtr<Memory::RingBuffer> m_receive_buffer;
|
||||
OwnPtr<Memory::RingBuffer> m_transmit_buffer;
|
||||
NonnullOwnPtr<Memory::RingBuffer> m_receive_buffer;
|
||||
NonnullOwnPtr<Memory::RingBuffer> m_transmit_buffer;
|
||||
|
||||
VirtIO::Console& m_console;
|
||||
unsigned m_port;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue