1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

Kernel/Storage: Change semantics for addressing block methods

Add a method for matehmatical operations when verifying IO operation
boundaries.
Also, make max_addressable_block method non-virtual, since no other
derived class actually has ever overrided this method.
This commit is contained in:
Liav A 2024-02-09 08:04:38 +02:00 committed by Andrew Kaster
parent f3a68fc80d
commit c33246235a

View file

@ -54,7 +54,12 @@ public:
};
public:
virtual u64 max_addressable_block() const { return m_max_addressable_block; }
u64 max_addressable_block() const { return m_max_addressable_block; }
// NOTE: This method should be used when we need to calculate the actual
// end of the storage device, because LBAs start counting at 0, which is not
// practical in many cases for verifying IO operation boundaries.
u64 max_mathematical_addressable_block() const { return m_max_addressable_block + 1; }
// ^BlockDevice
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override;