mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Use u64 instead of size_t for File::can_read offset
This ensures offsets will not be truncated on large files on i686.
This commit is contained in:
parent
0c630d5687
commit
9ce537d703
Notes:
sideshowbarker
2024-07-17 20:14:26 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/9ce537d7036 Pull-request: https://github.com/SerenityOS/serenity/pull/12132 Reviewed-by: https://github.com/bgianfo ✅ Reviewed-by: https://github.com/tomuta ✅
47 changed files with 47 additions and 47 deletions
|
@ -85,7 +85,7 @@ void ConsolePort::handle_queue_update(Badge<VirtIO::Console>, u16 queue_index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConsolePort::can_read(const OpenFileDescription&, size_t) const
|
bool ConsolePort::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return m_receive_buffer->used_bytes() > 0;
|
return m_receive_buffer->used_bytes() > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ private:
|
||||||
|
|
||||||
virtual StringView class_name() const override { return "VirtIOConsolePort"sv; }
|
virtual StringView class_name() const override { return "VirtIOConsolePort"sv; }
|
||||||
|
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
virtual StringView purpose() const override { return class_name(); }
|
virtual StringView purpose() const override { return class_name(); }
|
||||||
|
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return false; }
|
virtual bool can_read(const OpenFileDescription&, u64) const override { return false; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned, Userspace<void*>) override;
|
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned, Userspace<void*>) override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
|
|
|
@ -184,7 +184,7 @@ void SB16::set_irq_line(u8 irq_number)
|
||||||
change_irq_number(irq_number);
|
change_irq_number(irq_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SB16::can_read(OpenFileDescription const&, size_t) const
|
bool SB16::can_read(OpenFileDescription const&, u64) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
static RefPtr<SB16> try_detect_and_create();
|
static RefPtr<SB16> try_detect_and_create();
|
||||||
|
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
|
|
|
@ -32,7 +32,7 @@ UNMAP_AFTER_INIT ConsoleDevice::~ConsoleDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConsoleDevice::can_read(const Kernel::OpenFileDescription&, size_t) const
|
bool ConsoleDevice::can_read(const Kernel::OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
virtual ~ConsoleDevice() override;
|
virtual ~ConsoleDevice() override;
|
||||||
|
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual bool can_read(const Kernel::OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const Kernel::OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const Kernel::OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const Kernel::OpenFileDescription&, size_t) const override { return true; }
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override;
|
||||||
|
|
|
@ -17,7 +17,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<DeviceControlDevice> DeviceControlDevice::must_cr
|
||||||
return device_control_device_or_error.release_value();
|
return device_control_device_or_error.release_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceControlDevice::can_read(const OpenFileDescription&, size_t) const
|
bool DeviceControlDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ private:
|
||||||
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
|
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return Error::from_errno(ENOTSUP); }
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return Error::from_errno(ENOTSUP); }
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
||||||
virtual StringView class_name() const override { return "DeviceControlDevice"sv; }
|
virtual StringView class_name() const override { return "DeviceControlDevice"sv; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,7 +29,7 @@ UNMAP_AFTER_INIT FullDevice::~FullDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FullDevice::can_read(const OpenFileDescription&, size_t) const
|
bool FullDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ private:
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
virtual StringView class_name() const override { return "FullDevice"sv; }
|
virtual StringView class_name() const override { return "FullDevice"sv; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -280,7 +280,7 @@ UNMAP_AFTER_INIT KeyboardDevice::~KeyboardDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyboardDevice::can_read(const OpenFileDescription&, size_t) const
|
bool KeyboardDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return !m_queue.is_empty();
|
return !m_queue.is_empty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ MouseDevice::~MouseDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MouseDevice::can_read(const OpenFileDescription&, size_t) const
|
bool MouseDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
SpinlockLocker lock(m_queue_lock);
|
SpinlockLocker lock(m_queue_lock);
|
||||||
return !m_queue.is_empty();
|
return !m_queue.is_empty();
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
||||||
|
|
||||||
virtual StringView class_name() const override { return "KCOVDevice"sv; }
|
virtual StringView class_name() const override { return "KCOVDevice"sv; }
|
||||||
|
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override final { return true; }
|
virtual bool can_read(const OpenFileDescription&, u64) const override final { return true; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override final { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override final { return true; }
|
||||||
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
|
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||||
|
|
|
@ -25,7 +25,7 @@ private:
|
||||||
MemoryDevice();
|
MemoryDevice();
|
||||||
|
|
||||||
virtual StringView class_name() const override { return "MemoryDevice"sv; }
|
virtual StringView class_name() const override { return "MemoryDevice"sv; }
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_read(const OpenFileDescription&, u64) const override { return true; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
||||||
virtual bool is_seekable() const override { return true; }
|
virtual bool is_seekable() const override { return true; }
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
|
|
|
@ -28,7 +28,7 @@ UNMAP_AFTER_INIT NullDevice::~NullDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NullDevice::can_read(const OpenFileDescription&, size_t) const
|
bool NullDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ private:
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual StringView class_name() const override { return "NullDevice"sv; }
|
virtual StringView class_name() const override { return "NullDevice"sv; }
|
||||||
virtual bool is_seekable() const override { return true; }
|
virtual bool is_seekable() const override { return true; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,7 +28,7 @@ UNMAP_AFTER_INIT RandomDevice::~RandomDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RandomDevice::can_read(const OpenFileDescription&, size_t) const
|
bool RandomDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ private:
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
virtual StringView class_name() const override { return "RandomDevice"sv; }
|
virtual StringView class_name() const override { return "RandomDevice"sv; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -56,7 +56,7 @@ UNMAP_AFTER_INIT SerialDevice::~SerialDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SerialDevice::can_read(const OpenFileDescription&, size_t) const
|
bool SerialDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return (get_line_status() & DataReady) != 0;
|
return (get_line_status() & DataReady) != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual ~SerialDevice() override;
|
virtual ~SerialDevice() override;
|
||||||
|
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
|
|
|
@ -28,7 +28,7 @@ UNMAP_AFTER_INIT ZeroDevice::~ZeroDevice()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZeroDevice::can_read(const OpenFileDescription&, size_t) const
|
bool ZeroDevice::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ private:
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
virtual StringView class_name() const override { return "ZeroDevice"sv; }
|
virtual StringView class_name() const override { return "ZeroDevice"sv; }
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
private:
|
private:
|
||||||
virtual StringView class_name() const override { return "AnonymousFile"sv; }
|
virtual StringView class_name() const override { return "AnonymousFile"sv; }
|
||||||
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
|
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return false; }
|
virtual bool can_read(const OpenFileDescription&, u64) const override { return false; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return false; }
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
|
||||||
|
|
|
@ -99,7 +99,7 @@ void FIFO::detach(Direction direction)
|
||||||
evaluate_block_conditions();
|
evaluate_block_conditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FIFO::can_read(const OpenFileDescription&, size_t) const
|
bool FIFO::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
return !m_buffer->is_empty() || !m_writers;
|
return !m_buffer->is_empty() || !m_writers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ private:
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<struct stat> stat() const override;
|
virtual ErrorOr<struct stat> stat() const override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
|
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
|
||||||
virtual StringView class_name() const override { return "FIFO"sv; }
|
virtual StringView class_name() const override { return "FIFO"sv; }
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
virtual ErrorOr<NonnullRefPtr<OpenFileDescription>> open(int options);
|
virtual ErrorOr<NonnullRefPtr<OpenFileDescription>> open(int options);
|
||||||
virtual ErrorOr<void> close();
|
virtual ErrorOr<void> close();
|
||||||
|
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const = 0;
|
virtual bool can_read(const OpenFileDescription&, u64) const = 0;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const = 0;
|
virtual bool can_write(const OpenFileDescription&, size_t) const = 0;
|
||||||
|
|
||||||
virtual ErrorOr<void> attach(OpenFileDescription&);
|
virtual ErrorOr<void> attach(OpenFileDescription&);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
const Inode& inode() const { return *m_inode; }
|
const Inode& inode() const { return *m_inode; }
|
||||||
Inode& inode() { return *m_inode; }
|
Inode& inode() { return *m_inode; }
|
||||||
|
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_read(const OpenFileDescription&, u64) const override { return true; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
|
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
|
|
|
@ -22,7 +22,7 @@ InodeWatcher::~InodeWatcher()
|
||||||
(void)close();
|
(void)close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InodeWatcher::can_read(const OpenFileDescription&, size_t) const
|
bool InodeWatcher::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
MutexLocker locker(m_lock);
|
MutexLocker locker(m_lock);
|
||||||
return !m_queue.is_empty();
|
return !m_queue.is_empty();
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
static ErrorOr<NonnullRefPtr<InodeWatcher>> try_create();
|
static ErrorOr<NonnullRefPtr<InodeWatcher>> try_create();
|
||||||
virtual ~InodeWatcher() override;
|
virtual ~InodeWatcher() override;
|
||||||
|
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
// Can't write to an inode watcher.
|
// Can't write to an inode watcher.
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ^File
|
// ^File
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override final { return true; }
|
virtual bool can_read(const OpenFileDescription&, u64) const override final { return true; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override final { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override final { return true; }
|
||||||
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
|
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
|
||||||
|
|
|
@ -161,7 +161,7 @@ ErrorOr<void> IPv4Socket::connect(OpenFileDescription& description, Userspace<co
|
||||||
return protocol_connect(description, should_block);
|
return protocol_connect(description, should_block);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IPv4Socket::can_read(const OpenFileDescription&, size_t) const
|
bool IPv4Socket::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
if (m_role == Role::Listener)
|
if (m_role == Role::Listener)
|
||||||
return can_accept();
|
return can_accept();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
virtual ErrorOr<void> listen(size_t) override;
|
virtual ErrorOr<void> listen(size_t) override;
|
||||||
virtual void get_local_address(sockaddr*, socklen_t*) override;
|
virtual void get_local_address(sockaddr*, socklen_t*) override;
|
||||||
virtual void get_peer_address(sockaddr*, socklen_t*) override;
|
virtual void get_peer_address(sockaddr*, socklen_t*) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual ErrorOr<size_t> sendto(OpenFileDescription&, const UserOrKernelBuffer&, size_t, int, Userspace<const sockaddr*>, socklen_t) override;
|
virtual ErrorOr<size_t> sendto(OpenFileDescription&, const UserOrKernelBuffer&, size_t, int, Userspace<const sockaddr*>, socklen_t) override;
|
||||||
virtual ErrorOr<size_t> recvfrom(OpenFileDescription&, UserOrKernelBuffer&, size_t, int flags, Userspace<sockaddr*>, Userspace<socklen_t*>, Time&) override;
|
virtual ErrorOr<size_t> recvfrom(OpenFileDescription&, UserOrKernelBuffer&, size_t, int flags, Userspace<sockaddr*>, Userspace<socklen_t*>, Time&) override;
|
||||||
|
|
|
@ -258,7 +258,7 @@ void LocalSocket::detach(OpenFileDescription& description)
|
||||||
evaluate_block_conditions();
|
evaluate_block_conditions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalSocket::can_read(const OpenFileDescription& description, size_t) const
|
bool LocalSocket::can_read(const OpenFileDescription& description, u64) const
|
||||||
{
|
{
|
||||||
auto role = this->role(description);
|
auto role = this->role(description);
|
||||||
if (role == Role::Listener)
|
if (role == Role::Listener)
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
virtual void get_peer_address(sockaddr*, socklen_t*) override;
|
virtual void get_peer_address(sockaddr*, socklen_t*) override;
|
||||||
virtual ErrorOr<void> attach(OpenFileDescription&) override;
|
virtual ErrorOr<void> attach(OpenFileDescription&) override;
|
||||||
virtual void detach(OpenFileDescription&) override;
|
virtual void detach(OpenFileDescription&) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual ErrorOr<size_t> sendto(OpenFileDescription&, const UserOrKernelBuffer&, size_t, int, Userspace<const sockaddr*>, socklen_t) override;
|
virtual ErrorOr<size_t> sendto(OpenFileDescription&, const UserOrKernelBuffer&, size_t, int, Userspace<const sockaddr*>, socklen_t) override;
|
||||||
virtual ErrorOr<size_t> recvfrom(OpenFileDescription&, UserOrKernelBuffer&, size_t, int flags, Userspace<sockaddr*>, Userspace<socklen_t*>, Time&) override;
|
virtual ErrorOr<size_t> recvfrom(OpenFileDescription&, UserOrKernelBuffer&, size_t, int flags, Userspace<sockaddr*>, Userspace<socklen_t*>, Time&) override;
|
||||||
|
|
|
@ -54,7 +54,7 @@ ErrorOr<size_t> DiskPartition::read(OpenFileDescription& fd, u64 offset, UserOrK
|
||||||
return m_device.strong_ref()->read(fd, offset + adjust, outbuf, len);
|
return m_device.strong_ref()->read(fd, offset + adjust, outbuf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiskPartition::can_read(const OpenFileDescription& fd, size_t offset) const
|
bool DiskPartition::can_read(const OpenFileDescription& fd, u64 offset) const
|
||||||
{
|
{
|
||||||
unsigned adjust = m_metadata.start_block() * block_size();
|
unsigned adjust = m_metadata.start_block() * block_size();
|
||||||
dbgln_if(OFFD_DEBUG, "DiskPartition::can_read offset={}, adjust={}", offset, adjust);
|
dbgln_if(OFFD_DEBUG, "DiskPartition::can_read offset={}, adjust={}", offset, adjust);
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
// ^BlockDevice
|
// ^BlockDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
|
|
||||||
// ^BlockDevice
|
// ^BlockDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual void prepare_for_unplug() { m_partitions.clear(); }
|
virtual void prepare_for_unplug() { m_partitions.clear(); }
|
||||||
|
|
|
@ -72,7 +72,7 @@ ErrorOr<size_t> MasterPTY::write(OpenFileDescription&, u64, const UserOrKernelBu
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MasterPTY::can_read(const OpenFileDescription&, size_t) const
|
bool MasterPTY::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
if (!m_slave)
|
if (!m_slave)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -33,7 +33,7 @@ private:
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual ErrorOr<void> close() override;
|
virtual ErrorOr<void> close() override;
|
||||||
virtual bool is_master_pty() const override { return true; }
|
virtual bool is_master_pty() const override { return true; }
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
virtual ErrorOr<NonnullRefPtr<OpenFileDescription>> open(int options) override;
|
virtual ErrorOr<NonnullRefPtr<OpenFileDescription>> open(int options) override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return 0; }
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return 0; }
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return 0; }
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return 0; }
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_read(const OpenFileDescription&, u64) const override { return true; }
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; }
|
||||||
|
|
||||||
void notify_master_destroyed(Badge<MasterPTY>, unsigned index);
|
void notify_master_destroyed(Badge<MasterPTY>, unsigned index);
|
||||||
|
|
|
@ -90,7 +90,7 @@ bool SlavePTY::can_write(const OpenFileDescription&, size_t) const
|
||||||
return m_master->can_write_from_slave();
|
return m_master->can_write_from_slave();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SlavePTY::can_read(const OpenFileDescription& description, size_t offset) const
|
bool SlavePTY::can_read(const OpenFileDescription& description, u64 offset) const
|
||||||
{
|
{
|
||||||
if (m_master->is_closed())
|
if (m_master->is_closed())
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -32,7 +32,7 @@ private:
|
||||||
virtual void echo(u8) override;
|
virtual void echo(u8) override;
|
||||||
|
|
||||||
// ^CharacterDevice
|
// ^CharacterDevice
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual StringView class_name() const override { return "SlavePTY"sv; }
|
virtual StringView class_name() const override { return "SlavePTY"sv; }
|
||||||
|
|
|
@ -139,7 +139,7 @@ void TTY::process_output(u8 ch, Functor put_char)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTY::can_read(const OpenFileDescription&, size_t) const
|
bool TTY::can_read(const OpenFileDescription&, u64) const
|
||||||
{
|
{
|
||||||
if (in_canonical_mode()) {
|
if (in_canonical_mode()) {
|
||||||
return m_available_lines > 0;
|
return m_available_lines > 0;
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
|
||||||
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
|
||||||
virtual bool can_read(const OpenFileDescription&, size_t) const override;
|
virtual bool can_read(const OpenFileDescription&, u64) const override;
|
||||||
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
virtual bool can_write(const OpenFileDescription&, size_t) const override;
|
||||||
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override final;
|
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override final;
|
||||||
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
|
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;
|
||||||
|
|
Loading…
Reference in a new issue