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
commit c33246235a
Notes: sideshowbarker 2024-07-17 23:02:37 +09:00

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;