mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
Kernel: Annotate all KBuffer
and DoubleBuffer
with a custom name
This commit is contained in:
parent
d6d1ae667d
commit
3b3af58cf6
19 changed files with 32 additions and 32 deletions
|
@ -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) {
|
||||
|
|
|
@ -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))));
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue