mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
9624b54703
I'm still feeling this out, but I am starting to like the general idea.
29 lines
728 B
C++
29 lines
728 B
C++
#pragma once
|
|
|
|
#include "FileSystem.h"
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
class DiskBackedFS : public FS {
|
|
public:
|
|
virtual ~DiskBackedFS() override;
|
|
|
|
DiskDevice& device() { return *m_device; }
|
|
const DiskDevice& device() const { return *m_device; }
|
|
|
|
int block_size() const { return m_block_size; }
|
|
|
|
protected:
|
|
explicit DiskBackedFS(Retained<DiskDevice>&&);
|
|
|
|
void set_block_size(unsigned);
|
|
|
|
ByteBuffer read_block(unsigned index) const;
|
|
ByteBuffer read_blocks(unsigned index, unsigned count) const;
|
|
|
|
bool write_block(unsigned index, const ByteBuffer&);
|
|
bool write_blocks(unsigned index, unsigned count, const ByteBuffer&);
|
|
|
|
private:
|
|
int m_block_size { 0 };
|
|
Retained<DiskDevice> m_device;
|
|
};
|