Rename CharacterDevice::has_data_available_for_reading() -> can_read().

This commit is contained in:
Andreas Kling 2019-01-16 00:10:13 +01:00
parent 10387beda7
commit 08bfe518f9
Notes: sideshowbarker 2024-07-19 16:01:54 +09:00
23 changed files with 24 additions and 24 deletions

View File

@ -23,7 +23,7 @@ Console::~Console()
{
}
bool Console::has_data_available_for_reading(Process&) const
bool Console::can_read(Process&) const
{
return false;
}

View File

@ -18,7 +18,7 @@ public:
Console();
virtual ~Console() override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override { return true; }
virtual ssize_t read(byte* buffer, size_t size) override;
virtual ssize_t write(const byte* data, size_t size) override;

View File

@ -114,7 +114,7 @@ Keyboard::~Keyboard()
{
}
bool Keyboard::has_data_available_for_reading(Process&) const
bool Keyboard::can_read(Process&) const
{
return !m_queue.is_empty();
}

View File

@ -39,7 +39,7 @@ private:
// ^CharacterDevice
virtual ssize_t read(byte* buffer, size_t) override;
virtual ssize_t write(const byte* buffer, size_t) override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override { return true; }
void emit(byte);

View File

@ -31,7 +31,7 @@ ssize_t MasterPTY::write(const byte* buffer, size_t size)
return size;
}
bool MasterPTY::has_data_available_for_reading(Process&) const
bool MasterPTY::can_read(Process&) const
{
return !m_buffer.is_empty();
}

View File

@ -13,7 +13,7 @@ public:
virtual ssize_t read(byte*, size_t) override;
virtual ssize_t write(const byte*, size_t) override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override;
virtual bool is_master_pty() const override { return true; }

View File

@ -116,7 +116,7 @@ byte PS2MouseDevice::mouse_read()
return IO::in8(0x60);
}
bool PS2MouseDevice::has_data_available_for_reading(Process&) const
bool PS2MouseDevice::can_read(Process&) const
{
return !m_buffer.is_empty();
}

View File

@ -12,7 +12,7 @@ public:
static PS2MouseDevice& the();
// ^CharacterDevice
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual ssize_t read(byte* buffer, size_t) override;
virtual ssize_t write(const byte* buffer, size_t) override;
virtual bool can_write(Process&) const override { return true; }

View File

@ -42,7 +42,7 @@ ssize_t TTY::write(const byte* buffer, size_t size)
return size;
}
bool TTY::has_data_available_for_reading(Process&) const
bool TTY::can_read(Process&) const
{
return !m_buffer.is_empty();
}

View File

@ -12,7 +12,7 @@ public:
virtual ssize_t read(byte*, size_t) override;
virtual ssize_t write(const byte*, size_t) override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override;
virtual int ioctl(Process&, unsigned request, unsigned arg) override final;

View File

@ -12,7 +12,7 @@ public:
RetainPtr<FileDescriptor> open(int options);
virtual bool has_data_available_for_reading(Process&) const = 0;
virtual bool can_read(Process&) const = 0;
virtual bool can_write(Process&) const = 0;
virtual ssize_t read(byte* buffer, size_t bufferSize) = 0;

View File

@ -183,7 +183,7 @@ bool FileDescriptor::has_data_available_for_reading(Process& process)
return m_fifo->can_read();
}
if (m_vnode->isCharacterDevice())
return m_vnode->characterDevice()->has_data_available_for_reading(process);
return m_vnode->characterDevice()->can_read(process);
return true;
}

View File

@ -13,7 +13,7 @@ FullDevice::~FullDevice()
{
}
bool FullDevice::has_data_available_for_reading(Process&) const
bool FullDevice::can_read(Process&) const
{
return true;
}

View File

@ -10,7 +10,7 @@ public:
virtual ssize_t read(byte* buffer, size_t bufferSize) override;
virtual ssize_t write(const byte* buffer, size_t bufferSize) override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override { return true; }
};

View File

@ -12,7 +12,7 @@ NullDevice::~NullDevice()
{
}
bool NullDevice::has_data_available_for_reading(Process&) const
bool NullDevice::can_read(Process&) const
{
return true;
}

View File

@ -11,6 +11,6 @@ public:
virtual ssize_t read(byte* buffer, size_t bufferSize) override;
virtual ssize_t write(const byte* buffer, size_t bufferSize) override;
virtual bool can_write(Process&) const override { return true; }
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
};

View File

@ -29,7 +29,7 @@ static void mysrand(unsigned seed)
}
#endif
bool RandomDevice::has_data_available_for_reading(Process&) const
bool RandomDevice::can_read(Process&) const
{
return true;
}

View File

@ -10,7 +10,7 @@ public:
virtual ssize_t read(byte* buffer, size_t bufferSize) override;
virtual ssize_t write(const byte* buffer, size_t bufferSize) override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override { return true; }
};

View File

@ -12,7 +12,7 @@ ZeroDevice::~ZeroDevice()
{
}
bool ZeroDevice::has_data_available_for_reading(Process&) const
bool ZeroDevice::can_read(Process&) const
{
return true;
}

View File

@ -10,7 +10,7 @@ public:
virtual ssize_t read(byte* buffer, size_t bufferSize) override;
virtual ssize_t write(const byte* buffer, size_t bufferSize) override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override { return true; }
};

View File

@ -76,7 +76,7 @@ void EventLoop::waitForEvent()
bool prev_right_button = screen.right_mouse_button_pressed();
int dx = 0;
int dy = 0;
while (mouse.has_data_available_for_reading(*m_server_process)) {
while (mouse.can_read(*m_server_process)) {
signed_byte data[3];
ssize_t nread = mouse.read((byte*)data, 3);
ASSERT(nread == 3);
@ -84,7 +84,7 @@ void EventLoop::waitForEvent()
bool right_button = data[0] & 2;
dx += data[1];
dy += -data[2];
if (left_button != prev_left_button || right_button != prev_right_button || !mouse.has_data_available_for_reading(*m_server_process)) {
if (left_button != prev_left_button || right_button != prev_right_button || !mouse.can_read(*m_server_process)) {
prev_left_button = left_button;
prev_right_button = right_button;
screen.on_receive_mouse_data(dx, dy, left_button, right_button);

View File

@ -14,7 +14,7 @@ GUIEventDevice::~GUIEventDevice()
{
}
bool GUIEventDevice::has_data_available_for_reading(Process& process) const
bool GUIEventDevice::can_read(Process& process) const
{
return !process.gui_events().is_empty();
}

View File

@ -11,6 +11,6 @@ private:
// ^CharacterDevice
virtual ssize_t read(byte* buffer, size_t bufferSize) override;
virtual ssize_t write(const byte* buffer, size_t bufferSize) override;
virtual bool has_data_available_for_reading(Process&) const override;
virtual bool can_read(Process&) const override;
virtual bool can_write(Process&) const override { return true; }
};