summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2021-06-07 09:47:21 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-08 11:12:31 +0200
commitcac94b1c16b8c8063dfad6bf07d3e333c774d2cc (patch)
tree19f8df999211851bb43a670f4914bb83dd623a7e /Kernel/FileSystem
parent675b0aee2471d63b436577ccdec3a7d23a527014 (diff)
downloadserenity-cac94b1c16b8c8063dfad6bf07d3e333c774d2cc.zip
Kernel: Implement InodeFile::stat() and simplify FileDescription::stat()
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/FileDescription.cpp3
-rw-r--r--Kernel/FileSystem/InodeFile.h1
2 files changed, 1 insertions, 3 deletions
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 30a3e5d81f..20ba9a03d1 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -110,9 +110,6 @@ Thread::FileBlocker::BlockFlags FileDescription::should_unblock(Thread::FileBloc
KResult FileDescription::stat(::stat& buffer)
{
Locker locker(m_lock);
- // FIXME: This is a little awkward, why can't we always forward to File::stat()?
- if (m_inode)
- return metadata().stat(buffer);
return m_file->stat(buffer);
}
diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h
index 0bf3134570..bdc2d5aaf6 100644
--- a/Kernel/FileSystem/InodeFile.h
+++ b/Kernel/FileSystem/InodeFile.h
@@ -34,6 +34,7 @@ public:
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override;
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
virtual KResultOr<Region*> mmap(Process&, FileDescription&, const Range&, u64 offset, int prot, bool shared) override;
+ virtual KResult stat(::stat& buffer) const override { return inode().metadata().stat(buffer); }
virtual String absolute_path(const FileDescription&) const override;