mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:18:12 +00:00

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().
20 lines
518 B
C++
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();
|
|
};
|
|
|