diff --git a/Kernel/FileSystem/Custody.cpp b/Kernel/FileSystem/Custody.cpp index 3e31125fac0..84b7479c33c 100644 --- a/Kernel/FileSystem/Custody.cpp +++ b/Kernel/FileSystem/Custody.cpp @@ -73,7 +73,7 @@ ErrorOr> Custody::try_serialize_absolute_path() const Vector custody_chain; size_t path_length = 0; - for (auto* custody = this; custody; custody = custody->parent()) { + for (auto const* custody = this; custody; custody = custody->parent()) { custody_chain.append(custody); path_length += custody->m_name->length() + 1; } @@ -85,7 +85,7 @@ ErrorOr> Custody::try_serialize_absolute_path() const for (size_t custody_index = custody_chain.size() - 1; custody_index > 0; --custody_index) { buffer[string_index] = '/'; ++string_index; - auto& custody_name = *custody_chain[custody_index - 1]->m_name; + auto const& custody_name = *custody_chain[custody_index - 1]->m_name; __builtin_memcpy(buffer + string_index, custody_name.characters(), custody_name.length()); string_index += custody_name.length(); } @@ -99,7 +99,7 @@ String Custody::absolute_path() const if (!parent()) return "/"; Vector custody_chain; - for (auto* custody = this; custody; custody = custody->parent()) + for (auto const* custody = this; custody; custody = custody->parent()) custody_chain.append(custody); StringBuilder builder; for (int i = custody_chain.size() - 2; i >= 0; --i) { diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp index 29505ac1541..355f7ec6fe6 100644 --- a/Kernel/FileSystem/Ext2FileSystem.cpp +++ b/Kernel/FileSystem/Ext2FileSystem.cpp @@ -95,7 +95,7 @@ ErrorOr Ext2FS::initialize() bool success = raw_read_blocks(2, (sizeof(ext2_super_block) / logical_block_size()), super_block_buffer); VERIFY(success); - auto& super_block = this->super_block(); + auto const& super_block = this->super_block(); if constexpr (EXT2_DEBUG) { dmesgln("Ext2FS: super block magic: {:04x} (super block size: {})", super_block.s_magic, sizeof(ext2_super_block)); } @@ -138,7 +138,7 @@ ErrorOr Ext2FS::initialize() if constexpr (EXT2_DEBUG) { for (unsigned i = 1; i <= m_block_group_count; ++i) { - auto& group = group_descriptor(i); + auto const& group = group_descriptor(i); dbgln("Ext2FS: group[{}] ( block_bitmap: {}, inode_bitmap: {}, inode_table: {} )", i, group.bg_block_bitmap, group.bg_inode_bitmap, group.bg_inode_table); } } @@ -154,7 +154,7 @@ Ext2FSInode& Ext2FS::root_inode() bool Ext2FS::find_block_containing_inode(InodeIndex inode, BlockIndex& block_index, unsigned& offset) const { - auto& super_block = this->super_block(); + auto const& super_block = this->super_block(); if (inode != EXT2_ROOT_INO && inode < EXT2_FIRST_INO(&super_block)) return false; @@ -162,7 +162,7 @@ bool Ext2FS::find_block_containing_inode(InodeIndex inode, BlockIndex& block_ind if (inode > super_block.s_inodes_count) return false; - auto& bgd = group_descriptor(group_index_from_inode(inode)); + auto const& bgd = group_descriptor(group_index_from_inode(inode)); u64 full_offset = ((inode.value() - 1) % inodes_per_group()) * inode_size(); block_index = bgd.bg_inode_table + (full_offset >> EXT2_BLOCK_SIZE_BITS(&super_block)); @@ -1283,7 +1283,7 @@ auto Ext2FS::allocate_blocks(GroupIndex preferred_group_index, size_t count) -> } VERIFY(found_a_group); - auto& bgd = group_descriptor(group_index); + auto const& bgd = group_descriptor(group_index); auto* cached_bitmap = TRY(get_bitmap_block(bgd.bg_block_bitmap)); @@ -1338,7 +1338,7 @@ ErrorOr Ext2FS::allocate_inode(GroupIndex preferred_group) dbgln_if(EXT2_DEBUG, "Ext2FS: allocate_inode: found suitable group [{}] for new inode :^)", group_index); - auto& bgd = group_descriptor(group_index); + auto const& bgd = group_descriptor(group_index); unsigned inodes_in_group = min(inodes_per_group(), super_block().s_inodes_count); InodeIndex first_inode_in_group = (group_index.value() - 1) * inodes_per_group() + 1; @@ -1387,7 +1387,7 @@ ErrorOr Ext2FS::get_inode_allocation_state(InodeIndex index) const if (index == 0) return EINVAL; auto group_index = group_index_from_inode(index); - auto& bgd = group_descriptor(group_index); + auto const& bgd = group_descriptor(group_index); unsigned index_in_group = index.value() - ((group_index.value() - 1) * inodes_per_group()); unsigned bit_index = (index_in_group - 1) % inodes_per_group(); diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp index 2dbfe034cd3..d020c95b349 100644 --- a/Kernel/FileSystem/ISO9660FileSystem.cpp +++ b/Kernel/FileSystem/ISO9660FileSystem.cpp @@ -240,7 +240,7 @@ ErrorOr ISO9660FS::parse_volume_set() return EIO; } - auto header = reinterpret_cast(block->data()); + auto const* header = reinterpret_cast(block->data()); if (StringView { header->identifier, 5 } != "CD001") { dbgln_if(ISO9660_DEBUG, "Header magic at volume descriptor {} is not valid", current_block_index - first_data_area_block); return EIO; @@ -248,7 +248,7 @@ ErrorOr ISO9660FS::parse_volume_set() switch (header->type) { case ISO::VolumeDescriptorType::PrimaryVolumeDescriptor: { - auto primary_volume = reinterpret_cast(header); + auto const* primary_volume = reinterpret_cast(header); m_primary_volume = adopt_own_if_nonnull(new ISO::PrimaryVolumeDescriptor(*primary_volume)); break; } @@ -611,7 +611,7 @@ time_t ISO9660Inode::parse_numerical_date_time(ISO::NumericalDateAndTime const& StringView ISO9660Inode::get_normalized_filename(ISO::DirectoryRecordHeader const& record, Bytes buffer) { - auto file_identifier = reinterpret_cast(&record + 1); + auto const* file_identifier = reinterpret_cast(&record + 1); auto filename = StringView { file_identifier, record.file_identifier_length }; if (filename.length() == 1) { diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp index cd1a0f5abb8..03b3913e6c3 100644 --- a/Kernel/FileSystem/Inode.cpp +++ b/Kernel/FileSystem/Inode.cpp @@ -296,14 +296,14 @@ ErrorOr Inode::can_apply_flock(OpenFileDescription const& description, flo MutexLocker locker(m_inode_lock, Mutex::Mode::Shared); if (new_lock.l_type == F_UNLCK) { - for (auto& lock : m_flocks) { + for (auto const& lock : m_flocks) { if (&description == lock.owner && lock.start == new_lock.l_start && lock.len == new_lock.l_len) return {}; } return EINVAL; } - for (auto& lock : m_flocks) { + for (auto const& lock : m_flocks) { if (!range_overlap(lock.start, lock.len, new_lock.l_start, new_lock.l_len)) continue; @@ -348,7 +348,7 @@ ErrorOr Inode::get_flock(OpenFileDescription const& description, Userspace MutexLocker locker(m_inode_lock, Mutex::Mode::Shared); - for (auto& lock : m_flocks) { + for (auto const& lock : m_flocks) { if (!range_overlap(lock.start, lock.len, lookup.l_start, lookup.l_len)) continue; diff --git a/Kernel/FileSystem/OpenFileDescription.cpp b/Kernel/FileSystem/OpenFileDescription.cpp index 06ff77418a3..5dfd3a4fc09 100644 --- a/Kernel/FileSystem/OpenFileDescription.cpp +++ b/Kernel/FileSystem/OpenFileDescription.cpp @@ -87,7 +87,7 @@ Thread::FileBlocker::BlockFlags OpenFileDescription::should_unblock(Thread::File // TODO: Implement Thread::FileBlocker::BlockFlags::Exception if (has_any_flag(block_flags, BlockFlags::SocketFlags)) { - auto* sock = socket(); + auto const* sock = socket(); VERIFY(sock); if (has_flag(block_flags, BlockFlags::Accept) && sock->can_accept()) unblock_flags |= BlockFlags::Accept; diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index 98a7fcff5e3..fdf0110d4a9 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -491,7 +491,7 @@ bool Plan9FS::is_complete(const ReceiveCompletion& completion) ErrorOr Plan9FS::post_message(Message& message, RefPtr completion) { - auto& buffer = message.build(); + auto const& buffer = message.build(); const u8* data = buffer.data(); size_t size = buffer.size(); auto& description = file_description(); @@ -562,7 +562,7 @@ ErrorOr Plan9FS::read_and_dispatch_one_message() auto optional_completion = m_completions.get(header.tag); if (optional_completion.has_value()) { - auto completion = optional_completion.value(); + auto* completion = optional_completion.value(); SpinlockLocker lock(completion->lock); completion->result = {}; completion->message = adopt_own_if_nonnull(new (nothrow) Message { move(buffer) }); diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp index 46ea5d9b8d3..7395f0addbc 100644 --- a/Kernel/FileSystem/SysFS.cpp +++ b/Kernel/FileSystem/SysFS.cpp @@ -52,7 +52,7 @@ ErrorOr SysFSRootDirectory::traverse_as_directory(FileSystemID fsid, Funct TRY(callback({ ".", { fsid, component_index() }, 0 })); TRY(callback({ "..", { fsid, 0 }, 0 })); - for (auto& component : m_components) { + for (auto const& component : m_components) { InodeIdentifier identifier = { fsid, component.component_index() }; TRY(callback({ component.name(), identifier, 0 })); }