mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 11:25:07 +00:00
Kernel: Remove KBufferBuilder's can_expand restriction
KBufferBuilder is always allowed to expand if it wants to. This restriction was added a long time ago when it was unsafe to allocate VM while generating ProcFS contents.
This commit is contained in:
parent
fef835de7f
commit
f85b94e6d4
2 changed files with 2 additions and 6 deletions
|
@ -15,8 +15,6 @@ inline bool KBufferBuilder::check_expand(size_t size)
|
||||||
return false;
|
return false;
|
||||||
if ((m_size + size) < m_buffer->capacity())
|
if ((m_size + size) < m_buffer->capacity())
|
||||||
return true;
|
return true;
|
||||||
if (!m_can_expand)
|
|
||||||
return false;
|
|
||||||
if (Checked<size_t>::addition_would_overflow(m_size, size))
|
if (Checked<size_t>::addition_would_overflow(m_size, size))
|
||||||
return false;
|
return false;
|
||||||
size_t new_buffer_size = m_size + size;
|
size_t new_buffer_size = m_size + size;
|
||||||
|
@ -42,9 +40,8 @@ OwnPtr<KBuffer> KBufferBuilder::build()
|
||||||
return try_make<KBuffer>(move(m_buffer));
|
return try_make<KBuffer>(move(m_buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
KBufferBuilder::KBufferBuilder(bool can_expand)
|
KBufferBuilder::KBufferBuilder()
|
||||||
: m_buffer(KBufferImpl::try_create_with_size(4 * MiB, Region::Access::Read | Region::Access::Write))
|
: m_buffer(KBufferImpl::try_create_with_size(4 * MiB, Region::Access::Read | Region::Access::Write))
|
||||||
, m_can_expand(can_expand)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class KBufferBuilder {
|
||||||
public:
|
public:
|
||||||
using OutputType = KBuffer;
|
using OutputType = KBuffer;
|
||||||
|
|
||||||
explicit KBufferBuilder(bool can_expand = false);
|
KBufferBuilder();
|
||||||
KBufferBuilder(KBufferBuilder&&) = default;
|
KBufferBuilder(KBufferBuilder&&) = default;
|
||||||
~KBufferBuilder() = default;
|
~KBufferBuilder() = default;
|
||||||
|
|
||||||
|
@ -50,7 +50,6 @@ private:
|
||||||
|
|
||||||
RefPtr<KBufferImpl> m_buffer;
|
RefPtr<KBufferImpl> m_buffer;
|
||||||
size_t m_size { 0 };
|
size_t m_size { 0 };
|
||||||
bool m_can_expand { false };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue