/* * Copyright (c) 2021, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Kernel::Memory { // A Scatter-Gather List type that owns its buffers class ScatterGatherList final : public AtomicRefCounted { public: static ErrorOr> try_create(AsyncBlockDeviceRequest&, Span> allocated_pages, size_t device_block_size, StringView region_name); VMObject const& vmobject() const { return m_vm_object; } VirtualAddress dma_region() const { return m_dma_region->vaddr(); } size_t scatters_count() const { return m_vm_object->physical_pages().size(); } private: ScatterGatherList(NonnullLockRefPtr, NonnullOwnPtr dma_region); NonnullLockRefPtr m_vm_object; NonnullOwnPtr m_dma_region; }; }