Kernel/SysFS: Remove redundant SysFS& member from SysFSInode

This commit is contained in:
Andreas Kling 2021-07-18 02:23:22 +02:00
parent d3cf4cd8f0
commit d298de5e09
Notes: sideshowbarker 2024-07-18 08:50:36 +09:00
2 changed files with 7 additions and 7 deletions

View file

@ -170,7 +170,6 @@ NonnullRefPtr<SysFSDirectoryInode> SysFSDirectoryInode::create(SysFS const& sysf
SysFSDirectoryInode::SysFSDirectoryInode(SysFS const& fs, SysFSComponent const& component)
: SysFSInode(fs, component)
, m_parent_fs(const_cast<SysFS&>(fs))
{
}
@ -192,17 +191,17 @@ InodeMetadata SysFSDirectoryInode::metadata() const
}
KResult SysFSDirectoryInode::traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
{
MutexLocker locker(m_parent_fs.m_lock);
return m_associated_component->traverse_as_directory(m_parent_fs.fsid(), move(callback));
MutexLocker locker(fs().m_lock);
return m_associated_component->traverse_as_directory(fs().fsid(), move(callback));
}
RefPtr<Inode> SysFSDirectoryInode::lookup(StringView name)
{
MutexLocker locker(m_parent_fs.m_lock);
MutexLocker locker(fs().m_lock);
auto component = m_associated_component->lookup(name);
if (!component)
return {};
return component->to_inode(m_parent_fs);
return component->to_inode(fs());
}
SysFSBusDirectory& SysFSComponentRegistry::buses_directory()

View file

@ -106,14 +106,15 @@ public:
static NonnullRefPtr<SysFSDirectoryInode> create(SysFS const&, SysFSComponent const&);
virtual ~SysFSDirectoryInode() override;
SysFS& fs() { return static_cast<SysFS&>(Inode::fs()); }
SysFS const& fs() const { return static_cast<SysFS const&>(Inode::fs()); }
protected:
SysFSDirectoryInode(SysFS const&, SysFSComponent const&);
// ^Inode
virtual InodeMetadata metadata() const override;
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
virtual RefPtr<Inode> lookup(StringView name) override;
SysFS& m_parent_fs;
};
}