mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
Kernel: Add a conversion method from KBuffer to UserOrKernelBuffer
This commit is contained in:
parent
03ae9fdb0a
commit
98160e33c4
1 changed files with 3 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/Library/StdLib.h> // For memcpy. FIXME: Make memcpy less expensive to access a declaration of in the Kernel.
|
||||
#include <Kernel/Library/UserOrKernelBuffer.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -38,6 +39,8 @@ public:
|
|||
return buffer;
|
||||
}
|
||||
|
||||
UserOrKernelBuffer as_kernel_buffer() { return UserOrKernelBuffer::for_kernel_buffer(data()); }
|
||||
|
||||
[[nodiscard]] u8* data() { return m_region->vaddr().as_ptr(); }
|
||||
[[nodiscard]] u8 const* data() const { return m_region->vaddr().as_ptr(); }
|
||||
[[nodiscard]] size_t size() const { return m_size; }
|
||||
|
|
Loading…
Reference in a new issue