summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-12-15 14:55:18 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-15 23:34:11 -0800
commit4cec16a7136b8c3a6813a13b8fe96b2216da7b11 (patch)
treedcbcd2df41d9c22ce3a18e66e73cfd46c1b4ec8e /Kernel/FileSystem
parentfe2cf774c3721c64ea2ec76d030d16ff9edbde41 (diff)
downloadserenity-4cec16a7136b8c3a6813a13b8fe96b2216da7b11.zip
Kernel: Add implied auto-specifiers in FileSystem
As per clang-tidy.
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/Custody.cpp6
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp14
-rw-r--r--Kernel/FileSystem/ISO9660FileSystem.cpp6
-rw-r--r--Kernel/FileSystem/Inode.cpp6
-rw-r--r--Kernel/FileSystem/OpenFileDescription.cpp2
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp4
-rw-r--r--Kernel/FileSystem/SysFS.cpp2
7 files changed, 20 insertions, 20 deletions
diff --git a/Kernel/FileSystem/Custody.cpp b/Kernel/FileSystem/Custody.cpp
index 3e31125fac..84b7479c33 100644
--- a/Kernel/FileSystem/Custody.cpp
+++ b/Kernel/FileSystem/Custody.cpp
@@ -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) {
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index 29505ac154..355f7ec6fe 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -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();
diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp
index 2dbfe034cd..d020c95b34 100644
--- a/Kernel/FileSystem/ISO9660FileSystem.cpp
+++ b/Kernel/FileSystem/ISO9660FileSystem.cpp
@@ -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) {
diff --git a/Kernel/FileSystem/Inode.cpp b/Kernel/FileSystem/Inode.cpp
index cd1a0f5abb..03b3913e6c 100644
--- a/Kernel/FileSystem/Inode.cpp
+++ b/Kernel/FileSystem/Inode.cpp
@@ -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;
diff --git a/Kernel/FileSystem/OpenFileDescription.cpp b/Kernel/FileSystem/OpenFileDescription.cpp
index 06ff77418a..5dfd3a4fc0 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 98a7fcff5e..fdf0110d4a 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -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) });
diff --git a/Kernel/FileSystem/SysFS.cpp b/Kernel/FileSystem/SysFS.cpp
index 46ea5d9b8d..7395f0addb 100644
--- a/Kernel/FileSystem/SysFS.cpp
+++ b/Kernel/FileSystem/SysFS.cpp
@@ -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 }));
}