mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 03:22:43 +00:00 
			
		
		
		
	Kernel: Add implied auto-specifiers in FileSystem
As per clang-tidy.
This commit is contained in:
		
							parent
							
								
									fe2cf774c3
								
							
						
					
					
						commit
						4cec16a713
					
				
					 7 changed files with 20 additions and 20 deletions
				
			
		|  | @ -73,7 +73,7 @@ ErrorOr<NonnullOwnPtr<KString>> Custody::try_serialize_absolute_path() const | |||
| 
 | ||||
|     Vector<Custody const*, 32> 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<NonnullOwnPtr<KString>> 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 const*, 32> 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) { | ||||
|  |  | |||
|  | @ -95,7 +95,7 @@ ErrorOr<void> 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<void> 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<InodeIndex> 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<bool> 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(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -240,7 +240,7 @@ ErrorOr<void> ISO9660FS::parse_volume_set() | |||
|             return EIO; | ||||
|         } | ||||
| 
 | ||||
|         auto header = reinterpret_cast<ISO::VolumeDescriptorHeader const*>(block->data()); | ||||
|         auto const* header = reinterpret_cast<ISO::VolumeDescriptorHeader const*>(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<void> ISO9660FS::parse_volume_set() | |||
| 
 | ||||
|         switch (header->type) { | ||||
|         case ISO::VolumeDescriptorType::PrimaryVolumeDescriptor: { | ||||
|             auto primary_volume = reinterpret_cast<ISO::PrimaryVolumeDescriptor const*>(header); | ||||
|             auto const* primary_volume = reinterpret_cast<ISO::PrimaryVolumeDescriptor const*>(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<u8 const*>(&record + 1); | ||||
|     auto const* file_identifier = reinterpret_cast<u8 const*>(&record + 1); | ||||
|     auto filename = StringView { file_identifier, record.file_identifier_length }; | ||||
| 
 | ||||
|     if (filename.length() == 1) { | ||||
|  |  | |||
|  | @ -296,14 +296,14 @@ ErrorOr<void> 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<void> 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; | ||||
| 
 | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
|  | @ -491,7 +491,7 @@ bool Plan9FS::is_complete(const ReceiveCompletion& completion) | |||
| 
 | ||||
| ErrorOr<void> Plan9FS::post_message(Message& message, RefPtr<ReceiveCompletion> 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<void> 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) }); | ||||
|  |  | |||
|  | @ -52,7 +52,7 @@ ErrorOr<void> 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 })); | ||||
|     } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hendiadyoin1
						Hendiadyoin1