diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-04-24 15:27:32 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-25 09:38:27 +0200 |
commit | 8d6e9fad40d493e6f2027cec37212956294a591f (patch) | |
tree | 71816f325880a99ef5b623d9795f2eded3d69ca7 | |
parent | 0d5827f8652462715f6c2f91e2b91b2077547ae6 (diff) | |
download | serenity-8d6e9fad40d493e6f2027cec37212956294a591f.zip |
Kernel: Remove the now defunct `LOCKER(..)` macro.
31 files changed, 196 insertions, 198 deletions
diff --git a/Kernel/DoubleBuffer.cpp b/Kernel/DoubleBuffer.cpp index e54113aff3..ef5fd497e1 100644 --- a/Kernel/DoubleBuffer.cpp +++ b/Kernel/DoubleBuffer.cpp @@ -45,7 +45,7 @@ ssize_t DoubleBuffer::write(const UserOrKernelBuffer& data, size_t size) if (!size || m_storage.is_null()) return 0; VERIFY(size > 0); - LOCKER(m_lock); + Locker locker(m_lock); size_t bytes_to_write = min(size, m_space_for_writing); u8* write_ptr = m_write_buffer->data + m_write_buffer->size; m_write_buffer->size += bytes_to_write; @@ -62,7 +62,7 @@ ssize_t DoubleBuffer::read(UserOrKernelBuffer& data, size_t size) if (!size || m_storage.is_null()) return 0; VERIFY(size > 0); - LOCKER(m_lock); + Locker locker(m_lock); if (m_read_buffer_index >= m_read_buffer->size && m_write_buffer->size != 0) flip(); if (m_read_buffer_index >= m_read_buffer->size) diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp index 6c84039bea..275c415f22 100644 --- a/Kernel/FileSystem/BlockBasedFileSystem.cpp +++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp @@ -116,7 +116,7 @@ BlockBasedFS::~BlockBasedFS() KResult BlockBasedFS::write_block(BlockIndex index, const UserOrKernelBuffer& data, size_t count, size_t offset, bool allow_cache) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_logical_block_size); VERIFY(offset + count <= block_size()); dbgln_if(BBFS_DEBUG, "BlockBasedFileSystem::write_block {}, size={}", index, count); @@ -151,7 +151,7 @@ KResult BlockBasedFS::write_block(BlockIndex index, const UserOrKernelBuffer& da bool BlockBasedFS::raw_read(BlockIndex index, UserOrKernelBuffer& buffer) { - LOCKER(m_lock); + Locker locker(m_lock); u32 base_offset = index.value() * m_logical_block_size; auto seek_result = file_description().seek(base_offset, SEEK_SET); VERIFY(!seek_result.is_error()); @@ -163,7 +163,7 @@ bool BlockBasedFS::raw_read(BlockIndex index, UserOrKernelBuffer& buffer) bool BlockBasedFS::raw_write(BlockIndex index, const UserOrKernelBuffer& buffer) { - LOCKER(m_lock); + Locker locker(m_lock); size_t base_offset = index.value() * m_logical_block_size; auto seek_result = file_description().seek(base_offset, SEEK_SET); VERIFY(!seek_result.is_error()); @@ -175,7 +175,7 @@ bool BlockBasedFS::raw_write(BlockIndex index, const UserOrKernelBuffer& buffer) bool BlockBasedFS::raw_read_blocks(BlockIndex index, size_t count, UserOrKernelBuffer& buffer) { - LOCKER(m_lock); + Locker locker(m_lock); auto current = buffer; for (unsigned block = index.value(); block < (index.value() + count); block++) { if (!raw_read(BlockIndex { block }, current)) @@ -187,7 +187,7 @@ bool BlockBasedFS::raw_read_blocks(BlockIndex index, size_t count, UserOrKernelB bool BlockBasedFS::raw_write_blocks(BlockIndex index, size_t count, const UserOrKernelBuffer& buffer) { - LOCKER(m_lock); + Locker locker(m_lock); auto current = buffer; for (unsigned block = index.value(); block < (index.value() + count); block++) { if (!raw_write(block, current)) @@ -199,7 +199,7 @@ bool BlockBasedFS::raw_write_blocks(BlockIndex index, size_t count, const UserOr KResult BlockBasedFS::write_blocks(BlockIndex index, unsigned count, const UserOrKernelBuffer& data, bool allow_cache) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_logical_block_size); dbgln_if(BBFS_DEBUG, "BlockBasedFileSystem::write_blocks {}, count={}", index, count); for (unsigned i = 0; i < count; ++i) { @@ -212,7 +212,7 @@ KResult BlockBasedFS::write_blocks(BlockIndex index, unsigned count, const UserO KResult BlockBasedFS::read_block(BlockIndex index, UserOrKernelBuffer* buffer, size_t count, size_t offset, bool allow_cache) const { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_logical_block_size); VERIFY(offset + count <= block_size()); dbgln_if(BBFS_DEBUG, "BlockBasedFileSystem::read_block {}", index); @@ -250,7 +250,7 @@ KResult BlockBasedFS::read_block(BlockIndex index, UserOrKernelBuffer* buffer, s KResult BlockBasedFS::read_blocks(BlockIndex index, unsigned count, UserOrKernelBuffer& buffer, bool allow_cache) const { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_logical_block_size); if (!count) return EINVAL; @@ -269,7 +269,7 @@ KResult BlockBasedFS::read_blocks(BlockIndex index, unsigned count, UserOrKernel void BlockBasedFS::flush_specific_block_if_needed(BlockIndex index) { - LOCKER(m_lock); + Locker locker(m_lock); if (!cache().is_dirty()) return; Vector<CacheEntry*, 32> cleaned_entries; @@ -292,7 +292,7 @@ void BlockBasedFS::flush_specific_block_if_needed(BlockIndex index) void BlockBasedFS::flush_writes_impl() { - LOCKER(m_lock); + Locker locker(m_lock); if (!cache().is_dirty()) return; u32 count = 0; diff --git a/Kernel/FileSystem/DevFS.cpp b/Kernel/FileSystem/DevFS.cpp index e1503698e8..cab9e86326 100644 --- a/Kernel/FileSystem/DevFS.cpp +++ b/Kernel/FileSystem/DevFS.cpp @@ -20,7 +20,7 @@ NonnullRefPtr<DevFS> DevFS::create() DevFS::DevFS() : m_root_inode(adopt_ref(*new DevFSRootDirectoryInode(*this))) { - LOCKER(m_lock); + Locker locker(m_lock); Device::for_each([&](Device& device) { // FIXME: Find a better way to not add MasterPTYs or SlavePTYs! if (device.is_master_pty() || (device.is_character_device() && device.major() == 201)) @@ -31,7 +31,7 @@ DevFS::DevFS() void DevFS::notify_new_device(Device& device) { - LOCKER(m_lock); + Locker locker(m_lock); auto new_device_inode = adopt_ref(*new DevFSDeviceInode(*this, device)); m_nodes.append(new_device_inode); m_root_inode->m_devices.append(new_device_inode); @@ -39,7 +39,7 @@ void DevFS::notify_new_device(Device& device) size_t DevFS::allocate_inode_index() { - LOCKER(m_lock); + Locker locker(m_lock); m_next_inode_index = m_next_inode_index.value() + 1; VERIFY(m_next_inode_index > 0); return 1 + m_next_inode_index.value(); @@ -66,7 +66,7 @@ NonnullRefPtr<Inode> DevFS::root_inode() const RefPtr<Inode> DevFS::get_inode(InodeIdentifier inode_id) const { - LOCKER(m_lock); + Locker locker(m_lock); if (inode_id.index() == 1) return m_root_inode; for (auto& node : m_nodes) { @@ -153,7 +153,7 @@ DevFSLinkInode::DevFSLinkInode(DevFS& fs, String name) } ssize_t DevFSLinkInode::read_bytes(off_t offset, ssize_t, UserOrKernelBuffer& buffer, FileDescription*) const { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(offset == 0); VERIFY(!m_link.is_null()); if (!buffer.write(((const u8*)m_link.substring_view(0).characters_without_null_termination()) + offset, m_link.length())) @@ -162,7 +162,7 @@ ssize_t DevFSLinkInode::read_bytes(off_t offset, ssize_t, UserOrKernelBuffer& bu } InodeMetadata DevFSLinkInode::metadata() const { - LOCKER(m_lock); + Locker locker(m_lock); InodeMetadata metadata; metadata.inode = { fsid(), index() }; metadata.mode = S_IFLNK | 0555; @@ -174,7 +174,7 @@ InodeMetadata DevFSLinkInode::metadata() const } ssize_t DevFSLinkInode::write_bytes(off_t offset, ssize_t count, const UserOrKernelBuffer& buffer, FileDescription*) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(offset == 0); VERIFY(buffer.is_kernel_buffer()); m_link = buffer.copy_into_string(count); @@ -190,7 +190,7 @@ DevFSDirectoryInode::~DevFSDirectoryInode() } InodeMetadata DevFSDirectoryInode::metadata() const { - LOCKER(m_lock); + Locker locker(m_lock); InodeMetadata metadata; metadata.inode = { fsid(), 1 }; metadata.mode = 0040555; @@ -202,17 +202,17 @@ InodeMetadata DevFSDirectoryInode::metadata() const } KResult DevFSDirectoryInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)>) const { - LOCKER(m_lock); + Locker locker(m_lock); return EINVAL; } RefPtr<Inode> DevFSDirectoryInode::lookup(StringView) { - LOCKER(m_lock); + Locker locker(m_lock); return nullptr; } KResultOr<size_t> DevFSDirectoryInode::directory_entry_count() const { - LOCKER(m_lock); + Locker locker(m_lock); return m_devices.size(); } @@ -223,7 +223,7 @@ DevFSRootDirectoryInode::DevFSRootDirectoryInode(DevFS& fs) } KResult DevFSRootDirectoryInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const { - LOCKER(m_parent_fs.m_lock); + Locker locker(m_parent_fs.m_lock); callback({ ".", identifier(), 0 }); callback({ "..", identifier(), 0 }); @@ -244,7 +244,7 @@ KResult DevFSRootDirectoryInode::traverse_as_directory(Function<bool(const FS::D } RefPtr<Inode> DevFSRootDirectoryInode::lookup(StringView name) { - LOCKER(m_parent_fs.m_lock); + Locker locker(m_parent_fs.m_lock); for (auto& subfolder : m_subfolders) { if (subfolder.name() == name) return subfolder; @@ -263,7 +263,7 @@ RefPtr<Inode> DevFSRootDirectoryInode::lookup(StringView name) } KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(const String& name, mode_t mode, dev_t, uid_t, gid_t) { - LOCKER(m_parent_fs.m_lock); + Locker locker(m_parent_fs.m_lock); InodeMetadata metadata; metadata.mode = mode; @@ -297,7 +297,7 @@ DevFSRootDirectoryInode::~DevFSRootDirectoryInode() } InodeMetadata DevFSRootDirectoryInode::metadata() const { - LOCKER(m_parent_fs.m_lock); + Locker locker(m_parent_fs.m_lock); InodeMetadata metadata; metadata.inode = { fsid(), 1 }; metadata.mode = 0040555; @@ -309,7 +309,7 @@ InodeMetadata DevFSRootDirectoryInode::metadata() const } KResultOr<size_t> DevFSRootDirectoryInode::directory_entry_count() const { - LOCKER(m_parent_fs.m_lock); + Locker locker(m_parent_fs.m_lock); return m_devices.size() + DevFSDirectoryInode::directory_entry_count().value(); } @@ -323,7 +323,7 @@ DevFSDeviceInode::~DevFSDeviceInode() } KResult DevFSDeviceInode::chown(uid_t uid, gid_t gid) { - LOCKER(m_lock); + Locker locker(m_lock); m_uid = uid; m_gid = gid; return KSuccess; @@ -331,7 +331,7 @@ KResult DevFSDeviceInode::chown(uid_t uid, gid_t gid) String DevFSDeviceInode::name() const { - LOCKER(m_lock); + Locker locker(m_lock); if (m_cached_name.is_null() || m_cached_name.is_empty()) const_cast<DevFSDeviceInode&>(*this).m_cached_name = m_attached_device->device_name(); return m_cached_name; @@ -339,7 +339,7 @@ String DevFSDeviceInode::name() const ssize_t DevFSDeviceInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer& buffer, FileDescription* description) const { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(!!description); if (!m_attached_device->can_read(*description, offset)) return 0; @@ -351,7 +351,7 @@ ssize_t DevFSDeviceInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBu InodeMetadata DevFSDeviceInode::metadata() const { - LOCKER(m_lock); + Locker locker(m_lock); InodeMetadata metadata; metadata.inode = { fsid(), index() }; metadata.mode = (m_attached_device->is_block_device() ? S_IFBLK : S_IFCHR) | m_attached_device->required_mode(); @@ -365,7 +365,7 @@ InodeMetadata DevFSDeviceInode::metadata() const } ssize_t DevFSDeviceInode::write_bytes(off_t offset, ssize_t count, const UserOrKernelBuffer& buffer, FileDescription* description) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(!!description); if (!m_attached_device->can_write(*description, offset)) return 0; @@ -381,7 +381,7 @@ DevFSPtsDirectoryInode::DevFSPtsDirectoryInode(DevFS& fs) } KResult DevFSPtsDirectoryInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const { - LOCKER(m_lock); + Locker locker(m_lock); callback({ ".", identifier(), 0 }); callback({ "..", identifier(), 0 }); return KSuccess; @@ -395,7 +395,7 @@ DevFSPtsDirectoryInode::~DevFSPtsDirectoryInode() } InodeMetadata DevFSPtsDirectoryInode::metadata() const { - LOCKER(m_lock); + Locker locker(m_lock); InodeMetadata metadata; metadata.inode = { fsid(), index() }; metadata.mode = 0040555; diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 1c1eaf5358..9b03792f54 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -69,7 +69,7 @@ Ext2FS::~Ext2FS() bool Ext2FS::flush_super_block() { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY((sizeof(ext2_super_block) % logical_block_size()) == 0); auto super_block_buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)&m_super_block); bool success = raw_write_blocks(2, (sizeof(ext2_super_block) / logical_block_size()), super_block_buffer); @@ -87,7 +87,7 @@ const ext2_group_desc& Ext2FS::group_descriptor(GroupIndex group_index) const bool Ext2FS::initialize() { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY((sizeof(ext2_super_block) % logical_block_size()) == 0); auto super_block_buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)&m_super_block); bool success = raw_read_blocks(2, (sizeof(ext2_super_block) / logical_block_size()), super_block_buffer); @@ -387,7 +387,7 @@ KResult Ext2FSInode::shrink_triply_indirect_block(BlockBasedFS::BlockIndex block KResult Ext2FSInode::flush_block_list() { - LOCKER(m_lock); + Locker locker(m_lock); if (m_block_list.is_empty()) { m_raw_inode.i_blocks = 0; @@ -628,7 +628,7 @@ Vector<Ext2FS::BlockIndex> Ext2FSInode::compute_block_list_impl_internal(const e void Ext2FS::free_inode(Ext2FSInode& inode) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(inode.m_raw_inode.i_links_count == 0); dbgln_if(EXT2_DEBUG, "Ext2FS[{}]::free_inode(): Inode {} has no more links, time to delete!", fsid(), inode.index()); @@ -662,7 +662,7 @@ void Ext2FS::free_inode(Ext2FSInode& inode) void Ext2FS::flush_block_group_descriptor_table() { - LOCKER(m_lock); + Locker locker(m_lock); unsigned blocks_to_write = ceil_div(m_block_group_count * sizeof(ext2_group_desc), block_size()); unsigned first_block_of_bgdt = block_size() == 1024 ? 2 : 1; auto buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)block_group_descriptors()); @@ -672,7 +672,7 @@ void Ext2FS::flush_block_group_descriptor_table() void Ext2FS::flush_writes() { - LOCKER(m_lock); + Locker locker(m_lock); if (m_super_block_dirty) { flush_super_block(); m_super_block_dirty = false; @@ -732,7 +732,7 @@ u64 Ext2FSInode::size() const InodeMetadata Ext2FSInode::metadata() const { - LOCKER(m_lock); + Locker locker(m_lock); InodeMetadata metadata; metadata.inode = identifier(); metadata.size = size(); @@ -759,7 +759,7 @@ InodeMetadata Ext2FSInode::metadata() const void Ext2FSInode::flush_metadata() { - LOCKER(m_lock); + Locker locker(m_lock); dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]::flush_metadata(): Flushing inode", identifier()); fs().write_ext2_inode(index(), m_raw_inode); if (is_directory()) { @@ -774,7 +774,7 @@ void Ext2FSInode::flush_metadata() RefPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(inode.fsid() == fsid()); { @@ -1049,7 +1049,7 @@ Ext2FS::FeaturesReadOnly Ext2FS::get_features_readonly() const KResult Ext2FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(is_directory()); auto buffer_or = read_entire(); @@ -1073,7 +1073,7 @@ KResult Ext2FSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntr KResult Ext2FSInode::write_directory(const Vector<Ext2FSDirectoryEntry>& entries) { - LOCKER(m_lock); + Locker locker(m_lock); int directory_size = 0; for (auto& entry : entries) @@ -1130,7 +1130,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FSInode::create_child(const String& name, mo KResult Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(is_directory()); if (name.length() > EXT2_NAME_LEN) @@ -1173,7 +1173,7 @@ KResult Ext2FSInode::add_child(Inode& child, const StringView& name, mode_t mode KResult Ext2FSInode::remove_child(const StringView& name) { - LOCKER(m_lock); + Locker locker(m_lock); dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]::remove_child(): Removing '{}'", identifier(), name); VERIFY(is_directory()); @@ -1239,7 +1239,7 @@ bool Ext2FS::write_ext2_inode(InodeIndex inode, const ext2_inode& e2inode) auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) -> KResultOr<Vector<BlockIndex>> { - LOCKER(m_lock); + Locker locker(m_lock); dbgln_if(EXT2_DEBUG, "Ext2FS: allocate_blocks(preferred group: {}, count {})", preferred_group_index, count); if (count == 0) return Vector<BlockIndex> {}; @@ -1304,7 +1304,7 @@ auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) -> KResultOr<InodeIndex> Ext2FS::allocate_inode(GroupIndex preferred_group) { dbgln_if(EXT2_DEBUG, "Ext2FS: allocate_inode(preferred_group: {})", preferred_group); - LOCKER(m_lock); + Locker locker(m_lock); // FIXME: We shouldn't refuse to allocate an inode if there is no group that can house the whole thing. // In those cases we should just spread it across multiple groups. @@ -1380,7 +1380,7 @@ auto Ext2FS::group_index_from_inode(InodeIndex inode) const -> GroupIndex KResultOr<bool> Ext2FS::get_inode_allocation_state(InodeIndex index) const { - LOCKER(m_lock); + Locker locker(m_lock); if (index == 0) return EINVAL; auto group_index = group_index_from_inode(index); @@ -1423,7 +1423,7 @@ KResult Ext2FS::update_bitmap_block(BlockIndex bitmap_block, size_t bit_index, b KResult Ext2FS::set_inode_allocation_state(InodeIndex inode_index, bool new_state) { - LOCKER(m_lock); + Locker locker(m_lock); auto group_index = group_index_from_inode(inode_index); unsigned index_in_group = inode_index.value() - ((group_index.value() - 1) * inodes_per_group()); unsigned bit_index = (index_in_group - 1) % inodes_per_group(); @@ -1458,7 +1458,7 @@ KResultOr<Ext2FS::CachedBitmap*> Ext2FS::get_bitmap_block(BlockIndex bitmap_bloc KResult Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_state) { VERIFY(block_index != 0); - LOCKER(m_lock); + Locker locker(m_lock); auto group_index = group_index_from_block_index(block_index); unsigned index_in_group = (block_index.value() - first_block_index().value()) - ((group_index.value() - 1) * blocks_per_group()); @@ -1471,7 +1471,7 @@ KResult Ext2FS::set_block_allocation_state(BlockIndex block_index, bool new_stat KResult Ext2FS::create_directory(Ext2FSInode& parent_inode, const String& name, mode_t mode, uid_t uid, gid_t gid) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(is_directory(mode)); auto inode_or_error = create_inode(parent_inode, name, mode, 0, uid, gid); @@ -1546,7 +1546,7 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(Ext2FSInode& parent_inode, bool Ext2FSInode::populate_lookup_cache() const { - LOCKER(m_lock); + Locker locker(m_lock); if (!m_lookup_cache.is_empty()) return true; HashMap<String, InodeIndex> children; @@ -1571,7 +1571,7 @@ RefPtr<Inode> Ext2FSInode::lookup(StringView name) dbgln_if(EXT2_DEBUG, "Ext2FSInode[{}]:lookup(): Looking up '{}'", identifier(), name); if (!populate_lookup_cache()) return {}; - LOCKER(m_lock); + Locker locker(m_lock); auto it = m_lookup_cache.find(name.hash(), [&](auto& entry) { return entry.key == name; }); if (it != m_lookup_cache.end()) return fs().get_inode({ fsid(), (*it).value }); @@ -1586,7 +1586,7 @@ void Ext2FSInode::one_ref_left() int Ext2FSInode::set_atime(time_t t) { - LOCKER(m_lock); + Locker locker(m_lock); if (fs().is_readonly()) return -EROFS; m_raw_inode.i_atime = t; @@ -1596,7 +1596,7 @@ int Ext2FSInode::set_atime(time_t t) int Ext2FSInode::set_ctime(time_t t) { - LOCKER(m_lock); + Locker locker(m_lock); if (fs().is_readonly()) return -EROFS; m_raw_inode.i_ctime = t; @@ -1606,7 +1606,7 @@ int Ext2FSInode::set_ctime(time_t t) int Ext2FSInode::set_mtime(time_t t) { - LOCKER(m_lock); + Locker locker(m_lock); if (fs().is_readonly()) return -EROFS; m_raw_inode.i_mtime = t; @@ -1616,7 +1616,7 @@ int Ext2FSInode::set_mtime(time_t t) KResult Ext2FSInode::increment_link_count() { - LOCKER(m_lock); + Locker locker(m_lock); if (fs().is_readonly()) return EROFS; if (m_raw_inode.i_links_count == max_link_count) @@ -1628,7 +1628,7 @@ KResult Ext2FSInode::increment_link_count() KResult Ext2FSInode::decrement_link_count() { - LOCKER(m_lock); + Locker locker(m_lock); if (fs().is_readonly()) return EROFS; VERIFY(m_raw_inode.i_links_count); @@ -1641,21 +1641,21 @@ KResult Ext2FSInode::decrement_link_count() void Ext2FS::uncache_inode(InodeIndex index) { - LOCKER(m_lock); + Locker locker(m_lock); m_inode_cache.remove(index); } KResultOr<size_t> Ext2FSInode::directory_entry_count() const { VERIFY(is_directory()); - LOCKER(m_lock); + Locker locker(m_lock); populate_lookup_cache(); return m_lookup_cache.size(); } KResult Ext2FSInode::chmod(mode_t mode) { - LOCKER(m_lock); + Locker locker(m_lock); if (m_raw_inode.i_mode == mode) return KSuccess; m_raw_inode.i_mode = mode; @@ -1665,7 +1665,7 @@ KResult Ext2FSInode::chmod(mode_t mode) KResult Ext2FSInode::chown(uid_t uid, gid_t gid) { - LOCKER(m_lock); + Locker locker(m_lock); if (m_raw_inode.i_uid == uid && m_raw_inode.i_gid == gid) return KSuccess; m_raw_inode.i_uid = uid; @@ -1676,7 +1676,7 @@ KResult Ext2FSInode::chown(uid_t uid, gid_t gid) KResult Ext2FSInode::truncate(u64 size) { - LOCKER(m_lock); + Locker locker(m_lock); if (static_cast<u64>(m_raw_inode.i_size) == size) return KSuccess; if (auto result = resize(size); result.is_error()) @@ -1687,7 +1687,7 @@ KResult Ext2FSInode::truncate(u64 size) KResultOr<int> Ext2FSInode::get_block_address(int index) { - LOCKER(m_lock); + Locker locker(m_lock); if (m_block_list.is_empty()) m_block_list = compute_block_list(); @@ -1700,31 +1700,31 @@ KResultOr<int> Ext2FSInode::get_block_address(int index) unsigned Ext2FS::total_block_count() const { - LOCKER(m_lock); + Locker locker(m_lock); return super_block().s_blocks_count; } unsigned Ext2FS::free_block_count() const { - LOCKER(m_lock); + Locker locker(m_lock); return super_block().s_free_blocks_count; } unsigned Ext2FS::total_inode_count() const { - LOCKER(m_lock); + Locker locker(m_lock); return super_block().s_inodes_count; } unsigned Ext2FS::free_inode_count() const { - LOCKER(m_lock); + Locker locker(m_lock); return super_block().s_free_inodes_count; } KResult Ext2FS::prepare_to_unmount() const { - LOCKER(m_lock); + Locker locker(m_lock); for (auto& it : m_inode_cache) { if (it.value->ref_count() > 1) diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index a190c07f87..3365f07ad5 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -74,7 +74,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction_blocking(FIFO::Di FIFO::FIFO(uid_t uid) : m_uid(uid) { - LOCKER(all_fifos().lock()); + Locker locker(all_fifos().lock()); all_fifos().resource().set(this); m_fifo_id = ++s_next_fifo_id; @@ -86,7 +86,7 @@ FIFO::FIFO(uid_t uid) FIFO::~FIFO() { - LOCKER(all_fifos().lock()); + Locker locker(all_fifos().lock()); all_fifos().resource().remove(this); } diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp index 70a6be8ead..9ea9f23842 100644 --- a/Kernel/FileSystem/FileDescription.cpp +++ b/Kernel/FileSystem/FileDescription.cpp @@ -99,7 +99,7 @@ Thread::FileBlocker::BlockFlags FileDescription::should_unblock(Thread::FileBloc KResult FileDescription::stat(::stat& buffer) { - LOCKER(m_lock); + Locker locker(m_lock); // FIXME: This is a little awkward, why can't we always forward to File::stat()? if (m_inode) return metadata().stat(buffer); @@ -108,7 +108,7 @@ KResult FileDescription::stat(::stat& buffer) KResultOr<off_t> FileDescription::seek(off_t offset, int whence) { - LOCKER(m_lock); + Locker locker(m_lock); if (!m_file->is_seekable()) return ESPIPE; @@ -147,7 +147,7 @@ KResultOr<off_t> FileDescription::seek(off_t offset, int whence) KResultOr<size_t> FileDescription::read(UserOrKernelBuffer& buffer, size_t count) { - LOCKER(m_lock); + Locker locker(m_lock); if (Checked<off_t>::addition_would_overflow(m_current_offset, count)) return EOVERFLOW; auto nread_or_error = m_file->read(*this, offset(), buffer, count); @@ -161,7 +161,7 @@ KResultOr<size_t> FileDescription::read(UserOrKernelBuffer& buffer, size_t count KResultOr<size_t> FileDescription::write(const UserOrKernelBuffer& data, size_t size) { - LOCKER(m_lock); + Locker locker(m_lock); if (Checked<off_t>::addition_would_overflow(m_current_offset, size)) return EOVERFLOW; auto nwritten_or_error = m_file->write(*this, offset(), data, size); @@ -193,7 +193,7 @@ KResultOr<NonnullOwnPtr<KBuffer>> FileDescription::read_entire_file() ssize_t FileDescription::get_dir_entries(UserOrKernelBuffer& buffer, ssize_t size) { - LOCKER(m_lock, Lock::Mode::Shared); + Locker locker(m_lock, Lock::Mode::Shared); if (!is_directory()) return -ENOTDIR; @@ -309,13 +309,13 @@ InodeMetadata FileDescription::metadata() const KResultOr<Region*> FileDescription::mmap(Process& process, const Range& range, u64 offset, int prot, bool shared) { - LOCKER(m_lock); + Locker locker(m_lock); return m_file->mmap(process, *this, range, offset, prot, shared); } KResult FileDescription::truncate(u64 length) { - LOCKER(m_lock); + Locker locker(m_lock); return m_file->truncate(length); } @@ -352,7 +352,7 @@ const Socket* FileDescription::socket() const void FileDescription::set_file_flags(u32 flags) { - LOCKER(m_lock); + Locker locker(m_lock); m_is_blocking = !(flags & O_NONBLOCK); m_should_append = flags & O_APPEND; m_direct = flags & O_DIRECT; @@ -361,13 +361,13 @@ void FileDescription::set_file_flags(u32 flags) KResult FileDescription::chmod(mode_t mode) { - LOCKER(m_lock); + Locker locker(m_lock); return m_file->chmod(*this, mode); } KResult FileDescription::chown(uid_t uid, gid_t gid) { - LOCKER(m_lock); + Locker locker(m_lock); return m_file->chown(*this, uid, gid); } diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index 17121debcf..56cb560bc7 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -112,7 +112,7 @@ Inode::~Inode() void Inode::will_be_destroyed() { - LOCKER(m_lock); + Locker locker(m_lock); if (m_metadata_dirty) flush_metadata(); } @@ -144,13 +144,13 @@ KResult Inode::decrement_link_count() void Inode::set_shared_vmobject(SharedInodeVMObject& vmobject) { - LOCKER(m_lock); + Locker locker(m_lock); m_shared_vmobject = vmobject; } bool Inode::bind_socket(LocalSocket& socket) { - LOCKER(m_lock); + Locker locker(m_lock); if (m_socket) return false; m_socket = socket; @@ -159,7 +159,7 @@ bool Inode::bind_socket(LocalSocket& socket) bool Inode::unbind_socket() { - LOCKER(m_lock); + Locker locker(m_lock); if (!m_socket) return false; m_socket = nullptr; @@ -168,21 +168,21 @@ bool Inode::unbind_socket() void Inode::register_watcher(Badge<InodeWatcher>, InodeWatcher& watcher) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(!m_watchers.contains(&watcher)); m_watchers.set(&watcher); } void Inode::unregister_watcher(Badge<InodeWatcher>, InodeWatcher& watcher) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_watchers.contains(&watcher)); m_watchers.remove(&watcher); } NonnullRefPtr<FIFO> Inode::fifo() { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(metadata().is_fifo()); // FIXME: Release m_fifo when it is closed by all readers and writers @@ -195,7 +195,7 @@ NonnullRefPtr<FIFO> Inode::fifo() void Inode::set_metadata_dirty(bool metadata_dirty) { - LOCKER(m_lock); + Locker locker(m_lock); if (metadata_dirty) { // Sanity check. @@ -217,7 +217,7 @@ void Inode::set_metadata_dirty(bool metadata_dirty) void Inode::did_add_child(const InodeIdentifier& child_id) { - LOCKER(m_lock); + Locker locker(m_lock); for (auto& watcher : m_watchers) { watcher->notify_child_added({}, child_id); } @@ -225,7 +225,7 @@ void Inode::did_add_child(const InodeIdentifier& child_id) void Inode::did_remove_child(const InodeIdentifier& child_id) { - LOCKER(m_lock); + Locker locker(m_lock); for (auto& watcher : m_watchers) { watcher->notify_child_removed({}, child_id); } @@ -235,7 +235,7 @@ KResult Inode::prepare_to_write_data() { // FIXME: It's a poor design that filesystems are expected to call this before writing out data. // We should funnel everything through an interface at the VFS layer so this can happen from a single place. - LOCKER(m_lock); + Locker locker(m_lock); if (fs().is_readonly()) return EROFS; auto metadata = this->metadata(); @@ -248,13 +248,13 @@ KResult Inode::prepare_to_write_data() RefPtr<SharedInodeVMObject> Inode::shared_vmobject() const { - LOCKER(m_lock); + Locker locker(m_lock); return m_shared_vmobject.strong_ref(); } bool Inode::is_shared_vmobject(const SharedInodeVMObject& other) const { - LOCKER(m_lock); + Locker locker(m_lock); return m_shared_vmobject.unsafe_ptr() == &other; } diff --git a/Kernel/FileSystem/InodeWatcher.cpp b/Kernel/FileSystem/InodeWatcher.cpp index 20baf7d448..06b208c471 100644 --- a/Kernel/FileSystem/InodeWatcher.cpp +++ b/Kernel/FileSystem/InodeWatcher.cpp @@ -39,7 +39,7 @@ bool InodeWatcher::can_write(const FileDescription&, size_t) const KResultOr<size_t> InodeWatcher::read(FileDescription&, u64, UserOrKernelBuffer& buffer, size_t buffer_size) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(!m_queue.is_empty() || !m_inode); if (!m_inode) @@ -76,21 +76,21 @@ String InodeWatcher::absolute_path(const FileDescription&) const void InodeWatcher::notify_inode_event(Badge<Inode>, InodeWatcherEvent::Type event_type) { - LOCKER(m_lock); + Locker locker(m_lock); m_queue.enqueue({ event_type }); evaluate_block_conditions(); } void InodeWatcher::notify_child_added(Badge<Inode>, const InodeIdentifier& child_id) { - LOCKER(m_lock); + Locker locker(m_lock); m_queue.enqueue({ InodeWatcherEvent::Type::ChildAdded, child_id.index().value() }); evaluate_block_conditions(); } void InodeWatcher::notify_child_removed(Badge<Inode>, const InodeIdentifier& child_id) { - LOCKER(m_lock); + Locker locker(m_lock); m_queue.enqueue({ InodeWatcherEvent::Type::ChildRemoved, child_id.index().value() }); evaluate_block_conditions(); } diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index d28915515f..163dc3cb3c 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -475,7 +475,7 @@ void Plan9FS::Plan9FSBlockCondition::try_unblock(Plan9FS::Blocker& blocker) bool Plan9FS::is_complete(const ReceiveCompletion& completion) { - LOCKER(m_lock); + Locker locker(m_lock); if (m_completions.contains(completion.tag)) { // If it's still in the map then it can't be complete VERIFY(!completion.completed); @@ -495,12 +495,12 @@ KResult Plan9FS::post_message(Message& message, RefPtr<ReceiveCompletion> comple size_t size = buffer.size(); auto& description = file_description(); - LOCKER(m_send_lock); + Locker locker(m_send_lock); if (completion) { // Save the completion record *before* we send the message. This // ensures that it exists when the thread reads the response - LOCKER(m_lock); + Locker locker(m_lock); auto tag = completion->tag; m_completions.set(tag, completion.release_nonnull()); // TODO: What if there is a collision? Do we need to wait until @@ -569,7 +569,7 @@ KResult Plan9FS::read_and_dispatch_one_message() if (result.is_error()) return result; - LOCKER(m_lock); + Locker locker(m_lock); auto optional_completion = m_completions.get(header.tag); if (optional_completion.has_value()) { @@ -647,7 +647,7 @@ void Plan9FS::thread_main() auto result = read_and_dispatch_one_message(); if (result.is_error()) { // If we fail to read, wake up everyone with an error. - LOCKER(m_lock); + Locker locker(m_lock); for (auto& it : m_completions) { it.value->result = result; @@ -698,7 +698,7 @@ KResult Plan9FSInode::ensure_open_for_mode(int mode) u8 p9_mode = 0; { - LOCKER(m_lock); + Locker locker(m_lock); // If it's already open in this mode, we're done. if ((m_open_mode & mode) == mode) diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp index 486dc7e13b..01c439ad12 100644 --- a/Kernel/FileSystem/ProcFS.cpp +++ b/Kernel/FileSystem/ProcFS.cpp @@ -503,7 +503,7 @@ static bool procfs$net_adapters(InodeIdentifier, KBufferBuilder& builder) static bool procfs$net_arp(InodeIdentifier, KBufferBuilder& builder) { JsonArraySerializer array { builder }; - LOCKER(arp_table().lock(), Lock::Mode::Shared); + Locker locker(arp_table().lock(), Lock::Mode::Shared); for (auto& it : arp_table().resource()) { auto obj = array.add_object(); obj.add("mac_address", it.value.to_string()); @@ -884,7 +884,7 @@ static bool read_sys_bool(InodeIdentifier inode_id, KBufferBuilder& builder) u8 buffer[2]; auto* lockable_bool = reinterpret_cast<Lockable<bool>*>(variable.address); { - LOCKER(lockable_bool->lock(), Lock::Mode::Shared); + Locker locker(lockable_bool->lock(), Lock::Mode::Shared); buffer[0] = lockable_bool->resource() ? '1' : '0'; } buffer[1] = '\n'; @@ -914,7 +914,7 @@ static ssize_t write_sys_bool(InodeIdentifier inode_id, const UserOrKernelBuffer auto* lockable_bool = reinterpret_cast<Lockable<bool>*>(variable.address); { - LOCKER(lockable_bool->lock()); + Locker locker(lockable_bool->lock()); lockable_bool->resource() = value == '1'; } variable.notify(); @@ -927,7 +927,7 @@ static bool read_sys_string(InodeIdentifier inode_id, KBufferBuilder& builder) VERIFY(variable.type == SysVariable::Type::String); auto* lockable_string = reinterpret_cast<Lockable<String>*>(variable.address); - LOCKER(lockable_string->lock(), Lock::Mode::Shared); + Locker locker(lockable_string->lock(), Lock::Mode::Shared); builder.append_bytes(lockable_string->resource().bytes()); return true; } @@ -943,7 +943,7 @@ static ssize_t write_sys_string(InodeIdentifier inode_id, const UserOrKernelBuff { auto* lockable_string = reinterpret_cast<Lockable<String>*>(variable.address); - LOCKER(lockable_string->lock()); + Locker locker(lockable_string->lock()); lockable_string->resource() = move(string_copy); } variable.notify(); @@ -1012,7 +1012,7 @@ RefPtr<Inode> ProcFS::get_inode(InodeIdentifier inode_id) const if (inode_id == root_inode()->identifier()) return m_root_inode; - LOCKER(m_inodes_lock); + Locker locker(m_inodes_lock); auto it = m_inodes.find(inode_id.index().value()); if (it != m_inodes.end()) { // It's possible that the ProcFSInode ref count was dropped to 0 or @@ -1037,7 +1037,7 @@ ProcFSInode::ProcFSInode(ProcFS& fs, InodeIndex index) ProcFSInode::~ProcFSInode() { - LOCKER(fs().m_inodes_lock); + Locker locker(fs().m_inodes_lock); auto it = fs().m_inodes.find(index().value()); if (it != fs().m_inodes.end() && it->value == this) fs().m_inodes.remove(it); diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp index bc0d874140..9428940e96 100644 --- a/Kernel/FileSystem/TmpFS.cpp +++ b/Kernel/FileSystem/TmpFS.cpp @@ -39,7 +39,7 @@ NonnullRefPtr<Inode> TmpFS::root_inode() const void TmpFS::register_inode(TmpFSInode& inode) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(inode.identifier().fsid() == fsid()); auto index = inode.identifier().index(); @@ -48,7 +48,7 @@ void TmpFS::register_inode(TmpFSInode& inode) void TmpFS::unregister_inode(InodeIdentifier identifier) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(identifier.fsid() == fsid()); m_inodes.remove(identifier.index()); @@ -56,14 +56,14 @@ void TmpFS::unregister_inode(InodeIdentifier identifier) unsigned TmpFS::next_inode_index() { - LOCKER(m_lock); + Locker locker(m_lock); return m_next_inode_index++; } RefPtr<Inode> TmpFS::get_inode(InodeIdentifier identifier) const { - LOCKER(m_lock, Lock::Mode::Shared); + Locker locker(m_lock, Lock::Mode::Shared); VERIFY(identifier.fsid() == fsid()); auto it = m_inodes.find(identifier.index()); @@ -104,14 +104,14 @@ NonnullRefPtr<TmpFSInode> TmpFSInode::create_root(TmpFS& fs) InodeMetadata TmpFSInode::metadata() const { - LOCKER(m_lock, Lock::Mode::Shared); + Locker locker(m_lock, Lock::Mode::Shared); return m_metadata; } KResult TmpFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntryView&)> callback) const { - LOCKER(m_lock, Lock::Mode::Shared); + Locker locker(m_lock, Lock::Mode::Shared); if (!is_directory()) return ENOTDIR; @@ -128,7 +128,7 @@ KResult TmpFSInode::traverse_as_directory(Function<bool(const FS::DirectoryEntry ssize_t TmpFSInode::read_bytes(off_t offset, ssize_t size, UserOrKernelBuffer& buffer, FileDescription*) const { - LOCKER(m_lock, Lock::Mode::Shared); + Locker locker(m_lock, Lock::Mode::Shared); VERIFY(!is_directory()); VERIFY(size >= 0); VERIFY(offset >= 0); @@ -149,7 +149,7 @@ ssize_t TmpFSInode::read_bytes(off_t offset, ssize_t size, UserOrKernelBuffer& b ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelBuffer& buffer, FileDescription*) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(!is_directory()); VERIFY(offset >= 0); @@ -193,7 +193,7 @@ ssize_t TmpFSInode::write_bytes(off_t offset, ssize_t size, const UserOrKernelBu RefPtr<Inode> TmpFSInode::lookup(StringView name) { - LOCKER(m_lock, Lock::Mode::Shared); + Locker locker(m_lock, Lock::Mode::Shared); VERIFY(is_directory()); if (name == ".") @@ -209,7 +209,7 @@ RefPtr<Inode> TmpFSInode::lookup(StringView name) KResultOr<size_t> TmpFSInode::directory_entry_count() const { - LOCKER(m_lock, Lock::Mode::Shared); + Locker locker(m_lock, Lock::Mode::Shared); VERIFY(is_directory()); return 2 + m_children.size(); } @@ -232,7 +232,7 @@ void TmpFSInode::flush_metadata() KResult TmpFSInode::chmod(mode_t mode) { - LOCKER(m_lock); + Locker locker(m_lock); m_metadata.mode = mode; notify_watchers(); @@ -241,7 +241,7 @@ KResult TmpFSInode::chmod(mode_t mode) KResult TmpFSInode::chown(uid_t uid, gid_t gid) { - LOCKER(m_lock); + Locker locker(m_lock); m_metadata.uid = uid; m_metadata.gid = gid; @@ -251,7 +251,7 @@ KResult TmpFSInode::chown(uid_t uid, gid_t gid) KResultOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(const String& name, mode_t mode, dev_t dev, uid_t uid, gid_t gid) { - LOCKER(m_lock); + Locker locker(m_lock); // TODO: Support creating devices on TmpFS. if (dev != 0) @@ -276,7 +276,7 @@ KResultOr<NonnullRefPtr<Inode>> TmpFSInode::create_child(const String& name, mod KResult TmpFSInode::add_child(Inode& child, const StringView& name, mode_t) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(is_directory()); VERIFY(child.fsid() == fsid()); @@ -290,7 +290,7 @@ KResult TmpFSInode::add_child(Inode& child, const StringView& name, mode_t) KResult TmpFSInode::remove_child(const StringView& name) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(is_directory()); if (name == "." || name == "..") @@ -307,7 +307,7 @@ KResult TmpFSInode::remove_child(const StringView& name) KResult TmpFSInode::truncate(u64 size) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(!is_directory()); if (size == 0) @@ -337,7 +337,7 @@ KResult TmpFSInode::truncate(u64 size) int TmpFSInode::set_atime(time_t time) { - LOCKER(m_lock); + Locker locker(m_lock); m_metadata.atime = time; set_metadata_dirty(true); @@ -347,7 +347,7 @@ int TmpFSInode::set_atime(time_t time) int TmpFSInode::set_ctime(time_t time) { - LOCKER(m_lock); + Locker locker(m_lock); m_metadata.ctime = time; notify_watchers(); @@ -356,7 +356,7 @@ int TmpFSInode::set_ctime(time_t time) int TmpFSInode::set_mtime(time_t time) { - LOCKER(m_lock); + Locker locker(m_lock); m_metadata.mtime = time; notify_watchers(); diff --git a/Kernel/FileSystem/VirtualFileSystem.cpp b/Kernel/FileSystem/VirtualFileSystem.cpp index 4be7ffcde9..4753c1d6de 100644 --- a/Kernel/FileSystem/VirtualFileSystem.cpp +++ b/Kernel/FileSystem/VirtualFileSystem.cpp @@ -50,7 +50,7 @@ InodeIdentifier VFS::root_inode_id() const KResult VFS::mount(FS& file_system, Custody& mount_point, int flags) { - LOCKER(m_lock); + Locker locker(m_lock); auto& inode = mount_point.inode(); dbgln("VFS: Mounting {} at {} (inode: {}) with flags {}", @@ -66,7 +66,7 @@ KResult VFS::mount(FS& file_system, Custody& mount_point, int flags) KResult VFS::bind_mount(Custody& source, Custody& mount_point, int flags) { - LOCKER(m_lock); + Locker locker(m_lock); dbgln("VFS: Bind-mounting {} at {}", source.absolute_path(), mount_point.absolute_path()); // FIXME: check that this is not already a mount point @@ -77,7 +77,7 @@ KResult VFS::bind_mount(Custody& source, Custody& mount_point, int flags) KResult VFS::remount(Custody& mount_point, int new_flags) { - LOCKER(m_lock); + Locker locker(m_lock); dbgln("VFS: Remounting {}", mount_point.absolute_path()); @@ -91,7 +91,7 @@ KResult VFS::remount(Custody& mount_point, int new_flags) KResult VFS::unmount(Inode& guest_inode) { - LOCKER(m_lock); + Locker locker(m_lock); dbgln("VFS: unmount called with inode {}", guest_inode.identifier()); for (size_t i = 0; i < m_mounts.size(); ++i) { diff --git a/Kernel/Lock.h b/Kernel/Lock.h index 82acb319a9..55ed7d2757 100644 --- a/Kernel/Lock.h +++ b/Kernel/Lock.h @@ -127,8 +127,6 @@ private: bool m_locked { true }; }; -#define LOCKER(...) Locker locker(__VA_ARGS__) - template<typename T> class Lockable { public: @@ -142,7 +140,7 @@ public: [[nodiscard]] T lock_and_copy() { - LOCKER(m_lock); + Locker locker(m_lock); return m_resource; } diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp index 3063ec1e3e..d202f7e1f6 100644 --- a/Kernel/Net/IPv4Socket.cpp +++ b/Kernel/Net/IPv4Socket.cpp @@ -53,13 +53,13 @@ IPv4Socket::IPv4Socket(int type, int protocol) if (m_buffer_mode == BufferMode::Bytes) { m_scratch_buffer = KBuffer::create_with_size(65536); } - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().set(this); } IPv4Socket::~IPv4Socket() { - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().remove(this); } @@ -108,7 +108,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr KResult IPv4Socket::listen(size_t backlog) { - LOCKER(lock()); + Locker locker(lock()); int rc = allocate_local_port_if_needed(); if (rc < 0) return EADDRINUSE; @@ -172,7 +172,7 @@ int IPv4Socket::allocate_local_port_if_needed() KResultOr<size_t> IPv4Socket::sendto(FileDescription&, const UserOrKernelBuffer& data, size_t data_length, [[maybe_unused]] int flags, Userspace<const sockaddr*> addr, socklen_t addr_length) { - LOCKER(lock()); + Locker locker(lock()); if (addr && addr_length != sizeof(sockaddr_in)) return EINVAL; @@ -357,7 +357,7 @@ KResultOr<size_t> IPv4Socket::recvfrom(FileDescription& description, UserOrKerne bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port, KBuffer&& packet, const Time& packet_timestamp) { - LOCKER(lock()); + Locker locker(lock()); if (is_shut_down_for_reading()) return false; diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 6a73450b92..bb7b1cbe86 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -26,7 +26,7 @@ Lockable<InlineLinkedList<LocalSocket>>& LocalSocket::all_sockets() void LocalSocket::for_each(Function<void(const LocalSocket&)> callback) { - LOCKER(all_sockets().lock(), Lock::Mode::Shared); + Locker locker(all_sockets().lock(), Lock::Mode::Shared); for (auto& socket : all_sockets().resource()) callback(socket); } @@ -39,7 +39,7 @@ KResultOr<NonnullRefPtr<Socket>> LocalSocket::create(int type) LocalSocket::LocalSocket(int type) : Socket(AF_LOCAL, type, 0) { - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().append(this); auto current_process = Process::current(); @@ -59,7 +59,7 @@ LocalSocket::LocalSocket(int type) LocalSocket::~LocalSocket() { - LOCKER(all_sockets().lock()); + Locker locker(all_sockets().lock()); all_sockets().resource().remove(this); } @@ -182,7 +182,7 @@ KResult LocalSocket::connect(FileDescription& description, Userspace<const socka KResult LocalSocket::listen(size_t backlog) { - LOCKER(lock()); + Locker locker(lock()); if (type() != SOCK_STREAM) return EOPNOTSUPP; set_backlog(backlog); @@ -433,7 +433,7 @@ NonnullRefPtrVector<FileDescription>& LocalSocket::sendfd_queue_for(const FileDe KResult LocalSocket::sendfd(const FileDescription& socket_description, FileDescription& passing_description) { - LOCKER(lock()); + Locker locker(lock()); auto role = this->role(socket_description); if (role != Role::Connected && role != Role::Accepted) return EINVAL; @@ -447,7 +447,7 @@ KResult LocalSocket::sendfd(const FileDescription& socket_description, FileDescr KResultOr<NonnullRefPtr<FileDescription>> LocalSocket::recvfd(const FileDescription& socket_description) { - LOCKER(lock()); + Locker locker(lock()); auto role = this->role(socket_description); if (role != Role::Connected && role != Role::Accepted) return EINVAL; diff --git a/Kernel/Net/NetworkAdapter.cpp b/Kernel/Net/NetworkAdapter.cpp index 53a00a3b9b..658c694a67 100644 --- a/Kernel/Net/NetworkAdapter.cpp +++ b/Kernel/Net/NetworkAdapter.cpp @@ -28,14 +28,14 @@ static Lockable<HashTable<NetworkAdapter*>>& all_adapters() void NetworkAdapter::for_each(Function<void(NetworkAdapter&)> callback) { - LOCKER(all_adapters().lock()); + Locker locker(all_adapters().lock()); for (auto& it : all_adapters().resource()) callback(*it); } RefPtr<NetworkAdapter> NetworkAdapter::from_ipv4_address(const IPv4Address& address) { - LOCKER(all_adapters().lock()); + Locker locker(all_adapters().lock()); for (auto* adapter : all_adapters().resource()) { if (adapter->ipv4_address() == address) return adapter; diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index 7f97f6cbfc..d3a13c27fd 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -196,7 +196,7 @@ void handle_icmp(const EthernetFrameHeader& eth, const IPv4Packet& ipv4_packet, { NonnullRefPtrVector<IPv4Socket> icmp_sockets; { - LOCKER(IPv4Socket::all_sockets().lock(), Lock::Mode::Shared); + Locker locker(IPv4Socket::all_sockets().lock(), Lock::Mode::Shared); for (auto* socket : IPv4Socket::all_sockets().resource()) { if (socket->protocol() != (unsigned)IPv4Protocol::ICMP) continue; @@ -330,7 +330,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp) return; } - LOCKER(socket->lock()); + Locker locker(socket->lock()); VERIFY(socket->type() == SOCK_STREAM); VERIFY(socket->local_port() == tcp_packet.destination_port()); @@ -361,7 +361,7 @@ void handle_tcp(const IPv4Packet& ipv4_packet, const Time& packet_timestamp) dmesgln("handle_tcp: couldn't create client socket"); return; } - LOCKER(client->lock()); + Locker locker(client->lock()); dbgln_if(TCP_DEBUG, "handle_tcp: created new client socket with tuple {}", client->tuple().to_string()); client->set_sequence_number(1000); client->set_ack_number(tcp_packet.sequence_number() + payload_size + 1); diff --git a/Kernel/Net/Routing.cpp b/Kernel/Net/Routing.cpp index c642e5bc8e..6f2f944fb6 100644 --- a/Kernel/Net/Routing.cpp +++ b/Kernel/Net/Routing.cpp @@ -104,7 +104,7 @@ Lockable<HashMap<IPv4Address, MACAddress>>& arp_table() void update_arp_table(const IPv4Address& ip_addr, const MACAddress& addr) { - LOCKER(arp_table().lock()); + Locker locker(arp_table().lock()); arp_table().resource().set(ip_addr, addr); s_arp_table_block_condition->unblock(ip_addr, addr); @@ -196,7 +196,7 @@ RoutingDecision route_to(const IPv4Address& target, const IPv4Address& source, c return { adapter, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; { - LOCKER(arp_table().lock()); + Locker locker(arp_table().lock()); auto addr = arp_table().resource().get(next_hop_ip); if (addr.has_value()) { dbgln_if(ROUTING_DEBUG, "Routing: Using cached ARP entry for {} ({})", next_hop_ip, addr.value().to_string()); diff --git a/Kernel/Net/Socket.cpp b/Kernel/Net/Socket.cpp index 6c36f8ff1d..b7c48c73cc 100644 --- a/Kernel/Net/Socket.cpp +++ b/Kernel/Net/Socket.cpp @@ -51,7 +51,7 @@ void Socket::set_setup_state(SetupState new_setup_state) RefPtr<Socket> Socket::accept() { - LOCKER(m_lock); + Locker locker(m_lock); if (m_pending.is_empty()) return nullptr; dbgln_if(SOCKET_DEBUG, "Socket({}) de-queueing connection", this); @@ -69,7 +69,7 @@ RefPtr<Socket> Socket::accept() KResult Socket::queue_connection_from(NonnullRefPtr<Socket> peer) { dbgln_if(SOCKET_DEBUG, "Socket({}) queueing connection", this); - LOCKER(m_lock); + Locker locker(m_lock); if (m_pending.size() >= m_backlog) return ECONNREFUSED; m_pending.append(peer); @@ -240,7 +240,7 @@ KResultOr<size_t> Socket::write(FileDescription& description, u64, const UserOrK KResult Socket::shutdown(int how) { - LOCKER(lock()); + Locker locker(lock()); if (type() == SOCK_STREAM && !is_connected()) return ENOTCONN; if (m_role == Role::Listener) @@ -263,7 +263,7 @@ KResult Socket::stat(::stat& st) const void Socket::set_connected(bool connected) { - LOCKER(lock()); + Locker locker(lock()); if (m_connected == connected) return; m_connected = connected; diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index d7608cd5f5..ae06bffec7 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -20,7 +20,7 @@ namespace Kernel { void TCPSocket::for_each(Function<void(const TCPSocket&)> callback) { - LOCKER(sockets_by_tuple().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared); for (auto& it : sockets_by_tuple().resource()) callback(*it.value); } @@ -38,7 +38,7 @@ void TCPSocket::set_state(State new_state) m_role = Role::Connected; if (new_state == State::Closed) { - LOCKER(closing_sockets().lock()); + Locker locker(closing_sockets().lock()); closing_sockets().resource().remove(tuple()); } @@ -62,7 +62,7 @@ Lockable<HashMap<IPv4SocketTuple, TCPSocket*>>& TCPSocket::sockets_by_tuple() RefPtr<TCPSocket> TCPSocket::from_tuple(const IPv4SocketTuple& tuple) { - LOCKER(sockets_by_tuple().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_tuple().lock(), Lock::Mode::Shared); auto exact_match = sockets_by_tuple().resource().get(tuple); if (exact_match.has_value()) @@ -90,7 +90,7 @@ RefPtr<TCPSocket> TCPSocket::create_client(const IPv4Address& new_local_address, { auto tuple = IPv4SocketTuple(new_local_address, new_local_port, new_peer_address, new_peer_port); - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); if (sockets_by_tuple().resource().contains(tuple)) return {}; @@ -131,7 +131,7 @@ TCPSocket::TCPSocket(int protocol) TCPSocket::~TCPSocket() { - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); sockets_by_tuple().resource().remove(tuple()); dbgln_if(TCP_SOCKET_DEBUG, "~TCPSocket in state {}", to_string(state())); @@ -190,7 +190,7 @@ KResult TCPSocket::send_tcp_packet(u16 flags, const UserOrKernelBuffer* payload, tcp_packet.set_checksum(compute_tcp_checksum(local_address(), peer_address(), tcp_packet, payload_size)); if (tcp_packet.has_syn() || payload_size > 0) { - LOCKER(m_not_acked_lock); + Locker locker(m_not_acked_lock); m_not_acked.append({ m_sequence_number, move(buffer) }); send_outgoing_packets(); return KSuccess; @@ -218,7 +218,7 @@ void TCPSocket::send_outgoing_packets() auto now = kgettimeofday(); - LOCKER(m_not_acked_lock, Lock::Mode::Shared); + Locker locker(m_not_acked_lock, Lock::Mode::Shared); for (auto& packet : m_not_acked) { auto diff = now - packet.tx_time; if (diff <= Time::from_nanoseconds(500'000'000)) @@ -274,7 +274,7 @@ void TCPSocket::receive_tcp_packet(const TCPPacket& packet, u16 size) dbgln_if(TCP_SOCKET_DEBUG, "TCPSocket: receive_tcp_packet: {}", ack_number); int removed = 0; - LOCKER(m_not_acked_lock); + Locker locker(m_not_acked_lock); while (!m_not_acked.is_empty()) { auto& packet = m_not_acked.first(); @@ -349,7 +349,7 @@ KResult TCPSocket::protocol_bind() KResult TCPSocket::protocol_listen() { - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); if (sockets_by_tuple().resource().contains(tuple())) return EADDRINUSE; sockets_by_tuple().resource().set(tuple(), this); @@ -408,7 +408,7 @@ int TCPSocket::protocol_allocate_local_port() static const u16 ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port; u16 first_scan_port = first_ephemeral_port + get_good_random<u16>() % ephemeral_port_range_size; - LOCKER(sockets_by_tuple().lock()); + Locker locker(sockets_by_tuple().lock()); for (u16 port = first_scan_port;;) { IPv4SocketTuple proposed_tuple(local_address(), port, peer_address(), peer_port()); @@ -468,7 +468,7 @@ KResult TCPSocket::close() set_state(State::LastAck); } - LOCKER(closing_sockets().lock()); + Locker locker(closing_sockets().lock()); closing_sockets().resource().set(tuple(), *this); return result; } diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp index 309823d626..fe6068974b 100644 --- a/Kernel/Net/UDPSocket.cpp +++ b/Kernel/Net/UDPSocket.cpp @@ -17,7 +17,7 @@ namespace Kernel { void UDPSocket::for_each(Function<void(const UDPSocket&)> callback) { - LOCKER(sockets_by_port().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_port().lock(), Lock::Mode::Shared); for (auto it : sockets_by_port().resource()) callback(*it.value); } @@ -33,7 +33,7 @@ SocketHandle<UDPSocket> UDPSocket::from_port(u16 port) { RefPtr<UDPSocket> socket; { - LOCKER(sockets_by_port().lock(), Lock::Mode::Shared); + Locker locker(sockets_by_port().lock(), Lock::Mode::Shared); auto it = sockets_by_port().resource().find(port); if (it == sockets_by_port().resource().end()) return {}; @@ -50,7 +50,7 @@ UDPSocket::UDPSocket(int protocol) UDPSocket::~UDPSocket() { - LOCKER(sockets_by_port().lock()); + Locker locker(sockets_by_port().lock()); sockets_by_port().resource().remove(local_port()); } @@ -104,7 +104,7 @@ int UDPSocket::protocol_allocate_local_port() static const u16 ephemeral_port_range_size = last_ephemeral_port - first_ephemeral_port; u16 first_scan_port = first_ephemeral_port + get_good_random<u16>() % ephemeral_port_range_size; - LOCKER(sockets_by_port().lock()); + Locker locker(sockets_by_port().lock()); for (u16 port = first_scan_port;;) { auto it = sockets_by_port().resource().find(port); if (it == sockets_by_port().resource().end()) { @@ -123,7 +123,7 @@ int UDPSocket::protocol_allocate_local_port() KResult UDPSocket::protocol_bind() { - LOCKER(sockets_by_port().lock()); + Locker locker(sockets_by_port().lock()); if (sockets_by_port().resource().contains(local_port())) return EADDRINUSE; sockets_by_port().resource().set(local_port(), this); diff --git a/Kernel/Random.cpp b/Kernel/Random.cpp index 7e0434d0d4..86706d45be 100644 --- a/Kernel/Random.cpp +++ b/Kernel/Random.cpp @@ -125,7 +125,7 @@ bool get_good_random_bytes(u8* buffer, size_t buffer_size, bool allow_wait, bool if (can_wait && allow_wait) { for (;;) { { - LOCKER(KernelRng::the().lock()); + Locker locker(KernelRng::the().lock()); if (kernel_rng.resource().get_random_bytes(buffer, buffer_size)) { result = true; break; diff --git a/Kernel/Storage/AHCIPort.cpp b/Kernel/Storage/AHCIPort.cpp index 30e31a64c0..e6c9b8faa1 100644 --- a/Kernel/Storage/AHCIPort.cpp +++ b/Kernel/Storage/AHCIPort.cpp @@ -105,7 +105,7 @@ void AHCIPort::handle_interrupt() } else { g_io_work->queue([this]() { dbgln_if(AHCI_DEBUG, "AHCI Port {}: Request handled", representative_port_index()); - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_current_request); VERIFY(m_current_scatter_list); if (m_current_request->request_type() == AsyncBlockDeviceRequest::Read) { @@ -133,7 +133,7 @@ bool AHCIPort::is_interrupts_enabled() const void AHCIPort::recover_from_fatal_error() { - LOCKER(m_lock); + Locker locker(m_lock); ScopedSpinLock lock(m_hard_lock); dmesgln("{}: AHCI Port {} fatal error, shutting down!", m_parent_handler->hba_controller()->pci_address(), representative_port_index()); dmesgln("{}: AHCI Port {} fatal error, SError {}", m_parent_handler->hba_controller()->pci_address(), representative_port_index(), (u32)m_port_registers.serr); @@ -217,7 +217,7 @@ void AHCIPort::eject() bool AHCIPort::reset() { - LOCKER(m_lock); + Locker locker(m_lock); ScopedSpinLock lock(m_hard_lock); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Resetting", representative_port_index()); @@ -242,7 +242,7 @@ bool AHCIPort::reset() bool AHCIPort::initialize_without_reset() { - LOCKER(m_lock); + Locker locker(m_lock); ScopedSpinLock lock(m_hard_lock); dmesgln("AHCI Port {}: {}", representative_port_index(), try_disambiguate_sata_status()); return initialize(lock); @@ -454,7 +454,7 @@ Optional<AsyncDeviceRequest::RequestResult> AHCIPort::prepare_and_set_scatter_li void AHCIPort::start_request(AsyncBlockDeviceRequest& request) { - LOCKER(m_lock); + Locker locker(m_lock); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Request start", representative_port_index()); VERIFY(!m_current_request); VERIFY(!m_current_scatter_list); @@ -657,7 +657,7 @@ bool AHCIPort::identify_device(ScopedSpinLock<SpinLock<u8>>& main_lock) bool AHCIPort::shutdown() { - LOCKER(m_lock); + Locker locker(m_lock); ScopedSpinLock lock(m_hard_lock); rebase(); set_interface_state(AHCI::DeviceDetectionInitialization::DisableInterface); diff --git a/Kernel/Storage/IDEChannel.cpp b/Kernel/Storage/IDEChannel.cpp index 7c592007b5..ed18925f47 100644 --- a/Kernel/Storage/IDEChannel.cpp +++ b/Kernel/Storage/IDEChannel.cpp @@ -90,7 +90,7 @@ UNMAP_AFTER_INIT IDEChannel::~IDEChannel() void IDEChannel::start_request(AsyncBlockDeviceRequest& request, bool is_slave, u16 capabilities) { - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_current_request.is_null()); dbgln_if(PATA_DEBUG, "IDEChannel::start_request"); @@ -117,7 +117,7 @@ void IDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult resu // before Processor::deferred_call_queue returns! g_io_work->queue([this, result]() { dbgln_if(PATA_DEBUG, "IDEChannel::complete_current_request result: {}", (int)result); - LOCKER(m_lock); + Locker locker(m_lock); VERIFY(m_current_request); auto current_request = m_current_request; m_current_request.clear(); @@ -205,7 +205,7 @@ void IDEChannel::handle_irq(const RegisterState&) // This is important so that we can safely access the buffers, which could // trigger page faults g_io_work->queue([this]() { - LOCKER(m_lock); + Locker locker(m_lock); ScopedSpinLock lock(m_request_lock); if (m_current_request->request_type() == AsyncBlockDeviceRequest::Read) { dbgln_if(PATA_DEBUG, "IDEChannel: Read block {}/{}", m_current_request_block_index, m_current_request->block_count()); diff --git a/Kernel/Storage/RamdiskDevice.cpp b/Kernel/Storage/RamdiskDevice.cpp index 87fd37144e..f2f4fe028c 100644 --- a/Kernel/Storage/RamdiskDevice.cpp +++ b/Kernel/Storage/RamdiskDevice.cpp @@ -35,7 +35,7 @@ const char* RamdiskDevice::class_name() const void RamdiskDevice::start_request(AsyncBlockDeviceRequest& request) { - LOCKER(m_lock); + Locker locker(m_lock); u8* base = m_region->vaddr().as_ptr(); size_t size = m_region->size(); diff --git a/Kernel/Syscalls/hostname.cpp b/Kernel/Syscalls/hostname.cpp index 5ad02a905d..cc3b4b7f48 100644 --- a/Kernel/Syscalls/hostname.cpp +++ b/Kernel/Syscalls/hostname.cpp @@ -16,7 +16,7 @@ KResultOr<int> Process::sys$gethostname(Userspace<char*> buffer, ssize_t size) REQUIRE_PROMISE(stdio); if (size < 0) return EINVAL; - LOCKER(*g_hostname_lock, Lock::Mode::Shared); + Locker locker(*g_hostname_lock, Lock::Mode::Shared); if ((size_t)size < (g_hostname->length() + 1)) return ENAMETOOLONG; if (!copy_to_user(buffer, g_hostname->characters(), g_hostname->length() + 1)) @@ -31,7 +31,7 @@ KResultOr<int> Process::sys$sethostname(Userspace<const char*> hostname, ssize_t return EPERM; if (length < 0) return EINVAL; - LOCKER(*g_hostname_lock, Lock::Mode::Exclusive); + Locker locker(*g_hostname_lock, Lock::Mode::Exclusive); if (length > 64) return ENAMETOOLONG; auto copied_hostname = copy_string_from_user(hostname, length); diff --git a/Kernel/Syscalls/uname.cpp b/Kernel/Syscalls/uname.cpp index 21fb2c8784..2e65239b60 100644 --- a/Kernel/Syscalls/uname.cpp +++ b/Kernel/Syscalls/uname.cpp @@ -15,7 +15,7 @@ KResultOr<int> Process::sys$uname(Userspace<utsname*> user_buf) REQUIRE_PROMISE(stdio); - LOCKER(*g_hostname_lock, Lock::Mode::Shared); + Locker locker(*g_hostname_lock, Lock::Mode::Shared); if (g_hostname->length() + 1 > sizeof(utsname::nodename)) return ENAMETOOLONG; diff --git a/Kernel/TTY/PTYMultiplexer.cpp b/Kernel/TTY/PTYMultiplexer.cpp index 1df690cc5c..ae19e6f8ad 100644 --- a/Kernel/TTY/PTYMultiplexer.cpp +++ b/Kernel/TTY/PTYMultiplexer.cpp @@ -36,7 +36,7 @@ UNMAP_AFTER_INIT PTYMultiplexer::~PTYMultiplexer() KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options) { - LOCKER(m_lock); + Locker locker(m_lock); if (m_freelist.is_empty()) return EBUSY; auto master_index = m_freelist.take_last(); @@ -52,7 +52,7 @@ KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options) void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index) { - LOCKER(m_lock); + Locker locker(m_lock); m_freelist.append(index); dbgln_if(PTMX_DEBUG, "PTYMultiplexer: {} added to freelist", index); } diff --git a/Kernel/VM/AnonymousVMObject.cpp b/Kernel/VM/AnonymousVMObject.cpp index 7d9b577832..fec628414f 100644 --- a/Kernel/VM/AnonymousVMObject.cpp +++ b/Kernel/VM/AnonymousVMObject.cpp @@ -161,7 +161,7 @@ AnonymousVMObject::~AnonymousVMObject() int AnonymousVMObject::purge() { - LOCKER(m_paging_lock); + Locker locker(m_paging_lock); return purge_impl(); } diff --git a/Kernel/VM/InodeVMObject.cpp b/Kernel/VM/InodeVMObject.cpp index e553e4be66..bdde999712 100644 --- a/Kernel/VM/InodeVMObject.cpp +++ b/Kernel/VM/InodeVMObject.cpp @@ -53,7 +53,7 @@ size_t InodeVMObject::amount_dirty() const int InodeVMObject::release_all_clean_pages() { - LOCKER(m_paging_lock); + Locker locker(m_paging_lock); return release_all_clean_pages_impl(); } diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 8e68ba08d3..84be9f285d 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -451,7 +451,7 @@ PageFaultResponse Region::handle_zero_fault(size_t page_index_in_region) VERIFY_INTERRUPTS_DISABLED(); VERIFY(vmobject().is_anonymous()); - LOCKER(vmobject().m_paging_lock); + Locker locker(vmobject().m_paging_lock); auto& page_slot = physical_page_slot(page_index_in_region); auto page_index_in_vmobject = translate_to_vmobject_page(page_index_in_region); @@ -514,7 +514,7 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region, Scoped VERIFY(!s_mm_lock.own_lock()); VERIFY(!g_scheduler_lock.own_lock()); - LOCKER(vmobject().m_paging_lock); + Locker locker(vmobject().m_paging_lock); mm_lock.lock(); |