mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 17:47:18 +00:00
Add mechanism to expose kernel variables to userspace via ProcFS.
Only booleans are supported at first. More types can be added easily. Use this to add /proc/sys/wm_flash_flush which when enabled flashes pending screen flush rects in yellow before they happen.
This commit is contained in:
@@ -28,7 +28,8 @@ protected:
|
||||
|
||||
RetainPtr<SynthFSInode> create_directory(String&& name);
|
||||
RetainPtr<SynthFSInode> create_text_file(String&& name, ByteBuffer&&, Unix::mode_t = 0010644);
|
||||
RetainPtr<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer()>&&, Unix::mode_t = 0100644);
|
||||
RetainPtr<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, Unix::mode_t = 0100644);
|
||||
RetainPtr<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&&, Unix::mode_t = 0100644);
|
||||
|
||||
InodeIdentifier add_file(RetainPtr<SynthFSInode>&&, InodeIndex parent = RootInodeIndex);
|
||||
bool remove_file(InodeIndex);
|
||||
@@ -38,11 +39,19 @@ private:
|
||||
HashMap<InodeIndex, RetainPtr<SynthFSInode>> m_inodes;
|
||||
};
|
||||
|
||||
struct SynthFSInodeCustomData {
|
||||
virtual ~SynthFSInodeCustomData();
|
||||
};
|
||||
|
||||
class SynthFSInode final : public Inode {
|
||||
friend class SynthFS;
|
||||
public:
|
||||
virtual ~SynthFSInode() override;
|
||||
|
||||
void set_custom_data(OwnPtr<SynthFSInodeCustomData>&& custom_data) { m_custom_data = move(custom_data); }
|
||||
SynthFSInodeCustomData* custom_data() { return m_custom_data.ptr(); }
|
||||
const SynthFSInodeCustomData* custom_data() const { return m_custom_data.ptr(); }
|
||||
|
||||
private:
|
||||
// ^Inode
|
||||
virtual ssize_t read_bytes(Unix::off_t, size_t, byte* buffer, FileDescriptor*) override;
|
||||
@@ -62,9 +71,11 @@ private:
|
||||
String m_name;
|
||||
InodeIdentifier m_parent;
|
||||
ByteBuffer m_data;
|
||||
Function<ByteBuffer()> m_generator;
|
||||
Function<ByteBuffer(SynthFSInode&)> m_generator;
|
||||
Function<ssize_t(SynthFSInode&, const ByteBuffer&)> m_write_callback;
|
||||
Vector<SynthFSInode*> m_children;
|
||||
InodeMetadata m_metadata;
|
||||
OwnPtr<SynthFSInodeCustomData> m_custom_data;
|
||||
};
|
||||
|
||||
inline SynthFS& SynthFSInode::fs()
|
||||
|
||||
Reference in New Issue
Block a user