DiskBackedFileSystem.h 727 B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include "FileSystem.h"
  3. #include <AK/ByteBuffer.h>
  4. class DiskBackedFS : public FS {
  5. public:
  6. virtual ~DiskBackedFS() override;
  7. DiskDevice& device() { return *m_device; }
  8. const DiskDevice& device() const { return *m_device; }
  9. size_t blockSize() const { return m_blockSize; }
  10. protected:
  11. explicit DiskBackedFS(RetainPtr<DiskDevice>&&);
  12. void setBlockSize(unsigned);
  13. ByteBuffer readBlock(unsigned index) const;
  14. ByteBuffer readBlocks(unsigned index, unsigned count) const;
  15. bool writeBlock(unsigned index, const ByteBuffer&);
  16. bool writeBlocks(unsigned index, unsigned count, const ByteBuffer&);
  17. private:
  18. size_t m_blockSize { 0 };
  19. RetainPtr<DiskDevice> m_device;
  20. };