summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-03-07 12:25:00 +0100
committerAndreas Kling <kling@serenityos.org>2023-03-09 21:54:59 +0100
commite6fc7b3ff7618cd88a03683eb5b2145c9932d562 (patch)
treea94f6090c00962ac0468a402de4d92977f813481
parent067d0689c5f7ff720fcfec9ff4d2898741948fed (diff)
downloadserenity-e6fc7b3ff7618cd88a03683eb5b2145c9932d562.zip
Kernel: Switch LockRefPtr<Inode> to RefPtr<Inode>
The main place where this is a little iffy is in RAMFS where inodes have a LockWeakPtr to their parent inode. I've left that as a LockWeakPtr for now.
-rw-r--r--Kernel/FileSystem/Custody.h2
-rw-r--r--Kernel/FileSystem/DevPtsFS/FileSystem.cpp6
-rw-r--r--Kernel/FileSystem/DevPtsFS/FileSystem.h4
-rw-r--r--Kernel/FileSystem/DevPtsFS/Inode.cpp6
-rw-r--r--Kernel/FileSystem/DevPtsFS/Inode.h4
-rw-r--r--Kernel/FileSystem/Ext2FS/FileSystem.cpp16
-rw-r--r--Kernel/FileSystem/Ext2FS/FileSystem.h12
-rw-r--r--Kernel/FileSystem/Ext2FS/Inode.cpp4
-rw-r--r--Kernel/FileSystem/Ext2FS/Inode.h4
-rw-r--r--Kernel/FileSystem/FATFS/FileSystem.h2
-rw-r--r--Kernel/FileSystem/FATFS/Inode.cpp13
-rw-r--r--Kernel/FileSystem/FATFS/Inode.h8
-rw-r--r--Kernel/FileSystem/ISO9660FS/FileSystem.h2
-rw-r--r--Kernel/FileSystem/ISO9660FS/Inode.cpp10
-rw-r--r--Kernel/FileSystem/ISO9660FS/Inode.h6
-rw-r--r--Kernel/FileSystem/Inode.cpp2
-rw-r--r--Kernel/FileSystem/Inode.h4
-rw-r--r--Kernel/FileSystem/InodeFile.cpp2
-rw-r--r--Kernel/FileSystem/InodeFile.h6
-rw-r--r--Kernel/FileSystem/Mount.cpp8
-rw-r--r--Kernel/FileSystem/Mount.h6
-rw-r--r--Kernel/FileSystem/OpenFileDescription.h4
-rw-r--r--Kernel/FileSystem/Plan9FS/FileSystem.h2
-rw-r--r--Kernel/FileSystem/Plan9FS/Inode.cpp8
-rw-r--r--Kernel/FileSystem/Plan9FS/Inode.h6
-rw-r--r--Kernel/FileSystem/ProcFS/FileSystem.cpp6
-rw-r--r--Kernel/FileSystem/ProcFS/FileSystem.h4
-rw-r--r--Kernel/FileSystem/ProcFS/Inode.cpp4
-rw-r--r--Kernel/FileSystem/ProcFS/Inode.h6
-rw-r--r--Kernel/FileSystem/ProcFS/ProcessExposed.cpp10
-rw-r--r--Kernel/FileSystem/RAMFS/FileSystem.h2
-rw-r--r--Kernel/FileSystem/RAMFS/Inode.cpp14
-rw-r--r--Kernel/FileSystem/RAMFS/Inode.h10
-rw-r--r--Kernel/FileSystem/SysFS/Component.cpp6
-rw-r--r--Kernel/FileSystem/SysFS/Component.h6
-rw-r--r--Kernel/FileSystem/SysFS/DirectoryInode.cpp6
-rw-r--r--Kernel/FileSystem/SysFS/DirectoryInode.h4
-rw-r--r--Kernel/FileSystem/SysFS/FileSystem.h2
-rw-r--r--Kernel/FileSystem/SysFS/Inode.cpp8
-rw-r--r--Kernel/FileSystem/SysFS/Inode.h6
-rw-r--r--Kernel/FileSystem/SysFS/LinkInode.cpp4
-rw-r--r--Kernel/FileSystem/SysFS/LinkInode.h2
-rw-r--r--Kernel/FileSystem/VirtualFileSystem.h2
-rw-r--r--Kernel/Library/LockWeakPtr.h14
-rw-r--r--Kernel/Library/LockWeakable.h6
-rw-r--r--Kernel/Memory/InodeVMObject.h2
-rw-r--r--Kernel/Net/LocalSocket.h2
-rw-r--r--Kernel/Process.h8
-rw-r--r--Kernel/Thread.h4
-rw-r--r--Kernel/ThreadBlockers.cpp2
50 files changed, 143 insertions, 144 deletions
diff --git a/Kernel/FileSystem/Custody.h b/Kernel/FileSystem/Custody.h
index 8d6edba176..6bd9a0902e 100644
--- a/Kernel/FileSystem/Custody.h
+++ b/Kernel/FileSystem/Custody.h
@@ -37,7 +37,7 @@ private:
RefPtr<Custody> m_parent;
NonnullOwnPtr<KString> m_name;
- NonnullLockRefPtr<Inode> m_inode;
+ NonnullRefPtr<Inode> m_inode;
int m_mount_flags { 0 };
mutable IntrusiveListNode<Custody> m_all_custodies_list_node;
diff --git a/Kernel/FileSystem/DevPtsFS/FileSystem.cpp b/Kernel/FileSystem/DevPtsFS/FileSystem.cpp
index 363460972f..c0d64b9440 100644
--- a/Kernel/FileSystem/DevPtsFS/FileSystem.cpp
+++ b/Kernel/FileSystem/DevPtsFS/FileSystem.cpp
@@ -23,7 +23,7 @@ DevPtsFS::~DevPtsFS() = default;
ErrorOr<void> DevPtsFS::initialize()
{
- m_root_inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) DevPtsFSInode(*this, 1, nullptr)));
+ m_root_inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) DevPtsFSInode(*this, 1, nullptr)));
m_root_inode->m_metadata.inode = { fsid(), 1 };
m_root_inode->m_metadata.mode = 0040555;
m_root_inode->m_metadata.uid = 0;
@@ -44,7 +44,7 @@ Inode& DevPtsFS::root_inode()
return *m_root_inode;
}
-ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFS::get_inode(InodeIdentifier inode_id) const
+ErrorOr<NonnullRefPtr<Inode>> DevPtsFS::get_inode(InodeIdentifier inode_id) const
{
if (inode_id.index() == 1)
return *m_root_inode;
@@ -53,7 +53,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFS::get_inode(InodeIdentifier inode_id)
auto* device = DeviceManagement::the().get_device(201, pty_index);
VERIFY(device);
- auto inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) DevPtsFSInode(const_cast<DevPtsFS&>(*this), inode_id.index(), static_cast<SlavePTY*>(device))));
+ auto inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) DevPtsFSInode(const_cast<DevPtsFS&>(*this), inode_id.index(), static_cast<SlavePTY*>(device))));
inode->m_metadata.inode = inode_id;
inode->m_metadata.size = 0;
inode->m_metadata.uid = device->uid();
diff --git a/Kernel/FileSystem/DevPtsFS/FileSystem.h b/Kernel/FileSystem/DevPtsFS/FileSystem.h
index 801347387d..db9d32cc39 100644
--- a/Kernel/FileSystem/DevPtsFS/FileSystem.h
+++ b/Kernel/FileSystem/DevPtsFS/FileSystem.h
@@ -29,9 +29,9 @@ public:
private:
DevPtsFS();
- ErrorOr<NonnullLockRefPtr<Inode>> get_inode(InodeIdentifier) const;
+ ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const;
- LockRefPtr<DevPtsFSInode> m_root_inode;
+ RefPtr<DevPtsFSInode> m_root_inode;
};
}
diff --git a/Kernel/FileSystem/DevPtsFS/Inode.cpp b/Kernel/FileSystem/DevPtsFS/Inode.cpp
index 6c74b03457..92f3de94b6 100644
--- a/Kernel/FileSystem/DevPtsFS/Inode.cpp
+++ b/Kernel/FileSystem/DevPtsFS/Inode.cpp
@@ -63,7 +63,7 @@ ErrorOr<void> DevPtsFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSy
});
}
-ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFSInode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> DevPtsFSInode::lookup(StringView name)
{
VERIFY(identifier().index() == 1);
@@ -74,7 +74,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFSInode::lookup(StringView name)
if (!pty_index.has_value())
return ENOENT;
- return SlavePTY::all_instances().with([&](auto& list) -> ErrorOr<NonnullLockRefPtr<Inode>> {
+ return SlavePTY::all_instances().with([&](auto& list) -> ErrorOr<NonnullRefPtr<Inode>> {
for (SlavePTY& slave_pty : list) {
if (slave_pty.index() != pty_index.value())
continue;
@@ -94,7 +94,7 @@ ErrorOr<void> DevPtsFSInode::add_child(Inode&, StringView, mode_t)
return EROFS;
}
-ErrorOr<NonnullLockRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
+ErrorOr<NonnullRefPtr<Inode>> DevPtsFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
diff --git a/Kernel/FileSystem/DevPtsFS/Inode.h b/Kernel/FileSystem/DevPtsFS/Inode.h
index 4466aa0015..c133185778 100644
--- a/Kernel/FileSystem/DevPtsFS/Inode.h
+++ b/Kernel/FileSystem/DevPtsFS/Inode.h
@@ -29,10 +29,10 @@ private:
virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override;
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& buffer, OpenFileDescription*) override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> replace_child(StringView name, Inode& child) override;
diff --git a/Kernel/FileSystem/Ext2FS/FileSystem.cpp b/Kernel/FileSystem/Ext2FS/FileSystem.cpp
index 8fe5f3e6f0..e67ab51e7a 100644
--- a/Kernel/FileSystem/Ext2FS/FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FS/FileSystem.cpp
@@ -437,7 +437,7 @@ ErrorOr<void> Ext2FS::set_block_allocation_state(BlockIndex block_index, bool ne
return update_bitmap_block(bgd.bg_block_bitmap, bit_index, new_state, m_super_block.s_free_blocks_count, bgd.bg_free_blocks_count);
}
-ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::create_directory(Ext2FSInode& parent_inode, StringView name, mode_t mode, UserID uid, GroupID gid)
+ErrorOr<NonnullRefPtr<Inode>> Ext2FS::create_directory(Ext2FSInode& parent_inode, StringView name, mode_t mode, UserID uid, GroupID gid)
{
MutexLocker locker(m_lock);
VERIFY(is_directory(mode));
@@ -462,7 +462,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::create_directory(Ext2FSInode& parent_i
return inode;
}
-ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode, StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
+ErrorOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode, StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
{
if (name.length() > EXT2_NAME_LEN)
return ENAMETOOLONG;
@@ -626,7 +626,7 @@ void Ext2FS::flush_writes()
// The problem is that they are quite heavy objects, and use a lot of heap memory
// for their (child name lookup) and (block list) caches.
- m_inode_cache.remove_all_matching([](InodeIndex, LockRefPtr<Ext2FSInode> const& cached_inode) {
+ m_inode_cache.remove_all_matching([](InodeIndex, RefPtr<Ext2FSInode> const& cached_inode) {
// NOTE: If we're asked to look up an inode by number (via get_inode) and it turns out
// to not exist, we remember the fact that it doesn't exist by caching a nullptr.
// This seems like a reasonable time to uncache ideas about unknown inodes, so do that.
@@ -640,7 +640,7 @@ void Ext2FS::flush_writes()
BlockBasedFileSystem::flush_writes();
}
-ErrorOr<NonnullLockRefPtr<Ext2FSInode>> Ext2FS::build_root_inode() const
+ErrorOr<NonnullRefPtr<Ext2FSInode>> Ext2FS::build_root_inode() const
{
MutexLocker locker(m_lock);
BlockIndex block_index;
@@ -648,14 +648,14 @@ ErrorOr<NonnullLockRefPtr<Ext2FSInode>> Ext2FS::build_root_inode() const
if (!find_block_containing_inode(EXT2_ROOT_INO, block_index, offset))
return EINVAL;
- auto inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), EXT2_ROOT_INO)));
+ auto inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), EXT2_ROOT_INO)));
auto buffer = UserOrKernelBuffer::for_kernel_buffer(reinterpret_cast<u8*>(&inode->m_raw_inode));
TRY(read_block(block_index, &buffer, sizeof(ext2_inode), offset));
return inode;
}
-ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const
+ErrorOr<NonnullRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const
{
MutexLocker locker(m_lock);
VERIFY(inode.fsid() == fsid());
@@ -669,7 +669,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const
if (it != m_inode_cache.end()) {
if (!it->value)
return ENOENT;
- return NonnullLockRefPtr<Inode> { *it->value };
+ return NonnullRefPtr<Inode> { *it->value };
}
}
@@ -685,7 +685,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Ext2FS::get_inode(InodeIdentifier inode) const
if (!find_block_containing_inode(inode.index(), block_index, offset))
return EINVAL;
- auto new_inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index())));
+ auto new_inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index())));
auto buffer = UserOrKernelBuffer::for_kernel_buffer(reinterpret_cast<u8*>(&new_inode->m_raw_inode));
TRY(read_block(block_index, &buffer, sizeof(ext2_inode), offset));
diff --git a/Kernel/FileSystem/Ext2FS/FileSystem.h b/Kernel/FileSystem/Ext2FS/FileSystem.h
index aa6efd90ec..89d0f10a9f 100644
--- a/Kernel/FileSystem/Ext2FS/FileSystem.h
+++ b/Kernel/FileSystem/Ext2FS/FileSystem.h
@@ -60,7 +60,7 @@ private:
u64 blocks_per_group() const;
u64 inode_size() const;
- ErrorOr<NonnullLockRefPtr<Ext2FSInode>> build_root_inode() const;
+ ErrorOr<NonnullRefPtr<Ext2FSInode>> build_root_inode() const;
ErrorOr<void> write_ext2_inode(InodeIndex, ext2_inode const&);
bool find_block_containing_inode(InodeIndex, BlockIndex& block_index, unsigned& offset) const;
@@ -71,9 +71,9 @@ private:
virtual bool is_initialized_while_locked() override;
virtual ErrorOr<void> prepare_to_clear_last_mount() override;
- ErrorOr<NonnullLockRefPtr<Inode>> get_inode(InodeIdentifier) const;
- ErrorOr<NonnullLockRefPtr<Inode>> create_inode(Ext2FSInode& parent_inode, StringView name, mode_t, dev_t, UserID, GroupID);
- ErrorOr<NonnullLockRefPtr<Inode>> create_directory(Ext2FSInode& parent_inode, StringView name, mode_t, UserID, GroupID);
+ ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const;
+ ErrorOr<NonnullRefPtr<Inode>> create_inode(Ext2FSInode& parent_inode, StringView name, mode_t, dev_t, UserID, GroupID);
+ ErrorOr<NonnullRefPtr<Inode>> create_directory(Ext2FSInode& parent_inode, StringView name, mode_t, UserID, GroupID);
virtual void flush_writes() override;
BlockIndex first_block_index() const;
@@ -104,7 +104,7 @@ private:
mutable ext2_super_block m_super_block {};
mutable OwnPtr<KBuffer> m_cached_group_descriptor_table;
- mutable HashMap<InodeIndex, LockRefPtr<Ext2FSInode>> m_inode_cache;
+ mutable HashMap<InodeIndex, RefPtr<Ext2FSInode>> m_inode_cache;
bool m_super_block_dirty { false };
bool m_block_group_descriptors_dirty { false };
@@ -125,7 +125,7 @@ private:
ErrorOr<void> update_bitmap_block(BlockIndex bitmap_block, size_t bit_index, bool new_state, u32& super_block_counter, u16& group_descriptor_counter);
Vector<OwnPtr<CachedBitmap>> m_cached_bitmaps;
- LockRefPtr<Ext2FSInode> m_root_inode;
+ RefPtr<Ext2FSInode> m_root_inode;
};
}
diff --git a/Kernel/FileSystem/Ext2FS/Inode.cpp b/Kernel/FileSystem/Ext2FS/Inode.cpp
index b9764fa324..3a4b20a80f 100644
--- a/Kernel/FileSystem/Ext2FS/Inode.cpp
+++ b/Kernel/FileSystem/Ext2FS/Inode.cpp
@@ -815,7 +815,7 @@ ErrorOr<void> Ext2FSInode::write_directory(Vector<Ext2FSDirectoryEntry>& entries
return {};
}
-ErrorOr<NonnullLockRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
+ErrorOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
{
if (Kernel::is_directory(mode))
return fs().create_directory(*this, name, mode, uid, gid);
@@ -965,7 +965,7 @@ ErrorOr<void> Ext2FSInode::populate_lookup_cache()
return {};
}
-ErrorOr<NonnullLockRefPtr<Inode>> Ext2FSInode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> Ext2FSInode::lookup(StringView name)
{
VERIFY(is_directory());
dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]:lookup(): Looking up '{}'", identifier(), name);
diff --git a/Kernel/FileSystem/Ext2FS/Inode.h b/Kernel/FileSystem/Ext2FS/Inode.h
index fd0e4990d0..53e2f664ce 100644
--- a/Kernel/FileSystem/Ext2FS/Inode.h
+++ b/Kernel/FileSystem/Ext2FS/Inode.h
@@ -30,10 +30,10 @@ private:
virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override;
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& data, OpenFileDescription*) override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode& child, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> replace_child(StringView name, Inode& child) override;
diff --git a/Kernel/FileSystem/FATFS/FileSystem.h b/Kernel/FileSystem/FATFS/FileSystem.h
index 33c8e928aa..d6972f0154 100644
--- a/Kernel/FileSystem/FATFS/FileSystem.h
+++ b/Kernel/FileSystem/FATFS/FileSystem.h
@@ -46,7 +46,7 @@ private:
BlockBasedFileSystem::BlockIndex first_block_of_cluster(u32 cluster) const;
OwnPtr<KBuffer> m_boot_record {};
- LockRefPtr<FATInode> m_root_inode {};
+ RefPtr<FATInode> m_root_inode;
u32 m_first_data_sector { 0 };
};
diff --git a/Kernel/FileSystem/FATFS/Inode.cpp b/Kernel/FileSystem/FATFS/Inode.cpp
index 6683a77917..5a3c253f66 100644
--- a/Kernel/FileSystem/FATFS/Inode.cpp
+++ b/Kernel/FileSystem/FATFS/Inode.cpp
@@ -11,10 +11,10 @@
namespace Kernel {
-ErrorOr<NonnullLockRefPtr<FATInode>> FATInode::create(FATFS& fs, FATEntry entry, Vector<FATLongFileNameEntry> const& lfn_entries)
+ErrorOr<NonnullRefPtr<FATInode>> FATInode::create(FATFS& fs, FATEntry entry, Vector<FATLongFileNameEntry> const& lfn_entries)
{
auto filename = TRY(compute_filename(entry, lfn_entries));
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) FATInode(fs, entry, move(filename)));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) FATInode(fs, entry, move(filename)));
}
FATInode::FATInode(FATFS& fs, FATEntry entry, NonnullOwnPtr<KString> filename)
@@ -108,7 +108,7 @@ ErrorOr<void> FATInode::replace_child(StringView, Inode&)
return Error::from_errno(EROFS);
}
-ErrorOr<LockRefPtr<FATInode>> FATInode::traverse(Function<ErrorOr<bool>(LockRefPtr<FATInode>)> callback)
+ErrorOr<RefPtr<FATInode>> FATInode::traverse(Function<ErrorOr<bool>(RefPtr<FATInode>)> callback)
{
VERIFY(has_flag(m_entry.attributes, FATAttributes::Directory));
@@ -233,7 +233,7 @@ ErrorOr<void> FATInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem:
return {};
}
-ErrorOr<NonnullLockRefPtr<Inode>> FATInode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> FATInode::lookup(StringView name)
{
MutexLocker locker(m_inode_lock);
@@ -245,8 +245,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> FATInode::lookup(StringView name)
if (inode.is_null())
return ENOENT;
- else
- return inode.release_nonnull();
+ return inode.release_nonnull();
}
ErrorOr<size_t> FATInode::write_bytes_locked(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*)
@@ -254,7 +253,7 @@ ErrorOr<size_t> FATInode::write_bytes_locked(off_t, size_t, UserOrKernelBuffer c
return EROFS;
}
-ErrorOr<NonnullLockRefPtr<Inode>> FATInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
+ErrorOr<NonnullRefPtr<Inode>> FATInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
diff --git a/Kernel/FileSystem/FATFS/Inode.h b/Kernel/FileSystem/FATFS/Inode.h
index f2505470be..f5e7f1626a 100644
--- a/Kernel/FileSystem/FATFS/Inode.h
+++ b/Kernel/FileSystem/FATFS/Inode.h
@@ -22,7 +22,7 @@ class FATInode final : public Inode {
public:
virtual ~FATInode() override = default;
- static ErrorOr<NonnullLockRefPtr<FATInode>> create(FATFS&, FATEntry, Vector<FATLongFileNameEntry> const& = {});
+ static ErrorOr<NonnullRefPtr<FATInode>> create(FATFS&, FATEntry, Vector<FATLongFileNameEntry> const& = {});
FATFS& fs() { return static_cast<FATFS&>(Inode::fs()); }
FATFS const& fs() const { return static_cast<FATFS const&>(Inode::fs()); }
@@ -47,7 +47,7 @@ private:
ErrorOr<Vector<BlockBasedFileSystem::BlockIndex>> compute_block_list();
ErrorOr<NonnullOwnPtr<KBuffer>> read_block_list();
- ErrorOr<LockRefPtr<FATInode>> traverse(Function<ErrorOr<bool>(LockRefPtr<FATInode>)> callback);
+ ErrorOr<RefPtr<FATInode>> traverse(Function<ErrorOr<bool>(RefPtr<FATInode>)> callback);
u32 first_cluster() const;
// ^Inode
@@ -56,8 +56,8 @@ private:
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> replace_child(StringView name, Inode& child) override;
diff --git a/Kernel/FileSystem/ISO9660FS/FileSystem.h b/Kernel/FileSystem/ISO9660FS/FileSystem.h
index 4e6fe859a4..2bb54c5bcb 100644
--- a/Kernel/FileSystem/ISO9660FS/FileSystem.h
+++ b/Kernel/FileSystem/ISO9660FS/FileSystem.h
@@ -59,7 +59,7 @@ private:
ErrorOr<void> visit_directory_record(ISO::DirectoryRecordHeader const& record, Function<ErrorOr<RecursionDecision>(ISO::DirectoryRecordHeader const*)> const& visitor) const;
OwnPtr<ISO::PrimaryVolumeDescriptor> m_primary_volume;
- LockRefPtr<ISO9660Inode> m_root_inode;
+ RefPtr<ISO9660Inode> m_root_inode;
mutable u32 m_cached_inode_count { 0 };
HashMap<u32, NonnullLockRefPtr<ISO9660FSDirectoryEntry>> m_directory_entry_cache;
diff --git a/Kernel/FileSystem/ISO9660FS/Inode.cpp b/Kernel/FileSystem/ISO9660FS/Inode.cpp
index 56350a958e..4f6f7c3b2d 100644
--- a/Kernel/FileSystem/ISO9660FS/Inode.cpp
+++ b/Kernel/FileSystem/ISO9660FS/Inode.cpp
@@ -75,9 +75,9 @@ ErrorOr<void> ISO9660Inode::replace_child(StringView, Inode&)
return EROFS;
}
-ErrorOr<NonnullLockRefPtr<Inode>> ISO9660Inode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> ISO9660Inode::lookup(StringView name)
{
- LockRefPtr<Inode> inode;
+ RefPtr<Inode> inode;
Array<u8, max_file_identifier_length> file_identifier_buffer;
TRY(fs().visit_directory_record(m_record, [&](ISO::DirectoryRecordHeader const* record) {
@@ -115,7 +115,7 @@ ErrorOr<size_t> ISO9660Inode::write_bytes_locked(off_t, size_t, UserOrKernelBuff
return EROFS;
}
-ErrorOr<NonnullLockRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
+ErrorOr<NonnullRefPtr<Inode>> ISO9660Inode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
@@ -160,9 +160,9 @@ ISO9660Inode::ISO9660Inode(ISO9660FS& fs, ISO::DirectoryRecordHeader const& reco
ISO9660Inode::~ISO9660Inode() = default;
-ErrorOr<NonnullLockRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name)
+ErrorOr<NonnullRefPtr<ISO9660Inode>> ISO9660Inode::try_create_from_directory_record(ISO9660FS& fs, ISO::DirectoryRecordHeader const& record, StringView name)
{
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) ISO9660Inode(fs, record, name));
}
void ISO9660Inode::create_metadata()
diff --git a/Kernel/FileSystem/ISO9660FS/Inode.h b/Kernel/FileSystem/ISO9660FS/Inode.h
index 778e8f8c33..76641431a3 100644
--- a/Kernel/FileSystem/ISO9660FS/Inode.h
+++ b/Kernel/FileSystem/ISO9660FS/Inode.h
@@ -23,9 +23,9 @@ public:
// ^Inode
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<void> flush_metadata() override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> replace_child(StringView name, Inode& child) override;
@@ -45,7 +45,7 @@ private:
virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& buffer, OpenFileDescription*) override;
ISO9660Inode(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name);
- static ErrorOr<NonnullLockRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name);
+ static ErrorOr<NonnullRefPtr<ISO9660Inode>> try_create_from_directory_record(ISO9660FS&, ISO::DirectoryRecordHeader const& record, StringView name);
static InodeIndex get_inode_index(ISO::DirectoryRecordHeader const& record, StringView name);
static StringView get_normalized_filename(ISO::DirectoryRecordHeader const& record, Bytes buffer);
diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp
index ae838f2468..d0bb1ca1bf 100644
--- a/Kernel/FileSystem/Inode.cpp
+++ b/Kernel/FileSystem/Inode.cpp
@@ -30,7 +30,7 @@ SpinlockProtected<Inode::AllInstancesList, LockRank::None>& Inode::all_instances
void Inode::sync_all()
{
- Vector<NonnullLockRefPtr<Inode>, 32> inodes;
+ Vector<NonnullRefPtr<Inode>, 32> inodes;
Inode::all_instances().with([&](auto& all_inodes) {
for (auto& inode : all_inodes) {
if (inode.is_metadata_dirty())
diff --git a/Kernel/FileSystem/Inode.h b/Kernel/FileSystem/Inode.h
index 8a327ff266..dcf205513a 100644
--- a/Kernel/FileSystem/Inode.h
+++ b/Kernel/FileSystem/Inode.h
@@ -62,8 +62,8 @@ public:
virtual void detach(OpenFileDescription&) { }
virtual void did_seek(OpenFileDescription&, off_t) { }
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const = 0;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) = 0;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) = 0;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) = 0;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) = 0;
virtual ErrorOr<void> remove_child(StringView name) = 0;
/// Replace child atomically, incrementing the link count of the replacement
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp
index b225f31a9a..745079331c 100644
--- a/Kernel/FileSystem/InodeFile.cpp
+++ b/Kernel/FileSystem/InodeFile.cpp
@@ -17,7 +17,7 @@
namespace Kernel {
-InodeFile::InodeFile(NonnullLockRefPtr<Inode>&& inode)
+InodeFile::InodeFile(NonnullRefPtr<Inode> inode)
: m_inode(move(inode))
{
}
diff --git a/Kernel/FileSystem/InodeFile.h b/Kernel/FileSystem/InodeFile.h
index 4336166c3f..7ee198eed3 100644
--- a/Kernel/FileSystem/InodeFile.h
+++ b/Kernel/FileSystem/InodeFile.h
@@ -14,7 +14,7 @@ class Inode;
class InodeFile final : public File {
public:
- static ErrorOr<NonnullLockRefPtr<InodeFile>> create(NonnullLockRefPtr<Inode>&& inode)
+ static ErrorOr<NonnullLockRefPtr<InodeFile>> create(NonnullRefPtr<Inode> inode)
{
auto file = adopt_lock_ref_if_nonnull(new (nothrow) InodeFile(move(inode)));
if (!file)
@@ -51,8 +51,8 @@ public:
private:
virtual bool is_regular_file() const override;
- explicit InodeFile(NonnullLockRefPtr<Inode>&&);
- NonnullLockRefPtr<Inode> m_inode;
+ explicit InodeFile(NonnullRefPtr<Inode>);
+ NonnullRefPtr<Inode> m_inode;
};
}
diff --git a/Kernel/FileSystem/Mount.cpp b/Kernel/FileSystem/Mount.cpp
index b123b78ddc..a44aebee47 100644
--- a/Kernel/FileSystem/Mount.cpp
+++ b/Kernel/FileSystem/Mount.cpp
@@ -36,18 +36,18 @@ ErrorOr<NonnullOwnPtr<KString>> Mount::absolute_path() const
});
}
-LockRefPtr<Inode> Mount::host()
+RefPtr<Inode> Mount::host()
{
- return m_host_custody.with([](auto& host_custody) -> LockRefPtr<Inode> {
+ return m_host_custody.with([](auto& host_custody) -> RefPtr<Inode> {
if (!host_custody)
return nullptr;
return &host_custody->inode();
});
}
-LockRefPtr<Inode const> Mount::host() const
+RefPtr<Inode const> Mount::host() const
{
- return m_host_custody.with([](auto& host_custody) -> LockRefPtr<Inode const> {
+ return m_host_custody.with([](auto& host_custody) -> RefPtr<Inode const> {
if (!host_custody)
return nullptr;
return &host_custody->inode();
diff --git a/Kernel/FileSystem/Mount.h b/Kernel/FileSystem/Mount.h
index d0676a797e..a7c8f45c86 100644
--- a/Kernel/FileSystem/Mount.h
+++ b/Kernel/FileSystem/Mount.h
@@ -23,8 +23,8 @@ public:
Mount(FileSystem&, Custody* host_custody, int flags);
Mount(Inode& source, Custody& host_custody, int flags);
- LockRefPtr<Inode const> host() const;
- LockRefPtr<Inode> host();
+ RefPtr<Inode const> host() const;
+ RefPtr<Inode> host();
Inode const& guest() const { return *m_guest; }
Inode& guest() { return *m_guest; }
@@ -38,7 +38,7 @@ public:
void set_flags(int flags) { m_flags = flags; }
private:
- NonnullLockRefPtr<Inode> m_guest;
+ NonnullRefPtr<Inode> m_guest;
NonnullLockRefPtr<FileSystem> m_guest_fs;
SpinlockProtected<RefPtr<Custody>, LockRank::None> m_host_custody;
int m_flags;
diff --git a/Kernel/FileSystem/OpenFileDescription.h b/Kernel/FileSystem/OpenFileDescription.h
index a78fb94243..6f9004b68c 100644
--- a/Kernel/FileSystem/OpenFileDescription.h
+++ b/Kernel/FileSystem/OpenFileDescription.h
@@ -114,7 +114,7 @@ public:
OwnPtr<OpenFileDescriptionData>& data();
- void set_original_inode(Badge<VirtualFileSystem>, NonnullLockRefPtr<Inode>&& inode) { m_inode = move(inode); }
+ void set_original_inode(Badge<VirtualFileSystem>, NonnullRefPtr<Inode> inode) { m_inode = move(inode); }
void set_original_custody(Badge<VirtualFileSystem>, Custody& custody);
ErrorOr<void> truncate(u64);
@@ -140,7 +140,7 @@ private:
blocker_set().unblock_all_blockers_whose_conditions_are_met();
}
- LockRefPtr<Inode> m_inode;
+ RefPtr<Inode> m_inode;
NonnullLockRefPtr<File> m_file;
struct State {
diff --git a/Kernel/FileSystem/Plan9FS/FileSystem.h b/Kernel/FileSystem/Plan9FS/FileSystem.h
index 3b4ee0c0cc..0bf96da01a 100644
--- a/Kernel/FileSystem/Plan9FS/FileSystem.h
+++ b/Kernel/FileSystem/Plan9FS/FileSystem.h
@@ -125,7 +125,7 @@ private:
void thread_main();
void ensure_thread();
- LockRefPtr<Plan9FSInode> m_root_inode;
+ RefPtr<Plan9FSInode> m_root_inode;
Atomic<u16> m_next_tag { (u16)-1 };
Atomic<u32> m_next_fid { 1 };
diff --git a/Kernel/FileSystem/Plan9FS/Inode.cpp b/Kernel/FileSystem/Plan9FS/Inode.cpp
index 05093a3945..431661abc6 100644
--- a/Kernel/FileSystem/Plan9FS/Inode.cpp
+++ b/Kernel/FileSystem/Plan9FS/Inode.cpp
@@ -14,9 +14,9 @@ Plan9FSInode::Plan9FSInode(Plan9FS& fs, u32 fid)
{
}
-ErrorOr<NonnullLockRefPtr<Plan9FSInode>> Plan9FSInode::try_create(Plan9FS& fs, u32 fid)
+ErrorOr<NonnullRefPtr<Plan9FSInode>> Plan9FSInode::try_create(Plan9FS& fs, u32 fid)
{
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) Plan9FSInode(fs, fid));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) Plan9FSInode(fs, fid));
}
Plan9FSInode::~Plan9FSInode()
@@ -245,7 +245,7 @@ ErrorOr<void> Plan9FSInode::traverse_as_directory(Function<ErrorOr<void>(FileSys
return ENOTIMPL;
}
-ErrorOr<NonnullLockRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
{
u32 newfid = fs().allocate_fid();
Plan9FSMessage message { fs(), Plan9FSMessage::Type::Twalk };
@@ -254,7 +254,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> Plan9FSInode::lookup(StringView name)
return TRY(Plan9FSInode::try_create(fs(), newfid));
}
-ErrorOr<NonnullLockRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
+ErrorOr<NonnullRefPtr<Inode>> Plan9FSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
// TODO
return ENOTIMPL;
diff --git a/Kernel/FileSystem/Plan9FS/Inode.h b/Kernel/FileSystem/Plan9FS/Inode.h
index d075c4b440..9747cc330d 100644
--- a/Kernel/FileSystem/Plan9FS/Inode.h
+++ b/Kernel/FileSystem/Plan9FS/Inode.h
@@ -26,8 +26,8 @@ public:
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> flush_metadata() override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> replace_child(StringView name, Inode& child) override;
@@ -41,7 +41,7 @@ private:
virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const& data, OpenFileDescription*) override;
Plan9FSInode(Plan9FS&, u32 fid);
- static ErrorOr<NonnullLockRefPtr<Plan9FSInode>> try_create(Plan9FS&, u32 fid);
+ static ErrorOr<NonnullRefPtr<Plan9FSInode>> try_create(Plan9FS&, u32 fid);
enum class GetAttrMask : u64 {
Mode = 0x1,
diff --git a/Kernel/FileSystem/ProcFS/FileSystem.cpp b/Kernel/FileSystem/ProcFS/FileSystem.cpp
index 1423424327..970d523c78 100644
--- a/Kernel/FileSystem/ProcFS/FileSystem.cpp
+++ b/Kernel/FileSystem/ProcFS/FileSystem.cpp
@@ -19,16 +19,16 @@ ErrorOr<NonnullLockRefPtr<FileSystem>> ProcFS::try_create()
ProcFS::ProcFS() = default;
ProcFS::~ProcFS() = default;
-ErrorOr<NonnullLockRefPtr<Inode>> ProcFS::get_inode(InodeIdentifier inode_id) const
+ErrorOr<NonnullRefPtr<Inode>> ProcFS::get_inode(InodeIdentifier inode_id) const
{
if (inode_id.index() == 1)
return *m_root_inode;
- return TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), inode_id.index())));
+ return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), inode_id.index())));
}
ErrorOr<void> ProcFS::initialize()
{
- m_root_inode = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), 1)));
+ m_root_inode = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ProcFSInode(const_cast<ProcFS&>(*this), 1)));
return {};
}
diff --git a/Kernel/FileSystem/ProcFS/FileSystem.h b/Kernel/FileSystem/ProcFS/FileSystem.h
index fbec219017..6917deb415 100644
--- a/Kernel/FileSystem/ProcFS/FileSystem.h
+++ b/Kernel/FileSystem/ProcFS/FileSystem.h
@@ -30,9 +30,9 @@ public:
private:
ProcFS();
- ErrorOr<NonnullLockRefPtr<Inode>> get_inode(InodeIdentifier) const;
+ ErrorOr<NonnullRefPtr<Inode>> get_inode(InodeIdentifier) const;
- LockRefPtr<ProcFSInode> m_root_inode;
+ RefPtr<ProcFSInode> m_root_inode;
};
}
diff --git a/Kernel/FileSystem/ProcFS/Inode.cpp b/Kernel/FileSystem/ProcFS/Inode.cpp
index 11ff289b24..30287c6abc 100644
--- a/Kernel/FileSystem/ProcFS/Inode.cpp
+++ b/Kernel/FileSystem/ProcFS/Inode.cpp
@@ -155,7 +155,7 @@ ErrorOr<void> ProcFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSyst
return process->traverse_as_directory(procfs().fsid(), move(callback));
}
-ErrorOr<NonnullLockRefPtr<Inode>> ProcFSInode::lookup_as_root_directory(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> ProcFSInode::lookup_as_root_directory(StringView name)
{
if (name == "self"sv)
return procfs().get_inode({ fsid(), 2 });
@@ -172,7 +172,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> ProcFSInode::lookup_as_root_directory(StringVi
return ENOENT;
}
-ErrorOr<NonnullLockRefPtr<Inode>> ProcFSInode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> ProcFSInode::lookup(StringView name)
{
MutexLocker locker(procfs().m_lock);
if (m_type == Type::ProcessSubdirectory) {
diff --git a/Kernel/FileSystem/ProcFS/Inode.h b/Kernel/FileSystem/ProcFS/Inode.h
index 8e607ef09d..8a2b62b769 100644
--- a/Kernel/FileSystem/ProcFS/Inode.h
+++ b/Kernel/FileSystem/ProcFS/Inode.h
@@ -43,7 +43,7 @@ private:
ProcFS const& procfs() const { return static_cast<ProcFS const&>(Inode::fs()); }
// ^Inode (EROFS handling)
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView, mode_t, dev_t, UserID, GroupID) override { return EROFS; }
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView, mode_t, dev_t, UserID, GroupID) override { return EROFS; }
virtual ErrorOr<void> add_child(Inode&, StringView, mode_t) override { return EROFS; }
virtual ErrorOr<void> remove_child(StringView) override { return EROFS; }
virtual ErrorOr<void> replace_child(StringView, Inode&) override { return EROFS; }
@@ -65,8 +65,8 @@ private:
virtual InodeMetadata metadata() const override;
virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override;
- ErrorOr<NonnullLockRefPtr<Inode>> lookup_as_root_directory(StringView name);
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override final;
+ ErrorOr<NonnullRefPtr<Inode>> lookup_as_root_directory(StringView name);
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override final;
ErrorOr<void> refresh_process_property_data(OpenFileDescription& description);
ErrorOr<void> try_fetch_process_property_data(NonnullLockRefPtr<Process>, KBufferBuilder& builder) const;
diff --git a/Kernel/FileSystem/ProcFS/ProcessExposed.cpp b/Kernel/FileSystem/ProcFS/ProcessExposed.cpp
index 1ff4e140fe..d13a8ce944 100644
--- a/Kernel/FileSystem/ProcFS/ProcessExposed.cpp
+++ b/Kernel/FileSystem/ProcFS/ProcessExposed.cpp
@@ -29,7 +29,7 @@ ErrorOr<void> Process::traverse_as_directory(FileSystemID fsid, Function<ErrorOr
return {};
}
-ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_as_directory(ProcFS& procfs, StringView name) const
+ErrorOr<NonnullRefPtr<Inode>> Process::lookup_as_directory(ProcFS& procfs, StringView name) const
{
for (auto& entry : main_process_directory_entries) {
if (entry.name == name)
@@ -78,14 +78,14 @@ ErrorOr<void> Process::traverse_stacks_directory(FileSystemID fsid, Function<Err
});
}
-ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS& procfs, StringView name) const
+ErrorOr<NonnullRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS& procfs, StringView name) const
{
auto maybe_needle = name.to_uint();
if (!maybe_needle.has_value())
return ENOENT;
auto needle = maybe_needle.release_value();
- ErrorOr<NonnullLockRefPtr<Inode>> thread_stack_inode { ENOENT };
+ ErrorOr<NonnullRefPtr<Inode>> thread_stack_inode { ENOENT };
for_each_thread([&](Thread const& thread) {
int tid = thread.tid().value();
VERIFY(!(tid < 0));
@@ -119,7 +119,7 @@ ErrorOr<void> Process::traverse_children_directory(FileSystemID fsid, Function<E
});
}
-ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_children_directory(ProcFS& procfs, StringView name) const
+ErrorOr<NonnullRefPtr<Inode>> Process::lookup_children_directory(ProcFS& procfs, StringView name) const
{
auto maybe_pid = name.to_uint();
if (!maybe_pid.has_value())
@@ -172,7 +172,7 @@ ErrorOr<void> Process::traverse_file_descriptions_directory(FileSystemID fsid, F
return {};
}
-ErrorOr<NonnullLockRefPtr<Inode>> Process::lookup_file_descriptions_directory(ProcFS& procfs, StringView name) const
+ErrorOr<NonnullRefPtr<Inode>> Process::lookup_file_descriptions_directory(ProcFS& procfs, StringView name) const
{
auto maybe_index = name.to_uint();
if (!maybe_index.has_value())
diff --git a/Kernel/FileSystem/RAMFS/FileSystem.h b/Kernel/FileSystem/RAMFS/FileSystem.h
index bfe965e0dc..08273f1e00 100644
--- a/Kernel/FileSystem/RAMFS/FileSystem.h
+++ b/Kernel/FileSystem/RAMFS/FileSystem.h
@@ -30,7 +30,7 @@ public:
private:
RAMFS();
- LockRefPtr<RAMFSInode> m_root_inode;
+ RefPtr<RAMFSInode> m_root_inode;
// NOTE: We start by assigning InodeIndex of 2, because 0 is invalid and 1
// is reserved for the root directory inode.
diff --git a/Kernel/FileSystem/RAMFS/Inode.cpp b/Kernel/FileSystem/RAMFS/Inode.cpp
index d2368d0b22..0441a34c46 100644
--- a/Kernel/FileSystem/RAMFS/Inode.cpp
+++ b/Kernel/FileSystem/RAMFS/Inode.cpp
@@ -32,14 +32,14 @@ RAMFSInode::RAMFSInode(RAMFS& fs)
RAMFSInode::~RAMFSInode() = default;
-ErrorOr<NonnullLockRefPtr<RAMFSInode>> RAMFSInode::try_create(RAMFS& fs, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent)
+ErrorOr<NonnullRefPtr<RAMFSInode>> RAMFSInode::try_create(RAMFS& fs, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent)
{
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) RAMFSInode(fs, metadata, move(parent)));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) RAMFSInode(fs, metadata, move(parent)));
}
-ErrorOr<NonnullLockRefPtr<RAMFSInode>> RAMFSInode::try_create_root(RAMFS& fs)
+ErrorOr<NonnullRefPtr<RAMFSInode>> RAMFSInode::try_create_root(RAMFS& fs)
{
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) RAMFSInode(fs));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) RAMFSInode(fs));
}
InodeMetadata RAMFSInode::metadata() const
@@ -234,7 +234,7 @@ ErrorOr<void> RAMFSInode::truncate_to_block_index(size_t block_index)
return {};
}
-ErrorOr<NonnullLockRefPtr<Inode>> RAMFSInode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> RAMFSInode::lookup(StringView name)
{
MutexLocker locker(m_inode_lock, Mutex::Mode::Shared);
VERIFY(is_directory());
@@ -243,7 +243,7 @@ ErrorOr<NonnullLockRefPtr<Inode>> RAMFSInode::lookup(StringView name)
return *this;
if (name == "..") {
if (auto parent = m_parent.strong_ref())
- return parent.release_nonnull();
+ return *parent;
return ENOENT;
}
@@ -292,7 +292,7 @@ ErrorOr<void> RAMFSInode::chown(UserID uid, GroupID gid)
return {};
}
-ErrorOr<NonnullLockRefPtr<Inode>> RAMFSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
+ErrorOr<NonnullRefPtr<Inode>> RAMFSInode::create_child(StringView name, mode_t mode, dev_t dev, UserID uid, GroupID gid)
{
MutexLocker locker(m_inode_lock);
auto now = kgettimeofday();
diff --git a/Kernel/FileSystem/RAMFS/Inode.h b/Kernel/FileSystem/RAMFS/Inode.h
index 730b521e67..72ddeb0ea3 100644
--- a/Kernel/FileSystem/RAMFS/Inode.h
+++ b/Kernel/FileSystem/RAMFS/Inode.h
@@ -26,9 +26,9 @@ public:
// ^Inode
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<void> flush_metadata() override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> replace_child(StringView name, Inode& child) override;
@@ -40,8 +40,8 @@ public:
private:
RAMFSInode(RAMFS& fs, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent);
explicit RAMFSInode(RAMFS& fs);
- static ErrorOr<NonnullLockRefPtr<RAMFSInode>> try_create(RAMFS&, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent);
- static ErrorOr<NonnullLockRefPtr<RAMFSInode>> try_create_root(RAMFS&);
+ static ErrorOr<NonnullRefPtr<RAMFSInode>> try_create(RAMFS&, InodeMetadata const& metadata, LockWeakPtr<RAMFSInode> parent);
+ static ErrorOr<NonnullRefPtr<RAMFSInode>> try_create_root(RAMFS&);
// ^Inode
virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override;
@@ -51,7 +51,7 @@ private:
struct Child {
NonnullOwnPtr<KString> name;
- NonnullLockRefPtr<RAMFSInode> inode;
+ NonnullRefPtr<RAMFSInode> inode;
IntrusiveListNode<Child> list_node {};
using List = IntrusiveList<&Child::list_node>;
};
diff --git a/Kernel/FileSystem/SysFS/Component.cpp b/Kernel/FileSystem/SysFS/Component.cpp
index 274216718f..96a8473228 100644
--- a/Kernel/FileSystem/SysFS/Component.cpp
+++ b/Kernel/FileSystem/SysFS/Component.cpp
@@ -143,17 +143,17 @@ SysFSDirectory::SysFSDirectory(SysFSDirectory const& parent_directory)
{
}
-ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSDirectory::to_inode(SysFS const& sysfs_instance) const
+ErrorOr<NonnullRefPtr<SysFSInode>> SysFSDirectory::to_inode(SysFS const& sysfs_instance) const
{
return TRY(SysFSDirectoryInode::try_create(sysfs_instance, *this));
}
-ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSSymbolicLink::to_inode(SysFS const& sysfs_instance) const
+ErrorOr<NonnullRefPtr<SysFSInode>> SysFSSymbolicLink::to_inode(SysFS const& sysfs_instance) const
{
return TRY(SysFSLinkInode::try_create(sysfs_instance, *this));
}
-ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSComponent::to_inode(SysFS const& sysfs_instance) const
+ErrorOr<NonnullRefPtr<SysFSInode>> SysFSComponent::to_inode(SysFS const& sysfs_instance) const
{
return SysFSInode::try_create(sysfs_instance, *this);
}
diff --git a/Kernel/FileSystem/SysFS/Component.h b/Kernel/FileSystem/SysFS/Component.h
index 3f9b5643f5..611671459f 100644
--- a/Kernel/FileSystem/SysFS/Component.h
+++ b/Kernel/FileSystem/SysFS/Component.h
@@ -38,7 +38,7 @@ public:
virtual ErrorOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) { return EROFS; }
virtual ErrorOr<void> refresh_data(OpenFileDescription&) const { return {}; }
- virtual ErrorOr<NonnullLockRefPtr<SysFSInode>> to_inode(SysFS const&) const;
+ virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const&) const;
InodeIndex component_index() const { return m_component_index; };
@@ -62,7 +62,7 @@ private:
class SysFSSymbolicLink : public SysFSComponent {
public:
virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override final;
- virtual ErrorOr<NonnullLockRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final;
+ virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final;
protected:
ErrorOr<NonnullOwnPtr<KString>> try_generate_return_path_to_mount_point() const;
@@ -78,7 +78,7 @@ public:
virtual ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override final;
virtual LockRefPtr<SysFSComponent> lookup(StringView name) override final;
- virtual ErrorOr<NonnullLockRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final;
+ virtual ErrorOr<NonnullRefPtr<SysFSInode>> to_inode(SysFS const& sysfs_instance) const override final;
using ChildList = SpinlockProtected<IntrusiveList<&SysFSComponent::m_list_node>, LockRank::None>;
diff --git a/Kernel/FileSystem/SysFS/DirectoryInode.cpp b/Kernel/FileSystem/SysFS/DirectoryInode.cpp
index 8e3395e68b..8167fe4b30 100644
--- a/Kernel/FileSystem/SysFS/DirectoryInode.cpp
+++ b/Kernel/FileSystem/SysFS/DirectoryInode.cpp
@@ -11,9 +11,9 @@
namespace Kernel {
-ErrorOr<NonnullLockRefPtr<SysFSDirectoryInode>> SysFSDirectoryInode::try_create(SysFS const& sysfs, SysFSComponent const& component)
+ErrorOr<NonnullRefPtr<SysFSDirectoryInode>> SysFSDirectoryInode::try_create(SysFS const& sysfs, SysFSComponent const& component)
{
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) SysFSDirectoryInode(sysfs, component));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) SysFSDirectoryInode(sysfs, component));
}
SysFSDirectoryInode::SysFSDirectoryInode(SysFS const& fs, SysFSComponent const& component)
@@ -42,7 +42,7 @@ ErrorOr<void> SysFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>(
return m_associated_component->traverse_as_directory(fs().fsid(), move(callback));
}
-ErrorOr<NonnullLockRefPtr<Inode>> SysFSDirectoryInode::lookup(StringView name)
+ErrorOr<NonnullRefPtr<Inode>> SysFSDirectoryInode::lookup(StringView name)
{
MutexLocker locker(fs().m_lock);
auto component = m_associated_component->lookup(name);
diff --git a/Kernel/FileSystem/SysFS/DirectoryInode.h b/Kernel/FileSystem/SysFS/DirectoryInode.h
index 3f877eee39..f5168e1c0a 100644
--- a/Kernel/FileSystem/SysFS/DirectoryInode.h
+++ b/Kernel/FileSystem/SysFS/DirectoryInode.h
@@ -14,7 +14,7 @@ class SysFSDirectoryInode : public SysFSInode {
friend class SysFS;
public:
- static ErrorOr<NonnullLockRefPtr<SysFSDirectoryInode>> try_create(SysFS const&, SysFSComponent const&);
+ static ErrorOr<NonnullRefPtr<SysFSDirectoryInode>> try_create(SysFS const&, SysFSComponent const&);
virtual ~SysFSDirectoryInode() override;
SysFS& fs() { return static_cast<SysFS&>(Inode::fs()); }
@@ -25,7 +25,7 @@ protected:
// ^Inode
virtual InodeMetadata metadata() const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
};
}
diff --git a/Kernel/FileSystem/SysFS/FileSystem.h b/Kernel/FileSystem/SysFS/FileSystem.h
index 8d5d8a527e..f1669e2287 100644
--- a/Kernel/FileSystem/SysFS/FileSystem.h
+++ b/Kernel/FileSystem/SysFS/FileSystem.h
@@ -30,7 +30,7 @@ public:
private:
SysFS();
- LockRefPtr<SysFSInode> m_root_inode;
+ RefPtr<SysFSInode> m_root_inode;
};
}
diff --git a/Kernel/FileSystem/SysFS/Inode.cpp b/Kernel/FileSystem/SysFS/Inode.cpp
index 593e4316b4..626167b8d3 100644
--- a/Kernel/FileSystem/SysFS/Inode.cpp
+++ b/Kernel/FileSystem/SysFS/Inode.cpp
@@ -10,9 +10,9 @@
namespace Kernel {
-ErrorOr<NonnullLockRefPtr<SysFSInode>> SysFSInode::try_create(SysFS const& fs, SysFSComponent const& component)
+ErrorOr<NonnullRefPtr<SysFSInode>> SysFSInode::try_create(SysFS const& fs, SysFSComponent const& component)
{
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) SysFSInode(fs, component));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) SysFSInode(fs, component));
}
SysFSInode::SysFSInode(SysFS const& fs, SysFSComponent const& component)
@@ -47,7 +47,7 @@ ErrorOr<void> SysFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSyste
VERIFY_NOT_REACHED();
}
-ErrorOr<NonnullLockRefPtr<Inode>> SysFSInode::lookup(StringView)
+ErrorOr<NonnullRefPtr<Inode>> SysFSInode::lookup(StringView)
{
VERIFY_NOT_REACHED();
}
@@ -75,7 +75,7 @@ ErrorOr<size_t> SysFSInode::write_bytes_locked(off_t offset, size_t count, UserO
return m_associated_component->write_bytes(offset, count, buffer, fd);
}
-ErrorOr<NonnullLockRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
+ErrorOr<NonnullRefPtr<Inode>> SysFSInode::create_child(StringView, mode_t, dev_t, UserID, GroupID)
{
return EROFS;
}
diff --git a/Kernel/FileSystem/SysFS/Inode.h b/Kernel/FileSystem/SysFS/Inode.h
index 62797e293a..3dc96f988e 100644
--- a/Kernel/FileSystem/SysFS/Inode.h
+++ b/Kernel/FileSystem/SysFS/Inode.h
@@ -17,18 +17,18 @@ class SysFSInode : public Inode {
friend class SysFSDirectoryInode;
public:
- static ErrorOr<NonnullLockRefPtr<SysFSInode>> try_create(SysFS const&, SysFSComponent const&);
+ static ErrorOr<NonnullRefPtr<SysFSInode>> try_create(SysFS const&, SysFSComponent const&);
StringView name() const { return m_associated_component->name(); }
protected:
SysFSInode(SysFS const&, SysFSComponent const&);
virtual ErrorOr<size_t> read_bytes_locked(off_t, size_t, UserOrKernelBuffer& buffer, OpenFileDescription*) const override;
virtual ErrorOr<void> traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> lookup(StringView name) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> lookup(StringView name) override;
virtual ErrorOr<void> flush_metadata() override;
virtual InodeMetadata metadata() const override;
virtual ErrorOr<size_t> write_bytes_locked(off_t, size_t, UserOrKernelBuffer const&, OpenFileDescription*) override;
- virtual ErrorOr<NonnullLockRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
+ virtual ErrorOr<NonnullRefPtr<Inode>> create_child(StringView name, mode_t, dev_t, UserID, GroupID) override;
virtual ErrorOr<void> add_child(Inode&, StringView name, mode_t) override;
virtual ErrorOr<void> remove_child(StringView name) override;
virtual ErrorOr<void> replace_child(StringView name, Inode& child) override;
diff --git a/Kernel/FileSystem/SysFS/LinkInode.cpp b/Kernel/FileSystem/SysFS/LinkInode.cpp
index b3bf62e5ff..ac065bb288 100644
--- a/Kernel/FileSystem/SysFS/LinkInode.cpp
+++ b/Kernel/FileSystem/SysFS/LinkInode.cpp
@@ -9,9 +9,9 @@
namespace Kernel {
-ErrorOr<NonnullLockRefPtr<SysFSLinkInode>> SysFSLinkInode::try_create(SysFS const& sysfs, SysFSComponent const& component)
+ErrorOr<NonnullRefPtr<SysFSLinkInode>> SysFSLinkInode::try_create(SysFS const& sysfs, SysFSComponent const& component)
{
- return adopt_nonnull_lock_ref_or_enomem(new (nothrow) SysFSLinkInode(sysfs, component));
+ return adopt_nonnull_ref_or_enomem(new (nothrow) SysFSLinkInode(sysfs, component));
}
SysFSLinkInode::SysFSLinkInode(SysFS const& fs, SysFSComponent const& component)
diff --git a/Kernel/FileSystem/SysFS/LinkInode.h b/Kernel/FileSystem/SysFS/LinkInode.h
index 750b22b7ef..835bffe45e 100644
--- a/Kernel/FileSystem/SysFS/LinkInode.h
+++ b/Kernel/FileSystem/SysFS/LinkInode.h
@@ -14,7 +14,7 @@ class SysFSLinkInode : public SysFSInode {
friend class SysFS;
public:
- static ErrorOr<NonnullLockRefPtr<SysFSLinkInode>> try_create(SysFS const&, SysFSComponent const&);
+ static ErrorOr<NonnullRefPtr<SysFSLinkInode>> try_create(SysFS const&, SysFSComponent const&);
virtual ~SysFSLinkInode() override;
protected:
diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h
index cad6d0b562..5cf0d622c0 100644
--- a/Kernel/FileSystem/VirtualFileSystem.h
+++ b/Kernel/FileSystem/VirtualFileSystem.h
@@ -115,7 +115,7 @@ private:
Mount* find_mount_for_host(InodeIdentifier);
Mount* find_mount_for_guest(InodeIdentifier);
- LockRefPtr<Inode> m_root_inode;
+ RefPtr<Inode> m_root_inode;
SpinlockProtected<RefPtr<Custody>, LockRank::None> m_root_custody {};
diff --git a/Kernel/Library/LockWeakPtr.h b/Kernel/Library/LockWeakPtr.h
index f6bacbe6b7..f2fd204d94 100644
--- a/Kernel/Library/LockWeakPtr.h
+++ b/Kernel/Library/LockWeakPtr.h
@@ -143,7 +143,7 @@ public:
// use unsafe_ptr(), but as the name suggests, it is not safe...
LockRefPtr<T> ref;
// Using do_while_locked protects against a race with clear()!
- m_link.do_while_locked([&](WeakLink* link) {
+ m_link.do_while_locked([&](LockWeakLink* link) {
if (link)
ref = link->template strong_ref<T>();
});
@@ -153,7 +153,7 @@ public:
[[nodiscard]] T* unsafe_ptr() const
{
T* ptr = nullptr;
- m_link.do_while_locked([&](WeakLink* link) {
+ m_link.do_while_locked([&](LockWeakLink* link) {
if (link)
ptr = link->unsafe_ptr<T>();
});
@@ -165,15 +165,15 @@ public:
[[nodiscard]] bool is_null() const { return !m_link || m_link->is_null(); }
void clear() { m_link = nullptr; }
- [[nodiscard]] LockRefPtr<WeakLink> take_link() { return move(m_link); }
+ [[nodiscard]] LockRefPtr<LockWeakLink> take_link() { return move(m_link); }
private:
- LockWeakPtr(LockRefPtr<WeakLink> const& link)
+ LockWeakPtr(LockRefPtr<LockWeakLink> const& link)
: m_link(link)
{
}
- LockRefPtr<WeakLink> m_link;
+ LockRefPtr<LockWeakLink> m_link;
};
template<typename T>
@@ -196,10 +196,10 @@ inline ErrorOr<LockWeakPtr<U>> LockWeakable<T>::try_make_weak_ptr() const
return LockWeakPtr<U> {};
}
if (!m_link) {
- // There is a small chance that we create a new WeakLink and throw
+ // There is a small chance that we create a new LockWeakLink and throw
// it away because another thread beat us to it. But the window is
// pretty small and the overhead isn't terrible.
- m_link.assign_if_null(TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) WeakLink(const_cast<T&>(static_cast<T const&>(*this))))));
+ m_link.assign_if_null(TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) LockWeakLink(const_cast<T&>(static_cast<T const&>(*this))))));
}
LockWeakPtr<U> weak_ptr(m_link);
diff --git a/Kernel/Library/LockWeakable.h b/Kernel/Library/LockWeakable.h
index 5c21382e25..6c146e665b 100644
--- a/Kernel/Library/LockWeakable.h
+++ b/Kernel/Library/LockWeakable.h
@@ -21,7 +21,7 @@ class LockWeakable;
template<typename T>
class LockWeakPtr;
-class WeakLink final : public AtomicRefCounted<WeakLink> {
+class LockWeakLink final : public AtomicRefCounted<LockWeakLink> {
template<typename T>
friend class LockWeakable;
template<typename T>
@@ -82,7 +82,7 @@ public:
private:
template<typename T>
- explicit WeakLink(T& weakable)
+ explicit LockWeakLink(T& weakable)
: m_ptr(&weakable)
{
}
@@ -115,7 +115,7 @@ protected:
}
private:
- mutable LockRefPtr<WeakLink> m_link;
+ mutable LockRefPtr<LockWeakLink> m_link;
Atomic<bool> m_being_destroyed { false };
};
diff --git a/Kernel/Memory/InodeVMObject.h b/Kernel/Memory/InodeVMObject.h
index 2b439b32fd..182e24e26a 100644
--- a/Kernel/Memory/InodeVMObject.h
+++ b/Kernel/Memory/InodeVMObject.h
@@ -37,7 +37,7 @@ protected:
virtual bool is_inode() const final { return true; }
- NonnullLockRefPtr<Inode> m_inode;
+ NonnullRefPtr<Inode> m_inode;
Bitmap m_dirty_pages;
};
diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h
index 7b7a34e528..5668b30f25 100644
--- a/Kernel/Net/LocalSocket.h
+++ b/Kernel/Net/LocalSocket.h
@@ -74,7 +74,7 @@ private:
ErrorOr<void> try_set_path(StringView);
// The inode this socket is bound to.
- LockRefPtr<Inode> m_inode;
+ RefPtr<Inode> m_inode;
UserID m_prebind_uid { 0 };
GroupID m_prebind_gid { 0 };
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 075775ca4d..703cbb1dc9 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -635,7 +635,7 @@ private:
public:
ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const;
- ErrorOr<NonnullLockRefPtr<Inode>> lookup_as_directory(ProcFS&, StringView name) const;
+ ErrorOr<NonnullRefPtr<Inode>> lookup_as_directory(ProcFS&, StringView name) const;
ErrorOr<void> procfs_get_fds_stats(KBufferBuilder& builder) const;
ErrorOr<void> procfs_get_perf_events(KBufferBuilder& builder) const;
ErrorOr<void> procfs_get_unveil_stats(KBufferBuilder& builder) const;
@@ -647,11 +647,11 @@ public:
mode_t binary_link_required_mode() const;
ErrorOr<void> procfs_get_thread_stack(ThreadID thread_id, KBufferBuilder& builder) const;
ErrorOr<void> traverse_stacks_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const;
- ErrorOr<NonnullLockRefPtr<Inode>> lookup_stacks_directory(ProcFS&, StringView name) const;
+ ErrorOr<NonnullRefPtr<Inode>> lookup_stacks_directory(ProcFS&, StringView name) const;
ErrorOr<size_t> procfs_get_file_description_link(unsigned fd, KBufferBuilder& builder) const;
ErrorOr<void> traverse_file_descriptions_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const;
- ErrorOr<NonnullLockRefPtr<Inode>> lookup_file_descriptions_directory(ProcFS&, StringView name) const;
- ErrorOr<NonnullLockRefPtr<Inode>> lookup_children_directory(ProcFS&, StringView name) const;
+ ErrorOr<NonnullRefPtr<Inode>> lookup_file_descriptions_directory(ProcFS&, StringView name) const;
+ ErrorOr<NonnullRefPtr<Inode>> lookup_children_directory(ProcFS&, StringView name) const;
ErrorOr<void> traverse_children_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const;
ErrorOr<size_t> procfs_get_child_process_link(ProcessID child_pid, KBufferBuilder& builder) const;
diff --git a/Kernel/Thread.h b/Kernel/Thread.h
index d6939d6a95..2a18283c57 100644
--- a/Kernel/Thread.h
+++ b/Kernel/Thread.h
@@ -700,7 +700,7 @@ public:
class FlockBlocker final : public Blocker {
public:
- FlockBlocker(NonnullLockRefPtr<Inode>, flock const&);
+ FlockBlocker(NonnullRefPtr<Inode>, flock const&);
virtual StringView state_string() const override { return "Locking File"sv; }
virtual Type blocker_type() const override { return Type::Flock; }
virtual void will_unblock_immediately_without_blocking(UnblockImmediatelyReason) override;
@@ -708,7 +708,7 @@ public:
bool try_unblock(bool from_add_blocker);
private:
- NonnullLockRefPtr<Inode> m_inode;
+ NonnullRefPtr<Inode> m_inode;
flock const& m_flock;
bool m_did_unblock { false };
};
diff --git a/Kernel/ThreadBlockers.cpp b/Kernel/ThreadBlockers.cpp
index 52b89bec74..9181373ad0 100644
--- a/Kernel/ThreadBlockers.cpp
+++ b/Kernel/ThreadBlockers.cpp
@@ -822,7 +822,7 @@ bool Thread::WaitBlocker::unblock(Process& process, UnblockFlags flags, u8 signa
return true;
}
-Thread::FlockBlocker::FlockBlocker(NonnullLockRefPtr<Inode> inode, flock const& flock)
+Thread::FlockBlocker::FlockBlocker(NonnullRefPtr<Inode> inode, flock const& flock)
: m_inode(move(inode))
, m_flock(flock)
{