mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
Kernel: Add "child added" and "child removed" InodeWatcher events
The child name is not yet accessible to userspace, but will be in a future patch.
This commit is contained in:
parent
ea17d2d3da
commit
0d577ab781
6 changed files with 47 additions and 3 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <AK/CircularQueue.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/Lock.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
@ -44,9 +45,12 @@ public:
|
|||
enum class Type {
|
||||
Invalid = 0,
|
||||
Modified,
|
||||
ChildAdded,
|
||||
ChildRemoved,
|
||||
};
|
||||
|
||||
Type type { Type::Invalid };
|
||||
String string;
|
||||
};
|
||||
|
||||
virtual bool can_read(const FileDescription&, size_t) const override;
|
||||
|
@ -57,10 +61,13 @@ public:
|
|||
virtual const char* class_name() const override { return "InodeWatcher"; };
|
||||
|
||||
void notify_inode_event(Badge<Inode>, Event::Type);
|
||||
void notify_child_added(Badge<Inode>, const String& child_name);
|
||||
void notify_child_removed(Badge<Inode>, const String& child_name);
|
||||
|
||||
private:
|
||||
explicit InodeWatcher(Inode&);
|
||||
|
||||
Lock m_lock;
|
||||
WeakPtr<Inode> m_inode;
|
||||
CircularQueue<Event, 32> m_queue;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue