summaryrefslogtreecommitdiff
path: root/Kernel/KBuffer.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-01-20 14:00:11 +0100
committerAndreas Kling <kling@serenityos.org>2020-01-20 14:00:11 +0100
commit0a282e0a0231c961f769e585a83ca4fe565bc6fa (patch)
treeb5e2287f1e88fb1c7eae9047383c1d707eef062c /Kernel/KBuffer.h
parent2309029cb4e5563c3715c84140569c6a196b51fe (diff)
downloadserenity-0a282e0a0231c961f769e585a83ca4fe565bc6fa.zip
Kernel: Allow naming KBuffers
Diffstat (limited to 'Kernel/KBuffer.h')
-rw-r--r--Kernel/KBuffer.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/Kernel/KBuffer.h b/Kernel/KBuffer.h
index 5add1455d1..955e44d539 100644
--- a/Kernel/KBuffer.h
+++ b/Kernel/KBuffer.h
@@ -43,16 +43,16 @@
class KBufferImpl : public RefCounted<KBufferImpl> {
public:
- static NonnullRefPtr<KBufferImpl> create_with_size(size_t size, u8 access)
+ static NonnullRefPtr<KBufferImpl> create_with_size(size_t size, u8 access, const char* name)
{
- auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(size), "KBuffer", access, false, false);
+ auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(size), name, access, false, false);
ASSERT(region);
return adopt(*new KBufferImpl(region.release_nonnull(), size));
}
- static NonnullRefPtr<KBufferImpl> copy(const void* data, size_t size, u8 access)
+ static NonnullRefPtr<KBufferImpl> copy(const void* data, size_t size, u8 access, const char* name)
{
- auto buffer = create_with_size(size, access);
+ auto buffer = create_with_size(size, access, name);
memcpy(buffer->data(), data, size);
return buffer;
}
@@ -81,14 +81,14 @@ private:
class KBuffer {
public:
- static KBuffer create_with_size(size_t size, u8 access = Region::Access::Read | Region::Access::Write)
+ static KBuffer create_with_size(size_t size, u8 access = Region::Access::Read | Region::Access::Write, const char* name = "KBuffer")
{
- return KBuffer(KBufferImpl::create_with_size(size, access));
+ return KBuffer(KBufferImpl::create_with_size(size, access, name));
}
- static KBuffer copy(const void* data, size_t size, u8 access = Region::Access::Read | Region::Access::Write)
+ static KBuffer copy(const void* data, size_t size, u8 access = Region::Access::Read | Region::Access::Write, const char* name = "KBuffer")
{
- return KBuffer(KBufferImpl::copy(data, size, access));
+ return KBuffer(KBufferImpl::copy(data, size, access, name));
}
u8* data() { return m_impl->data(); }
@@ -100,8 +100,8 @@ public:
const KBufferImpl& impl() const { return m_impl; }
- KBuffer(const ByteBuffer& buffer, u8 access = Region::Access::Read | Region::Access::Write)
- : m_impl(KBufferImpl::copy(buffer.data(), buffer.size(), access))
+ KBuffer(const ByteBuffer& buffer, u8 access = Region::Access::Read | Region::Access::Write, const char* name = "KBuffer")
+ : m_impl(KBufferImpl::copy(buffer.data(), buffer.size(), access, name))
{
}