mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 14:07:42 +00:00
TmpFS: Add "." and ".." entries to all directories
It was so weird not seeing them in "ls -la" output :^)
This commit is contained in:
parent
0e7cee58c0
commit
bb9db9d430
1 changed files with 9 additions and 4 deletions
|
@ -96,7 +96,10 @@ RefPtr<Inode> TmpFS::create_directory(InodeIdentifier parent_id, const String& n
|
||||||
// Ensure it's a directory.
|
// Ensure it's a directory.
|
||||||
mode &= ~0170000;
|
mode &= ~0170000;
|
||||||
mode |= 0040000;
|
mode |= 0040000;
|
||||||
return create_inode(parent_id, name, mode, 0, 0, uid, gid, error);
|
auto new_directory = create_inode(parent_id, name, mode, 0, 0, uid, gid, error);
|
||||||
|
new_directory->add_child(new_directory->identifier(), ".", 0);
|
||||||
|
new_directory->add_child(parent_id, "..", 0);
|
||||||
|
return new_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
TmpFSInode::TmpFSInode(TmpFS& fs, InodeMetadata metadata, InodeIdentifier parent)
|
TmpFSInode::TmpFSInode(TmpFS& fs, InodeMetadata metadata, InodeIdentifier parent)
|
||||||
|
@ -122,7 +125,10 @@ NonnullRefPtr<TmpFSInode> TmpFSInode::create_root(TmpFS& fs)
|
||||||
{
|
{
|
||||||
InodeMetadata metadata;
|
InodeMetadata metadata;
|
||||||
metadata.mode = 0041777;
|
metadata.mode = 0041777;
|
||||||
return create(fs, metadata, { fs.fsid(), 1 });
|
auto root_inode = create(fs, metadata, { fs.fsid(), 1 });
|
||||||
|
root_inode->add_child(root_inode->identifier(), ".", 0);
|
||||||
|
root_inode->add_child(root_inode->identifier(), "..", 0);
|
||||||
|
return root_inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
InodeMetadata TmpFSInode::metadata() const
|
InodeMetadata TmpFSInode::metadata() const
|
||||||
|
@ -211,8 +217,7 @@ size_t TmpFSInode::directory_entry_count() const
|
||||||
{
|
{
|
||||||
LOCKER(m_lock);
|
LOCKER(m_lock);
|
||||||
ASSERT(is_directory());
|
ASSERT(is_directory());
|
||||||
|
return m_children.size();
|
||||||
return 2 + m_children.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TmpFSInode::flush_metadata()
|
void TmpFSInode::flush_metadata()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue