mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 10:01:13 +09:00
Add basic character device support. Start with null and zero.
This commit is contained in:
parent
fa3b11ac64
commit
93556d6743
Notes:
sideshowbarker
2024-07-19 18:48:27 +09:00
Author: https://github.com/awesomekling
Commit: 93556d6743
14 changed files with 157 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <AK/Vector.h>
|
||||
#include "InodeIdentifier.h"
|
||||
|
||||
class CharacterDevice;
|
||||
class FileHandle;
|
||||
class FileSystem;
|
||||
|
||||
|
@ -17,6 +18,9 @@ public:
|
|||
|
||||
bool inUse() const { return inode.isValid(); }
|
||||
|
||||
bool isCharacterDevice() const { return m_characterDevice; }
|
||||
CharacterDevice* characterDevice() { return m_characterDevice; }
|
||||
|
||||
void retain();
|
||||
void release();
|
||||
|
||||
|
@ -27,6 +31,7 @@ public:
|
|||
friend class VirtualFileSystem;
|
||||
VirtualFileSystem* vfs { nullptr };
|
||||
unsigned retainCount { 0 };
|
||||
CharacterDevice* m_characterDevice { nullptr };
|
||||
};
|
||||
|
||||
VirtualFileSystem();
|
||||
|
@ -52,6 +57,8 @@ public:
|
|||
|
||||
bool touch(const String&path);
|
||||
|
||||
void registerCharacterDevice(unsigned major, unsigned minor, CharacterDevice&);
|
||||
|
||||
private:
|
||||
template<typename F> void enumerateDirectoryInode(InodeIdentifier, F func);
|
||||
InodeIdentifier resolvePath(const String& path);
|
||||
|
@ -80,6 +87,7 @@ private:
|
|||
Mount* findMountForGuest(InodeIdentifier);
|
||||
|
||||
HashMap<InodeIdentifier, Node*> m_inode2vnode;
|
||||
HashMap<dword, Node*> m_device2vnode;
|
||||
|
||||
Vector<OwnPtr<Mount>> m_mounts;
|
||||
|
||||
|
@ -89,5 +97,7 @@ private:
|
|||
Vector<Node*> m_nodeFreeList;
|
||||
|
||||
RetainPtr<Node> m_rootNode;
|
||||
|
||||
HashMap<dword, CharacterDevice*> m_characterDevices;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue