mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 18:22:45 +00:00 
			
		
		
		
	AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.
This commit is contained in:
		
							parent
							
								
									77b9fa89dd
								
							
						
					
					
						commit
						90b1354688
					
				
					 188 changed files with 562 additions and 562 deletions
				
			
		|  | @ -12,7 +12,7 @@ namespace AK { | |||
| 
 | ||||
| // String is a convenience wrapper around StringImpl, suitable for passing
 | ||||
| // around as a value type. It's basically the same as passing around a
 | ||||
| // RetainPtr<StringImpl>, with a bit of syntactic sugar.
 | ||||
| // RefPtr<StringImpl>, with a bit of syntactic sugar.
 | ||||
| //
 | ||||
| // Note that StringImpl is an immutable object that cannot shrink or grow.
 | ||||
| // Its allocation size is snugly tailored to the specific string it contains.
 | ||||
|  | @ -74,12 +74,12 @@ public: | |||
|     { | ||||
|     } | ||||
| 
 | ||||
|     String(RetainPtr<StringImpl>&& impl) | ||||
|     String(RefPtr<StringImpl>&& impl) | ||||
|         : m_impl(move(impl)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     String(Retained<StringImpl>&& impl) | ||||
|     String(NonnullRefPtr<StringImpl>&& impl) | ||||
|         : m_impl(move(impl)) | ||||
|     { | ||||
|     } | ||||
|  | @ -186,7 +186,7 @@ public: | |||
| 
 | ||||
| private: | ||||
|     bool match_helper(const StringView& mask) const; | ||||
|     RetainPtr<StringImpl> m_impl; | ||||
|     RefPtr<StringImpl> m_impl; | ||||
| }; | ||||
| 
 | ||||
| inline bool StringView::operator==(const String& string) const | ||||
|  |  | |||
|  | @ -10,12 +10,12 @@ namespace AK { | |||
| 
 | ||||
| class ByteBufferImpl : public RefCounted<ByteBufferImpl> { | ||||
| public: | ||||
|     static Retained<ByteBufferImpl> create_uninitialized(int size); | ||||
|     static Retained<ByteBufferImpl> create_zeroed(int); | ||||
|     static Retained<ByteBufferImpl> copy(const void*, int); | ||||
|     static Retained<ByteBufferImpl> wrap(void*, int); | ||||
|     static Retained<ByteBufferImpl> wrap(const void*, int); | ||||
|     static Retained<ByteBufferImpl> adopt(void*, int); | ||||
|     static NonnullRefPtr<ByteBufferImpl> create_uninitialized(int size); | ||||
|     static NonnullRefPtr<ByteBufferImpl> create_zeroed(int); | ||||
|     static NonnullRefPtr<ByteBufferImpl> copy(const void*, int); | ||||
|     static NonnullRefPtr<ByteBufferImpl> wrap(void*, int); | ||||
|     static NonnullRefPtr<ByteBufferImpl> wrap(const void*, int); | ||||
|     static NonnullRefPtr<ByteBufferImpl> adopt(void*, int); | ||||
| 
 | ||||
|     ~ByteBufferImpl() { clear(); } | ||||
| 
 | ||||
|  | @ -180,12 +180,12 @@ public: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     explicit ByteBuffer(RetainPtr<ByteBufferImpl>&& impl) | ||||
|     explicit ByteBuffer(RefPtr<ByteBufferImpl>&& impl) | ||||
|         : m_impl(move(impl)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     RetainPtr<ByteBufferImpl> m_impl; | ||||
|     RefPtr<ByteBufferImpl> m_impl; | ||||
| }; | ||||
| 
 | ||||
| inline ByteBufferImpl::ByteBufferImpl(int size) | ||||
|  | @ -227,34 +227,34 @@ inline void ByteBufferImpl::grow(int size) | |||
|     kfree(old_data); | ||||
| } | ||||
| 
 | ||||
| inline Retained<ByteBufferImpl> ByteBufferImpl::create_uninitialized(int size) | ||||
| inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::create_uninitialized(int size) | ||||
| { | ||||
|     return ::adopt(*new ByteBufferImpl(size)); | ||||
| } | ||||
| 
 | ||||
| inline Retained<ByteBufferImpl> ByteBufferImpl::create_zeroed(int size) | ||||
| inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::create_zeroed(int size) | ||||
| { | ||||
|     auto buffer = ::adopt(*new ByteBufferImpl(size)); | ||||
|     memset(buffer->pointer(), 0, size); | ||||
|     return buffer; | ||||
| } | ||||
| 
 | ||||
| inline Retained<ByteBufferImpl> ByteBufferImpl::copy(const void* data, int size) | ||||
| inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::copy(const void* data, int size) | ||||
| { | ||||
|     return ::adopt(*new ByteBufferImpl(data, size, Copy)); | ||||
| } | ||||
| 
 | ||||
| inline Retained<ByteBufferImpl> ByteBufferImpl::wrap(void* data, int size) | ||||
| inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::wrap(void* data, int size) | ||||
| { | ||||
|     return ::adopt(*new ByteBufferImpl(data, size, Wrap)); | ||||
| } | ||||
| 
 | ||||
| inline Retained<ByteBufferImpl> ByteBufferImpl::wrap(const void* data, int size) | ||||
| inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::wrap(const void* data, int size) | ||||
| { | ||||
|     return ::adopt(*new ByteBufferImpl(const_cast<void*>(data), size, Wrap)); | ||||
| } | ||||
| 
 | ||||
| inline Retained<ByteBufferImpl> ByteBufferImpl::adopt(void* data, int size) | ||||
| inline NonnullRefPtr<ByteBufferImpl> ByteBufferImpl::adopt(void* data, int size) | ||||
| { | ||||
|     return ::adopt(*new ByteBufferImpl(data, size, Adopt)); | ||||
| } | ||||
|  |  | |||
|  | @ -6,65 +6,65 @@ | |||
| namespace AK { | ||||
| 
 | ||||
| template<typename T> | ||||
| class RetainPtr { | ||||
| class RefPtr { | ||||
| public: | ||||
|     enum AdoptTag { | ||||
|         Adopt | ||||
|     }; | ||||
| 
 | ||||
|     RetainPtr() {} | ||||
|     RetainPtr(const T* ptr) | ||||
|     RefPtr() {} | ||||
|     RefPtr(const T* ptr) | ||||
|         : m_ptr(const_cast<T*>(ptr)) | ||||
|     { | ||||
|         ref_if_not_null(m_ptr); | ||||
|     } | ||||
|     RetainPtr(T* ptr) | ||||
|     RefPtr(T* ptr) | ||||
|         : m_ptr(ptr) | ||||
|     { | ||||
|         ref_if_not_null(m_ptr); | ||||
|     } | ||||
|     RetainPtr(T& object) | ||||
|     RefPtr(T& object) | ||||
|         : m_ptr(&object) | ||||
|     { | ||||
|         m_ptr->ref(); | ||||
|     } | ||||
|     RetainPtr(const T& object) | ||||
|     RefPtr(const T& object) | ||||
|         : m_ptr(const_cast<T*>(&object)) | ||||
|     { | ||||
|         m_ptr->ref(); | ||||
|     } | ||||
|     RetainPtr(AdoptTag, T& object) | ||||
|     RefPtr(AdoptTag, T& object) | ||||
|         : m_ptr(&object) | ||||
|     { | ||||
|     } | ||||
|     RetainPtr(RetainPtr& other) | ||||
|     RefPtr(RefPtr& other) | ||||
|         : m_ptr(other.copy_ref().leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     RetainPtr(RetainPtr&& other) | ||||
|     RefPtr(RefPtr&& other) | ||||
|         : m_ptr(other.leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     template<typename U> | ||||
|     RetainPtr(Retained<U>&& other) | ||||
|     RefPtr(NonnullRefPtr<U>&& other) | ||||
|         : m_ptr(static_cast<T*>(&other.leak_ref())) | ||||
|     { | ||||
|     } | ||||
|     template<typename U> | ||||
|     RetainPtr(RetainPtr<U>&& other) | ||||
|     RefPtr(RefPtr<U>&& other) | ||||
|         : m_ptr(static_cast<T*>(other.leak_ref())) | ||||
|     { | ||||
|     } | ||||
|     RetainPtr(const RetainPtr& other) | ||||
|         : m_ptr(const_cast<RetainPtr&>(other).copy_ref().leak_ref()) | ||||
|     RefPtr(const RefPtr& other) | ||||
|         : m_ptr(const_cast<RefPtr&>(other).copy_ref().leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     template<typename U> | ||||
|     RetainPtr(const RetainPtr<U>& other) | ||||
|         : m_ptr(const_cast<RetainPtr<U>&>(other).copy_ref().leak_ref()) | ||||
|     RefPtr(const RefPtr<U>& other) | ||||
|         : m_ptr(const_cast<RefPtr<U>&>(other).copy_ref().leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     ~RetainPtr() | ||||
|     ~RefPtr() | ||||
|     { | ||||
|         clear(); | ||||
| #ifdef SANITIZE_PTRS | ||||
|  | @ -74,9 +74,9 @@ public: | |||
|             m_ptr = (T*)(0xe0e0e0e0); | ||||
| #endif | ||||
|     } | ||||
|     RetainPtr(std::nullptr_t) {} | ||||
|     RefPtr(std::nullptr_t) {} | ||||
| 
 | ||||
|     RetainPtr& operator=(RetainPtr&& other) | ||||
|     RefPtr& operator=(RefPtr&& other) | ||||
|     { | ||||
|         if (this != &other) { | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -86,7 +86,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     template<typename U> | ||||
|     RetainPtr& operator=(RetainPtr<U>&& other) | ||||
|     RefPtr& operator=(RefPtr<U>&& other) | ||||
|     { | ||||
|         if (this != static_cast<void*>(&other)) { | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -96,7 +96,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     template<typename U> | ||||
|     RetainPtr& operator=(Retained<U>&& other) | ||||
|     RefPtr& operator=(NonnullRefPtr<U>&& other) | ||||
|     { | ||||
|         deref_if_not_null(m_ptr); | ||||
|         m_ptr = &other.leak_ref(); | ||||
|  | @ -104,7 +104,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     template<typename U> | ||||
|     RetainPtr& operator=(const Retained<U>& other) | ||||
|     RefPtr& operator=(const NonnullRefPtr<U>& other) | ||||
|     { | ||||
|         if (m_ptr != other.ptr()) | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -115,7 +115,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     template<typename U> | ||||
|     RetainPtr& operator=(const RetainPtr<U>& other) | ||||
|     RefPtr& operator=(const RefPtr<U>& other) | ||||
|     { | ||||
|         if (m_ptr != other.ptr()) | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -124,7 +124,7 @@ public: | |||
|         return *this; | ||||
|     } | ||||
| 
 | ||||
|     RetainPtr& operator=(const T* ptr) | ||||
|     RefPtr& operator=(const T* ptr) | ||||
|     { | ||||
|         if (m_ptr != ptr) | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -133,7 +133,7 @@ public: | |||
|         return *this; | ||||
|     } | ||||
| 
 | ||||
|     RetainPtr& operator=(const T& object) | ||||
|     RefPtr& operator=(const T& object) | ||||
|     { | ||||
|         if (m_ptr != &object) | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -142,15 +142,15 @@ public: | |||
|         return *this; | ||||
|     } | ||||
| 
 | ||||
|     RetainPtr& operator=(std::nullptr_t) | ||||
|     RefPtr& operator=(std::nullptr_t) | ||||
|     { | ||||
|         clear(); | ||||
|         return *this; | ||||
|     } | ||||
| 
 | ||||
|     RetainPtr copy_ref() const | ||||
|     RefPtr copy_ref() const | ||||
|     { | ||||
|         return RetainPtr(m_ptr); | ||||
|         return RefPtr(m_ptr); | ||||
|     } | ||||
| 
 | ||||
|     void clear() | ||||
|  | @ -185,11 +185,11 @@ public: | |||
|     bool operator==(std::nullptr_t) const { return !m_ptr; } | ||||
|     bool operator!=(std::nullptr_t) const { return m_ptr; } | ||||
| 
 | ||||
|     bool operator==(const RetainPtr& other) const { return m_ptr == other.m_ptr; } | ||||
|     bool operator!=(const RetainPtr& other) const { return m_ptr != other.m_ptr; } | ||||
|     bool operator==(const RefPtr& other) const { return m_ptr == other.m_ptr; } | ||||
|     bool operator!=(const RefPtr& other) const { return m_ptr != other.m_ptr; } | ||||
| 
 | ||||
|     bool operator==(RetainPtr& other) { return m_ptr == other.m_ptr; } | ||||
|     bool operator!=(RetainPtr& other) { return m_ptr != other.m_ptr; } | ||||
|     bool operator==(RefPtr& other) { return m_ptr == other.m_ptr; } | ||||
|     bool operator!=(RefPtr& other) { return m_ptr != other.m_ptr; } | ||||
| 
 | ||||
|     bool operator==(const T* other) const { return m_ptr == other; } | ||||
|     bool operator!=(const T* other) const { return m_ptr != other; } | ||||
|  | @ -205,4 +205,4 @@ private: | |||
| 
 | ||||
| } | ||||
| 
 | ||||
| using AK::RetainPtr; | ||||
| using AK::RefPtr; | ||||
|  |  | |||
|  | @ -32,58 +32,58 @@ inline void deref_if_not_null(T* ptr) | |||
| } | ||||
| 
 | ||||
| template<typename T> | ||||
| class CONSUMABLE(unconsumed) Retained { | ||||
| class CONSUMABLE(unconsumed) NonnullRefPtr { | ||||
| public: | ||||
|     enum AdoptTag { | ||||
|         Adopt | ||||
|     }; | ||||
| 
 | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(const T& object) | ||||
|     NonnullRefPtr(const T& object) | ||||
|         : m_ptr(const_cast<T*>(&object)) | ||||
|     { | ||||
|         m_ptr->ref(); | ||||
|     } | ||||
|     template<typename U> | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(const U& object) | ||||
|     NonnullRefPtr(const U& object) | ||||
|         : m_ptr(&const_cast<T&>(static_cast<const T&>(object))) | ||||
|     { | ||||
|         m_ptr->ref(); | ||||
|     } | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(AdoptTag, T& object) | ||||
|     NonnullRefPtr(AdoptTag, T& object) | ||||
|         : m_ptr(&object) | ||||
|     { | ||||
|     } | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(Retained& other) | ||||
|     NonnullRefPtr(NonnullRefPtr& other) | ||||
|         : m_ptr(&other.copy_ref().leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(Retained&& other) | ||||
|     NonnullRefPtr(NonnullRefPtr&& other) | ||||
|         : m_ptr(&other.leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     template<typename U> | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(Retained<U>&& other) | ||||
|     NonnullRefPtr(NonnullRefPtr<U>&& other) | ||||
|         : m_ptr(static_cast<T*>(&other.leak_ref())) | ||||
|     { | ||||
|     } | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(const Retained& other) | ||||
|         : m_ptr(&const_cast<Retained&>(other).copy_ref().leak_ref()) | ||||
|     NonnullRefPtr(const NonnullRefPtr& other) | ||||
|         : m_ptr(&const_cast<NonnullRefPtr&>(other).copy_ref().leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     template<typename U> | ||||
|     RETURN_TYPESTATE(unconsumed) | ||||
|     Retained(const Retained<U>& other) | ||||
|         : m_ptr(&const_cast<Retained<U>&>(other).copy_ref().leak_ref()) | ||||
|     NonnullRefPtr(const NonnullRefPtr<U>& other) | ||||
|         : m_ptr(&const_cast<NonnullRefPtr<U>&>(other).copy_ref().leak_ref()) | ||||
|     { | ||||
|     } | ||||
|     ~Retained() | ||||
|     ~NonnullRefPtr() | ||||
|     { | ||||
|         deref_if_not_null(m_ptr); | ||||
|         m_ptr = nullptr; | ||||
|  | @ -96,7 +96,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     CALLABLE_WHEN(unconsumed) | ||||
|     Retained& operator=(Retained&& other) | ||||
|     NonnullRefPtr& operator=(NonnullRefPtr&& other) | ||||
|     { | ||||
|         if (this != &other) { | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -107,7 +107,7 @@ public: | |||
| 
 | ||||
|     template<typename U> | ||||
|     CALLABLE_WHEN(unconsumed) | ||||
|     Retained& operator=(Retained<U>&& other) | ||||
|     NonnullRefPtr& operator=(NonnullRefPtr<U>&& other) | ||||
|     { | ||||
|         if (this != static_cast<void*>(&other)) { | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -117,7 +117,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     CALLABLE_WHEN(unconsumed) | ||||
|     Retained& operator=(T& object) | ||||
|     NonnullRefPtr& operator=(T& object) | ||||
|     { | ||||
|         if (m_ptr != &object) | ||||
|             deref_if_not_null(m_ptr); | ||||
|  | @ -127,9 +127,9 @@ public: | |||
|     } | ||||
| 
 | ||||
|     CALLABLE_WHEN(unconsumed) | ||||
|     Retained copy_ref() const | ||||
|     NonnullRefPtr copy_ref() const | ||||
|     { | ||||
|         return Retained(*m_ptr); | ||||
|         return NonnullRefPtr(*m_ptr); | ||||
|     } | ||||
| 
 | ||||
|     CALLABLE_WHEN(unconsumed) | ||||
|  | @ -208,18 +208,18 @@ public: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     Retained() {} | ||||
|     NonnullRefPtr() {} | ||||
| 
 | ||||
|     T* m_ptr { nullptr }; | ||||
| }; | ||||
| 
 | ||||
| template<typename T> | ||||
| inline Retained<T> adopt(T& object) | ||||
| inline NonnullRefPtr<T> adopt(T& object) | ||||
| { | ||||
|     return Retained<T>(Retained<T>::Adopt, object); | ||||
|     return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, object); | ||||
| } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| using AK::adopt; | ||||
| using AK::Retained; | ||||
| using AK::NonnullRefPtr; | ||||
|  |  | |||
|  | @ -60,7 +60,7 @@ static inline int allocation_size_for_stringimpl(int length) | |||
|     return sizeof(StringImpl) + (sizeof(char) * length) + sizeof(char); | ||||
| } | ||||
| 
 | ||||
| Retained<StringImpl> StringImpl::create_uninitialized(int length, char*& buffer) | ||||
| NonnullRefPtr<StringImpl> StringImpl::create_uninitialized(int length, char*& buffer) | ||||
| { | ||||
|     ASSERT(length); | ||||
|     void* slot = kmalloc(allocation_size_for_stringimpl(length)); | ||||
|  | @ -71,7 +71,7 @@ Retained<StringImpl> StringImpl::create_uninitialized(int length, char*& buffer) | |||
|     return new_stringimpl; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<StringImpl> StringImpl::create(const char* cstring, int length, ShouldChomp should_chomp) | ||||
| RefPtr<StringImpl> StringImpl::create(const char* cstring, int length, ShouldChomp should_chomp) | ||||
| { | ||||
|     if (!cstring) | ||||
|         return nullptr; | ||||
|  | @ -99,7 +99,7 @@ RetainPtr<StringImpl> StringImpl::create(const char* cstring, int length, Should | |||
|     return new_stringimpl; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldChomp) | ||||
| RefPtr<StringImpl> StringImpl::create(const char* cstring, ShouldChomp shouldChomp) | ||||
| { | ||||
|     if (!cstring) | ||||
|         return nullptr; | ||||
|  | @ -131,7 +131,7 @@ static inline char to_ascii_uppercase(char c) | |||
|     return c; | ||||
| } | ||||
| 
 | ||||
| Retained<StringImpl> StringImpl::to_lowercase() const | ||||
| NonnullRefPtr<StringImpl> StringImpl::to_lowercase() const | ||||
| { | ||||
|     for (int i = 0; i < m_length; ++i) { | ||||
|         if (!is_ascii_lowercase(characters()[i])) | ||||
|  | @ -147,7 +147,7 @@ slow_path: | |||
|     return lowercased; | ||||
| } | ||||
| 
 | ||||
| Retained<StringImpl> StringImpl::to_uppercase() const | ||||
| NonnullRefPtr<StringImpl> StringImpl::to_uppercase() const | ||||
| { | ||||
|     for (int i = 0; i < m_length; ++i) { | ||||
|         if (!is_ascii_uppercase(characters()[i])) | ||||
|  |  | |||
|  | @ -14,11 +14,11 @@ enum ShouldChomp { | |||
| 
 | ||||
| class StringImpl : public RefCounted<StringImpl> { | ||||
| public: | ||||
|     static Retained<StringImpl> create_uninitialized(int length, char*& buffer); | ||||
|     static RetainPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp); | ||||
|     static RetainPtr<StringImpl> create(const char* cstring, int length, ShouldChomp = NoChomp); | ||||
|     Retained<StringImpl> to_lowercase() const; | ||||
|     Retained<StringImpl> to_uppercase() const; | ||||
|     static NonnullRefPtr<StringImpl> create_uninitialized(int length, char*& buffer); | ||||
|     static RefPtr<StringImpl> create(const char* cstring, ShouldChomp = NoChomp); | ||||
|     static RefPtr<StringImpl> create(const char* cstring, int length, ShouldChomp = NoChomp); | ||||
|     NonnullRefPtr<StringImpl> to_lowercase() const; | ||||
|     NonnullRefPtr<StringImpl> to_uppercase() const; | ||||
| 
 | ||||
|     void operator delete(void* ptr) | ||||
|     { | ||||
|  |  | |||
|  | @ -50,12 +50,12 @@ public: | |||
|     bool operator==(const OwnPtr<T>& other) const { return ptr() == other.ptr(); } | ||||
| 
 | ||||
| private: | ||||
|     WeakPtr(RetainPtr<WeakLink<T>>&& link) | ||||
|     WeakPtr(RefPtr<WeakLink<T>>&& link) | ||||
|         : m_link(move(link)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     RetainPtr<WeakLink<T>> m_link; | ||||
|     RefPtr<WeakLink<T>> m_link; | ||||
| }; | ||||
| 
 | ||||
| template<typename T> | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ protected: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     RetainPtr<WeakLink<T>> m_link; | ||||
|     RefPtr<WeakLink<T>> m_link; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ private: | |||
| 
 | ||||
|     ViewMode m_view_mode { Invalid }; | ||||
| 
 | ||||
|     Retained<GDirectoryModel> m_model; | ||||
|     NonnullRefPtr<GDirectoryModel> m_model; | ||||
|     int m_path_history_position { 0 }; | ||||
|     Vector<String> m_path_history; | ||||
|     void add_path_to_history(const StringView& path); | ||||
|  |  | |||
|  | @ -103,8 +103,8 @@ int main(int argc, char** argv) | |||
|         } | ||||
|     }); | ||||
| 
 | ||||
|     RetainPtr<GAction> view_as_table_action; | ||||
|     RetainPtr<GAction> view_as_icons_action; | ||||
|     RefPtr<GAction> view_as_table_action; | ||||
|     RefPtr<GAction> view_as_icons_action; | ||||
| 
 | ||||
|     view_as_table_action = GAction::create("Table view", { Mod_Ctrl, KeyCode::Key_L }, GraphicsBitmap::load_from_file("/res/icons/16x16/table-view.png"), [&](const GAction&) { | ||||
|         directory_view->set_view_mode(DirectoryView::ViewMode::List); | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| #include <LibGUI/GTextBox.h> | ||||
| #include <stdlib.h> | ||||
| 
 | ||||
| FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_font, GWidget* parent) | ||||
| FontEditorWidget::FontEditorWidget(const String& path, RefPtr<Font>&& edited_font, GWidget* parent) | ||||
|     : GWidget(parent) | ||||
|     , m_edited_font(move(edited_font)) | ||||
| { | ||||
|  |  | |||
|  | @ -9,11 +9,11 @@ class GTextBox; | |||
| 
 | ||||
| class FontEditorWidget final : public GWidget { | ||||
| public: | ||||
|     FontEditorWidget(const String& path, RetainPtr<Font>&&, GWidget* parent = nullptr); | ||||
|     FontEditorWidget(const String& path, RefPtr<Font>&&, GWidget* parent = nullptr); | ||||
|     virtual ~FontEditorWidget() override; | ||||
| 
 | ||||
| private: | ||||
|     RetainPtr<Font> m_edited_font; | ||||
|     RefPtr<Font> m_edited_font; | ||||
| 
 | ||||
|     GlyphMapWidget* m_glyph_map_widget { nullptr }; | ||||
|     GlyphEditorWidget* m_glyph_editor_widget { nullptr }; | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ private: | |||
| 
 | ||||
|     void draw_at_mouse(const GMouseEvent&); | ||||
| 
 | ||||
|     RetainPtr<Font> m_font; | ||||
|     RefPtr<Font> m_font; | ||||
|     byte m_glyph { 0 }; | ||||
|     int m_scale { 10 }; | ||||
| }; | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ private: | |||
| 
 | ||||
|     Rect get_outer_rect(byte glyph) const; | ||||
| 
 | ||||
|     RetainPtr<Font> m_font; | ||||
|     RefPtr<Font> m_font; | ||||
|     int m_rows { 8 }; | ||||
|     int m_horizontal_spacing { 2 }; | ||||
|     int m_vertical_spacing { 2 }; | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ int main(int argc, char** argv) | |||
| { | ||||
|     GApplication app(argc, argv); | ||||
| 
 | ||||
|     RetainPtr<Font> edited_font; | ||||
|     RefPtr<Font> edited_font; | ||||
|     String path; | ||||
| 
 | ||||
|     if (argc == 2) { | ||||
|  |  | |||
|  | @ -24,10 +24,10 @@ private: | |||
|     IRCClient m_client; | ||||
|     GStackWidget* m_container { nullptr }; | ||||
|     GTableView* m_window_list { nullptr }; | ||||
|     RetainPtr<GAction> m_join_action; | ||||
|     RetainPtr<GAction> m_part_action; | ||||
|     RetainPtr<GAction> m_whois_action; | ||||
|     RetainPtr<GAction> m_open_query_action; | ||||
|     RetainPtr<GAction> m_close_query_action; | ||||
|     RetainPtr<GAction> m_change_nick_action; | ||||
|     RefPtr<GAction> m_join_action; | ||||
|     RefPtr<GAction> m_part_action; | ||||
|     RefPtr<GAction> m_whois_action; | ||||
|     RefPtr<GAction> m_open_query_action; | ||||
|     RefPtr<GAction> m_close_query_action; | ||||
|     RefPtr<GAction> m_change_nick_action; | ||||
| }; | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ IRCChannel::~IRCChannel() | |||
| { | ||||
| } | ||||
| 
 | ||||
| Retained<IRCChannel> IRCChannel::create(IRCClient& client, const String& name) | ||||
| NonnullRefPtr<IRCChannel> IRCChannel::create(IRCClient& client, const String& name) | ||||
| { | ||||
|     return adopt(*new IRCChannel(client, name)); | ||||
| } | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ class IRCWindow; | |||
| 
 | ||||
| class IRCChannel : public RefCounted<IRCChannel> { | ||||
| public: | ||||
|     static Retained<IRCChannel> create(IRCClient&, const String&); | ||||
|     static NonnullRefPtr<IRCChannel> create(IRCClient&, const String&); | ||||
|     ~IRCChannel(); | ||||
| 
 | ||||
|     bool is_open() const { return m_open; } | ||||
|  | @ -64,7 +64,7 @@ private: | |||
|     Vector<Member> m_members; | ||||
|     bool m_open { false }; | ||||
| 
 | ||||
|     Retained<IRCLogBuffer> m_log; | ||||
|     Retained<IRCChannelMemberListModel> m_member_model; | ||||
|     NonnullRefPtr<IRCLogBuffer> m_log; | ||||
|     NonnullRefPtr<IRCChannelMemberListModel> m_member_model; | ||||
|     IRCWindow* m_window { nullptr }; | ||||
| }; | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ public: | |||
|     enum Column { | ||||
|         Name | ||||
|     }; | ||||
|     static Retained<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); } | ||||
|     static NonnullRefPtr<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); } | ||||
|     virtual ~IRCChannelMemberListModel() override; | ||||
| 
 | ||||
|     virtual int row_count(const GModelIndex&) const override; | ||||
|  |  | |||
|  | @ -120,14 +120,14 @@ private: | |||
| 
 | ||||
|     String m_nickname; | ||||
|     OwnPtr<CNotifier> m_notifier; | ||||
|     HashMap<String, RetainPtr<IRCChannel>> m_channels; | ||||
|     HashMap<String, RetainPtr<IRCQuery>> m_queries; | ||||
|     HashMap<String, RefPtr<IRCChannel>> m_channels; | ||||
|     HashMap<String, RefPtr<IRCQuery>> m_queries; | ||||
| 
 | ||||
|     Vector<IRCWindow*> m_windows; | ||||
| 
 | ||||
|     IRCWindow* m_server_subwindow { nullptr }; | ||||
| 
 | ||||
|     Retained<IRCWindowListModel> m_client_window_list_model; | ||||
|     Retained<IRCLogBuffer> m_log; | ||||
|     Retained<CConfigFile> m_config; | ||||
|     NonnullRefPtr<IRCWindowListModel> m_client_window_list_model; | ||||
|     NonnullRefPtr<IRCLogBuffer> m_log; | ||||
|     NonnullRefPtr<CConfigFile> m_config; | ||||
| }; | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| #include <stdio.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
| Retained<IRCLogBuffer> IRCLogBuffer::create() | ||||
| NonnullRefPtr<IRCLogBuffer> IRCLogBuffer::create() | ||||
| { | ||||
|     return adopt(*new IRCLogBuffer); | ||||
| } | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ class IRCLogBufferModel; | |||
| 
 | ||||
| class IRCLogBuffer : public RefCounted<IRCLogBuffer> { | ||||
| public: | ||||
|     static Retained<IRCLogBuffer> create(); | ||||
|     static NonnullRefPtr<IRCLogBuffer> create(); | ||||
|     ~IRCLogBuffer(); | ||||
| 
 | ||||
|     struct Message { | ||||
|  | @ -32,6 +32,6 @@ public: | |||
| 
 | ||||
| private: | ||||
|     IRCLogBuffer(); | ||||
|     Retained<IRCLogBufferModel> m_model; | ||||
|     NonnullRefPtr<IRCLogBufferModel> m_model; | ||||
|     CircularQueue<Message, 1000> m_messages; | ||||
| }; | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| #include <stdio.h> | ||||
| #include <time.h> | ||||
| 
 | ||||
| IRCLogBufferModel::IRCLogBufferModel(Retained<IRCLogBuffer>&& log_buffer) | ||||
| IRCLogBufferModel::IRCLogBufferModel(NonnullRefPtr<IRCLogBuffer>&& log_buffer) | ||||
|     : m_log_buffer(move(log_buffer)) | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ public: | |||
|         __Count, | ||||
|     }; | ||||
| 
 | ||||
|     static Retained<IRCLogBufferModel> create(Retained<IRCLogBuffer>&& log_buffer) { return adopt(*new IRCLogBufferModel(move(log_buffer))); } | ||||
|     static NonnullRefPtr<IRCLogBufferModel> create(NonnullRefPtr<IRCLogBuffer>&& log_buffer) { return adopt(*new IRCLogBufferModel(move(log_buffer))); } | ||||
|     virtual ~IRCLogBufferModel() override; | ||||
| 
 | ||||
|     virtual int row_count(const GModelIndex&) const override; | ||||
|  | @ -24,7 +24,7 @@ public: | |||
|     virtual void update() override; | ||||
| 
 | ||||
| private: | ||||
|     explicit IRCLogBufferModel(Retained<IRCLogBuffer>&&); | ||||
|     explicit IRCLogBufferModel(NonnullRefPtr<IRCLogBuffer>&&); | ||||
| 
 | ||||
|     Retained<IRCLogBuffer> m_log_buffer; | ||||
|     NonnullRefPtr<IRCLogBuffer> m_log_buffer; | ||||
| }; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ IRCQuery::~IRCQuery() | |||
| { | ||||
| } | ||||
| 
 | ||||
| Retained<IRCQuery> IRCQuery::create(IRCClient& client, const String& name) | ||||
| NonnullRefPtr<IRCQuery> IRCQuery::create(IRCClient& client, const String& name) | ||||
| { | ||||
|     return adopt(*new IRCQuery(client, name)); | ||||
| } | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ class IRCWindow; | |||
| 
 | ||||
| class IRCQuery : public RefCounted<IRCQuery> { | ||||
| public: | ||||
|     static Retained<IRCQuery> create(IRCClient&, const String& name); | ||||
|     static NonnullRefPtr<IRCQuery> create(IRCClient&, const String& name); | ||||
|     ~IRCQuery(); | ||||
| 
 | ||||
|     String name() const { return m_name; } | ||||
|  | @ -35,5 +35,5 @@ private: | |||
|     String m_name; | ||||
|     IRCWindow* m_window { nullptr }; | ||||
| 
 | ||||
|     Retained<IRCLogBuffer> m_log; | ||||
|     NonnullRefPtr<IRCLogBuffer> m_log; | ||||
| }; | ||||
|  |  | |||
|  | @ -49,6 +49,6 @@ private: | |||
|     String m_name; | ||||
|     GTableView* m_table_view { nullptr }; | ||||
|     GTextEditor* m_text_editor { nullptr }; | ||||
|     RetainPtr<IRCLogBuffer> m_log_buffer; | ||||
|     RefPtr<IRCLogBuffer> m_log_buffer; | ||||
|     int m_unread_count { 0 }; | ||||
| }; | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ public: | |||
|         Name, | ||||
|     }; | ||||
| 
 | ||||
|     static Retained<IRCWindowListModel> create(IRCClient& client) { return adopt(*new IRCWindowListModel(client)); } | ||||
|     static NonnullRefPtr<IRCWindowListModel> create(IRCClient& client) { return adopt(*new IRCWindowListModel(client)); } | ||||
|     virtual ~IRCWindowListModel() override; | ||||
| 
 | ||||
|     virtual int row_count(const GModelIndex&) const override; | ||||
|  |  | |||
|  | @ -32,7 +32,7 @@ private: | |||
|     virtual void mouseup_event(GMouseEvent&) override; | ||||
|     virtual void mousemove_event(GMouseEvent&) override; | ||||
| 
 | ||||
|     RetainPtr<GraphicsBitmap> m_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_bitmap; | ||||
| 
 | ||||
|     Color m_primary_color { Color::Black }; | ||||
|     Color m_secondary_color { Color::White }; | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ public: | |||
|         __Count | ||||
|     }; | ||||
| 
 | ||||
|     static Retained<ProcessModel> create(GraphWidget& graph) { return adopt(*new ProcessModel(graph)); } | ||||
|     static NonnullRefPtr<ProcessModel> create(GraphWidget& graph) { return adopt(*new ProcessModel(graph)); } | ||||
|     virtual ~ProcessModel() override; | ||||
| 
 | ||||
|     virtual int row_count(const GModelIndex&) const override; | ||||
|  | @ -61,9 +61,9 @@ private: | |||
|     HashMap<uid_t, String> m_usernames; | ||||
|     HashMap<pid_t, OwnPtr<Process>> m_processes; | ||||
|     Vector<pid_t> m_pids; | ||||
|     RetainPtr<GraphicsBitmap> m_generic_process_icon; | ||||
|     RetainPtr<GraphicsBitmap> m_high_priority_icon; | ||||
|     RetainPtr<GraphicsBitmap> m_low_priority_icon; | ||||
|     RetainPtr<GraphicsBitmap> m_normal_priority_icon; | ||||
|     RefPtr<GraphicsBitmap> m_generic_process_icon; | ||||
|     RefPtr<GraphicsBitmap> m_high_priority_icon; | ||||
|     RefPtr<GraphicsBitmap> m_low_priority_icon; | ||||
|     RefPtr<GraphicsBitmap> m_normal_priority_icon; | ||||
|     CFile m_proc_all; | ||||
| }; | ||||
|  |  | |||
|  | @ -55,7 +55,7 @@ private: | |||
|     Rect m_rect; | ||||
|     GButton* m_button { nullptr }; | ||||
|     String m_icon_path; | ||||
|     RetainPtr<GraphicsBitmap> m_icon; | ||||
|     RefPtr<GraphicsBitmap> m_icon; | ||||
|     bool m_active { false }; | ||||
|     bool m_minimized { false }; | ||||
| }; | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ | |||
| byte Terminal::Attribute::default_foreground_color = 7; | ||||
| byte Terminal::Attribute::default_background_color = 0; | ||||
| 
 | ||||
| Terminal::Terminal(int ptm_fd, RetainPtr<CConfigFile> config) | ||||
| Terminal::Terminal(int ptm_fd, RefPtr<CConfigFile> config) | ||||
|     : m_ptm_fd(ptm_fd) | ||||
|     , m_notifier(ptm_fd, CNotifier::Read) | ||||
|     , m_config(config) | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class Font; | |||
| 
 | ||||
| class Terminal final : public GFrame { | ||||
| public: | ||||
|     explicit Terminal(int ptm_fd, RetainPtr<CConfigFile> config); | ||||
|     explicit Terminal(int ptm_fd, RefPtr<CConfigFile> config); | ||||
|     virtual ~Terminal() override; | ||||
| 
 | ||||
|     void create_window(); | ||||
|  | @ -30,7 +30,7 @@ public: | |||
|     bool should_beep() { return m_should_beep; } | ||||
|     void set_should_beep(bool sb) { m_should_beep = sb; }; | ||||
| 
 | ||||
|     RetainPtr<CConfigFile> config() const { return m_config; } | ||||
|     RefPtr<CConfigFile> config() const { return m_config; } | ||||
| 
 | ||||
| private: | ||||
|     typedef Vector<unsigned, 4> ParamVector; | ||||
|  | @ -205,7 +205,7 @@ private: | |||
| 
 | ||||
|     CTimer m_cursor_blink_timer; | ||||
|     CTimer m_visual_beep_timer; | ||||
|     RetainPtr<CConfigFile> m_config; | ||||
|     RefPtr<CConfigFile> m_config; | ||||
| 
 | ||||
|     byte m_last_char { 0 }; | ||||
| }; | ||||
|  |  | |||
|  | @ -81,7 +81,7 @@ static void make_shell(int ptm_fd) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| GWindow* create_settings_window(Terminal& terminal, RetainPtr<CConfigFile> config) | ||||
| GWindow* create_settings_window(Terminal& terminal, RefPtr<CConfigFile> config) | ||||
| { | ||||
|     auto* window = new GWindow; | ||||
|     window->set_title("Terminal Settings"); | ||||
|  | @ -149,7 +149,7 @@ int main(int argc, char** argv) | |||
|     window->set_double_buffering_enabled(false); | ||||
|     window->set_should_exit_event_loop_on_close(true); | ||||
| 
 | ||||
|     RetainPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal"); | ||||
|     RefPtr<CConfigFile> config = CConfigFile::get_for_app("Terminal"); | ||||
|     Terminal terminal(ptm_fd, config); | ||||
|     window->set_has_alpha_channel(true); | ||||
|     window->set_main_widget(&terminal); | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ public: | |||
|     void set_stat_label(GLabel* l) { stats = l; }; | ||||
| 
 | ||||
| private: | ||||
|     RetainPtr<GraphicsBitmap> bitmap; | ||||
|     RefPtr<GraphicsBitmap> bitmap; | ||||
|     GLabel* stats; | ||||
| 
 | ||||
|     virtual void paint_event(GPaintEvent&) override; | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ public: | |||
|     } | ||||
|     virtual ~TestWidget() override {} | ||||
| 
 | ||||
|     void set_bitmap(RetainPtr<GraphicsBitmap>&& bitmap) | ||||
|     void set_bitmap(RefPtr<GraphicsBitmap>&& bitmap) | ||||
|     { | ||||
|         m_bitmap = move(bitmap); | ||||
|         update(); | ||||
|  | @ -31,7 +31,7 @@ private: | |||
|         painter.blit_tiled({ 160, 160, 160, 160 }, *m_bitmap, m_bitmap->rect()); | ||||
|     } | ||||
| 
 | ||||
|     RetainPtr<GraphicsBitmap> m_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_bitmap; | ||||
| }; | ||||
| 
 | ||||
| int main(int argc, char** argv) | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ private: | |||
|     String m_name; | ||||
|     int m_grid_size { 5 }; | ||||
|     bool m_should_snap_to_grid { true }; | ||||
|     Vector<Retained<VBWidget>> m_widgets; | ||||
|     Vector<NonnullRefPtr<VBWidget>> m_widgets; | ||||
|     HashMap<GWidget*, VBWidget*> m_gwidget_map; | ||||
|     HashTable<VBWidget*> m_selected_widgets; | ||||
|     Point m_transform_event_origin; | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ class VBWidget : public RefCounted<VBWidget> | |||
|     friend class VBWidgetPropertyModel; | ||||
| 
 | ||||
| public: | ||||
|     static Retained<VBWidget> create(VBWidgetType type, VBForm& form) { return adopt(*new VBWidget(type, form)); } | ||||
|     static NonnullRefPtr<VBWidget> create(VBWidgetType type, VBForm& form) { return adopt(*new VBWidget(type, form)); } | ||||
|     ~VBWidget(); | ||||
| 
 | ||||
|     bool is_selected() const; | ||||
|  | @ -80,6 +80,6 @@ private: | |||
|     VBForm& m_form; | ||||
|     GWidget* m_gwidget { nullptr }; | ||||
|     Vector<OwnPtr<VBProperty>> m_properties; | ||||
|     Retained<VBWidgetPropertyModel> m_property_model; | ||||
|     NonnullRefPtr<VBWidgetPropertyModel> m_property_model; | ||||
|     Rect m_transform_origin_rect; | ||||
| }; | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ public: | |||
|         __Count | ||||
|     }; | ||||
| 
 | ||||
|     static Retained<VBWidgetPropertyModel> create(VBWidget& widget) { return adopt(*new VBWidgetPropertyModel(widget)); } | ||||
|     static NonnullRefPtr<VBWidgetPropertyModel> create(VBWidget& widget) { return adopt(*new VBWidgetPropertyModel(widget)); } | ||||
|     virtual ~VBWidgetPropertyModel() override; | ||||
| 
 | ||||
|     virtual int row_count(const GModelIndex&) const override; | ||||
|  |  | |||
|  | @ -83,14 +83,14 @@ private: | |||
|     int m_mine_count { 10 }; | ||||
|     int m_unswept_empties { 0 }; | ||||
|     Vector<OwnPtr<Square>> m_squares; | ||||
|     RetainPtr<GraphicsBitmap> m_mine_bitmap; | ||||
|     RetainPtr<GraphicsBitmap> m_flag_bitmap; | ||||
|     RetainPtr<GraphicsBitmap> m_badflag_bitmap; | ||||
|     RetainPtr<GraphicsBitmap> m_consider_bitmap; | ||||
|     RetainPtr<GraphicsBitmap> m_default_face_bitmap; | ||||
|     RetainPtr<GraphicsBitmap> m_good_face_bitmap; | ||||
|     RetainPtr<GraphicsBitmap> m_bad_face_bitmap; | ||||
|     RetainPtr<GraphicsBitmap> m_number_bitmap[8]; | ||||
|     RefPtr<GraphicsBitmap> m_mine_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_flag_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_badflag_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_consider_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_default_face_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_good_face_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_bad_face_bitmap; | ||||
|     RefPtr<GraphicsBitmap> m_number_bitmap[8]; | ||||
|     GButton& m_face_button; | ||||
|     GLabel& m_flag_label; | ||||
|     GLabel& m_time_label; | ||||
|  |  | |||
|  | @ -59,5 +59,5 @@ private: | |||
|     unsigned m_high_score { 0 }; | ||||
|     String m_high_score_text; | ||||
| 
 | ||||
|     Vector<Retained<GraphicsBitmap>> m_fruit_bitmaps; | ||||
|     Vector<NonnullRefPtr<GraphicsBitmap>> m_fruit_bitmaps; | ||||
| }; | ||||
|  |  | |||
|  | @ -2,12 +2,12 @@ | |||
| 
 | ||||
| // #define OFFD_DEBUG
 | ||||
| 
 | ||||
| Retained<DiskPartition> DiskPartition::create(Retained<DiskDevice>&& device, unsigned block_offset) | ||||
| NonnullRefPtr<DiskPartition> DiskPartition::create(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset) | ||||
| { | ||||
|     return adopt(*new DiskPartition(move(device), block_offset)); | ||||
| } | ||||
| 
 | ||||
| DiskPartition::DiskPartition(Retained<DiskDevice>&& device, unsigned block_offset) | ||||
| DiskPartition::DiskPartition(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset) | ||||
|     : m_device(move(device)) | ||||
|     , m_block_offset(block_offset) | ||||
| { | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
| 
 | ||||
| class DiskPartition final : public DiskDevice { | ||||
| public: | ||||
|     static Retained<DiskPartition> create(Retained<DiskDevice>&& device, unsigned block_offset); | ||||
|     static NonnullRefPtr<DiskPartition> create(NonnullRefPtr<DiskDevice>&& device, unsigned block_offset); | ||||
|     virtual ~DiskPartition(); | ||||
| 
 | ||||
|     virtual unsigned block_size() const override; | ||||
|  | @ -17,8 +17,8 @@ public: | |||
| private: | ||||
|     virtual const char* class_name() const override; | ||||
| 
 | ||||
|     DiskPartition(Retained<DiskDevice>&&, unsigned); | ||||
|     DiskPartition(NonnullRefPtr<DiskDevice>&&, unsigned); | ||||
| 
 | ||||
|     Retained<DiskDevice> m_device; | ||||
|     NonnullRefPtr<DiskDevice> m_device; | ||||
|     unsigned m_block_offset; | ||||
| }; | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| //#define FBBD_DEBUG
 | ||||
| #define IGNORE_FILE_LENGTH // Useful for e.g /dev/hda2
 | ||||
| 
 | ||||
| RetainPtr<FileBackedDiskDevice> FileBackedDiskDevice::create(String&& image_path, unsigned block_size) | ||||
| RefPtr<FileBackedDiskDevice> FileBackedDiskDevice::create(String&& image_path, unsigned block_size) | ||||
| { | ||||
|     return adopt(*new FileBackedDiskDevice(move(image_path), block_size)); | ||||
| } | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| class FileBackedDiskDevice final : public DiskDevice { | ||||
| public: | ||||
|     static RetainPtr<FileBackedDiskDevice> create(String&& image_path, unsigned block_size); | ||||
|     static RefPtr<FileBackedDiskDevice> create(String&& image_path, unsigned block_size); | ||||
|     virtual ~FileBackedDiskDevice() override; | ||||
| 
 | ||||
|     bool is_valid() const { return m_file; } | ||||
|  |  | |||
|  | @ -78,7 +78,7 @@ | |||
| #define ATA_REG_ALTSTATUS 0x0C | ||||
| #define ATA_REG_DEVADDRESS 0x0D | ||||
| 
 | ||||
| Retained<IDEDiskDevice> IDEDiskDevice::create() | ||||
| NonnullRefPtr<IDEDiskDevice> IDEDiskDevice::create() | ||||
| { | ||||
|     return adopt(*new IDEDiskDevice); | ||||
| } | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ class IDEDiskDevice final : public IRQHandler | |||
|     , public DiskDevice { | ||||
|     AK_MAKE_ETERNAL | ||||
| public: | ||||
|     static Retained<IDEDiskDevice> create(); | ||||
|     static NonnullRefPtr<IDEDiskDevice> create(); | ||||
|     virtual ~IDEDiskDevice() override; | ||||
| 
 | ||||
|     // ^DiskDevice
 | ||||
|  | @ -55,7 +55,7 @@ private: | |||
| 
 | ||||
|     PCI::Address m_pci_address; | ||||
|     PhysicalRegionDescriptor m_prdt; | ||||
|     RetainPtr<PhysicalPage> m_dma_buffer_page; | ||||
|     RefPtr<PhysicalPage> m_dma_buffer_page; | ||||
|     word m_bus_master_base { 0 }; | ||||
|     Lockable<bool> m_dma_enabled; | ||||
| }; | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| 
 | ||||
| #define MBR_DEBUG | ||||
| 
 | ||||
| MBRPartitionTable::MBRPartitionTable(Retained<DiskDevice>&& device) | ||||
| MBRPartitionTable::MBRPartitionTable(NonnullRefPtr<DiskDevice>&& device) | ||||
|     : m_device(move(device)) | ||||
| { | ||||
| } | ||||
|  | @ -37,7 +37,7 @@ bool MBRPartitionTable::initialize() | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<DiskPartition> MBRPartitionTable::partition(unsigned index) | ||||
| RefPtr<DiskPartition> MBRPartitionTable::partition(unsigned index) | ||||
| { | ||||
|     ASSERT(index >= 1 && index <= 4); | ||||
| 
 | ||||
|  |  | |||
|  | @ -31,14 +31,14 @@ class MBRPartitionTable { | |||
|     AK_MAKE_ETERNAL | ||||
| 
 | ||||
| public: | ||||
|     MBRPartitionTable(Retained<DiskDevice>&& device); | ||||
|     MBRPartitionTable(NonnullRefPtr<DiskDevice>&& device); | ||||
|     ~MBRPartitionTable(); | ||||
| 
 | ||||
|     bool initialize(); | ||||
|     RetainPtr<DiskPartition> partition(unsigned index); | ||||
|     RefPtr<DiskPartition> partition(unsigned index); | ||||
| 
 | ||||
| private: | ||||
|     Retained<DiskDevice> m_device; | ||||
|     NonnullRefPtr<DiskDevice> m_device; | ||||
| 
 | ||||
|     ByteBuffer read_header() const; | ||||
|     const MBRPartitionHeader& header() const; | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ File::~File() | |||
| { | ||||
| } | ||||
| 
 | ||||
| KResultOr<Retained<FileDescription>> File::open(int options) | ||||
| KResultOr<NonnullRefPtr<FileDescription>> File::open(int options) | ||||
| { | ||||
|     UNUSED_PARAM(options); | ||||
|     return FileDescription::create(this); | ||||
|  |  | |||
|  | @ -43,7 +43,7 @@ class File : public RefCounted<File> { | |||
| public: | ||||
|     virtual ~File(); | ||||
| 
 | ||||
|     virtual KResultOr<Retained<FileDescription>> open(int options); | ||||
|     virtual KResultOr<NonnullRefPtr<FileDescription>> open(int options); | ||||
|     virtual void close(); | ||||
| 
 | ||||
|     virtual bool can_read(FileDescription&) const = 0; | ||||
|  |  | |||
|  | @ -26,9 +26,9 @@ Custody* Custody::get_if_cached(Custody* parent, const String& name) | |||
|     return nullptr; | ||||
| } | ||||
| 
 | ||||
| Retained<Custody> Custody::get_or_create(Custody* parent, const String& name, Inode& inode) | ||||
| NonnullRefPtr<Custody> Custody::get_or_create(Custody* parent, const String& name, Inode& inode) | ||||
| { | ||||
|     if (RetainPtr<Custody> cached_custody = get_if_cached(parent, name)) { | ||||
|     if (RefPtr<Custody> cached_custody = get_if_cached(parent, name)) { | ||||
|         if (&cached_custody->inode() != &inode) { | ||||
|             dbgprintf("WTF! cached custody for name '%s' has inode=%s, new inode=%s\n", | ||||
|                 name.characters(), | ||||
|  |  | |||
|  | @ -13,8 +13,8 @@ class VFS; | |||
| class Custody : public RefCounted<Custody> { | ||||
| public: | ||||
|     static Custody* get_if_cached(Custody* parent, const String& name); | ||||
|     static Retained<Custody> get_or_create(Custody* parent, const String& name, Inode&); | ||||
|     static Retained<Custody> create(Custody* parent, const String& name, Inode& inode) | ||||
|     static NonnullRefPtr<Custody> get_or_create(Custody* parent, const String& name, Inode&); | ||||
|     static NonnullRefPtr<Custody> create(Custody* parent, const String& name, Inode& inode) | ||||
|     { | ||||
|         return adopt(*new Custody(parent, name, inode)); | ||||
|     } | ||||
|  | @ -38,9 +38,9 @@ public: | |||
| private: | ||||
|     Custody(Custody* parent, const String& name, Inode&); | ||||
| 
 | ||||
|     RetainPtr<Custody> m_parent; | ||||
|     RefPtr<Custody> m_parent; | ||||
|     String m_name; | ||||
|     Retained<Inode> m_inode; | ||||
|     NonnullRefPtr<Inode> m_inode; | ||||
|     bool m_deleted { false }; | ||||
|     bool m_mounted_on { false }; | ||||
| }; | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ DevPtsFS& DevPtsFS::the() | |||
|     return *s_the; | ||||
| } | ||||
| 
 | ||||
| Retained<DevPtsFS> DevPtsFS::create() | ||||
| NonnullRefPtr<DevPtsFS> DevPtsFS::create() | ||||
| { | ||||
|     return adopt(*new DevPtsFS); | ||||
| } | ||||
|  | @ -36,7 +36,7 @@ const char* DevPtsFS::class_name() const | |||
|     return "DevPtsFS"; | ||||
| } | ||||
| 
 | ||||
| Retained<SynthFSInode> DevPtsFS::create_slave_pty_device_file(unsigned index) | ||||
| NonnullRefPtr<SynthFSInode> DevPtsFS::create_slave_pty_device_file(unsigned index) | ||||
| { | ||||
|     auto file = adopt(*new SynthFSInode(*this, generate_inode_index())); | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ public: | |||
|     [[gnu::pure]] static DevPtsFS& the(); | ||||
| 
 | ||||
|     virtual ~DevPtsFS() override; | ||||
|     static Retained<DevPtsFS> create(); | ||||
|     static NonnullRefPtr<DevPtsFS> create(); | ||||
| 
 | ||||
|     virtual bool initialize() override; | ||||
|     virtual const char* class_name() const override; | ||||
|  | @ -22,7 +22,7 @@ public: | |||
| private: | ||||
|     DevPtsFS(); | ||||
| 
 | ||||
|     Retained<SynthFSInode> create_slave_pty_device_file(unsigned index); | ||||
|     NonnullRefPtr<SynthFSInode> create_slave_pty_device_file(unsigned index); | ||||
| 
 | ||||
|     HashTable<SlavePTY*> m_slave_ptys; | ||||
| }; | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ Lockable<InlineLRUCache<BlockIdentifier, CachedBlock>>& block_cache() | |||
|     return *s_cache; | ||||
| } | ||||
| 
 | ||||
| DiskBackedFS::DiskBackedFS(Retained<DiskDevice>&& device) | ||||
| DiskBackedFS::DiskBackedFS(NonnullRefPtr<DiskDevice>&& device) | ||||
|     : m_device(move(device)) | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ public: | |||
|     virtual void flush_writes() override; | ||||
| 
 | ||||
| protected: | ||||
|     explicit DiskBackedFS(Retained<DiskDevice>&&); | ||||
|     explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&); | ||||
| 
 | ||||
|     void set_block_size(unsigned); | ||||
| 
 | ||||
|  | @ -27,7 +27,7 @@ protected: | |||
| 
 | ||||
| private: | ||||
|     int m_block_size { 0 }; | ||||
|     Retained<DiskDevice> m_device; | ||||
|     NonnullRefPtr<DiskDevice> m_device; | ||||
| 
 | ||||
|     HashMap<unsigned, ByteBuffer> m_write_cache; | ||||
| }; | ||||
|  |  | |||
|  | @ -31,12 +31,12 @@ static byte to_ext2_file_type(mode_t mode) | |||
|     return EXT2_FT_UNKNOWN; | ||||
| } | ||||
| 
 | ||||
| Retained<Ext2FS> Ext2FS::create(Retained<DiskDevice>&& device) | ||||
| NonnullRefPtr<Ext2FS> Ext2FS::create(NonnullRefPtr<DiskDevice>&& device) | ||||
| { | ||||
|     return adopt(*new Ext2FS(move(device))); | ||||
| } | ||||
| 
 | ||||
| Ext2FS::Ext2FS(Retained<DiskDevice>&& device) | ||||
| Ext2FS::Ext2FS(NonnullRefPtr<DiskDevice>&& device) | ||||
|     : DiskBackedFS(move(device)) | ||||
| { | ||||
| } | ||||
|  | @ -448,7 +448,7 @@ void Ext2FSInode::flush_metadata() | |||
|     set_metadata_dirty(false); | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const | ||||
| RefPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const | ||||
| { | ||||
|     LOCKER(m_lock); | ||||
|     ASSERT(inode.fsid() == fsid()); | ||||
|  | @ -1085,7 +1085,7 @@ bool Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state) | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const String& name, mode_t mode, int& error) | ||||
| RefPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const String& name, mode_t mode, int& error) | ||||
| { | ||||
|     LOCKER(m_lock); | ||||
|     ASSERT(parent_id.fsid() == fsid()); | ||||
|  | @ -1125,7 +1125,7 @@ RetainPtr<Inode> Ext2FS::create_directory(InodeIdentifier parent_id, const Strin | |||
|     return inode; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& name, mode_t mode, off_t size, dev_t dev, int& error) | ||||
| RefPtr<Inode> Ext2FS::create_inode(InodeIdentifier parent_id, const String& name, mode_t mode, off_t size, dev_t dev, int& error) | ||||
| { | ||||
|     LOCKER(m_lock); | ||||
|     ASSERT(parent_id.fsid() == fsid()); | ||||
|  |  | |||
|  | @ -60,7 +60,7 @@ class Ext2FS final : public DiskBackedFS { | |||
|     friend class Ext2FSInode; | ||||
| 
 | ||||
| public: | ||||
|     static Retained<Ext2FS> create(Retained<DiskDevice>&&); | ||||
|     static NonnullRefPtr<Ext2FS> create(NonnullRefPtr<DiskDevice>&&); | ||||
|     virtual ~Ext2FS() override; | ||||
|     virtual bool initialize() override; | ||||
| 
 | ||||
|  | @ -73,7 +73,7 @@ private: | |||
|     typedef unsigned BlockIndex; | ||||
|     typedef unsigned GroupIndex; | ||||
|     typedef unsigned InodeIndex; | ||||
|     explicit Ext2FS(Retained<DiskDevice>&&); | ||||
|     explicit Ext2FS(NonnullRefPtr<DiskDevice>&&); | ||||
| 
 | ||||
|     const ext2_super_block& super_block() const; | ||||
|     const ext2_group_desc& group_descriptor(unsigned groupIndex) const; | ||||
|  | @ -92,9 +92,9 @@ private: | |||
| 
 | ||||
|     virtual const char* class_name() const override; | ||||
|     virtual InodeIdentifier root_inode() const override; | ||||
|     virtual RetainPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override; | ||||
|     virtual RetainPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override; | ||||
|     virtual RetainPtr<Inode> get_inode(InodeIdentifier) const override; | ||||
|     virtual RefPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override; | ||||
|     virtual RefPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override; | ||||
|     virtual RefPtr<Inode> get_inode(InodeIdentifier) const override; | ||||
| 
 | ||||
|     InodeIndex allocate_inode(GroupIndex preferred_group, off_t expected_size); | ||||
|     Vector<BlockIndex> allocate_blocks(GroupIndex, int count); | ||||
|  | @ -126,7 +126,7 @@ private: | |||
|     mutable ByteBuffer m_cached_super_block; | ||||
|     mutable ByteBuffer m_cached_group_descriptor_table; | ||||
| 
 | ||||
|     mutable HashMap<BlockIndex, RetainPtr<Ext2FSInode>> m_inode_cache; | ||||
|     mutable HashMap<BlockIndex, RefPtr<Ext2FSInode>> m_inode_cache; | ||||
| }; | ||||
| 
 | ||||
| inline Ext2FS& Ext2FSInode::fs() | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ Lockable<HashTable<FIFO*>>& all_fifos() | |||
|     return *s_table; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<FIFO> FIFO::from_fifo_id(dword id) | ||||
| RefPtr<FIFO> FIFO::from_fifo_id(dword id) | ||||
| { | ||||
|     auto* ptr = reinterpret_cast<FIFO*>(id); | ||||
|     LOCKER(all_fifos().lock()); | ||||
|  | @ -25,12 +25,12 @@ RetainPtr<FIFO> FIFO::from_fifo_id(dword id) | |||
|     return ptr; | ||||
| } | ||||
| 
 | ||||
| Retained<FIFO> FIFO::create(uid_t uid) | ||||
| NonnullRefPtr<FIFO> FIFO::create(uid_t uid) | ||||
| { | ||||
|     return adopt(*new FIFO(uid)); | ||||
| } | ||||
| 
 | ||||
| Retained<FileDescription> FIFO::open_direction(FIFO::Direction direction) | ||||
| NonnullRefPtr<FileDescription> FIFO::open_direction(FIFO::Direction direction) | ||||
| { | ||||
|     auto description = FileDescription::create(this); | ||||
|     attach(direction); | ||||
|  |  | |||
|  | @ -14,14 +14,14 @@ public: | |||
|         Writer | ||||
|     }; | ||||
| 
 | ||||
|     static RetainPtr<FIFO> from_fifo_id(dword); | ||||
|     static RefPtr<FIFO> from_fifo_id(dword); | ||||
| 
 | ||||
|     static Retained<FIFO> create(uid_t); | ||||
|     static NonnullRefPtr<FIFO> create(uid_t); | ||||
|     virtual ~FIFO() override; | ||||
| 
 | ||||
|     uid_t uid() const { return m_uid; } | ||||
| 
 | ||||
|     Retained<FileDescription> open_direction(Direction); | ||||
|     NonnullRefPtr<FileDescription> open_direction(Direction); | ||||
| 
 | ||||
|     void attach(Direction); | ||||
|     void detach(Direction); | ||||
|  |  | |||
|  | @ -15,19 +15,19 @@ | |||
| #include <Kernel/VM/MemoryManager.h> | ||||
| #include <LibC/errno_numbers.h> | ||||
| 
 | ||||
| Retained<FileDescription> FileDescription::create(RetainPtr<Custody>&& custody) | ||||
| NonnullRefPtr<FileDescription> FileDescription::create(RefPtr<Custody>&& custody) | ||||
| { | ||||
|     auto description = adopt(*new FileDescription(InodeFile::create(custody->inode()))); | ||||
|     description->m_custody = move(custody); | ||||
|     return description; | ||||
| } | ||||
| 
 | ||||
| Retained<FileDescription> FileDescription::create(RetainPtr<File>&& file, SocketRole role) | ||||
| NonnullRefPtr<FileDescription> FileDescription::create(RefPtr<File>&& file, SocketRole role) | ||||
| { | ||||
|     return adopt(*new FileDescription(move(file), role)); | ||||
| } | ||||
| 
 | ||||
| FileDescription::FileDescription(RetainPtr<File>&& file, SocketRole role) | ||||
| FileDescription::FileDescription(RefPtr<File>&& file, SocketRole role) | ||||
|     : m_file(move(file)) | ||||
| { | ||||
|     if (m_file->is_inode()) | ||||
|  | @ -58,9 +58,9 @@ void FileDescription::set_socket_role(SocketRole role) | |||
|     socket()->attach(*this); | ||||
| } | ||||
| 
 | ||||
| Retained<FileDescription> FileDescription::clone() | ||||
| NonnullRefPtr<FileDescription> FileDescription::clone() | ||||
| { | ||||
|     RetainPtr<FileDescription> description; | ||||
|     RefPtr<FileDescription> description; | ||||
|     if (is_fifo()) { | ||||
|         description = fifo()->open_direction(m_fifo_direction); | ||||
|     } else { | ||||
|  |  | |||
|  | @ -21,11 +21,11 @@ class SharedMemory; | |||
| 
 | ||||
| class FileDescription : public RefCounted<FileDescription> { | ||||
| public: | ||||
|     static Retained<FileDescription> create(RetainPtr<Custody>&&); | ||||
|     static Retained<FileDescription> create(RetainPtr<File>&&, SocketRole = SocketRole::None); | ||||
|     static NonnullRefPtr<FileDescription> create(RefPtr<Custody>&&); | ||||
|     static NonnullRefPtr<FileDescription> create(RefPtr<File>&&, SocketRole = SocketRole::None); | ||||
|     ~FileDescription(); | ||||
| 
 | ||||
|     Retained<FileDescription> clone(); | ||||
|     NonnullRefPtr<FileDescription> clone(); | ||||
| 
 | ||||
|     int close(); | ||||
| 
 | ||||
|  | @ -92,7 +92,7 @@ public: | |||
| 
 | ||||
|     ByteBuffer& generator_cache() { return m_generator_cache; } | ||||
| 
 | ||||
|     void set_original_inode(Badge<VFS>, Retained<Inode>&& inode) { m_inode = move(inode); } | ||||
|     void set_original_inode(Badge<VFS>, NonnullRefPtr<Inode>&& inode) { m_inode = move(inode); } | ||||
| 
 | ||||
|     SocketRole socket_role() const { return m_socket_role; } | ||||
|     void set_socket_role(SocketRole); | ||||
|  | @ -105,12 +105,12 @@ public: | |||
| 
 | ||||
| private: | ||||
|     friend class VFS; | ||||
|     FileDescription(RetainPtr<File>&&, SocketRole = SocketRole::None); | ||||
|     FileDescription(RefPtr<File>&&, SocketRole = SocketRole::None); | ||||
|     FileDescription(FIFO&, FIFO::Direction); | ||||
| 
 | ||||
|     RetainPtr<Custody> m_custody; | ||||
|     RetainPtr<Inode> m_inode; | ||||
|     RetainPtr<File> m_file; | ||||
|     RefPtr<Custody> m_custody; | ||||
|     RefPtr<Inode> m_inode; | ||||
|     RefPtr<File> m_file; | ||||
| 
 | ||||
|     off_t m_current_offset { 0 }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ void FS::sync() | |||
| { | ||||
|     Inode::sync(); | ||||
| 
 | ||||
|     Vector<Retained<FS>, 32> fses; | ||||
|     Vector<NonnullRefPtr<FS>, 32> fses; | ||||
|     { | ||||
|         InterruptDisabler disabler; | ||||
|         for (auto& it : all_fses()) | ||||
|  |  | |||
|  | @ -54,10 +54,10 @@ public: | |||
|         byte file_type { 0 }; | ||||
|     }; | ||||
| 
 | ||||
|     virtual RetainPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) = 0; | ||||
|     virtual RetainPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) = 0; | ||||
|     virtual RefPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) = 0; | ||||
|     virtual RefPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) = 0; | ||||
| 
 | ||||
|     virtual RetainPtr<Inode> get_inode(InodeIdentifier) const = 0; | ||||
|     virtual RefPtr<Inode> get_inode(InodeIdentifier) const = 0; | ||||
| 
 | ||||
|     virtual void flush_writes() {} | ||||
| 
 | ||||
|  |  | |||
|  | @ -13,7 +13,7 @@ HashTable<Inode*>& all_inodes() | |||
| 
 | ||||
| void Inode::sync() | ||||
| { | ||||
|     Vector<Retained<Inode>, 32> inodes; | ||||
|     Vector<NonnullRefPtr<Inode>, 32> inodes; | ||||
|     { | ||||
|         InterruptDisabler disabler; | ||||
|         for (auto* inode : all_inodes()) { | ||||
|  |  | |||
|  | @ -85,6 +85,6 @@ private: | |||
|     FS& m_fs; | ||||
|     unsigned m_index { 0 }; | ||||
|     WeakPtr<VMObject> m_vmo; | ||||
|     RetainPtr<LocalSocket> m_socket; | ||||
|     RefPtr<LocalSocket> m_socket; | ||||
|     bool m_metadata_dirty { false }; | ||||
| }; | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| #include <Kernel/FileSystem/VirtualFileSystem.h> | ||||
| #include <Kernel/Process.h> | ||||
| 
 | ||||
| InodeFile::InodeFile(Retained<Inode>&& inode) | ||||
| InodeFile::InodeFile(NonnullRefPtr<Inode>&& inode) | ||||
|     : m_inode(move(inode)) | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ class Inode; | |||
| 
 | ||||
| class InodeFile final : public File { | ||||
| public: | ||||
|     static Retained<InodeFile> create(Retained<Inode>&& inode) | ||||
|     static NonnullRefPtr<InodeFile> create(NonnullRefPtr<Inode>&& inode) | ||||
|     { | ||||
|         return adopt(*new InodeFile(move(inode))); | ||||
|     } | ||||
|  | @ -33,6 +33,6 @@ public: | |||
|     virtual bool is_inode() const override { return true; } | ||||
| 
 | ||||
| private: | ||||
|     explicit InodeFile(Retained<Inode>&&); | ||||
|     Retained<Inode> m_inode; | ||||
|     explicit InodeFile(NonnullRefPtr<Inode>&&); | ||||
|     NonnullRefPtr<Inode> m_inode; | ||||
| }; | ||||
|  |  | |||
|  | @ -174,7 +174,7 @@ ProcFS& ProcFS::the() | |||
|     return *s_the; | ||||
| } | ||||
| 
 | ||||
| Retained<ProcFS> ProcFS::create() | ||||
| NonnullRefPtr<ProcFS> ProcFS::create() | ||||
| { | ||||
|     return adopt(*new ProcFS); | ||||
| } | ||||
|  | @ -614,7 +614,7 @@ ByteBuffer procfs$inodes(InodeIdentifier) | |||
|     extern HashTable<Inode*>& all_inodes(); | ||||
|     StringBuilder builder; | ||||
|     for (auto it : all_inodes()) { | ||||
|         RetainPtr<Inode> inode = *it; | ||||
|         RefPtr<Inode> inode = *it; | ||||
|         builder.appendf("Inode{K%x} %02u:%08u (%u)\n", inode.ptr(), inode->fsid(), inode->index(), inode->ref_count()); | ||||
|     } | ||||
|     return builder.to_byte_buffer(); | ||||
|  | @ -747,13 +747,13 @@ const char* ProcFS::class_name() const | |||
|     return "ProcFS"; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> ProcFS::create_inode(InodeIdentifier, const String&, mode_t, off_t, dev_t, int&) | ||||
| RefPtr<Inode> ProcFS::create_inode(InodeIdentifier, const String&, mode_t, off_t, dev_t, int&) | ||||
| { | ||||
|     kprintf("FIXME: Implement ProcFS::create_inode()?\n"); | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> ProcFS::create_directory(InodeIdentifier, const String&, mode_t, int& error) | ||||
| RefPtr<Inode> ProcFS::create_directory(InodeIdentifier, const String&, mode_t, int& error) | ||||
| { | ||||
|     error = -EROFS; | ||||
|     return nullptr; | ||||
|  | @ -764,7 +764,7 @@ InodeIdentifier ProcFS::root_inode() const | |||
|     return { fsid(), FI_Root }; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> ProcFS::get_inode(InodeIdentifier inode_id) const | ||||
| RefPtr<Inode> ProcFS::get_inode(InodeIdentifier inode_id) const | ||||
| { | ||||
| #ifdef PROCFS_DEBUG | ||||
|     dbgprintf("ProcFS::get_inode(%u)\n", inode_id.index()); | ||||
|  |  | |||
|  | @ -16,16 +16,16 @@ public: | |||
|     [[gnu::pure]] static ProcFS& the(); | ||||
| 
 | ||||
|     virtual ~ProcFS() override; | ||||
|     static Retained<ProcFS> create(); | ||||
|     static NonnullRefPtr<ProcFS> create(); | ||||
| 
 | ||||
|     virtual bool initialize() override; | ||||
|     virtual const char* class_name() const override; | ||||
| 
 | ||||
|     virtual InodeIdentifier root_inode() const override; | ||||
|     virtual RetainPtr<Inode> get_inode(InodeIdentifier) const override; | ||||
|     virtual RefPtr<Inode> get_inode(InodeIdentifier) const override; | ||||
| 
 | ||||
|     virtual RetainPtr<Inode> create_inode(InodeIdentifier parent_id, const String& name, mode_t, off_t size, dev_t, int& error) override; | ||||
|     virtual RetainPtr<Inode> create_directory(InodeIdentifier parent_id, const String& name, mode_t, int& error) override; | ||||
|     virtual RefPtr<Inode> create_inode(InodeIdentifier parent_id, const String& name, mode_t, off_t size, dev_t, int& error) override; | ||||
|     virtual RefPtr<Inode> create_directory(InodeIdentifier parent_id, const String& name, mode_t, int& error) override; | ||||
| 
 | ||||
|     void add_sys_file(String&&, Function<ByteBuffer(ProcFSInode&)>&& read_callback, Function<ssize_t(ProcFSInode&, const ByteBuffer&)>&& write_callback); | ||||
|     void add_sys_bool(String&&, Lockable<bool>&, Function<void()>&& notify_callback = nullptr); | ||||
|  | @ -36,7 +36,7 @@ private: | |||
| 
 | ||||
|     struct ProcFSDirectoryEntry { | ||||
|         ProcFSDirectoryEntry() {} | ||||
|         ProcFSDirectoryEntry(const char* a_name, unsigned a_proc_file_type, Function<ByteBuffer(InodeIdentifier)>&& a_read_callback = nullptr, Function<ssize_t(InodeIdentifier, const ByteBuffer&)>&& a_write_callback = nullptr, RetainPtr<ProcFSInode>&& a_inode = nullptr) | ||||
|         ProcFSDirectoryEntry(const char* a_name, unsigned a_proc_file_type, Function<ByteBuffer(InodeIdentifier)>&& a_read_callback = nullptr, Function<ssize_t(InodeIdentifier, const ByteBuffer&)>&& a_write_callback = nullptr, RefPtr<ProcFSInode>&& a_inode = nullptr) | ||||
|             : name(a_name) | ||||
|             , proc_file_type(a_proc_file_type) | ||||
|             , read_callback(move(a_read_callback)) | ||||
|  | @ -49,7 +49,7 @@ private: | |||
|         unsigned proc_file_type { 0 }; | ||||
|         Function<ByteBuffer(InodeIdentifier)> read_callback; | ||||
|         Function<ssize_t(InodeIdentifier, const ByteBuffer&)> write_callback; | ||||
|         RetainPtr<ProcFSInode> inode; | ||||
|         RefPtr<ProcFSInode> inode; | ||||
|         InodeIdentifier identifier(unsigned fsid) const; | ||||
|     }; | ||||
| 
 | ||||
|  | @ -60,7 +60,7 @@ private: | |||
| 
 | ||||
|     mutable Lock m_inodes_lock; | ||||
|     mutable HashMap<unsigned, ProcFSInode*> m_inodes; | ||||
|     RetainPtr<ProcFSInode> m_root_inode; | ||||
|     RefPtr<ProcFSInode> m_root_inode; | ||||
|     Lockable<bool> m_kmalloc_stack_helper; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
| 
 | ||||
| //#define SYNTHFS_DEBUG
 | ||||
| 
 | ||||
| Retained<SynthFS> SynthFS::create() | ||||
| NonnullRefPtr<SynthFS> SynthFS::create() | ||||
| { | ||||
|     return adopt(*new SynthFS); | ||||
| } | ||||
|  | @ -33,7 +33,7 @@ bool SynthFS::initialize() | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| Retained<SynthFSInode> SynthFS::create_directory(String&& name) | ||||
| NonnullRefPtr<SynthFSInode> SynthFS::create_directory(String&& name) | ||||
| { | ||||
|     auto file = adopt(*new SynthFSInode(*this, generate_inode_index())); | ||||
|     file->m_name = move(name); | ||||
|  | @ -45,7 +45,7 @@ Retained<SynthFSInode> SynthFS::create_directory(String&& name) | |||
|     return file; | ||||
| } | ||||
| 
 | ||||
| Retained<SynthFSInode> SynthFS::create_text_file(String&& name, ByteBuffer&& contents, mode_t mode) | ||||
| NonnullRefPtr<SynthFSInode> SynthFS::create_text_file(String&& name, ByteBuffer&& contents, mode_t mode) | ||||
| { | ||||
|     auto file = adopt(*new SynthFSInode(*this, generate_inode_index())); | ||||
|     file->m_data = contents; | ||||
|  | @ -58,7 +58,7 @@ Retained<SynthFSInode> SynthFS::create_text_file(String&& name, ByteBuffer&& con | |||
|     return file; | ||||
| } | ||||
| 
 | ||||
| Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& generator, mode_t mode) | ||||
| NonnullRefPtr<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& generator, mode_t mode) | ||||
| { | ||||
|     auto file = adopt(*new SynthFSInode(*this, generate_inode_index())); | ||||
|     file->m_generator = move(generator); | ||||
|  | @ -71,7 +71,7 @@ Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<By | |||
|     return file; | ||||
| } | ||||
| 
 | ||||
| Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& read_callback, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&& write_callback, mode_t mode) | ||||
| NonnullRefPtr<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&& read_callback, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&& write_callback, mode_t mode) | ||||
| { | ||||
|     auto file = adopt(*new SynthFSInode(*this, generate_inode_index())); | ||||
|     file->m_generator = move(read_callback); | ||||
|  | @ -85,7 +85,7 @@ Retained<SynthFSInode> SynthFS::create_generated_file(String&& name, Function<By | |||
|     return file; | ||||
| } | ||||
| 
 | ||||
| InodeIdentifier SynthFS::add_file(RetainPtr<SynthFSInode>&& file, InodeIndex parent) | ||||
| InodeIdentifier SynthFS::add_file(RefPtr<SynthFSInode>&& file, InodeIndex parent) | ||||
| { | ||||
|     LOCKER(m_lock); | ||||
|     ASSERT(file); | ||||
|  | @ -138,7 +138,7 @@ InodeIdentifier SynthFS::root_inode() const | |||
|     return { fsid(), 1 }; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> SynthFS::create_inode(InodeIdentifier parentInode, const String& name, mode_t mode, off_t size, dev_t, int& error) | ||||
| RefPtr<Inode> SynthFS::create_inode(InodeIdentifier parentInode, const String& name, mode_t mode, off_t size, dev_t, int& error) | ||||
| { | ||||
|     (void)parentInode; | ||||
|     (void)name; | ||||
|  | @ -149,7 +149,7 @@ RetainPtr<Inode> SynthFS::create_inode(InodeIdentifier parentInode, const String | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> SynthFS::create_directory(InodeIdentifier, const String&, mode_t, int& error) | ||||
| RefPtr<Inode> SynthFS::create_directory(InodeIdentifier, const String&, mode_t, int& error) | ||||
| { | ||||
|     error = -EROFS; | ||||
|     return nullptr; | ||||
|  | @ -161,7 +161,7 @@ auto SynthFS::generate_inode_index() -> InodeIndex | |||
|     return m_next_inode_index++; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> SynthFS::get_inode(InodeIdentifier inode) const | ||||
| RefPtr<Inode> SynthFS::get_inode(InodeIdentifier inode) const | ||||
| { | ||||
|     LOCKER(m_lock); | ||||
|     auto it = m_inodes.find(inode.index()); | ||||
|  |  | |||
|  | @ -10,14 +10,14 @@ class SynthFSInode; | |||
| class SynthFS : public FS { | ||||
| public: | ||||
|     virtual ~SynthFS() override; | ||||
|     static Retained<SynthFS> create(); | ||||
|     static NonnullRefPtr<SynthFS> create(); | ||||
| 
 | ||||
|     virtual bool initialize() override; | ||||
|     virtual const char* class_name() const override; | ||||
|     virtual InodeIdentifier root_inode() const override; | ||||
|     virtual RetainPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override; | ||||
|     virtual RetainPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override; | ||||
|     virtual RetainPtr<Inode> get_inode(InodeIdentifier) const override; | ||||
|     virtual RefPtr<Inode> create_inode(InodeIdentifier parentInode, const String& name, mode_t, off_t size, dev_t, int& error) override; | ||||
|     virtual RefPtr<Inode> create_directory(InodeIdentifier parentInode, const String& name, mode_t, int& error) override; | ||||
|     virtual RefPtr<Inode> get_inode(InodeIdentifier) const override; | ||||
| 
 | ||||
| protected: | ||||
|     typedef unsigned InodeIndex; | ||||
|  | @ -27,17 +27,17 @@ protected: | |||
| 
 | ||||
|     SynthFS(); | ||||
| 
 | ||||
|     Retained<SynthFSInode> create_directory(String&& name); | ||||
|     Retained<SynthFSInode> create_text_file(String&& name, ByteBuffer&&, mode_t = 0010644); | ||||
|     Retained<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, mode_t = 0100644); | ||||
|     Retained<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&&, mode_t = 0100644); | ||||
|     NonnullRefPtr<SynthFSInode> create_directory(String&& name); | ||||
|     NonnullRefPtr<SynthFSInode> create_text_file(String&& name, ByteBuffer&&, mode_t = 0010644); | ||||
|     NonnullRefPtr<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, mode_t = 0100644); | ||||
|     NonnullRefPtr<SynthFSInode> create_generated_file(String&& name, Function<ByteBuffer(SynthFSInode&)>&&, Function<ssize_t(SynthFSInode&, const ByteBuffer&)>&&, mode_t = 0100644); | ||||
| 
 | ||||
|     InodeIdentifier add_file(RetainPtr<SynthFSInode>&&, InodeIndex parent = RootInodeIndex); | ||||
|     InodeIdentifier add_file(RefPtr<SynthFSInode>&&, InodeIndex parent = RootInodeIndex); | ||||
|     bool remove_file(InodeIndex); | ||||
| 
 | ||||
| private: | ||||
|     InodeIndex m_next_inode_index { 2 }; | ||||
|     HashMap<InodeIndex, RetainPtr<SynthFSInode>> m_inodes; | ||||
|     HashMap<InodeIndex, RefPtr<SynthFSInode>> m_inodes; | ||||
| }; | ||||
| 
 | ||||
| struct SynthFSInodeCustomData { | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ InodeIdentifier VFS::root_inode_id() const | |||
|     return m_root_inode->identifier(); | ||||
| } | ||||
| 
 | ||||
| bool VFS::mount(Retained<FS>&& file_system, StringView path) | ||||
| bool VFS::mount(NonnullRefPtr<FS>&& file_system, StringView path) | ||||
| { | ||||
|     auto result = resolve_path(path, root_custody()); | ||||
|     if (result.is_error()) { | ||||
|  | @ -53,7 +53,7 @@ bool VFS::mount(Retained<FS>&& file_system, StringView path) | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| bool VFS::mount_root(Retained<FS>&& file_system) | ||||
| bool VFS::mount_root(NonnullRefPtr<FS>&& file_system) | ||||
| { | ||||
|     if (m_root_inode) { | ||||
|         kprintf("VFS: mount_root can't mount another root\n"); | ||||
|  | @ -149,9 +149,9 @@ KResult VFS::stat(StringView path, int options, Custody& base, struct stat& stat | |||
|     return custody_or_error.value()->inode().metadata().stat(statbuf); | ||||
| } | ||||
| 
 | ||||
| KResultOr<Retained<FileDescription>> VFS::open(StringView path, int options, mode_t mode, Custody& base) | ||||
| KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options, mode_t mode, Custody& base) | ||||
| { | ||||
|     RetainPtr<Custody> parent_custody; | ||||
|     RefPtr<Custody> parent_custody; | ||||
|     auto custody_or_error = resolve_path(path, base, &parent_custody, options); | ||||
|     if (options & O_CREAT) { | ||||
|         if (!parent_custody) | ||||
|  | @ -208,7 +208,7 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base) | |||
|     if (!is_regular_file(mode) && !is_block_device(mode) && !is_character_device(mode) && !is_fifo(mode) && !is_socket(mode)) | ||||
|         return KResult(-EINVAL); | ||||
| 
 | ||||
|     RetainPtr<Custody> parent_custody; | ||||
|     RefPtr<Custody> parent_custody; | ||||
|     auto existing_file_or_error = resolve_path(path, base, &parent_custody); | ||||
|     if (!existing_file_or_error.is_error()) | ||||
|         return KResult(-EEXIST); | ||||
|  | @ -230,7 +230,7 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base) | |||
|     return KSuccess; | ||||
| } | ||||
| 
 | ||||
| KResultOr<Retained<FileDescription>> VFS::create(StringView path, int options, mode_t mode, Custody& parent_custody) | ||||
| KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int options, mode_t mode, Custody& parent_custody) | ||||
| { | ||||
|     (void)options; | ||||
| 
 | ||||
|  | @ -255,7 +255,7 @@ KResultOr<Retained<FileDescription>> VFS::create(StringView path, int options, m | |||
| 
 | ||||
| KResult VFS::mkdir(StringView path, mode_t mode, Custody& base) | ||||
| { | ||||
|     RetainPtr<Custody> parent_custody; | ||||
|     RefPtr<Custody> parent_custody; | ||||
|     auto result = resolve_path(path, base, &parent_custody); | ||||
|     if (!result.is_error()) | ||||
|         return KResult(-EEXIST); | ||||
|  | @ -300,7 +300,7 @@ KResult VFS::access(StringView path, int mode, Custody& base) | |||
|     return KSuccess; | ||||
| } | ||||
| 
 | ||||
| KResultOr<Retained<Custody>> VFS::open_directory(StringView path, Custody& base) | ||||
| KResultOr<NonnullRefPtr<Custody>> VFS::open_directory(StringView path, Custody& base) | ||||
| { | ||||
|     auto inode_or_error = resolve_path(path, base); | ||||
|     if (inode_or_error.is_error()) | ||||
|  | @ -339,14 +339,14 @@ KResult VFS::chmod(StringView path, mode_t mode, Custody& base) | |||
| 
 | ||||
| KResult VFS::rename(StringView old_path, StringView new_path, Custody& base) | ||||
| { | ||||
|     RetainPtr<Custody> old_parent_custody; | ||||
|     RefPtr<Custody> old_parent_custody; | ||||
|     auto old_custody_or_error = resolve_path(old_path, base, &old_parent_custody); | ||||
|     if (old_custody_or_error.is_error()) | ||||
|         return old_custody_or_error.error(); | ||||
|     auto& old_custody = *old_custody_or_error.value(); | ||||
|     auto& old_inode = old_custody.inode(); | ||||
| 
 | ||||
|     RetainPtr<Custody> new_parent_custody; | ||||
|     RefPtr<Custody> new_parent_custody; | ||||
|     auto new_custody_or_error = resolve_path(new_path, base, &new_parent_custody); | ||||
|     if (new_custody_or_error.is_error()) { | ||||
|         if (new_custody_or_error.error() != -ENOENT) | ||||
|  | @ -445,7 +445,7 @@ KResult VFS::link(StringView old_path, StringView new_path, Custody& base) | |||
|     auto& old_custody = *old_custody_or_error.value(); | ||||
|     auto& old_inode = old_custody.inode(); | ||||
| 
 | ||||
|     RetainPtr<Custody> parent_custody; | ||||
|     RefPtr<Custody> parent_custody; | ||||
|     auto new_custody_or_error = resolve_path(new_path, base, &parent_custody); | ||||
|     if (!new_custody_or_error.is_error()) | ||||
|         return KResult(-EEXIST); | ||||
|  | @ -469,7 +469,7 @@ KResult VFS::link(StringView old_path, StringView new_path, Custody& base) | |||
| 
 | ||||
| KResult VFS::unlink(StringView path, Custody& base) | ||||
| { | ||||
|     RetainPtr<Custody> parent_custody; | ||||
|     RefPtr<Custody> parent_custody; | ||||
|     auto custody_or_error = resolve_path(path, base, &parent_custody); | ||||
|     if (custody_or_error.is_error()) | ||||
|         return custody_or_error.error(); | ||||
|  | @ -498,7 +498,7 @@ KResult VFS::unlink(StringView path, Custody& base) | |||
| 
 | ||||
| KResult VFS::symlink(StringView target, StringView linkpath, Custody& base) | ||||
| { | ||||
|     RetainPtr<Custody> parent_custody; | ||||
|     RefPtr<Custody> parent_custody; | ||||
|     auto existing_custody_or_error = resolve_path(linkpath, base, &parent_custody); | ||||
|     if (!existing_custody_or_error.is_error()) | ||||
|         return KResult(-EEXIST); | ||||
|  | @ -524,7 +524,7 @@ KResult VFS::symlink(StringView target, StringView linkpath, Custody& base) | |||
| 
 | ||||
| KResult VFS::rmdir(StringView path, Custody& base) | ||||
| { | ||||
|     RetainPtr<Custody> parent_custody; | ||||
|     RefPtr<Custody> parent_custody; | ||||
|     auto custody_or_error = resolve_path(path, base, &parent_custody); | ||||
|     if (custody_or_error.is_error()) | ||||
|         return KResult(custody_or_error.error()); | ||||
|  | @ -559,14 +559,14 @@ KResult VFS::rmdir(StringView path, Custody& base) | |||
|     return parent_inode.remove_child(FileSystemPath(path).basename()); | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Inode> VFS::get_inode(InodeIdentifier inode_id) | ||||
| RefPtr<Inode> VFS::get_inode(InodeIdentifier inode_id) | ||||
| { | ||||
|     if (!inode_id.is_valid()) | ||||
|         return nullptr; | ||||
|     return inode_id.fs()->get_inode(inode_id); | ||||
| } | ||||
| 
 | ||||
| VFS::Mount::Mount(RetainPtr<Custody>&& host_custody, Retained<FS>&& guest_fs) | ||||
| VFS::Mount::Mount(RefPtr<Custody>&& host_custody, NonnullRefPtr<FS>&& guest_fs) | ||||
|     : m_guest(guest_fs->root_inode()) | ||||
|     , m_guest_fs(move(guest_fs)) | ||||
|     , m_host_custody(move(host_custody)) | ||||
|  | @ -624,7 +624,7 @@ Custody& VFS::root_custody() | |||
|     return *m_root_custody; | ||||
| } | ||||
| 
 | ||||
| KResultOr<Retained<Custody>> VFS::resolve_path(StringView path, Custody& base, RetainPtr<Custody>* parent_custody, int options) | ||||
| KResultOr<NonnullRefPtr<Custody>> VFS::resolve_path(StringView path, Custody& base, RefPtr<Custody>* parent_custody, int options) | ||||
| { | ||||
|     if (path.is_empty()) | ||||
|         return KResult(-EINVAL); | ||||
|  | @ -632,7 +632,7 @@ KResultOr<Retained<Custody>> VFS::resolve_path(StringView path, Custody& base, R | |||
|     auto parts = path.split_view('/'); | ||||
|     InodeIdentifier crumb_id; | ||||
| 
 | ||||
|     Vector<Retained<Custody>, 32> custody_chain; | ||||
|     Vector<NonnullRefPtr<Custody>, 32> custody_chain; | ||||
| 
 | ||||
|     if (path[0] == '/') { | ||||
|         custody_chain.append(root_custody()); | ||||
|  |  | |||
|  | @ -35,7 +35,7 @@ class VFS { | |||
| public: | ||||
|     class Mount { | ||||
|     public: | ||||
|         Mount(RetainPtr<Custody>&&, Retained<FS>&&); | ||||
|         Mount(RefPtr<Custody>&&, NonnullRefPtr<FS>&&); | ||||
| 
 | ||||
|         InodeIdentifier host() const; | ||||
|         InodeIdentifier guest() const { return m_guest; } | ||||
|  | @ -47,8 +47,8 @@ public: | |||
|     private: | ||||
|         InodeIdentifier m_host; | ||||
|         InodeIdentifier m_guest; | ||||
|         Retained<FS> m_guest_fs; | ||||
|         RetainPtr<Custody> m_host_custody; | ||||
|         NonnullRefPtr<FS> m_guest_fs; | ||||
|         RefPtr<Custody> m_host_custody; | ||||
|     }; | ||||
| 
 | ||||
|     [[gnu::pure]] static VFS& the(); | ||||
|  | @ -56,12 +56,12 @@ public: | |||
|     VFS(); | ||||
|     ~VFS(); | ||||
| 
 | ||||
|     bool mount_root(Retained<FS>&&); | ||||
|     bool mount(Retained<FS>&&, StringView path); | ||||
|     bool mount_root(NonnullRefPtr<FS>&&); | ||||
|     bool mount(NonnullRefPtr<FS>&&, StringView path); | ||||
| 
 | ||||
|     KResultOr<Retained<FileDescription>> open(RetainPtr<Device>&&, int options); | ||||
|     KResultOr<Retained<FileDescription>> open(StringView path, int options, mode_t mode, Custody& base); | ||||
|     KResultOr<Retained<FileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody); | ||||
|     KResultOr<NonnullRefPtr<FileDescription>> open(RefPtr<Device>&&, int options); | ||||
|     KResultOr<NonnullRefPtr<FileDescription>> open(StringView path, int options, mode_t mode, Custody& base); | ||||
|     KResultOr<NonnullRefPtr<FileDescription>> create(StringView path, int options, mode_t mode, Custody& parent_custody); | ||||
|     KResult mkdir(StringView path, mode_t mode, Custody& base); | ||||
|     KResult link(StringView old_path, StringView new_path, Custody& base); | ||||
|     KResult unlink(StringView path, Custody& base); | ||||
|  | @ -76,7 +76,7 @@ public: | |||
|     KResult utime(StringView path, Custody& base, time_t atime, time_t mtime); | ||||
|     KResult rename(StringView oldpath, StringView newpath, Custody& base); | ||||
|     KResult mknod(StringView path, mode_t, dev_t, Custody& base); | ||||
|     KResultOr<Retained<Custody>> open_directory(StringView path, Custody& base); | ||||
|     KResultOr<NonnullRefPtr<Custody>> open_directory(StringView path, Custody& base); | ||||
| 
 | ||||
|     void register_device(Badge<Device>, Device&); | ||||
|     void unregister_device(Badge<Device>, Device&); | ||||
|  | @ -91,12 +91,12 @@ public: | |||
|     Device* get_device(unsigned major, unsigned minor); | ||||
| 
 | ||||
|     Custody& root_custody(); | ||||
|     KResultOr<Retained<Custody>> resolve_path(StringView path, Custody& base, RetainPtr<Custody>* parent = nullptr, int options = 0); | ||||
|     KResultOr<NonnullRefPtr<Custody>> resolve_path(StringView path, Custody& base, RefPtr<Custody>* parent = nullptr, int options = 0); | ||||
| 
 | ||||
| private: | ||||
|     friend class FileDescription; | ||||
| 
 | ||||
|     RetainPtr<Inode> get_inode(InodeIdentifier); | ||||
|     RefPtr<Inode> get_inode(InodeIdentifier); | ||||
| 
 | ||||
|     bool is_vfs_root(InodeIdentifier) const; | ||||
| 
 | ||||
|  | @ -105,9 +105,9 @@ private: | |||
|     Mount* find_mount_for_host(InodeIdentifier); | ||||
|     Mount* find_mount_for_guest(InodeIdentifier); | ||||
| 
 | ||||
|     RetainPtr<Inode> m_root_inode; | ||||
|     RefPtr<Inode> m_root_inode; | ||||
|     Vector<OwnPtr<Mount>> m_mounts; | ||||
|     HashMap<dword, Device*> m_devices; | ||||
| 
 | ||||
|     RetainPtr<Custody> m_root_custody; | ||||
|     RefPtr<Custody> m_root_custody; | ||||
| }; | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ Lockable<HashTable<IPv4Socket*>>& IPv4Socket::all_sockets() | |||
|     return *s_table; | ||||
| } | ||||
| 
 | ||||
| Retained<IPv4Socket> IPv4Socket::create(int type, int protocol) | ||||
| NonnullRefPtr<IPv4Socket> IPv4Socket::create(int type, int protocol) | ||||
| { | ||||
|     if (type == SOCK_STREAM) | ||||
|         return TCPSocket::create(protocol); | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ class TCPSocket; | |||
| 
 | ||||
| class IPv4Socket : public Socket { | ||||
| public: | ||||
|     static Retained<IPv4Socket> create(int type, int protocol); | ||||
|     static NonnullRefPtr<IPv4Socket> create(int type, int protocol); | ||||
|     virtual ~IPv4Socket() override; | ||||
| 
 | ||||
|     static Lockable<HashTable<IPv4Socket*>>& all_sockets(); | ||||
|  | @ -88,7 +88,7 @@ class IPv4SocketHandle : public SocketHandle { | |||
| public: | ||||
|     IPv4SocketHandle() {} | ||||
| 
 | ||||
|     IPv4SocketHandle(RetainPtr<IPv4Socket>&& socket) | ||||
|     IPv4SocketHandle(RefPtr<IPv4Socket>&& socket) | ||||
|         : SocketHandle(move(socket)) | ||||
|     { | ||||
|     } | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| //#define DEBUG_LOCAL_SOCKET
 | ||||
| 
 | ||||
| Retained<LocalSocket> LocalSocket::create(int type) | ||||
| NonnullRefPtr<LocalSocket> LocalSocket::create(int type) | ||||
| { | ||||
|     return adopt(*new LocalSocket(type)); | ||||
| } | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ class FileDescription; | |||
| 
 | ||||
| class LocalSocket final : public Socket { | ||||
| public: | ||||
|     static Retained<LocalSocket> create(int type); | ||||
|     static NonnullRefPtr<LocalSocket> create(int type); | ||||
|     virtual ~LocalSocket() override; | ||||
| 
 | ||||
|     virtual KResult bind(const sockaddr*, socklen_t) override; | ||||
|  | @ -28,7 +28,7 @@ private: | |||
|     virtual bool is_local() const override { return true; } | ||||
|     bool has_attached_peer(const FileDescription&) const; | ||||
| 
 | ||||
|     RetainPtr<FileDescription> m_file; | ||||
|     RefPtr<FileDescription> m_file; | ||||
| 
 | ||||
|     bool m_bound { false }; | ||||
|     int m_accepted_fds_open { 0 }; | ||||
|  |  | |||
|  | @ -209,7 +209,7 @@ void handle_icmp(const EthernetFrameHeader& eth, int frame_size) | |||
| 
 | ||||
|     { | ||||
|         LOCKER(IPv4Socket::all_sockets().lock()); | ||||
|         for (RetainPtr<IPv4Socket> socket : IPv4Socket::all_sockets().resource()) { | ||||
|         for (RefPtr<IPv4Socket> socket : IPv4Socket::all_sockets().resource()) { | ||||
|             LOCKER(socket->lock()); | ||||
|             if (socket->protocol() != (unsigned)IPv4Protocol::ICMP) | ||||
|                 continue; | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| #include <Kernel/UnixTypes.h> | ||||
| #include <LibC/errno_numbers.h> | ||||
| 
 | ||||
| KResultOr<Retained<Socket>> Socket::create(int domain, int type, int protocol) | ||||
| KResultOr<NonnullRefPtr<Socket>> Socket::create(int domain, int type, int protocol) | ||||
| { | ||||
|     (void)protocol; | ||||
|     switch (domain) { | ||||
|  | @ -41,7 +41,7 @@ KResult Socket::listen(int backlog) | |||
|     return KSuccess; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Socket> Socket::accept() | ||||
| RefPtr<Socket> Socket::accept() | ||||
| { | ||||
|     LOCKER(m_lock); | ||||
|     if (m_pending.is_empty()) | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ class FileDescription; | |||
| 
 | ||||
| class Socket : public File { | ||||
| public: | ||||
|     static KResultOr<Retained<Socket>> create(int domain, int type, int protocol); | ||||
|     static KResultOr<NonnullRefPtr<Socket>> create(int domain, int type, int protocol); | ||||
|     virtual ~Socket() override; | ||||
| 
 | ||||
|     int domain() const { return m_domain; } | ||||
|  | @ -33,7 +33,7 @@ public: | |||
|     int protocol() const { return m_protocol; } | ||||
| 
 | ||||
|     bool can_accept() const { return !m_pending.is_empty(); } | ||||
|     RetainPtr<Socket> accept(); | ||||
|     RefPtr<Socket> accept(); | ||||
|     bool is_connected() const { return m_connected; } | ||||
|     KResult listen(int backlog); | ||||
| 
 | ||||
|  | @ -89,14 +89,14 @@ private: | |||
|     timeval m_receive_deadline { 0, 0 }; | ||||
|     timeval m_send_deadline { 0, 0 }; | ||||
| 
 | ||||
|     Vector<RetainPtr<Socket>> m_pending; | ||||
|     Vector<RefPtr<Socket>> m_pending; | ||||
| }; | ||||
| 
 | ||||
| class SocketHandle { | ||||
| public: | ||||
|     SocketHandle() {} | ||||
| 
 | ||||
|     SocketHandle(RetainPtr<Socket>&& socket) | ||||
|     SocketHandle(RefPtr<Socket>&& socket) | ||||
|         : m_socket(move(socket)) | ||||
|     { | ||||
|         if (m_socket) | ||||
|  | @ -126,5 +126,5 @@ public: | |||
|     const Socket& socket() const { return *m_socket; } | ||||
| 
 | ||||
| private: | ||||
|     RetainPtr<Socket> m_socket; | ||||
|     RefPtr<Socket> m_socket; | ||||
| }; | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ Lockable<HashMap<word, TCPSocket*>>& TCPSocket::sockets_by_port() | |||
| 
 | ||||
| TCPSocketHandle TCPSocket::from_port(word port) | ||||
| { | ||||
|     RetainPtr<TCPSocket> socket; | ||||
|     RefPtr<TCPSocket> socket; | ||||
|     { | ||||
|         LOCKER(sockets_by_port().lock()); | ||||
|         auto it = sockets_by_port().resource().find(port); | ||||
|  | @ -38,7 +38,7 @@ TCPSocket::~TCPSocket() | |||
|     sockets_by_port().resource().remove(local_port()); | ||||
| } | ||||
| 
 | ||||
| Retained<TCPSocket> TCPSocket::create(int protocol) | ||||
| NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol) | ||||
| { | ||||
|     return adopt(*new TCPSocket(protocol)); | ||||
| } | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| 
 | ||||
| class TCPSocket final : public IPv4Socket { | ||||
| public: | ||||
|     static Retained<TCPSocket> create(int protocol); | ||||
|     static NonnullRefPtr<TCPSocket> create(int protocol); | ||||
|     virtual ~TCPSocket() override; | ||||
| 
 | ||||
|     enum class State { | ||||
|  | @ -49,7 +49,7 @@ class TCPSocketHandle : public SocketHandle { | |||
| public: | ||||
|     TCPSocketHandle() {} | ||||
| 
 | ||||
|     TCPSocketHandle(RetainPtr<TCPSocket>&& socket) | ||||
|     TCPSocketHandle(RefPtr<TCPSocket>&& socket) | ||||
|         : SocketHandle(move(socket)) | ||||
|     { | ||||
|     } | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ Lockable<HashMap<word, UDPSocket*>>& UDPSocket::sockets_by_port() | |||
| 
 | ||||
| UDPSocketHandle UDPSocket::from_port(word port) | ||||
| { | ||||
|     RetainPtr<UDPSocket> socket; | ||||
|     RefPtr<UDPSocket> socket; | ||||
|     { | ||||
|         LOCKER(sockets_by_port().lock()); | ||||
|         auto it = sockets_by_port().resource().find(port); | ||||
|  | @ -38,7 +38,7 @@ UDPSocket::~UDPSocket() | |||
|     sockets_by_port().resource().remove(local_port()); | ||||
| } | ||||
| 
 | ||||
| Retained<UDPSocket> UDPSocket::create(int protocol) | ||||
| NonnullRefPtr<UDPSocket> UDPSocket::create(int protocol) | ||||
| { | ||||
|     return adopt(*new UDPSocket(protocol)); | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ class UDPSocketHandle; | |||
| 
 | ||||
| class UDPSocket final : public IPv4Socket { | ||||
| public: | ||||
|     static Retained<UDPSocket> create(int protocol); | ||||
|     static NonnullRefPtr<UDPSocket> create(int protocol); | ||||
|     virtual ~UDPSocket() override; | ||||
| 
 | ||||
|     static UDPSocketHandle from_port(word); | ||||
|  | @ -27,7 +27,7 @@ class UDPSocketHandle : public SocketHandle { | |||
| public: | ||||
|     UDPSocketHandle() {} | ||||
| 
 | ||||
|     UDPSocketHandle(RetainPtr<UDPSocket>&& socket) | ||||
|     UDPSocketHandle(RefPtr<UDPSocket>&& socket) | ||||
|         : SocketHandle(move(socket)) | ||||
|     { | ||||
|     } | ||||
|  |  | |||
|  | @ -105,7 +105,7 @@ Region* Process::allocate_region(VirtualAddress vaddr, size_t size, const String | |||
|     return m_regions.last().ptr(); | ||||
| } | ||||
| 
 | ||||
| Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size, RetainPtr<Inode>&& inode, const String& name, int prot) | ||||
| Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size, RefPtr<Inode>&& inode, const String& name, int prot) | ||||
| { | ||||
|     auto range = allocate_range(vaddr, size); | ||||
|     if (!range.is_valid()) | ||||
|  | @ -115,7 +115,7 @@ Region* Process::allocate_file_backed_region(VirtualAddress vaddr, size_t size, | |||
|     return m_regions.last().ptr(); | ||||
| } | ||||
| 
 | ||||
| Region* Process::allocate_region_with_vmo(VirtualAddress vaddr, size_t size, Retained<VMObject>&& vmo, size_t offset_in_vmo, const String& name, int prot) | ||||
| Region* Process::allocate_region_with_vmo(VirtualAddress vaddr, size_t size, NonnullRefPtr<VMObject>&& vmo, size_t offset_in_vmo, const String& name, int prot) | ||||
| { | ||||
|     auto range = allocate_range(vaddr, size); | ||||
|     if (!range.is_valid()) | ||||
|  | @ -334,7 +334,7 @@ int Process::do_exec(String path, Vector<String> arguments, Vector<String> envir | |||
| 
 | ||||
|     auto vmo = VMObject::create_file_backed(description->inode()); | ||||
|     vmo->set_name(description->absolute_path()); | ||||
|     RetainPtr<Region> region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo.copy_ref(), 0, vmo->name(), PROT_READ); | ||||
|     RefPtr<Region> region = allocate_region_with_vmo(VirtualAddress(), metadata.size, vmo.copy_ref(), 0, vmo->name(), PROT_READ); | ||||
|     ASSERT(region); | ||||
| 
 | ||||
|     if (this != ¤t->process()) { | ||||
|  | @ -516,7 +516,7 @@ Process* Process::create_user_process(const String& path, uid_t uid, gid_t gid, | |||
|     if (arguments.is_empty()) { | ||||
|         arguments.append(parts.last()); | ||||
|     } | ||||
|     RetainPtr<Custody> cwd; | ||||
|     RefPtr<Custody> cwd; | ||||
|     { | ||||
|         InterruptDisabler disabler; | ||||
|         if (auto* parent = Process::from_pid(parent_pid)) | ||||
|  | @ -562,7 +562,7 @@ Process* Process::create_kernel_process(String&& name, void (*e)()) | |||
|     return process; | ||||
| } | ||||
| 
 | ||||
| Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RetainPtr<Custody>&& cwd, RetainPtr<Custody>&& executable, TTY* tty, Process* fork_parent) | ||||
| Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring, RefPtr<Custody>&& cwd, RefPtr<Custody>&& executable, TTY* tty, Process* fork_parent) | ||||
|     : m_name(move(name)) | ||||
|     , m_pid(next_pid++) // FIXME: RACE: This variable looks racy!
 | ||||
|     , m_uid(uid) | ||||
|  | @ -2445,7 +2445,7 @@ struct SharedBuffer { | |||
|     Region* m_pid2_region { nullptr }; | ||||
|     bool m_pid1_writable { false }; | ||||
|     bool m_pid2_writable { false }; | ||||
|     Retained<VMObject> m_vmo; | ||||
|     NonnullRefPtr<VMObject> m_vmo; | ||||
| }; | ||||
| 
 | ||||
| static int s_next_shared_buffer_id; | ||||
|  | @ -2734,7 +2734,7 @@ void Process::FileDescriptionAndFlags::clear() | |||
|     flags = 0; | ||||
| } | ||||
| 
 | ||||
| void Process::FileDescriptionAndFlags::set(Retained<FileDescription>&& d, dword f) | ||||
| void Process::FileDescriptionAndFlags::set(NonnullRefPtr<FileDescription>&& d, dword f) | ||||
| { | ||||
|     description = move(d); | ||||
|     flags = f; | ||||
|  |  | |||
|  | @ -211,7 +211,7 @@ public: | |||
|     void set_tty(TTY* tty) { m_tty = tty; } | ||||
| 
 | ||||
|     size_t region_count() const { return m_regions.size(); } | ||||
|     const Vector<Retained<Region>>& regions() const { return m_regions; } | ||||
|     const Vector<NonnullRefPtr<Region>>& regions() const { return m_regions; } | ||||
|     void dump_regions(); | ||||
| 
 | ||||
|     ProcessTracer* tracer() { return m_tracer.ptr(); } | ||||
|  | @ -248,8 +248,8 @@ public: | |||
| 
 | ||||
|     bool is_superuser() const { return m_euid == 0; } | ||||
| 
 | ||||
|     Region* allocate_region_with_vmo(VirtualAddress, size_t, Retained<VMObject>&&, size_t offset_in_vmo, const String& name, int prot); | ||||
|     Region* allocate_file_backed_region(VirtualAddress, size_t, RetainPtr<Inode>&&, const String& name, int prot); | ||||
|     Region* allocate_region_with_vmo(VirtualAddress, size_t, NonnullRefPtr<VMObject>&&, size_t offset_in_vmo, const String& name, int prot); | ||||
|     Region* allocate_file_backed_region(VirtualAddress, size_t, RefPtr<Inode>&&, const String& name, int prot); | ||||
|     Region* allocate_region(VirtualAddress, size_t, const String& name, int prot = PROT_READ | PROT_WRITE, bool commit = true); | ||||
|     bool deallocate_region(Region& region); | ||||
| 
 | ||||
|  | @ -273,7 +273,7 @@ private: | |||
|     friend class Scheduler; | ||||
|     friend class Region; | ||||
| 
 | ||||
|     Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RetainPtr<Custody>&& cwd = nullptr, RetainPtr<Custody>&& executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr); | ||||
|     Process(String&& name, uid_t, gid_t, pid_t ppid, RingLevel, RefPtr<Custody>&& cwd = nullptr, RefPtr<Custody>&& executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr); | ||||
| 
 | ||||
|     Range allocate_range(VirtualAddress, size_t); | ||||
| 
 | ||||
|  | @ -287,7 +287,7 @@ private: | |||
| 
 | ||||
|     Thread* m_main_thread { nullptr }; | ||||
| 
 | ||||
|     RetainPtr<PageDirectory> m_page_directory; | ||||
|     RefPtr<PageDirectory> m_page_directory; | ||||
| 
 | ||||
|     Process* m_prev { nullptr }; | ||||
|     Process* m_next { nullptr }; | ||||
|  | @ -307,8 +307,8 @@ private: | |||
|     struct FileDescriptionAndFlags { | ||||
|         operator bool() const { return !!description; } | ||||
|         void clear(); | ||||
|         void set(Retained<FileDescription>&& d, dword f = 0); | ||||
|         RetainPtr<FileDescription> description; | ||||
|         void set(NonnullRefPtr<FileDescription>&& d, dword f = 0); | ||||
|         RefPtr<FileDescription> description; | ||||
|         dword flags { 0 }; | ||||
|     }; | ||||
|     Vector<FileDescriptionAndFlags> m_fds; | ||||
|  | @ -319,14 +319,14 @@ private: | |||
|     byte m_termination_status { 0 }; | ||||
|     byte m_termination_signal { 0 }; | ||||
| 
 | ||||
|     RetainPtr<Custody> m_executable; | ||||
|     RetainPtr<Custody> m_cwd; | ||||
|     RefPtr<Custody> m_executable; | ||||
|     RefPtr<Custody> m_cwd; | ||||
| 
 | ||||
|     TTY* m_tty { nullptr }; | ||||
| 
 | ||||
|     Region* region_from_range(VirtualAddress, size_t); | ||||
| 
 | ||||
|     Vector<Retained<Region>> m_regions; | ||||
|     Vector<NonnullRefPtr<Region>> m_regions; | ||||
| 
 | ||||
|     VirtualAddress m_return_to_ring3_from_signal_trampoline; | ||||
|     VirtualAddress m_return_to_ring0_from_signal_trampoline; | ||||
|  | @ -345,7 +345,7 @@ private: | |||
| 
 | ||||
|     unsigned m_syscall_count { 0 }; | ||||
| 
 | ||||
|     RetainPtr<ProcessTracer> m_tracer; | ||||
|     RefPtr<ProcessTracer> m_tracer; | ||||
|     OwnPtr<ELFLoader> m_elf_loader; | ||||
| 
 | ||||
|     Lock m_big_lock { "Process" }; | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| class ProcessTracer : public File { | ||||
| public: | ||||
|     static Retained<ProcessTracer> create(pid_t pid) { return adopt(*new ProcessTracer(pid)); } | ||||
|     static NonnullRefPtr<ProcessTracer> create(pid_t pid) { return adopt(*new ProcessTracer(pid)); } | ||||
|     virtual ~ProcessTracer() override; | ||||
| 
 | ||||
|     bool is_dead() const { return m_dead; } | ||||
|  |  | |||
|  | @ -4,15 +4,15 @@ | |||
| #include <Kernel/SharedMemory.h> | ||||
| #include <Kernel/VM/VMObject.h> | ||||
| 
 | ||||
| Lockable<HashMap<String, RetainPtr<SharedMemory>>>& shared_memories() | ||||
| Lockable<HashMap<String, RefPtr<SharedMemory>>>& shared_memories() | ||||
| { | ||||
|     static Lockable<HashMap<String, RetainPtr<SharedMemory>>>* map; | ||||
|     static Lockable<HashMap<String, RefPtr<SharedMemory>>>* map; | ||||
|     if (!map) | ||||
|         map = new Lockable<HashMap<String, RetainPtr<SharedMemory>>>; | ||||
|         map = new Lockable<HashMap<String, RefPtr<SharedMemory>>>; | ||||
|     return *map; | ||||
| } | ||||
| 
 | ||||
| KResultOr<Retained<SharedMemory>> SharedMemory::open(const String& name, int flags, mode_t mode) | ||||
| KResultOr<NonnullRefPtr<SharedMemory>> SharedMemory::open(const String& name, int flags, mode_t mode) | ||||
| { | ||||
|     UNUSED_PARAM(flags); | ||||
|     LOCKER(shared_memories().lock()); | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ class VMObject; | |||
| 
 | ||||
| class SharedMemory : public File { | ||||
| public: | ||||
|     static KResultOr<Retained<SharedMemory>> open(const String& name, int flags, mode_t); | ||||
|     static KResultOr<NonnullRefPtr<SharedMemory>> open(const String& name, int flags, mode_t); | ||||
|     static KResult unlink(const String& name); | ||||
|     virtual ~SharedMemory() override; | ||||
| 
 | ||||
|  | @ -39,5 +39,5 @@ private: | |||
|     uid_t m_uid { 0 }; | ||||
|     gid_t m_gid { 0 }; | ||||
|     mode_t m_mode { 0 }; | ||||
|     RetainPtr<VMObject> m_vmo; | ||||
|     RefPtr<VMObject> m_vmo; | ||||
| }; | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ private: | |||
|     virtual int ioctl(FileDescription&, unsigned request, unsigned arg) override; | ||||
|     virtual const char* class_name() const override { return "MasterPTY"; } | ||||
| 
 | ||||
|     RetainPtr<SlavePTY> m_slave; | ||||
|     RefPtr<SlavePTY> m_slave; | ||||
|     unsigned m_index; | ||||
|     bool m_closed { false }; | ||||
|     DoubleBuffer m_buffer; | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ PTYMultiplexer::~PTYMultiplexer() | |||
| { | ||||
| } | ||||
| 
 | ||||
| KResultOr<Retained<FileDescription>> PTYMultiplexer::open(int options) | ||||
| KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options) | ||||
| { | ||||
|     UNUSED_PARAM(options); | ||||
|     LOCKER(m_lock); | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ public: | |||
|     static PTYMultiplexer& the(); | ||||
| 
 | ||||
|     // ^CharacterDevice
 | ||||
|     virtual KResultOr<Retained<FileDescription>> open(int options) override; | ||||
|     virtual KResultOr<NonnullRefPtr<FileDescription>> open(int options) override; | ||||
|     virtual ssize_t read(FileDescription&, byte*, ssize_t) override { return 0; } | ||||
|     virtual ssize_t write(FileDescription&, const byte*, ssize_t) override { return 0; } | ||||
|     virtual bool can_read(FileDescription&) const override { return true; } | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ private: | |||
|     friend class MasterPTY; | ||||
|     SlavePTY(MasterPTY&, unsigned index); | ||||
| 
 | ||||
|     RetainPtr<MasterPTY> m_master; | ||||
|     RefPtr<MasterPTY> m_master; | ||||
|     unsigned m_index; | ||||
|     InodeIdentifier m_devpts_inode_id; | ||||
|     String m_tty_name; | ||||
|  |  | |||
|  | @ -176,10 +176,10 @@ private: | |||
|     dword m_pending_signals { 0 }; | ||||
|     dword m_signal_mask { 0 }; | ||||
|     dword m_kernel_stack_base { 0 }; | ||||
|     RetainPtr<Region> m_kernel_stack_region; | ||||
|     RetainPtr<Region> m_kernel_stack_for_signal_handler_region; | ||||
|     RefPtr<Region> m_kernel_stack_region; | ||||
|     RefPtr<Region> m_kernel_stack_for_signal_handler_region; | ||||
|     pid_t m_waitee_pid { -1 }; | ||||
|     RetainPtr<FileDescription> m_blocked_description; | ||||
|     RefPtr<FileDescription> m_blocked_description; | ||||
|     timeval m_select_timeout; | ||||
|     SignalActionData m_signal_action_data[32]; | ||||
|     Region* m_signal_stack_user_region { nullptr }; | ||||
|  |  | |||
|  | @ -81,7 +81,7 @@ void MemoryManager::initialize_paging() | |||
| #endif | ||||
|     m_quickmap_addr = VirtualAddress((1 * MB) - PAGE_SIZE); | ||||
| 
 | ||||
|     RetainPtr<PhysicalRegion> region = nullptr; | ||||
|     RefPtr<PhysicalRegion> region = nullptr; | ||||
|     bool region_is_super = false; | ||||
| 
 | ||||
|     for (auto* mmap = (multiboot_memory_map_t*)multiboot_info_ptr->mmap_addr; (unsigned long)mmap < multiboot_info_ptr->mmap_addr + multiboot_info_ptr->mmap_length; mmap = (multiboot_memory_map_t*)((unsigned long)mmap + mmap->size + sizeof(mmap->size))) { | ||||
|  | @ -151,7 +151,7 @@ void MemoryManager::initialize_paging() | |||
| #endif | ||||
| } | ||||
| 
 | ||||
| RetainPtr<PhysicalPage> MemoryManager::allocate_page_table(PageDirectory& page_directory, unsigned index) | ||||
| RefPtr<PhysicalPage> MemoryManager::allocate_page_table(PageDirectory& page_directory, unsigned index) | ||||
| { | ||||
|     ASSERT(!page_directory.m_physical_pages.contains(index)); | ||||
|     auto physical_page = allocate_supervisor_physical_page(); | ||||
|  | @ -444,7 +444,7 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault) | |||
|     return PageFaultResponse::ShouldCrash; | ||||
| } | ||||
| 
 | ||||
| RetainPtr<Region> MemoryManager::allocate_kernel_region(size_t size, String&& name) | ||||
| RefPtr<Region> MemoryManager::allocate_kernel_region(size_t size, String&& name) | ||||
| { | ||||
|     InterruptDisabler disabler; | ||||
| 
 | ||||
|  | @ -478,11 +478,11 @@ void MemoryManager::deallocate_user_physical_page(PhysicalPage&& page) | |||
|     ASSERT_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| RetainPtr<PhysicalPage> MemoryManager::allocate_user_physical_page(ShouldZeroFill should_zero_fill) | ||||
| RefPtr<PhysicalPage> MemoryManager::allocate_user_physical_page(ShouldZeroFill should_zero_fill) | ||||
| { | ||||
|     InterruptDisabler disabler; | ||||
| 
 | ||||
|     RetainPtr<PhysicalPage> page = nullptr; | ||||
|     RefPtr<PhysicalPage> page = nullptr; | ||||
| 
 | ||||
|     for (auto& region : m_user_physical_regions) { | ||||
|         page = region->take_free_page(false); | ||||
|  | @ -535,11 +535,11 @@ void MemoryManager::deallocate_supervisor_physical_page(PhysicalPage&& page) | |||
|     ASSERT_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| RetainPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page() | ||||
| RefPtr<PhysicalPage> MemoryManager::allocate_supervisor_physical_page() | ||||
| { | ||||
|     InterruptDisabler disabler; | ||||
| 
 | ||||
|     RetainPtr<PhysicalPage> page = nullptr; | ||||
|     RefPtr<PhysicalPage> page = nullptr; | ||||
| 
 | ||||
|     for (auto& region : m_super_physical_regions) { | ||||
|         page = region->take_free_page(true); | ||||
|  |  | |||
|  | @ -61,8 +61,8 @@ public: | |||
|         Yes | ||||
|     }; | ||||
| 
 | ||||
|     RetainPtr<PhysicalPage> allocate_user_physical_page(ShouldZeroFill); | ||||
|     RetainPtr<PhysicalPage> allocate_supervisor_physical_page(); | ||||
|     RefPtr<PhysicalPage> allocate_user_physical_page(ShouldZeroFill); | ||||
|     RefPtr<PhysicalPage> allocate_supervisor_physical_page(); | ||||
|     void deallocate_user_physical_page(PhysicalPage&&); | ||||
|     void deallocate_supervisor_physical_page(PhysicalPage&&); | ||||
| 
 | ||||
|  | @ -70,7 +70,7 @@ public: | |||
| 
 | ||||
|     void map_for_kernel(VirtualAddress, PhysicalAddress); | ||||
| 
 | ||||
|     RetainPtr<Region> allocate_kernel_region(size_t, String&& name); | ||||
|     RefPtr<Region> allocate_kernel_region(size_t, String&& name); | ||||
|     void map_region_at_address(PageDirectory&, Region&, VirtualAddress, bool user_accessible); | ||||
| 
 | ||||
|     unsigned user_physical_pages() const { return m_user_physical_pages; } | ||||
|  | @ -93,7 +93,7 @@ private: | |||
|     void flush_entire_tlb(); | ||||
|     void flush_tlb(VirtualAddress); | ||||
| 
 | ||||
|     RetainPtr<PhysicalPage> allocate_page_table(PageDirectory&, unsigned index); | ||||
|     RefPtr<PhysicalPage> allocate_page_table(PageDirectory&, unsigned index); | ||||
| 
 | ||||
|     void map_protected(VirtualAddress, size_t length); | ||||
| 
 | ||||
|  | @ -214,7 +214,7 @@ private: | |||
| 
 | ||||
|     PageTableEntry ensure_pte(PageDirectory&, VirtualAddress); | ||||
| 
 | ||||
|     RetainPtr<PageDirectory> m_kernel_page_directory; | ||||
|     RefPtr<PageDirectory> m_kernel_page_directory; | ||||
|     dword* m_page_table_zero { nullptr }; | ||||
|     dword* m_page_table_one { nullptr }; | ||||
| 
 | ||||
|  | @ -225,8 +225,8 @@ private: | |||
|     unsigned m_super_physical_pages { 0 }; | ||||
|     unsigned m_super_physical_pages_used { 0 }; | ||||
| 
 | ||||
|     Vector<Retained<PhysicalRegion>> m_user_physical_regions {}; | ||||
|     Vector<Retained<PhysicalRegion>> m_super_physical_regions {}; | ||||
|     Vector<NonnullRefPtr<PhysicalRegion>> m_user_physical_regions {}; | ||||
|     Vector<NonnullRefPtr<PhysicalRegion>> m_super_physical_regions {}; | ||||
| 
 | ||||
|     HashTable<VMObject*> m_vmos; | ||||
|     HashTable<Region*> m_user_regions; | ||||
|  |  | |||
|  | @ -10,8 +10,8 @@ class PageDirectory : public RefCounted<PageDirectory> { | |||
|     friend class MemoryManager; | ||||
| 
 | ||||
| public: | ||||
|     static Retained<PageDirectory> create_for_userspace(const RangeAllocator* parent_range_allocator = nullptr) { return adopt(*new PageDirectory(parent_range_allocator)); } | ||||
|     static Retained<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); } | ||||
|     static NonnullRefPtr<PageDirectory> create_for_userspace(const RangeAllocator* parent_range_allocator = nullptr) { return adopt(*new PageDirectory(parent_range_allocator)); } | ||||
|     static NonnullRefPtr<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); } | ||||
|     ~PageDirectory(); | ||||
| 
 | ||||
|     dword cr3() const { return m_directory_page->paddr().get(); } | ||||
|  | @ -26,6 +26,6 @@ private: | |||
|     explicit PageDirectory(PhysicalAddress); | ||||
| 
 | ||||
|     RangeAllocator m_range_allocator; | ||||
|     RetainPtr<PhysicalPage> m_directory_page; | ||||
|     HashMap<unsigned, RetainPtr<PhysicalPage>> m_physical_pages; | ||||
|     RefPtr<PhysicalPage> m_directory_page; | ||||
|     HashMap<unsigned, RefPtr<PhysicalPage>> m_physical_pages; | ||||
| }; | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| #include <Kernel/VM/PhysicalPage.h> | ||||
| #include <Kernel/kmalloc.h> | ||||
| 
 | ||||
| Retained<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist) | ||||
| NonnullRefPtr<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist) | ||||
| { | ||||
|     void* slot = kmalloc(sizeof(PhysicalPage)); | ||||
|     new (slot) PhysicalPage(paddr, supervisor, may_return_to_freelist); | ||||
|  |  | |||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling