From 728c3fbd14252bd746f97dbb5441063992074b6b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 21 Aug 2022 01:04:35 +0200 Subject: Kernel: Use RefPtr instead of LockRefPtr for Custody By protecting all the RefPtr objects that may be accessed from multiple threads at the same time (with spinlocks), we remove the need for using LockRefPtr (which is basically a RefPtr with a built-in spinlock.) --- Kernel/FileSystem/OpenFileDescription.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Kernel/FileSystem/OpenFileDescription.h') diff --git a/Kernel/FileSystem/OpenFileDescription.h b/Kernel/FileSystem/OpenFileDescription.h index fc513f56cb..c4cdae2d49 100644 --- a/Kernel/FileSystem/OpenFileDescription.h +++ b/Kernel/FileSystem/OpenFileDescription.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -88,8 +89,8 @@ public: Inode* inode() { return m_inode.ptr(); } Inode const* inode() const { return m_inode.ptr(); } - Custody* custody() { return m_custody.ptr(); } - Custody const* custody() const { return m_custody.ptr(); } + RefPtr custody(); + RefPtr custody() const; ErrorOr mmap(Process&, Memory::VirtualRange const&, u64 offset, int prot, bool shared); @@ -138,12 +139,12 @@ private: blocker_set().unblock_all_blockers_whose_conditions_are_met(); } - LockRefPtr m_custody; LockRefPtr m_inode; NonnullLockRefPtr m_file; struct State { OwnPtr data; + RefPtr custody; off_t current_offset { 0 }; u32 file_flags { 0 }; bool readable : 1 { false }; -- cgit v1.2.3