mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:57:35 +00:00
Kernel: Use u64 instead of size_t for File::can_write offset
This ensures offsets will not be truncated on large files on i686.
This commit is contained in:
parent
9ce537d703
commit
664ca58746
40 changed files with 40 additions and 40 deletions
|
@ -68,7 +68,7 @@ ErrorOr<size_t> DiskPartition::write(OpenFileDescription& fd, u64 offset, const
|
|||
return m_device.strong_ref()->write(fd, offset + adjust, inbuf, len);
|
||||
}
|
||||
|
||||
bool DiskPartition::can_write(const OpenFileDescription& fd, size_t offset) const
|
||||
bool DiskPartition::can_write(const OpenFileDescription& fd, u64 offset) const
|
||||
{
|
||||
unsigned adjust = m_metadata.start_block() * block_size();
|
||||
dbgln_if(OFFD_DEBUG, "DiskPartition::can_write offset={}, adjust={}", offset, adjust);
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) 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 bool can_write(const OpenFileDescription&, u64) const override;
|
||||
|
||||
const DiskPartitionMetadata& metadata() const;
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ StringView StorageDevice::early_storage_name() const
|
|||
return m_early_storage_device_name->view();
|
||||
}
|
||||
|
||||
bool StorageDevice::can_write(const OpenFileDescription&, size_t offset) const
|
||||
bool StorageDevice::can_write(const OpenFileDescription&, u64 offset) const
|
||||
{
|
||||
return offset < (max_addressable_block() * block_size());
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) 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 bool can_write(const OpenFileDescription&, u64) const override;
|
||||
virtual void prepare_for_unplug() { m_partitions.clear(); }
|
||||
|
||||
// FIXME: Remove this method after figuring out another scheme for naming.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue