From fc0cd8317a22e982cbf1ba90c18ca72299660eb8 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 16 Aug 2021 14:19:36 +0200 Subject: [PATCH] Kernel/DevPtsFS: Add tightly typed DevPtsFSInode::fs() --- Kernel/FileSystem/DevPtsFS.cpp | 4 +--- 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 2290449b296..7c84db9f0b3 100644 --- a/Kernel/FileSystem/DevPtsFS.cpp +++ b/Kernel/FileSystem/DevPtsFS.cpp @@ -145,11 +145,9 @@ KResultOr> DevPtsFSInode::lookup(StringView name) if (name == "." || name == "..") return *this; - auto& fs = static_cast(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 9efbb3ba009..568b2c2ca43 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(Inode::fs()); } + DevPtsFS const& fs() const { return static_cast(Inode::fs()); } + private: DevPtsFSInode(DevPtsFS&, InodeIndex, SlavePTY*);