mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-03 16:58:30 +03:00
9cd0a34b5c
BlockDevice was the wrong name for this abstraction, since a block device is a type of file in a unix system, and we should use that name for that concept in the fs implementation.
31 lines
792 B
C++
31 lines
792 B
C++
#pragma once
|
|
|
|
#include "FileSystem.h"
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
class DiskBackedFileSystem : public FileSystem {
|
|
public:
|
|
virtual ~DiskBackedFileSystem() override;
|
|
|
|
DiskDevice& device() { return *m_device; }
|
|
const DiskDevice& device() const { return *m_device; }
|
|
|
|
unsigned blockSize() const { return m_blockSize; }
|
|
|
|
protected:
|
|
explicit DiskBackedFileSystem(RetainPtr<DiskDevice>&&);
|
|
|
|
void setBlockSize(unsigned);
|
|
void invalidateCaches();
|
|
|
|
ByteBuffer readBlock(unsigned index) const;
|
|
ByteBuffer readBlocks(unsigned index, unsigned count) const;
|
|
|
|
bool writeBlock(unsigned index, const ByteBuffer&);
|
|
bool writeBlocks(unsigned index, unsigned count, const ByteBuffer&);
|
|
|
|
private:
|
|
unsigned m_blockSize { 0 };
|
|
RetainPtr<DiskDevice> m_device;
|
|
};
|