mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 18:05:07 +00:00
Kernel: Remove UserOrKernelBuffer::copy_into_string()
All former users of this API have been converted to use KString. :^)
This commit is contained in:
parent
211c1c087d
commit
393229e2aa
2 changed files with 2 additions and 17 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -14,21 +15,6 @@ bool UserOrKernelBuffer::is_kernel_buffer() const
|
|||
return !Memory::is_user_address(VirtualAddress(m_buffer));
|
||||
}
|
||||
|
||||
String UserOrKernelBuffer::copy_into_string(size_t size) const
|
||||
{
|
||||
if (!m_buffer)
|
||||
return {};
|
||||
if (Memory::is_user_address(VirtualAddress(m_buffer))) {
|
||||
char* buffer;
|
||||
auto data_copy = StringImpl::create_uninitialized(size, buffer);
|
||||
if (!copy_from_user(buffer, m_buffer, size))
|
||||
return {};
|
||||
return data_copy;
|
||||
}
|
||||
|
||||
return String(ReadonlyBytes { m_buffer, size });
|
||||
}
|
||||
|
||||
KResultOr<NonnullOwnPtr<KString>> UserOrKernelBuffer::try_copy_into_kstring(size_t size) const
|
||||
{
|
||||
if (!m_buffer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue