mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +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
35
VirtualFileSystem/SyntheticFileSystem.h
Normal file
35
VirtualFileSystem/SyntheticFileSystem.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include <AK/HashMap.h>
|
||||
|
||||
class SyntheticFileSystem final : public FileSystem {
|
||||
public:
|
||||
virtual ~SyntheticFileSystem() override;
|
||||
static RetainPtr<SyntheticFileSystem> create();
|
||||
|
||||
virtual bool initialize() override;
|
||||
virtual const char* className() const override;
|
||||
virtual InodeIdentifier rootInode() const override;
|
||||
virtual ByteBuffer readInode(InodeIdentifier) const override;
|
||||
virtual bool writeInode(InodeIdentifier, const ByteBuffer&) override;
|
||||
virtual bool enumerateDirectoryInode(InodeIdentifier, std::function<bool(const DirectoryEntry&)>) const override;
|
||||
virtual InodeMetadata inodeMetadata(InodeIdentifier) const override;
|
||||
virtual bool setModificationTime(InodeIdentifier, dword timestamp) override;
|
||||
virtual InodeIdentifier createInode(InodeIdentifier parentInode, const String& name, word mode) override;
|
||||
|
||||
private:
|
||||
SyntheticFileSystem();
|
||||
|
||||
struct File {
|
||||
String name;
|
||||
InodeMetadata metadata;
|
||||
ByteBuffer data;
|
||||
};
|
||||
|
||||
OwnPtr<File> createTextFile(String&& name, String&& text);
|
||||
void addFile(OwnPtr<File>&&);
|
||||
|
||||
Vector<OwnPtr<File>> m_files;
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue