mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:37:35 +00:00
Import all this stuff into a single repo called Serenity.
This commit is contained in:
commit
5a30055157
67 changed files with 8836 additions and 0 deletions
30
VirtualFileSystem/DeviceBackedFileSystem.h
Normal file
30
VirtualFileSystem/DeviceBackedFileSystem.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include <AK/ByteBuffer.h>
|
||||
|
||||
class DeviceBackedFileSystem : public FileSystem {
|
||||
public:
|
||||
virtual ~DeviceBackedFileSystem() override;
|
||||
|
||||
BlockDevice& device() { return *m_device; }
|
||||
const BlockDevice& device() const { return *m_device; }
|
||||
|
||||
unsigned blockSize() const { return m_blockSize; }
|
||||
|
||||
protected:
|
||||
explicit DeviceBackedFileSystem(RetainPtr<BlockDevice>&&);
|
||||
|
||||
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<BlockDevice> m_device;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue