summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-16 14:19:36 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-17 01:21:47 +0200
commitfc0cd8317a22e982cbf1ba90c18ca72299660eb8 (patch)
tree96dc5131a01a7b74148deba00195a898b440ccee /Kernel
parent65c8fa9f91e9fa1d7444a2d9e1926d1851c7d10a (diff)
downloadserenity-fc0cd8317a22e982cbf1ba90c18ca72299660eb8.zip
Kernel/DevPtsFS: Add tightly typed DevPtsFSInode::fs()
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/FileSystem/DevPtsFS.cpp4
-rw-r--r--Kernel/FileSystem/DevPtsFS.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp
index 2290449b29..7c84db9f0b 100644
--- a/Kernel/FileSystem/DevPtsFS.cpp
+++ b/Kernel/FileSystem/DevPtsFS.cpp
@@ -145,11 +145,9 @@ KResultOr<NonnullRefPtr<Inode>> DevPtsFSInode::lookup(StringView name)
if (name == "." || name == "..")
return *this;
- auto& fs = static_cast<DevPtsFS&>(this->fs());
-
auto pty_index = name.to_uint();
if (pty_index.has_value() && s_ptys->contains(pty_index.value())) {
- auto inode = fs.get_inode({ fsid(), pty_index_to_inode_index(pty_index.value()) });
+ auto inode = fs().get_inode({ fsid(), pty_index_to_inode_index(pty_index.value()) });
if (!inode)
return ENOENT;
return inode.release_nonnull();
diff --git a/Kernel/FileSystem/DevPtsFS.h b/Kernel/FileSystem/DevPtsFS.h
index 9efbb3ba00..568b2c2ca4 100644
--- a/Kernel/FileSystem/DevPtsFS.h
+++ b/Kernel/FileSystem/DevPtsFS.h
@@ -43,6 +43,9 @@ class DevPtsFSInode final : public Inode {
public:
virtual ~DevPtsFSInode() override;
+ DevPtsFS& fs() { return static_cast<DevPtsFS&>(Inode::fs()); }
+ DevPtsFS const& fs() const { return static_cast<DevPtsFS const&>(Inode::fs()); }
+
private:
DevPtsFSInode(DevPtsFS&, InodeIndex, SlavePTY*);