Explorar o código

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.
Andreas Kling %!s(int64=4) %!d(string=hai) anos
pai
achega
f85b94e6d4
Modificáronse 2 ficheiros con 2 adicións e 6 borrados
  1. 1 4
      Kernel/KBufferBuilder.cpp
  2. 1 2
      Kernel/KBufferBuilder.h

+ 1 - 4
Kernel/KBufferBuilder.cpp

@@ -15,8 +15,6 @@ inline bool KBufferBuilder::check_expand(size_t size)
         return false;
     if ((m_size + size) < m_buffer->capacity())
         return true;
-    if (!m_can_expand)
-        return false;
     if (Checked<size_t>::addition_would_overflow(m_size, size))
         return false;
     size_t new_buffer_size = m_size + size;
@@ -42,9 +40,8 @@ OwnPtr<KBuffer> KBufferBuilder::build()
     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_can_expand(can_expand)
 {
 }
 

+ 1 - 2
Kernel/KBufferBuilder.h

@@ -16,7 +16,7 @@ class KBufferBuilder {
 public:
     using OutputType = KBuffer;
 
-    explicit KBufferBuilder(bool can_expand = false);
+    KBufferBuilder();
     KBufferBuilder(KBufferBuilder&&) = default;
     ~KBufferBuilder() = default;
 
@@ -50,7 +50,6 @@ private:
 
     RefPtr<KBufferImpl> m_buffer;
     size_t m_size { 0 };
-    bool m_can_expand { false };
 };
 
 }