1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:58:10 +00:00

FileSystem: Remove now-unused Inode::parent() and Inode::reverse_lookup().

These were only used to implement the old path resolution algorithm.
This commit is contained in:
Andreas Kling 2019-06-01 17:46:37 +02:00
parent 02e21de20a
commit 2e14e5891c
7 changed files with 0 additions and 94 deletions

View file

@ -1204,36 +1204,6 @@ RetainPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& n
return get_inode({ fsid(), inode_id });
}
RetainPtr<Inode> Ext2FSInode::parent() const
{
LOCKER(m_lock);
if (m_parent_id.is_valid())
return fs().get_inode(m_parent_id);
unsigned group_index = fs().group_index_from_inode(index());
unsigned first_inode_in_group = fs().inodes_per_group() * (group_index - 1);
Vector<Retained<Ext2FSInode>> directories_in_group;
for (unsigned i = 0; i < fs().inodes_per_group(); ++i) {
auto group_member = fs().get_inode({ fsid(), first_inode_in_group + i });
if (!group_member)
continue;
if (group_member->is_directory())
directories_in_group.append(*group_member);
}
for (auto& directory : directories_in_group) {
if (!directory->reverse_lookup(identifier()).is_null()) {
m_parent_id = directory->identifier();
break;
}
}
ASSERT(m_parent_id.is_valid());
return fs().get_inode(m_parent_id);
}
void Ext2FSInode::populate_lookup_cache() const
{
LOCKER(m_lock);
@ -1262,19 +1232,6 @@ InodeIdentifier Ext2FSInode::lookup(const String& name)
return { };
}
String Ext2FSInode::reverse_lookup(InodeIdentifier child_id)
{
ASSERT(is_directory());
ASSERT(child_id.fsid() == fsid());
populate_lookup_cache();
LOCKER(m_lock);
for (auto it : m_lookup_cache) {
if (it.value == child_id.index())
return it.key;
}
return { };
}
void Ext2FSInode::one_retain_left()
{
// FIXME: I would like to not live forever, but uncached Ext2FS is fucking painful right now.