Skip to content

Commit

Permalink
Rename CharacterDevice::has_data_available_for_reading() -> can_read().
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Jan 15, 2019
1 parent 10387be commit 08bfe51
Show file tree
Hide file tree
Showing 23 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Kernel/Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Console::~Console()
{
}

bool Console::has_data_available_for_reading(Process&) const
bool Console::can_read(Process&) const
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Console final : public CharacterDevice {
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;
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/Keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Keyboard final : public IRQHandler, public CharacterDevice {
// ^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);
Expand Down
2 changes: 1 addition & 1 deletion Kernel/MasterPTY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/MasterPTY.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MasterPTY final : public CharacterDevice {

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; }

Expand Down
2 changes: 1 addition & 1 deletion Kernel/PS2MouseDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/PS2MouseDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PS2MouseDevice final : public IRQHandler, public CharacterDevice {
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; }
Expand Down
2 changes: 1 addition & 1 deletion Kernel/TTY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion Kernel/TTY.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TTY : public CharacterDevice {

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;

Expand Down
2 changes: 1 addition & 1 deletion VirtualFileSystem/CharacterDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CharacterDevice {

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;
Expand Down
2 changes: 1 addition & 1 deletion VirtualFileSystem/FileDescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion VirtualFileSystem/FullDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FullDevice::~FullDevice()
{
}

bool FullDevice::has_data_available_for_reading(Process&) const
bool FullDevice::can_read(Process&) const
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion VirtualFileSystem/FullDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FullDevice final : public 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; }
};

2 changes: 1 addition & 1 deletion VirtualFileSystem/NullDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NullDevice::~NullDevice()
{
}

bool NullDevice::has_data_available_for_reading(Process&) const
bool NullDevice::can_read(Process&) const
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion VirtualFileSystem/NullDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class NullDevice final : public CharacterDevice {
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;
};

2 changes: 1 addition & 1 deletion VirtualFileSystem/RandomDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion VirtualFileSystem/RandomDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class RandomDevice final : public 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; }
};

2 changes: 1 addition & 1 deletion VirtualFileSystem/ZeroDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ZeroDevice::~ZeroDevice()
{
}

bool ZeroDevice::has_data_available_for_reading(Process&) const
bool ZeroDevice::can_read(Process&) const
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion VirtualFileSystem/ZeroDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ZeroDevice final : public 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; }
};

4 changes: 2 additions & 2 deletions Widgets/EventLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ 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);
bool left_button = data[0] & 1;
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);
Expand Down
2 changes: 1 addition & 1 deletion Widgets/GUIEventDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion Widgets/GUIEventDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class GUIEventDevice final : public CharacterDevice {
// ^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; }
};

0 comments on commit 08bfe51

Please sign in to comment.