1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

Kernel: Convert SlavePTY all-instances HashTable to an IntrusiveList

This simplifies the DevPtsFS implementation somewhat, as it no longer
requires SlavePTY to register itself with it, since it can now simply
use the list of SlavePTY instances.
This commit is contained in:
Andreas Kling 2021-08-16 22:13:58 +02:00
parent 62719b85e0
commit 0de8c95d49
4 changed files with 53 additions and 33 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -15,6 +15,7 @@ class MasterPTY;
class SlavePTY final : public TTY {
public:
virtual bool unref() const override;
virtual ~SlavePTY() override;
void on_master_write(const UserOrKernelBuffer&, size_t);
@ -47,6 +48,12 @@ private:
time_t m_time_of_last_write { 0 };
unsigned m_index { 0 };
String m_tty_name;
mutable IntrusiveListNode<SlavePTY> m_list_node;
public:
using List = IntrusiveList<SlavePTY, RawPtr<SlavePTY>, &SlavePTY::m_list_node>;
static SpinLockProtectedValue<SlavePTY::List>& all_instances();
};
}