mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:05:07 +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:
parent
3f050c1972
commit
1d4af51250
11 changed files with 116 additions and 18 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue