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:
Andreas Kling 2020-07-04 13:36:55 +02:00
parent ea17d2d3da
commit 0d577ab781
Notes: sideshowbarker 2024-07-19 05:11:34 +09:00
6 changed files with 47 additions and 3 deletions

View file

@ -215,6 +215,22 @@ void Inode::set_metadata_dirty(bool metadata_dirty)
}
}
void Inode::did_add_child(const String& name)
{
LOCKER(m_lock);
for (auto& watcher : m_watchers) {
watcher->notify_child_added({}, name);
}
}
void Inode::did_remove_child(const String& name)
{
LOCKER(m_lock);
for (auto& watcher : m_watchers) {
watcher->notify_child_removed({}, name);
}
}
KResult Inode::prepare_to_write_data()
{
// FIXME: It's a poor design that filesystems are expected to call this before writing out data.