kernel: Rename Inode::blocking() to Inode::will_block_if_read()
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
parent
0c873923e8
commit
187f0ff83e
@ -310,7 +310,7 @@ class ATADevice : public Device
|
||||
return err(ENOTSUP);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace MBR
|
||||
|
||||
Result<usize> write(const u8* buf, usize offset, usize length) override;
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class MountInode : public VFS::Inode, public LinkedListNode<MountInode>
|
||||
return err(EISDIR);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ Result<usize> Pipe::write(const u8* buf, usize, usize length)
|
||||
return length;
|
||||
}
|
||||
|
||||
bool Pipe::blocking() const
|
||||
bool Pipe::will_block_if_read() const
|
||||
{
|
||||
return !m_data_buffer.size() && m_writer;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class Pipe : public Shareable
|
||||
|
||||
Result<usize> write(const u8* buf, usize, usize length);
|
||||
|
||||
bool blocking() const;
|
||||
bool will_block_if_read() const;
|
||||
|
||||
private:
|
||||
Buffer m_data_buffer;
|
||||
@ -40,9 +40,9 @@ class PipeInodeBase : public VFS::FileInode
|
||||
return err(ENOTSUP);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return m_pipe->blocking();
|
||||
return m_pipe->will_block_if_read();
|
||||
}
|
||||
|
||||
usize size() const override
|
||||
|
@ -120,7 +120,7 @@ namespace VFS
|
||||
|
||||
virtual Result<void> truncate(usize size) = 0;
|
||||
|
||||
virtual bool blocking() const = 0;
|
||||
virtual bool will_block_if_read() const = 0;
|
||||
|
||||
// Symlink-specific methods
|
||||
virtual Result<StringView> readlink()
|
||||
@ -231,7 +231,7 @@ namespace VFS
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ Result<usize> ConsoleDevice::write(const u8* buf, usize, usize length)
|
||||
return length;
|
||||
}
|
||||
|
||||
bool ConsoleDevice::blocking() const
|
||||
bool ConsoleDevice::will_block_if_read() const
|
||||
{
|
||||
return m_may_read_without_blocking ? false : m_input_buffer.size() == 0;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ class ConsoleDevice : public Device
|
||||
|
||||
static void did_press_or_release_key(u8 scancode);
|
||||
|
||||
bool blocking() const override;
|
||||
bool will_block_if_read() const override;
|
||||
|
||||
Result<u64> ioctl(int request, void* arg) override;
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Device : public Shareable
|
||||
// Path in devfs.
|
||||
virtual StringView device_path() const = 0;
|
||||
|
||||
virtual bool blocking() const = 0;
|
||||
virtual bool will_block_if_read() const = 0;
|
||||
|
||||
virtual ~Device() = default;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ usize FramebufferDevice::size() const
|
||||
return Framebuffer::size();
|
||||
}
|
||||
|
||||
bool FramebufferDevice::blocking() const
|
||||
bool FramebufferDevice::will_block_if_read() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ class FramebufferDevice : public Device
|
||||
|
||||
Result<usize> write(const u8*, usize, usize) override;
|
||||
|
||||
bool blocking() const override;
|
||||
bool will_block_if_read() const override;
|
||||
|
||||
bool is_block_device() const override
|
||||
{
|
||||
|
@ -19,7 +19,7 @@ class FullDevice : public Device
|
||||
return err(ENOSPC);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class NullDevice : public Device
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ class UARTDevice : public Device
|
||||
|
||||
Result<usize> write(const u8*, usize, usize) override;
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class ZeroDevice : public Device
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ namespace Ext2
|
||||
return m_entries.size();
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -281,9 +281,9 @@ namespace TmpFS
|
||||
return m_device->isatty();
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return m_device->blocking();
|
||||
return m_device->will_block_if_read();
|
||||
}
|
||||
|
||||
usize size() const override
|
||||
@ -385,7 +385,7 @@ namespace TmpFS
|
||||
return err(EISDIR);
|
||||
}
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ class UnixSocket : public Socket
|
||||
UnixSocket();
|
||||
UnixSocket(UnixSocket* peer);
|
||||
|
||||
bool blocking() const override
|
||||
bool will_block_if_read() const override
|
||||
{
|
||||
return (m_state == Connected || m_state == Reset) && !m_data.size();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ Result<u64> sys_read(Registers* regs, SyscallArgs args)
|
||||
|
||||
if (!descriptor.is_readable()) return err(EBADF);
|
||||
|
||||
while (descriptor.inode()->blocking())
|
||||
while (descriptor.inode()->will_block_if_read())
|
||||
{
|
||||
if (descriptor.should_block()) kernel_sleep(10);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user