mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 02:08:53 +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
Notes:
sideshowbarker
2024-07-19 05:11:34 +09:00
Author: https://github.com/awesomekling
Commit: 0d577ab781
6 changed files with 47 additions and 3 deletions
|
@ -59,6 +59,7 @@ bool InodeWatcher::can_write(const FileDescription&, size_t) const
|
|||
|
||||
ssize_t InodeWatcher::read(FileDescription&, size_t, u8* buffer, ssize_t buffer_size)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
ASSERT(!m_queue.is_empty() || !m_inode);
|
||||
|
||||
if (!m_inode)
|
||||
|
@ -85,7 +86,20 @@ String InodeWatcher::absolute_path(const FileDescription&) const
|
|||
|
||||
void InodeWatcher::notify_inode_event(Badge<Inode>, Event::Type event_type)
|
||||
{
|
||||
m_queue.enqueue({ event_type });
|
||||
LOCKER(m_lock);
|
||||
m_queue.enqueue({ event_type, {} });
|
||||
}
|
||||
|
||||
void InodeWatcher::notify_child_added(Badge<Inode>, const String& child_name)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
m_queue.enqueue({ Event::Type::ChildAdded, child_name });
|
||||
}
|
||||
|
||||
void InodeWatcher::notify_child_removed(Badge<Inode>, const String& child_name)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
m_queue.enqueue({ Event::Type::ChildRemoved, child_name });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue