From 9ce537d7036bf4aff61d4ce10e7fe0b134c122b3 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Tue, 25 Jan 2022 20:17:49 +0200 Subject: [PATCH] Kernel: Use u64 instead of size_t for File::can_read offset This ensures offsets will not be truncated on large files on i686. --- Kernel/Bus/VirtIO/ConsolePort.cpp | 2 +- Kernel/Bus/VirtIO/ConsolePort.h | 2 +- Kernel/Devices/Audio/AC97.h | 2 +- Kernel/Devices/Audio/SB16.cpp | 2 +- Kernel/Devices/Audio/SB16.h | 2 +- Kernel/Devices/ConsoleDevice.cpp | 2 +- Kernel/Devices/ConsoleDevice.h | 2 +- Kernel/Devices/DeviceControlDevice.cpp | 2 +- Kernel/Devices/DeviceControlDevice.h | 2 +- Kernel/Devices/FullDevice.cpp | 2 +- Kernel/Devices/FullDevice.h | 2 +- Kernel/Devices/HID/KeyboardDevice.cpp | 2 +- Kernel/Devices/HID/KeyboardDevice.h | 2 +- Kernel/Devices/HID/MouseDevice.cpp | 2 +- Kernel/Devices/HID/MouseDevice.h | 2 +- Kernel/Devices/KCOVDevice.h | 2 +- Kernel/Devices/MemoryDevice.h | 2 +- Kernel/Devices/NullDevice.cpp | 2 +- Kernel/Devices/NullDevice.h | 2 +- Kernel/Devices/RandomDevice.cpp | 2 +- Kernel/Devices/RandomDevice.h | 2 +- Kernel/Devices/SerialDevice.cpp | 2 +- Kernel/Devices/SerialDevice.h | 2 +- Kernel/Devices/ZeroDevice.cpp | 2 +- Kernel/Devices/ZeroDevice.h | 2 +- Kernel/FileSystem/AnonymousFile.h | 2 +- Kernel/FileSystem/FIFO.cpp | 2 +- Kernel/FileSystem/FIFO.h | 2 +- Kernel/FileSystem/File.h | 2 +- Kernel/FileSystem/InodeFile.h | 2 +- Kernel/FileSystem/InodeWatcher.cpp | 2 +- Kernel/FileSystem/InodeWatcher.h | 2 +- Kernel/Graphics/GenericFramebufferDevice.h | 2 +- Kernel/Net/IPv4Socket.cpp | 2 +- Kernel/Net/IPv4Socket.h | 2 +- Kernel/Net/LocalSocket.cpp | 2 +- Kernel/Net/LocalSocket.h | 2 +- Kernel/Storage/Partition/DiskPartition.cpp | 2 +- Kernel/Storage/Partition/DiskPartition.h | 2 +- Kernel/Storage/StorageDevice.h | 2 +- Kernel/TTY/MasterPTY.cpp | 2 +- Kernel/TTY/MasterPTY.h | 2 +- Kernel/TTY/PTYMultiplexer.h | 2 +- Kernel/TTY/SlavePTY.cpp | 2 +- Kernel/TTY/SlavePTY.h | 2 +- Kernel/TTY/TTY.cpp | 2 +- Kernel/TTY/TTY.h | 2 +- 47 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Kernel/Bus/VirtIO/ConsolePort.cpp b/Kernel/Bus/VirtIO/ConsolePort.cpp index 8545aac8ae9..e30b227cd4c 100644 --- a/Kernel/Bus/VirtIO/ConsolePort.cpp +++ b/Kernel/Bus/VirtIO/ConsolePort.cpp @@ -85,7 +85,7 @@ void ConsolePort::handle_queue_update(Badge, 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; } diff --git a/Kernel/Bus/VirtIO/ConsolePort.h b/Kernel/Bus/VirtIO/ConsolePort.h index 81a8aca8741..44c50f09b91 100644 --- a/Kernel/Bus/VirtIO/ConsolePort.h +++ b/Kernel/Bus/VirtIO/ConsolePort.h @@ -37,7 +37,7 @@ private: 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 read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual bool can_write(const OpenFileDescription&, size_t) const override; virtual ErrorOr write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override; diff --git a/Kernel/Devices/Audio/AC97.h b/Kernel/Devices/Audio/AC97.h index aae4c7dc581..36ed77190eb 100644 --- a/Kernel/Devices/Audio/AC97.h +++ b/Kernel/Devices/Audio/AC97.h @@ -31,7 +31,7 @@ public: virtual StringView purpose() const override { return class_name(); } // ^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 ErrorOr ioctl(OpenFileDescription&, unsigned, Userspace) override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; diff --git a/Kernel/Devices/Audio/SB16.cpp b/Kernel/Devices/Audio/SB16.cpp index 7256db1807c..b654060ba16 100644 --- a/Kernel/Devices/Audio/SB16.cpp +++ b/Kernel/Devices/Audio/SB16.cpp @@ -184,7 +184,7 @@ void SB16::set_irq_line(u8 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; } diff --git a/Kernel/Devices/Audio/SB16.h b/Kernel/Devices/Audio/SB16.h index fe596b5204a..5331b978478 100644 --- a/Kernel/Devices/Audio/SB16.h +++ b/Kernel/Devices/Audio/SB16.h @@ -26,7 +26,7 @@ public: static RefPtr try_detect_and_create(); // ^CharacterDevice - virtual bool can_read(const OpenFileDescription&, size_t) const override; + virtual bool can_read(const OpenFileDescription&, u64) const override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; } diff --git a/Kernel/Devices/ConsoleDevice.cpp b/Kernel/Devices/ConsoleDevice.cpp index b589d62a95a..e2cb009e104 100644 --- a/Kernel/Devices/ConsoleDevice.cpp +++ b/Kernel/Devices/ConsoleDevice.cpp @@ -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; } diff --git a/Kernel/Devices/ConsoleDevice.h b/Kernel/Devices/ConsoleDevice.h index 1c2e05fae8e..192d693f976 100644 --- a/Kernel/Devices/ConsoleDevice.h +++ b/Kernel/Devices/ConsoleDevice.h @@ -21,7 +21,7 @@ public: virtual ~ConsoleDevice() override; // ^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 ErrorOr read(OpenFileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override; virtual ErrorOr write(OpenFileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override; diff --git a/Kernel/Devices/DeviceControlDevice.cpp b/Kernel/Devices/DeviceControlDevice.cpp index 5eeff02c43a..28d36dd343f 100644 --- a/Kernel/Devices/DeviceControlDevice.cpp +++ b/Kernel/Devices/DeviceControlDevice.cpp @@ -17,7 +17,7 @@ UNMAP_AFTER_INIT NonnullRefPtr DeviceControlDevice::must_cr 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; } diff --git a/Kernel/Devices/DeviceControlDevice.h b/Kernel/Devices/DeviceControlDevice.h index 16fdc73e7a8..f192778cfb9 100644 --- a/Kernel/Devices/DeviceControlDevice.h +++ b/Kernel/Devices/DeviceControlDevice.h @@ -24,7 +24,7 @@ private: virtual ErrorOr ioctl(OpenFileDescription&, unsigned request, Userspace arg) override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr 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 StringView class_name() const override { return "DeviceControlDevice"sv; } }; diff --git a/Kernel/Devices/FullDevice.cpp b/Kernel/Devices/FullDevice.cpp index 122216bccbd..98a91c5a3fc 100644 --- a/Kernel/Devices/FullDevice.cpp +++ b/Kernel/Devices/FullDevice.cpp @@ -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; } diff --git a/Kernel/Devices/FullDevice.h b/Kernel/Devices/FullDevice.h index e7a5412ef68..44bf07c75fa 100644 --- a/Kernel/Devices/FullDevice.h +++ b/Kernel/Devices/FullDevice.h @@ -23,7 +23,7 @@ private: // ^CharacterDevice virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr 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 StringView class_name() const override { return "FullDevice"sv; } }; diff --git a/Kernel/Devices/HID/KeyboardDevice.cpp b/Kernel/Devices/HID/KeyboardDevice.cpp index f6062712465..6b22a28d270 100644 --- a/Kernel/Devices/HID/KeyboardDevice.cpp +++ b/Kernel/Devices/HID/KeyboardDevice.cpp @@ -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(); } diff --git a/Kernel/Devices/HID/KeyboardDevice.h b/Kernel/Devices/HID/KeyboardDevice.h index f5885aabb40..4b865ba09f5 100644 --- a/Kernel/Devices/HID/KeyboardDevice.h +++ b/Kernel/Devices/HID/KeyboardDevice.h @@ -26,7 +26,7 @@ public: // ^CharacterDevice virtual ErrorOr 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 write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; } virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; } diff --git a/Kernel/Devices/HID/MouseDevice.cpp b/Kernel/Devices/HID/MouseDevice.cpp index 53d8f90dd99..5139ec892d3 100644 --- a/Kernel/Devices/HID/MouseDevice.cpp +++ b/Kernel/Devices/HID/MouseDevice.cpp @@ -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); return !m_queue.is_empty(); diff --git a/Kernel/Devices/HID/MouseDevice.h b/Kernel/Devices/HID/MouseDevice.h index e240c27cae6..a39f2cb0142 100644 --- a/Kernel/Devices/HID/MouseDevice.h +++ b/Kernel/Devices/HID/MouseDevice.h @@ -24,7 +24,7 @@ public: // ^CharacterDevice virtual ErrorOr 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 write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return EINVAL; } virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; } diff --git a/Kernel/Devices/KCOVDevice.h b/Kernel/Devices/KCOVDevice.h index 2977704b9a6..c8eebf8c31c 100644 --- a/Kernel/Devices/KCOVDevice.h +++ b/Kernel/Devices/KCOVDevice.h @@ -30,7 +30,7 @@ protected: 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 void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); } virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; } diff --git a/Kernel/Devices/MemoryDevice.h b/Kernel/Devices/MemoryDevice.h index 0535562034f..a311d6561ba 100644 --- a/Kernel/Devices/MemoryDevice.h +++ b/Kernel/Devices/MemoryDevice.h @@ -25,7 +25,7 @@ private: MemoryDevice(); 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 is_seekable() const override { return true; } virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; diff --git a/Kernel/Devices/NullDevice.cpp b/Kernel/Devices/NullDevice.cpp index efd78ca75aa..b9cfc2cde5a 100644 --- a/Kernel/Devices/NullDevice.cpp +++ b/Kernel/Devices/NullDevice.cpp @@ -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; } diff --git a/Kernel/Devices/NullDevice.h b/Kernel/Devices/NullDevice.h index 661c3deab4c..5668bccbe6e 100644 --- a/Kernel/Devices/NullDevice.h +++ b/Kernel/Devices/NullDevice.h @@ -24,7 +24,7 @@ private: virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override; 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 bool is_seekable() const override { return true; } }; diff --git a/Kernel/Devices/RandomDevice.cpp b/Kernel/Devices/RandomDevice.cpp index 5c8790c98fc..d3843134358 100644 --- a/Kernel/Devices/RandomDevice.cpp +++ b/Kernel/Devices/RandomDevice.cpp @@ -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; } diff --git a/Kernel/Devices/RandomDevice.h b/Kernel/Devices/RandomDevice.h index 2e6639c7a6c..d9e8799960d 100644 --- a/Kernel/Devices/RandomDevice.h +++ b/Kernel/Devices/RandomDevice.h @@ -23,7 +23,7 @@ private: // ^CharacterDevice virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr 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 StringView class_name() const override { return "RandomDevice"sv; } }; diff --git a/Kernel/Devices/SerialDevice.cpp b/Kernel/Devices/SerialDevice.cpp index 9a21dfb4475..573be81326c 100644 --- a/Kernel/Devices/SerialDevice.cpp +++ b/Kernel/Devices/SerialDevice.cpp @@ -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; } diff --git a/Kernel/Devices/SerialDevice.h b/Kernel/Devices/SerialDevice.h index 84f8c968a15..e8d78f24108 100644 --- a/Kernel/Devices/SerialDevice.h +++ b/Kernel/Devices/SerialDevice.h @@ -20,7 +20,7 @@ public: virtual ~SerialDevice() override; // ^CharacterDevice - virtual bool can_read(const OpenFileDescription&, size_t) const override; + virtual bool can_read(const OpenFileDescription&, u64) const override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual bool can_write(const OpenFileDescription&, size_t) const override; virtual ErrorOr write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override; diff --git a/Kernel/Devices/ZeroDevice.cpp b/Kernel/Devices/ZeroDevice.cpp index 400fa511177..2024db5f74b 100644 --- a/Kernel/Devices/ZeroDevice.cpp +++ b/Kernel/Devices/ZeroDevice.cpp @@ -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; } diff --git a/Kernel/Devices/ZeroDevice.h b/Kernel/Devices/ZeroDevice.h index 07f19ef29e5..090fcf97c54 100644 --- a/Kernel/Devices/ZeroDevice.h +++ b/Kernel/Devices/ZeroDevice.h @@ -23,7 +23,7 @@ private: // ^CharacterDevice virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr 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 StringView class_name() const override { return "ZeroDevice"sv; } }; diff --git a/Kernel/FileSystem/AnonymousFile.h b/Kernel/FileSystem/AnonymousFile.h index a1346aef28a..e9af0a62e36 100644 --- a/Kernel/FileSystem/AnonymousFile.h +++ b/Kernel/FileSystem/AnonymousFile.h @@ -25,7 +25,7 @@ public: private: virtual StringView class_name() const override { return "AnonymousFile"sv; } virtual ErrorOr> 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 ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; } virtual ErrorOr write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return ENOTSUP; } diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index 6ca8a1f3f87..a8072f1d8b3 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -99,7 +99,7 @@ void FIFO::detach(Direction direction) 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; } diff --git a/Kernel/FileSystem/FIFO.h b/Kernel/FileSystem/FIFO.h index 082930f6be1..fe2b125fbd1 100644 --- a/Kernel/FileSystem/FIFO.h +++ b/Kernel/FileSystem/FIFO.h @@ -43,7 +43,7 @@ private: virtual ErrorOr write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr 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 ErrorOr> pseudo_path(const OpenFileDescription&) const override; virtual StringView class_name() const override { return "FIFO"sv; } diff --git a/Kernel/FileSystem/File.h b/Kernel/FileSystem/File.h index c3396fc74e1..40677d6fc17 100644 --- a/Kernel/FileSystem/File.h +++ b/Kernel/FileSystem/File.h @@ -81,7 +81,7 @@ public: virtual ErrorOr> open(int options); virtual ErrorOr 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 ErrorOr attach(OpenFileDescription&); diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h index e22dc165f5b..90508e8b0b0 100644 --- a/Kernel/FileSystem/InodeFile.h +++ b/Kernel/FileSystem/InodeFile.h @@ -27,7 +27,7 @@ public: const Inode& inode() const { 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 ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; diff --git a/Kernel/FileSystem/InodeWatcher.cpp b/Kernel/FileSystem/InodeWatcher.cpp index eedf5e0938c..61dd040a89b 100644 --- a/Kernel/FileSystem/InodeWatcher.cpp +++ b/Kernel/FileSystem/InodeWatcher.cpp @@ -22,7 +22,7 @@ InodeWatcher::~InodeWatcher() (void)close(); } -bool InodeWatcher::can_read(const OpenFileDescription&, size_t) const +bool InodeWatcher::can_read(const OpenFileDescription&, u64) const { MutexLocker locker(m_lock); return !m_queue.is_empty(); diff --git a/Kernel/FileSystem/InodeWatcher.h b/Kernel/FileSystem/InodeWatcher.h index cec9acb0e13..8c23c0e2172 100644 --- a/Kernel/FileSystem/InodeWatcher.h +++ b/Kernel/FileSystem/InodeWatcher.h @@ -44,7 +44,7 @@ public: static ErrorOr> try_create(); virtual ~InodeWatcher() override; - virtual bool can_read(const OpenFileDescription&, size_t) const override; + virtual bool can_read(const OpenFileDescription&, u64) const override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; // Can't write to an inode watcher. virtual bool can_write(const OpenFileDescription&, size_t) const override { return true; } diff --git a/Kernel/Graphics/GenericFramebufferDevice.h b/Kernel/Graphics/GenericFramebufferDevice.h index ccf549a2821..197bea761da 100644 --- a/Kernel/Graphics/GenericFramebufferDevice.h +++ b/Kernel/Graphics/GenericFramebufferDevice.h @@ -33,7 +33,7 @@ public: private: // ^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 void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); } virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; } diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp index 035656b0711..9fefdc3c728 100644 --- a/Kernel/Net/IPv4Socket.cpp +++ b/Kernel/Net/IPv4Socket.cpp @@ -161,7 +161,7 @@ ErrorOr IPv4Socket::connect(OpenFileDescription& description, Userspace listen(size_t) override; virtual void get_local_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 ErrorOr sendto(OpenFileDescription&, const UserOrKernelBuffer&, size_t, int, Userspace, socklen_t) override; virtual ErrorOr recvfrom(OpenFileDescription&, UserOrKernelBuffer&, size_t, int flags, Userspace, Userspace, Time&) override; diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 791262370e2..40fa8dc4124 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -258,7 +258,7 @@ void LocalSocket::detach(OpenFileDescription& description) 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); if (role == Role::Listener) diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h index 881eb29cf7c..94dc7b591ce 100644 --- a/Kernel/Net/LocalSocket.h +++ b/Kernel/Net/LocalSocket.h @@ -42,7 +42,7 @@ public: virtual void get_peer_address(sockaddr*, socklen_t*) override; virtual ErrorOr attach(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 ErrorOr sendto(OpenFileDescription&, const UserOrKernelBuffer&, size_t, int, Userspace, socklen_t) override; virtual ErrorOr recvfrom(OpenFileDescription&, UserOrKernelBuffer&, size_t, int flags, Userspace, Userspace, Time&) override; diff --git a/Kernel/Storage/Partition/DiskPartition.cpp b/Kernel/Storage/Partition/DiskPartition.cpp index 2e81fc99148..2a294033dec 100644 --- a/Kernel/Storage/Partition/DiskPartition.cpp +++ b/Kernel/Storage/Partition/DiskPartition.cpp @@ -54,7 +54,7 @@ ErrorOr DiskPartition::read(OpenFileDescription& fd, u64 offset, UserOrK 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(); dbgln_if(OFFD_DEBUG, "DiskPartition::can_read offset={}, adjust={}", offset, adjust); diff --git a/Kernel/Storage/Partition/DiskPartition.h b/Kernel/Storage/Partition/DiskPartition.h index 8c3e1ec6c16..92412d2c2fe 100644 --- a/Kernel/Storage/Partition/DiskPartition.h +++ b/Kernel/Storage/Partition/DiskPartition.h @@ -24,7 +24,7 @@ public: // ^BlockDevice virtual ErrorOr 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 write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual bool can_write(const OpenFileDescription&, size_t) const override; diff --git a/Kernel/Storage/StorageDevice.h b/Kernel/Storage/StorageDevice.h index 4f3555e0bca..53ad1d750e3 100644 --- a/Kernel/Storage/StorageDevice.h +++ b/Kernel/Storage/StorageDevice.h @@ -38,7 +38,7 @@ public: // ^BlockDevice virtual ErrorOr 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 write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual bool can_write(const OpenFileDescription&, size_t) const override; virtual void prepare_for_unplug() { m_partitions.clear(); } diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp index 1198134832e..3ec336bc17c 100644 --- a/Kernel/TTY/MasterPTY.cpp +++ b/Kernel/TTY/MasterPTY.cpp @@ -72,7 +72,7 @@ ErrorOr MasterPTY::write(OpenFileDescription&, u64, const UserOrKernelBu return size; } -bool MasterPTY::can_read(const OpenFileDescription&, size_t) const +bool MasterPTY::can_read(const OpenFileDescription&, u64) const { if (!m_slave) return true; diff --git a/Kernel/TTY/MasterPTY.h b/Kernel/TTY/MasterPTY.h index 6ebe95dd4c6..27eb945d5ce 100644 --- a/Kernel/TTY/MasterPTY.h +++ b/Kernel/TTY/MasterPTY.h @@ -33,7 +33,7 @@ private: // ^CharacterDevice virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr 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 ErrorOr close() override; virtual bool is_master_pty() const override { return true; } diff --git a/Kernel/TTY/PTYMultiplexer.h b/Kernel/TTY/PTYMultiplexer.h index 3a7ea9beb47..e3c395d32f8 100644 --- a/Kernel/TTY/PTYMultiplexer.h +++ b/Kernel/TTY/PTYMultiplexer.h @@ -26,7 +26,7 @@ public: virtual ErrorOr> open(int options) override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return 0; } virtual ErrorOr 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; } void notify_master_destroyed(Badge, unsigned index); diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp index 3de56626040..b5a46daf8d7 100644 --- a/Kernel/TTY/SlavePTY.cpp +++ b/Kernel/TTY/SlavePTY.cpp @@ -90,7 +90,7 @@ bool SlavePTY::can_write(const OpenFileDescription&, size_t) const 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()) return true; diff --git a/Kernel/TTY/SlavePTY.h b/Kernel/TTY/SlavePTY.h index 4be7373e77f..1e1cb891779 100644 --- a/Kernel/TTY/SlavePTY.h +++ b/Kernel/TTY/SlavePTY.h @@ -32,7 +32,7 @@ private: virtual void echo(u8) override; // ^CharacterDevice - virtual bool can_read(const OpenFileDescription&, size_t) const override; + virtual bool can_read(const OpenFileDescription&, u64) const override; virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual bool can_write(const OpenFileDescription&, size_t) const override; virtual StringView class_name() const override { return "SlavePTY"sv; } diff --git a/Kernel/TTY/TTY.cpp b/Kernel/TTY/TTY.cpp index a7424da9614..237f10eff4f 100644 --- a/Kernel/TTY/TTY.cpp +++ b/Kernel/TTY/TTY.cpp @@ -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()) { return m_available_lines > 0; diff --git a/Kernel/TTY/TTY.h b/Kernel/TTY/TTY.h index eb1ee2134ec..06dc967b43c 100644 --- a/Kernel/TTY/TTY.h +++ b/Kernel/TTY/TTY.h @@ -23,7 +23,7 @@ public: virtual ErrorOr read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual ErrorOr 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 ErrorOr ioctl(OpenFileDescription&, unsigned request, Userspace arg) override final; virtual ErrorOr> pseudo_path(const OpenFileDescription&) const override;