diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-16 14:19:36 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-17 01:21:47 +0200 |
commit | fc0cd8317a22e982cbf1ba90c18ca72299660eb8 (patch) | |
tree | 96dc5131a01a7b74148deba00195a898b440ccee | |
parent | 65c8fa9f91e9fa1d7444a2d9e1926d1851c7d10a (diff) | |
download | serenity-fc0cd8317a22e982cbf1ba90c18ca72299660eb8.zip |
Kernel/DevPtsFS: Add tightly typed DevPtsFSInode::fs()
-rw-r--r-- | Kernel/FileSystem/DevPtsFS.cpp | 4 | ||||
-rw-r--r-- | Kernel/FileSystem/DevPtsFS.h | 3 |
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*); |