Disk: Allow mismatched access for Read and Write drivers

This will cause the driver to fall back to the least common
denominator.
This commit is contained in:
Paul Hollinsky
2022-03-03 20:29:13 -05:00
parent 1118428250
commit 0a15adbe91
9 changed files with 56 additions and 7 deletions
+20 -1
View File
@@ -25,8 +25,27 @@ enum class Access {
class Driver {
public:
virtual ~Driver() = default;
virtual Access getAccess() const = 0;
Access getAccess() const {
if(vsaOffset)
return Access::VSA;
return getPossibleAccess();
}
virtual std::pair<uint32_t, uint32_t> getBlockSizeBounds() const = 0;
void setVSAOffset(uint64_t offset) { vsaOffset = offset; }
protected:
uint64_t vsaOffset = 0;
private:
/**
* Report the possible access that this driver has
*
* In some cases, such as a mismatched possible access between
* read and write drivers, this will be overridden in the driver
* layer.
*/
virtual Access getPossibleAccess() const = 0;
};
} // namespace Disk