mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 07:37:03 +00:00
Import all this stuff into a single repo called Serenity.
This commit is contained in:
commit
5a30055157
Notes:
sideshowbarker
2024-07-19 18:51:29 +09:00
Author: https://github.com/awesomekling 🔰
Commit: 5a30055157
67 changed files with 8836 additions and 0 deletions
32
VirtualFileSystem/FileBackedBlockDevice.h
Normal file
32
VirtualFileSystem/FileBackedBlockDevice.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include "BlockDevice.h"
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <stdio.h>
|
||||
|
||||
class FileBackedBlockDevice final : public BlockDevice {
|
||||
public:
|
||||
static RetainPtr<FileBackedBlockDevice> create(String&& imagePath, unsigned blockSize);
|
||||
virtual ~FileBackedBlockDevice() override;
|
||||
|
||||
bool isValid() const { return m_file; }
|
||||
|
||||
virtual unsigned blockSize() const override;
|
||||
virtual bool readBlock(unsigned index, byte* out) const override;
|
||||
virtual bool writeBlock(unsigned index, const byte*) override;
|
||||
virtual bool read(qword offset, unsigned length, byte* out) const override;
|
||||
virtual bool write(qword offset, unsigned length, const byte* data) override;
|
||||
|
||||
private:
|
||||
virtual const char* className() const override;
|
||||
|
||||
FileBackedBlockDevice(String&& imagePath, unsigned blockSize);
|
||||
|
||||
String m_imagePath;
|
||||
FILE* m_file { nullptr };
|
||||
qword m_fileLength { 0 };
|
||||
unsigned m_blockSize { 0 };
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue