Kernel: Use m_inode to stat in FileDescription::stat() if available

This is necessary since the Device class does not hold a reference to
its inode (because there could be multiple), and thus doesn't override
File::stat(). For simplicity, we should just always stat via the inode
if there is one, since that shouldn't ever be the wrong thing.

This partially reverts #7867.
This commit is contained in:
Max Wipfli 2021-06-11 10:55:43 +02:00 committed by Andreas Kling
parent 54a33c45bb
commit 90e229c9b5
Notes: sideshowbarker 2024-07-18 12:26:12 +09:00

View file

@ -110,6 +110,9 @@ Thread::FileBlocker::BlockFlags FileDescription::should_unblock(Thread::FileBloc
KResult FileDescription::stat(::stat& buffer)
{
Locker locker(m_lock);
// FIXME: This is due to the Device class not overriding File::stat().
if (m_inode)
return m_inode->metadata().stat(buffer);
return m_file->stat(buffer);
}