1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 07:55:07 +00:00

Kernel: Make RAMFS pass along the inode type when traversing as a dir

RAMFS was passing 0, which lead to the userspace seeing all entries as
DT_UNKNOWN when iterating over the directory contents.
To repro prior to this commit, simply check `echo /tmp/*/`.
This commit is contained in:
Ali Mohammad Pur 2023-12-01 21:07:25 +03:30 committed by Andreas Kling
parent 24a7df9b09
commit b545427d53
3 changed files with 63 additions and 4 deletions

View file

@ -37,4 +37,27 @@ unsigned RAMFS::next_inode_index()
return m_next_inode_index++;
}
u8 RAMFS::internal_file_type_to_directory_entry_type(DirectoryEntryView const& entry) const
{
switch (static_cast<FileType>(entry.file_type)) {
case FileType::Directory:
return DT_DIR;
case FileType::Character:
return DT_CHR;
case FileType::Block:
return DT_BLK;
case FileType::Regular:
return DT_REG;
case FileType::FIFO:
return DT_FIFO;
case FileType::Link:
return DT_LNK;
case FileType::Socket:
return DT_SOCK;
case FileType::Unknown:
default:
return DT_UNKNOWN;
}
}
}