mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +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:
@@ -50,6 +50,20 @@ InodeIdentifier FileSystem::childOfDirectoryInodeWithName(InodeIdentifier inode,
|
||||
return foundInode;
|
||||
}
|
||||
|
||||
String FileSystem::nameOfChildInDirectory(InodeIdentifier parent, InodeIdentifier child) const
|
||||
{
|
||||
String name;
|
||||
bool success = enumerateDirectoryInode(parent, [&] (auto& entry) {
|
||||
if (entry.inode == child) {
|
||||
name = entry.name;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
ASSERT(success);
|
||||
return name;
|
||||
}
|
||||
|
||||
ByteBuffer FileSystem::readEntireInode(InodeIdentifier inode, FileHandle* handle) const
|
||||
{
|
||||
ASSERT(inode.fileSystemID() == id());
|
||||
|
||||
Reference in New Issue
Block a user