1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:15:08 +00:00
serenity/Kernel/VM/ScatterGatherList.h
Brian Gianforcaro 1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00

35 lines
802 B
C++

/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Vector.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/VM/MemoryManager.h>
namespace Kernel {
class ScatterGatherList {
struct ScatterGatherEntry {
FlatPtr page_base;
size_t offset;
size_t length;
};
public:
static ScatterGatherList create_from_buffer(const u8* buffer, size_t);
static ScatterGatherList create_from_physical(PhysicalAddress, size_t);
void add_entry(FlatPtr, size_t offset, size_t size);
[[nodiscard]] size_t length() const { return m_entries.size(); }
void for_each_entry(Function<void(const FlatPtr, const size_t)> callback) const;
private:
Vector<ScatterGatherEntry> m_entries;
};
}