summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/Custody.h
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-12-29 00:23:25 +0200
committerAndreas Kling <kling@serenityos.org>2021-12-29 12:04:15 +0100
commit81e23617d6525663c11619a9c330a62654671155 (patch)
treecc63059e99b4c5d329df5c922325857ad0fce5c8 /Kernel/FileSystem/Custody.h
parentbe91b4fe3e3f1fd57f83538e57714e3f50a9ece8 (diff)
downloadserenity-81e23617d6525663c11619a9c330a62654671155.zip
Kernel: Port Custody to ListedRefCounted
Custody's unref is one of many implementions of ListedRefCounted's behaviour in the Kernel, which results in avoidable bugs caused by the fragmentation of the implementations. This commit starts the work of replacing all custom implementations with ListedRefCounted by porting Custody to it.
Diffstat (limited to 'Kernel/FileSystem/Custody.h')
-rw-r--r--Kernel/FileSystem/Custody.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/Kernel/FileSystem/Custody.h b/Kernel/FileSystem/Custody.h
index 64a4c4dae1..b688ae660c 100644
--- a/Kernel/FileSystem/Custody.h
+++ b/Kernel/FileSystem/Custody.h
@@ -8,20 +8,19 @@
#include <AK/Error.h>
#include <AK/IntrusiveList.h>
-#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <Kernel/Forward.h>
#include <Kernel/KString.h>
+#include <Kernel/Library/ListedRefCounted.h>
+#include <Kernel/Locking/MutexProtected.h>
namespace Kernel {
// FIXME: Custody needs some locking.
-class Custody : public RefCountedBase {
+class Custody : public ListedRefCounted<Custody, LockType::Mutex> {
public:
- bool unref() const;
-
static ErrorOr<NonnullRefPtr<Custody>> try_create(Custody* parent, StringView name, Inode&, int mount_flags);
~Custody();
@@ -49,6 +48,7 @@ private:
public:
using AllCustodiesList = IntrusiveList<&Custody::m_all_custodies_list_node>;
+ static MutexProtected<Custody::AllCustodiesList>& all_instances();
};
}