1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:47:45 +00:00

Kernel: Annotate all KBuffer and DoubleBuffer with a custom name

This commit is contained in:
Tim Schumacher 2022-04-11 00:08:07 +02:00 committed by Linus Groh
parent d6d1ae667d
commit 3b3af58cf6
19 changed files with 32 additions and 32 deletions

View file

@ -24,16 +24,16 @@ namespace Kernel {
class [[nodiscard]] KBuffer {
public:
static ErrorOr<NonnullOwnPtr<KBuffer>> try_create_with_size(size_t size, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
static ErrorOr<NonnullOwnPtr<KBuffer>> try_create_with_size(StringView name, size_t size, Memory::Region::Access access = Memory::Region::Access::ReadWrite, AllocationStrategy strategy = AllocationStrategy::Reserve)
{
auto rounded_size = TRY(Memory::page_round_up(size));
auto region = TRY(MM.allocate_kernel_region(rounded_size, name, access, strategy));
return TRY(adopt_nonnull_own_or_enomem(new (nothrow) KBuffer { size, move(region) }));
}
static ErrorOr<NonnullOwnPtr<KBuffer>> try_create_with_bytes(ReadonlyBytes bytes, Memory::Region::Access access = Memory::Region::Access::ReadWrite, StringView name = "KBuffer", AllocationStrategy strategy = AllocationStrategy::Reserve)
static ErrorOr<NonnullOwnPtr<KBuffer>> try_create_with_bytes(StringView name, ReadonlyBytes bytes, Memory::Region::Access access = Memory::Region::Access::ReadWrite, AllocationStrategy strategy = AllocationStrategy::Reserve)
{
auto buffer = TRY(try_create_with_size(bytes.size(), access, name, strategy));
auto buffer = TRY(try_create_with_size(name, bytes.size(), access, strategy));
memcpy(buffer->data(), bytes.data(), bytes.size());
return buffer;
}