summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-25 20:17:49 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2022-01-25 22:41:17 +0200
commit9ce537d7036bf4aff61d4ce10e7fe0b134c122b3 (patch)
tree3dc45992db0acbfad56c0555821909432a1f86cd
parent0c630d568721f1efba2d5c0ee72c52c08b43d6e8 (diff)
downloadserenity-9ce537d7036bf4aff61d4ce10e7fe0b134c122b3.zip
Kernel: Use u64 instead of size_t for File::can_read offset
This ensures offsets will not be truncated on large files on i686.
-rw-r--r--Kernel/Bus/VirtIO/ConsolePort.cpp2
-rw-r--r--Kernel/Bus/VirtIO/ConsolePort.h2
-rw-r--r--Kernel/Devices/Audio/AC97.h2
-rw-r--r--Kernel/Devices/Audio/SB16.cpp2
-rw-r--r--Kernel/Devices/Audio/SB16.h2
-rw-r--r--Kernel/Devices/ConsoleDevice.cpp2
-rw-r--r--Kernel/Devices/ConsoleDevice.h2
-rw-r--r--Kernel/Devices/DeviceControlDevice.cpp2
-rw-r--r--Kernel/Devices/DeviceControlDevice.h2
-rw-r--r--Kernel/Devices/FullDevice.cpp2
-rw-r--r--Kernel/Devices/FullDevice.h2
-rw-r--r--Kernel/Devices/HID/KeyboardDevice.cpp2
-rw-r--r--Kernel/Devices/HID/KeyboardDevice.h2
-rw-r--r--Kernel/Devices/HID/MouseDevice.cpp2
-rw-r--r--Kernel/Devices/HID/MouseDevice.h2
-rw-r--r--Kernel/Devices/KCOVDevice.h2
-rw-r--r--Kernel/Devices/MemoryDevice.h2
-rw-r--r--Kernel/Devices/NullDevice.cpp2
-rw-r--r--Kernel/Devices/NullDevice.h2
-rw-r--r--Kernel/Devices/RandomDevice.cpp2
-rw-r--r--Kernel/Devices/RandomDevice.h2
-rw-r--r--Kernel/Devices/SerialDevice.cpp2
-rw-r--r--Kernel/Devices/SerialDevice.h2
-rw-r--r--Kernel/Devices/ZeroDevice.cpp2
-rw-r--r--Kernel/Devices/ZeroDevice.h2
-rw-r--r--Kernel/FileSystem/AnonymousFile.h2
-rw-r--r--Kernel/FileSystem/FIFO.cpp2
-rw-r--r--Kernel/FileSystem/FIFO.h2
-rw-r--r--Kernel/FileSystem/File.h2
-rw-r--r--Kernel/FileSystem/InodeFile.h2
-rw-r--r--Kernel/FileSystem/InodeWatcher.cpp2
-rw-r--r--Kernel/FileSystem/InodeWatcher.h2
-rw-r--r--Kernel/Graphics/GenericFramebufferDevice.h2
-rw-r--r--Kernel/Net/IPv4Socket.cpp2
-rw-r--r--Kernel/Net/IPv4Socket.h2
-rw-r--r--Kernel/Net/LocalSocket.cpp2
-rw-r--r--Kernel/Net/LocalSocket.h2
-rw-r--r--Kernel/Storage/Partition/DiskPartition.cpp2
-rw-r--r--Kernel/Storage/Partition/DiskPartition.h2
-rw-r--r--Kernel/Storage/StorageDevice.h2
-rw-r--r--Kernel/TTY/MasterPTY.cpp2
-rw-r--r--Kernel/TTY/MasterPTY.h2
-rw-r--r--Kernel/TTY/PTYMultiplexer.h2
-rw-r--r--Kernel/TTY/SlavePTY.cpp2
-rw-r--r--Kernel/TTY/SlavePTY.h2
-rw-r--r--Kernel/TTY/TTY.cpp2
-rw-r--r--Kernel/TTY/TTY.h2
47 files changed, 47 insertions, 47 deletions
diff --git a/Kernel/Bus/VirtIO/ConsolePort.cpp b/Kernel/Bus/VirtIO/ConsolePort.cpp
index 8545aac8ae..e30b227cd4 100644
--- a/Kernel/Bus/VirtIO/ConsolePort.cpp
+++ b/Kernel/Bus/VirtIO/ConsolePort.cpp
@@ -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;
}
diff --git a/Kernel/Bus/VirtIO/ConsolePort.h b/Kernel/Bus/VirtIO/ConsolePort.h
index 81a8aca874..44c50f09b9 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<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
virtual bool can_write(const OpenFileDescription&, size_t) const override;
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
diff --git a/Kernel/Devices/Audio/AC97.h b/Kernel/Devices/Audio/AC97.h
index aae4c7dc58..36ed77190e 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<void> ioctl(OpenFileDescription&, unsigned, Userspace<void*>) override;
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
diff --git a/Kernel/Devices/Audio/SB16.cpp b/Kernel/Devices/Audio/SB16.cpp
index 7256db1807..b654060ba1 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 fe596b5204..5331b97847 100644
--- a/Kernel/Devices/Audio/SB16.h
+++ b/Kernel/Devices/Audio/SB16.h
@@ -26,7 +26,7 @@ public:
static RefPtr<SB16> 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<size_t> read(OpenFileDescription&, u64, 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; }
diff --git a/Kernel/Devices/ConsoleDevice.cpp b/Kernel/Devices/ConsoleDevice.cpp
index b589d62a95..e2cb009e10 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 1c2e05fae8..192d693f97 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<size_t> read(OpenFileDescription&, u64, Kernel::UserOrKernelBuffer&, size_t) override;
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const Kernel::UserOrKernelBuffer&, size_t) override;
diff --git a/Kernel/Devices/DeviceControlDevice.cpp b/Kernel/Devices/DeviceControlDevice.cpp
index 5eeff02c43..28d36dd343 100644
--- a/Kernel/Devices/DeviceControlDevice.cpp
+++ b/Kernel/Devices/DeviceControlDevice.cpp
@@ -17,7 +17,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<DeviceControlDevice> 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 16fdc73e7a..f192778cfb 100644
--- a/Kernel/Devices/DeviceControlDevice.h
+++ b/Kernel/Devices/DeviceControlDevice.h
@@ -24,7 +24,7 @@ private:
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> 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 122216bccb..98a91c5a3f 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 e7a5412ef6..44bf07c75f 100644
--- a/Kernel/Devices/FullDevice.h
+++ b/Kernel/Devices/FullDevice.h
@@ -23,7 +23,7 @@ private:
// ^CharacterDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, 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 StringView class_name() const override { return "FullDevice"sv; }
};
diff --git a/Kernel/Devices/HID/KeyboardDevice.cpp b/Kernel/Devices/HID/KeyboardDevice.cpp
index f606271246..6b22a28d27 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 f5885aabb4..4b865ba09f 100644
--- a/Kernel/Devices/HID/KeyboardDevice.h
+++ b/Kernel/Devices/HID/KeyboardDevice.h
@@ -26,7 +26,7 @@ public:
// ^CharacterDevice
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 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 53d8f90dd9..5139ec892d 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 e240c27cae..a39f2cb014 100644
--- a/Kernel/Devices/HID/MouseDevice.h
+++ b/Kernel/Devices/HID/MouseDevice.h
@@ -24,7 +24,7 @@ public:
// ^CharacterDevice
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 bool can_write(const OpenFileDescription&, size_t) const override { return true; }
diff --git a/Kernel/Devices/KCOVDevice.h b/Kernel/Devices/KCOVDevice.h
index 2977704b9a..c8eebf8c31 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<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
diff --git a/Kernel/Devices/MemoryDevice.h b/Kernel/Devices/MemoryDevice.h
index 0535562034..a311d6561b 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<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
diff --git a/Kernel/Devices/NullDevice.cpp b/Kernel/Devices/NullDevice.cpp
index efd78ca75a..b9cfc2cde5 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 661c3deab4..5668bccbe6 100644
--- a/Kernel/Devices/NullDevice.h
+++ b/Kernel/Devices/NullDevice.h
@@ -24,7 +24,7 @@ private:
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, 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_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 5c8790c98f..d384313435 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 2e6639c7a6..d9e8799960 100644
--- a/Kernel/Devices/RandomDevice.h
+++ b/Kernel/Devices/RandomDevice.h
@@ -23,7 +23,7 @@ private:
// ^CharacterDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, 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 StringView class_name() const override { return "RandomDevice"sv; }
};
diff --git a/Kernel/Devices/SerialDevice.cpp b/Kernel/Devices/SerialDevice.cpp
index 9a21dfb447..573be81326 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 84f8c968a1..e8d78f2410 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<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
virtual bool can_write(const OpenFileDescription&, size_t) const override;
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
diff --git a/Kernel/Devices/ZeroDevice.cpp b/Kernel/Devices/ZeroDevice.cpp
index 400fa51117..2024db5f74 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 07f19ef29e..090fcf97c5 100644
--- a/Kernel/Devices/ZeroDevice.h
+++ b/Kernel/Devices/ZeroDevice.h
@@ -23,7 +23,7 @@ private:
// ^CharacterDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, 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 StringView class_name() const override { return "ZeroDevice"sv; }
};
diff --git a/Kernel/FileSystem/AnonymousFile.h b/Kernel/FileSystem/AnonymousFile.h
index a1346aef28..e9af0a62e3 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<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 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; }
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp
index 6ca8a1f3f8..a8072f1d8b 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 082930f6be..fe2b125fbd 100644
--- a/Kernel/FileSystem/FIFO.h
+++ b/Kernel/FileSystem/FIFO.h
@@ -43,7 +43,7 @@ private:
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<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 ErrorOr<NonnullOwnPtr<KString>> 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 c3396fc74e..40677d6fc1 100644
--- a/Kernel/FileSystem/File.h
+++ b/Kernel/FileSystem/File.h
@@ -81,7 +81,7 @@ public:
virtual ErrorOr<NonnullRefPtr<OpenFileDescription>> open(int options);
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 ErrorOr<void> attach(OpenFileDescription&);
diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h
index e22dc165f5..90508e8b0b 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<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;
diff --git a/Kernel/FileSystem/InodeWatcher.cpp b/Kernel/FileSystem/InodeWatcher.cpp
index eedf5e0938..61dd040a89 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 cec9acb0e1..8c23c0e217 100644
--- a/Kernel/FileSystem/InodeWatcher.h
+++ b/Kernel/FileSystem/InodeWatcher.h
@@ -44,7 +44,7 @@ public:
static ErrorOr<NonnullRefPtr<InodeWatcher>> 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<size_t> 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 ccf549a282..197bea761d 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<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return EINVAL; }
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 035656b071..9fefdc3c72 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -161,7 +161,7 @@ ErrorOr<void> IPv4Socket::connect(OpenFileDescription& description, Userspace<co
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)
return can_accept();
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h
index b9bcbf6821..9a04c81ecd 100644
--- a/Kernel/Net/IPv4Socket.h
+++ b/Kernel/Net/IPv4Socket.h
@@ -37,7 +37,7 @@ public:
virtual ErrorOr<void> 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<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;
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp
index 791262370e..40fa8dc412 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 881eb29cf7..94dc7b591c 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<void> 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<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;
diff --git a/Kernel/Storage/Partition/DiskPartition.cpp b/Kernel/Storage/Partition/DiskPartition.cpp
index 2e81fc9914..2a294033de 100644
--- a/Kernel/Storage/Partition/DiskPartition.cpp
+++ b/Kernel/Storage/Partition/DiskPartition.cpp
@@ -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);
}
-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 8c3e1ec6c1..92412d2c2f 100644
--- a/Kernel/Storage/Partition/DiskPartition.h
+++ b/Kernel/Storage/Partition/DiskPartition.h
@@ -24,7 +24,7 @@ public:
// ^BlockDevice
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 bool can_write(const OpenFileDescription&, size_t) const override;
diff --git a/Kernel/Storage/StorageDevice.h b/Kernel/Storage/StorageDevice.h
index 4f3555e0bc..53ad1d750e 100644
--- a/Kernel/Storage/StorageDevice.h
+++ b/Kernel/Storage/StorageDevice.h
@@ -38,7 +38,7 @@ public:
// ^BlockDevice
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 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 1198134832..3ec336bc17 100644
--- a/Kernel/TTY/MasterPTY.cpp
+++ b/Kernel/TTY/MasterPTY.cpp
@@ -72,7 +72,7 @@ ErrorOr<size_t> 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 6ebe95dd4c..27eb945d5c 100644
--- a/Kernel/TTY/MasterPTY.h
+++ b/Kernel/TTY/MasterPTY.h
@@ -33,7 +33,7 @@ private:
// ^CharacterDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, 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 ErrorOr<void> close() override;
virtual bool is_master_pty() const override { return true; }
diff --git a/Kernel/TTY/PTYMultiplexer.h b/Kernel/TTY/PTYMultiplexer.h
index 3a7ea9beb4..e3c395d32f 100644
--- a/Kernel/TTY/PTYMultiplexer.h
+++ b/Kernel/TTY/PTYMultiplexer.h
@@ -26,7 +26,7 @@ public:
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> 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<MasterPTY>, unsigned index);
diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp
index 3de5662604..b5a46daf8d 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 4be7373e77..1e1cb89177 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<size_t> 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 a7424da961..237f10eff4 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 eb1ee2134e..06dc967b43 100644
--- a/Kernel/TTY/TTY.h
+++ b/Kernel/TTY/TTY.h
@@ -23,7 +23,7 @@ public:
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, 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 ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override final;
virtual ErrorOr<NonnullOwnPtr<KString>> pseudo_path(const OpenFileDescription&) const override;