1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00
serenity/VirtualFileSystem/DiskDevice.h
Andreas Kling 8293a0ff36 Rework DiskDevice's read() and write() to be non-virtual wrappers.
This way subclasses only have to implement readBlock() and writeBlock().
read() and write() require that the offset and length are both divisible
by the blockSize().
2018-10-16 14:13:32 +02:00

20 lines
518 B
C++

#pragma once
#include <AK/Retainable.h>
#include <AK/Types.h>
class DiskDevice : public Retainable<DiskDevice> {
public:
virtual ~DiskDevice();
virtual unsigned blockSize() const = 0;
virtual bool readBlock(unsigned index, byte*) const = 0;
virtual bool writeBlock(unsigned index, const byte*) = 0;
virtual const char* className() const = 0;
bool read(qword offset, unsigned length, byte*) const;
bool write(qword offset, unsigned length, const byte*);
protected:
DiskDevice();
};