1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

Kernel: Move InodeWatcher::Event into Kernel/API/InodeWatcherEvent

This allows userspace code to parse these events.
This commit is contained in:
Itamar 2020-11-07 09:38:48 +02:00 committed by Andreas Kling
parent b4842d33bb
commit 345abc3132
4 changed files with 51 additions and 19 deletions

View file

@ -29,6 +29,7 @@
#include <AK/Badge.h>
#include <AK/CircularQueue.h>
#include <AK/WeakPtr.h>
#include <Kernel/API/InodeWatcherEvent.h>
#include <Kernel/FileSystem/File.h>
#include <Kernel/Lock.h>
@ -41,18 +42,6 @@ public:
static NonnullRefPtr<InodeWatcher> create(Inode&);
virtual ~InodeWatcher() override;
struct Event {
enum class Type {
Invalid = 0,
Modified,
ChildAdded,
ChildRemoved,
};
Type type { Type::Invalid };
unsigned inode_index { 0 };
};
virtual bool can_read(const FileDescription&, size_t) const override;
virtual bool can_write(const FileDescription&, size_t) const override;
virtual KResultOr<size_t> read(FileDescription&, size_t, UserOrKernelBuffer&, size_t) override;
@ -60,7 +49,7 @@ public:
virtual String absolute_path(const FileDescription&) const override;
virtual const char* class_name() const override { return "InodeWatcher"; };
void notify_inode_event(Badge<Inode>, Event::Type);
void notify_inode_event(Badge<Inode>, InodeWatcherEvent::Type);
void notify_child_added(Badge<Inode>, const InodeIdentifier& child_id);
void notify_child_removed(Badge<Inode>, const InodeIdentifier& child_id);
@ -69,7 +58,7 @@ private:
Lock m_lock;
WeakPtr<Inode> m_inode;
CircularQueue<Event, 32> m_queue;
CircularQueue<InodeWatcherEvent, 32> m_queue;
};
}