summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2022-04-11 00:08:07 +0200
committerLinus Groh <mail@linusgroh.de>2022-07-12 00:55:31 +0100
commit3b3af58cf6ca757319bf3814a35ebc6943a0f97a (patch)
tree827615ad231d91c19021570555aa210243f7c67f /Kernel/FileSystem
parentd6d1ae667d97aa5ceca55b4c99e8931b0c29aa56 (diff)
downloadserenity-3b3af58cf6ca757319bf3814a35ebc6943a0f97a.zip
Kernel: Annotate all `KBuffer` and `DoubleBuffer` with a custom name
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/BlockBasedFileSystem.cpp4
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp4
-rw-r--r--Kernel/FileSystem/FIFO.cpp2
-rw-r--r--Kernel/FileSystem/ISO9660FileSystem.cpp6
-rw-r--r--Kernel/FileSystem/Plan9FileSystem.cpp2
-rw-r--r--Kernel/FileSystem/SysFS/Subsystems/Bus/PCI/DeviceAttribute.cpp2
-rw-r--r--Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.cpp2
-rw-r--r--Kernel/FileSystem/TmpFS.cpp6
8 files changed, 14 insertions, 14 deletions
diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp
index 1ae40139dd..ab2cd21689 100644
--- a/Kernel/FileSystem/BlockBasedFileSystem.cpp
+++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp
@@ -119,8 +119,8 @@ BlockBasedFileSystem::~BlockBasedFileSystem() = default;
ErrorOr<void> BlockBasedFileSystem::initialize()
{
VERIFY(block_size() != 0);
- auto cached_block_data = TRY(KBuffer::try_create_with_size(DiskCache::EntryCount * block_size()));
- auto entries_data = TRY(KBuffer::try_create_with_size(DiskCache::EntryCount * sizeof(CacheEntry)));
+ auto cached_block_data = TRY(KBuffer::try_create_with_size("BlockBasedFS: Cache blocks"sv, DiskCache::EntryCount * block_size()));
+ auto entries_data = TRY(KBuffer::try_create_with_size("BlockBasedFS: Cache entries"sv, DiskCache::EntryCount * sizeof(CacheEntry)));
auto disk_cache = TRY(adopt_nonnull_own_or_enomem(new (nothrow) DiskCache(*this, move(cached_block_data), move(entries_data))));
m_cache.with_exclusive([&](auto& cache) {
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index e8e1ec5638..08c77aa3a0 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -122,7 +122,7 @@ ErrorOr<void> Ext2FS::initialize()
auto blocks_to_read = ceil_div(m_block_group_count * sizeof(ext2_group_desc), block_size());
BlockIndex first_block_of_bgdt = block_size() == 1024 ? 2 : 1;
- m_cached_group_descriptor_table = TRY(KBuffer::try_create_with_size(block_size() * blocks_to_read, Memory::Region::Access::ReadWrite, "Ext2FS: Block group descriptors"));
+ m_cached_group_descriptor_table = TRY(KBuffer::try_create_with_size("Ext2FS: Block group descriptors"sv, block_size() * blocks_to_read, Memory::Region::Access::ReadWrite));
auto buffer = UserOrKernelBuffer::for_kernel_buffer(m_cached_group_descriptor_table->data());
TRY(read_blocks(first_block_of_bgdt, blocks_to_read, buffer));
@@ -1415,7 +1415,7 @@ ErrorOr<Ext2FS::CachedBitmap*> Ext2FS::get_bitmap_block(BlockIndex bitmap_block_
return cached_bitmap.ptr();
}
- auto block = TRY(KBuffer::try_create_with_size(block_size(), Memory::Region::Access::ReadWrite, "Ext2FS: Cached bitmap block"));
+ auto block = TRY(KBuffer::try_create_with_size("Ext2FS: Cached bitmap block"sv, block_size(), Memory::Region::Access::ReadWrite));
auto buffer = UserOrKernelBuffer::for_kernel_buffer(block->data());
TRY(read_block(bitmap_block_index, &buffer, block_size()));
auto new_bitmap = TRY(adopt_nonnull_own_or_enomem(new (nothrow) CachedBitmap(bitmap_block_index, move(block))));
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp
index c4f573a418..571e70d3df 100644
--- a/Kernel/FileSystem/FIFO.cpp
+++ b/Kernel/FileSystem/FIFO.cpp
@@ -18,7 +18,7 @@ static Atomic<int> s_next_fifo_id = 1;
ErrorOr<NonnullRefPtr<FIFO>> FIFO::try_create(UserID uid)
{
- auto buffer = TRY(DoubleBuffer::try_create());
+ auto buffer = TRY(DoubleBuffer::try_create("FIFO: Buffer"sv));
return adopt_nonnull_ref_or_enomem(new (nothrow) FIFO(uid, move(buffer)));
}
diff --git a/Kernel/FileSystem/ISO9660FileSystem.cpp b/Kernel/FileSystem/ISO9660FileSystem.cpp
index 5d54a2e4c3..81843c4372 100644
--- a/Kernel/FileSystem/ISO9660FileSystem.cpp
+++ b/Kernel/FileSystem/ISO9660FileSystem.cpp
@@ -227,7 +227,7 @@ ErrorOr<void> ISO9660FS::parse_volume_set()
{
VERIFY(!m_primary_volume);
- auto block = TRY(KBuffer::try_create_with_size(m_logical_block_size, Memory::Region::Access::Read | Memory::Region::Access::Write, "ISO9660FS: Temporary volume descriptor storage"));
+ auto block = TRY(KBuffer::try_create_with_size("ISO9660FS: Temporary volume descriptor storage"sv, m_logical_block_size, Memory::Region::Access::Read | Memory::Region::Access::Write));
auto block_buffer = UserOrKernelBuffer::for_kernel_buffer(block->data());
auto current_block_index = first_data_area_block;
@@ -383,7 +383,7 @@ ErrorOr<NonnullRefPtr<ISO9660FS::DirectoryEntry>> ISO9660FS::directory_entry_for
return EIO;
}
- auto blocks = TRY(KBuffer::try_create_with_size(data_length, Memory::Region::Access::Read | Memory::Region::Access::Write, "ISO9660FS: Directory traversal buffer"));
+ auto blocks = TRY(KBuffer::try_create_with_size("ISO9660FS: Directory traversal buffer"sv, data_length, Memory::Region::Access::Read | Memory::Region::Access::Write));
auto blocks_buffer = UserOrKernelBuffer::for_kernel_buffer(blocks->data());
TRY(raw_read_blocks(BlockBasedFileSystem::BlockIndex { extent_location }, data_length / logical_block_size(), blocks_buffer));
auto entry = TRY(DirectoryEntry::try_create(extent_location, data_length, move(blocks)));
@@ -408,7 +408,7 @@ ErrorOr<size_t> ISO9660Inode::read_bytes(off_t offset, size_t size, UserOrKernel
if (static_cast<u64>(offset) >= data_length)
return 0;
- auto block = TRY(KBuffer::try_create_with_size(fs().m_logical_block_size));
+ auto block = TRY(KBuffer::try_create_with_size("ISO9660FS: Inode read buffer"sv, fs().m_logical_block_size));
auto block_buffer = UserOrKernelBuffer::for_kernel_buffer(block->data());
size_t total_bytes = min(size, data_length - offset);
diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp
index 7bc3b6f9df..17336b7b24 100644
--- a/Kernel/FileSystem/Plan9FileSystem.cpp
+++ b/Kernel/FileSystem/Plan9FileSystem.cpp
@@ -551,7 +551,7 @@ ErrorOr<void> Plan9FS::read_and_dispatch_one_message()
Header header;
TRY(do_read(reinterpret_cast<u8*>(&header), sizeof(header)));
- auto buffer = TRY(KBuffer::try_create_with_size(header.size, Memory::Region::Access::ReadWrite));
+ auto buffer = TRY(KBuffer::try_create_with_size("Plan9FS: Message read buffer"sv, header.size, Memory::Region::Access::ReadWrite));
// Copy the already read header into the buffer.
memcpy(buffer->data(), &header, sizeof(header));
TRY(do_read(buffer->data() + sizeof(header), header.size - sizeof(header)));
diff --git a/Kernel/FileSystem/SysFS/Subsystems/Bus/PCI/DeviceAttribute.cpp b/Kernel/FileSystem/SysFS/Subsystems/Bus/PCI/DeviceAttribute.cpp
index 652dfb5064..5fe4039167 100644
--- a/Kernel/FileSystem/SysFS/Subsystems/Bus/PCI/DeviceAttribute.cpp
+++ b/Kernel/FileSystem/SysFS/Subsystems/Bus/PCI/DeviceAttribute.cpp
@@ -90,6 +90,6 @@ ErrorOr<NonnullOwnPtr<KBuffer>> PCIDeviceAttributeSysFSComponent::try_to_generat
VERIFY_NOT_REACHED();
}
- return KBuffer::try_create_with_bytes(value->view().bytes());
+ return KBuffer::try_create_with_bytes("PCIDeviceAttributeSysFSComponent: Device address"sv, value->view().bytes());
}
}
diff --git a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.cpp b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.cpp
index 131f611d2f..b503116e7f 100644
--- a/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.cpp
+++ b/Kernel/FileSystem/SysFS/Subsystems/Firmware/BIOS/Component.cpp
@@ -56,6 +56,6 @@ StringView BIOSSysFSComponent::name() const
ErrorOr<NonnullOwnPtr<KBuffer>> BIOSSysFSComponent::try_to_generate_buffer() const
{
auto blob = TRY(Memory::map_typed<u8>((m_blob_paddr), m_blob_length));
- return KBuffer::try_create_with_bytes(Span<u8> { blob.ptr(), m_blob_length });
+ return KBuffer::try_create_with_bytes("BIOSSysFSComponent: Blob"sv, Span<u8> { blob.ptr(), m_blob_length });
}
}
diff --git a/Kernel/FileSystem/TmpFS.cpp b/Kernel/FileSystem/TmpFS.cpp
index d6f65fbc16..b8e58f094c 100644
--- a/Kernel/FileSystem/TmpFS.cpp
+++ b/Kernel/FileSystem/TmpFS.cpp
@@ -133,7 +133,7 @@ ErrorOr<size_t> TmpFSInode::write_bytes(off_t offset, size_t size, UserOrKernelB
// FIXME: Fix this so that no memcpy() is necessary, and we can just grow the
// KBuffer and it will add physical pages as needed while keeping the
// existing ones.
- auto tmp = TRY(KBuffer::try_create_with_size(new_size * 2));
+ auto tmp = TRY(KBuffer::try_create_with_size("TmpFSInode: Content"sv, new_size * 2));
tmp->set_size(new_size);
if (m_content)
memcpy(tmp->data(), m_content->data(), old_size);
@@ -285,7 +285,7 @@ ErrorOr<void> TmpFSInode::truncate(u64 size)
if (size == 0)
m_content.clear();
else if (!m_content) {
- m_content = TRY(KBuffer::try_create_with_size(size));
+ m_content = TRY(KBuffer::try_create_with_size("TmpFSInode: Content"sv, size));
} else if (static_cast<size_t>(size) < m_content->capacity()) {
size_t prev_size = m_metadata.size;
m_content->set_size(size);
@@ -293,7 +293,7 @@ ErrorOr<void> TmpFSInode::truncate(u64 size)
memset(m_content->data() + prev_size, 0, size - prev_size);
} else {
size_t prev_size = m_metadata.size;
- auto tmp = TRY(KBuffer::try_create_with_size(size));
+ auto tmp = TRY(KBuffer::try_create_with_size("TmpFSInode: Content"sv, size));
memcpy(tmp->data(), m_content->data(), prev_size);
m_content = move(tmp);
}