mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
11eee67b85
Until now, our kernel has reimplemented a number of AK classes to provide automatic internal locking: - RefPtr - NonnullRefPtr - WeakPtr - Weakable This patch renames the Kernel classes so that they can coexist with the original AK classes: - RefPtr => LockRefPtr - NonnullRefPtr => NonnullLockRefPtr - WeakPtr => LockWeakPtr - Weakable => LockWeakable The goal here is to eventually get rid of the Lock* classes in favor of using external locking.
33 lines
1.1 KiB
C++
33 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/AtomicRefCounted.h>
|
|
#include <AK/Vector.h>
|
|
#include <Kernel/Devices/BlockDevice.h>
|
|
#include <Kernel/Memory/AnonymousVMObject.h>
|
|
#include <Kernel/Memory/MemoryManager.h>
|
|
#include <Kernel/PhysicalAddress.h>
|
|
|
|
namespace Kernel::Memory {
|
|
|
|
// A Scatter-Gather List type that owns its buffers
|
|
|
|
class ScatterGatherList final : public AtomicRefCounted<ScatterGatherList> {
|
|
public:
|
|
static LockRefPtr<ScatterGatherList> try_create(AsyncBlockDeviceRequest&, Span<NonnullLockRefPtr<PhysicalPage>> allocated_pages, size_t device_block_size);
|
|
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<AnonymousVMObject>, AsyncBlockDeviceRequest&, size_t device_block_size);
|
|
NonnullLockRefPtr<AnonymousVMObject> m_vm_object;
|
|
OwnPtr<Region> m_dma_region;
|
|
};
|
|
|
|
}
|