mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
922fd703c9
This way clients are not required to have instantiated ByteBuffers and can choose whatever memory scheme works best for them. Also converted some of the Ext2FS code to use stack buffers instead.
33 lines
815 B
C++
33 lines
815 B
C++
#pragma once
|
|
|
|
#include "FileSystem.h"
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
class DiskCache;
|
|
|
|
class DiskBackedFS : public FS {
|
|
public:
|
|
virtual ~DiskBackedFS() override;
|
|
|
|
virtual bool is_disk_backed() const override { return true; }
|
|
|
|
DiskDevice& device() { return *m_device; }
|
|
const DiskDevice& device() const { return *m_device; }
|
|
|
|
virtual void flush_writes() override;
|
|
|
|
protected:
|
|
explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&);
|
|
|
|
bool read_block(unsigned index, u8* buffer) const;
|
|
bool read_blocks(unsigned index, unsigned count, u8* buffer) const;
|
|
|
|
bool write_block(unsigned index, const u8*);
|
|
bool write_blocks(unsigned index, unsigned count, const u8*);
|
|
|
|
private:
|
|
DiskCache& cache() const;
|
|
|
|
NonnullRefPtr<DiskDevice> m_device;
|
|
mutable OwnPtr<DiskCache> m_cache;
|
|
};
|