ladybird/Kernel/FileSystem/DiskBackedFileSystem.h
Andreas Kling c0bfea1b5c FileSystem: Move block_size() from DiskBackedFS to FS
Let's just say that all filesystems have a block size, to keep things
nice and simple.
2019-08-11 10:09:36 +02:00

28 lines
713 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; }
virtual void flush_writes() override;
protected:
explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&);
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:
NonnullRefPtr<DiskDevice> m_device;
HashMap<unsigned, ByteBuffer> m_write_cache;
};