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

Add a VFS::absolutePath(InodeIdentifier).

This is pretty inefficient for ext2fs. We walk the entire block group
containing the inode, searching through every directory for an entry
referencing this inode.

It might be a good idea to cache this information somehow. I'm not sure
how often we'll be searching for it.

Obviously there are multiple caching layers missing in the file system.
This commit is contained in:
Andreas Kling 2018-10-28 12:20:25 +01:00
parent 3f050c1972
commit 1d4af51250
11 changed files with 116 additions and 18 deletions

View file

@ -199,7 +199,7 @@ Unix::ssize_t SyntheticFileSystem::readInodeBytes(InodeIdentifier inode, Unix::o
#endif
ASSERT(offset >= 0);
ASSERT(buffer);
\
auto it = m_inodes.find(inode.index());
if (it == m_inodes.end())
return false;
@ -235,3 +235,11 @@ auto SyntheticFileSystem::generateInodeIndex() -> InodeIndex
{
return m_nextInodeIndex++;
}
InodeIdentifier SyntheticFileSystem::findParentOfInode(InodeIdentifier inode) const
{
auto it = m_inodes.find(inode.index());
if (it == m_inodes.end())
return { };
return (*it).value->parent;
}