[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/7] memory: Document flatview_for_each_range()
From: |
Peter Maydell |
Subject: |
[PULL 3/7] memory: Document flatview_for_each_range() |
Date: |
Tue, 23 Mar 2021 14:26:49 +0000 |
Add a documentation comment describing flatview_for_each_range().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20210318174823.18066-3-peter.maydell@linaro.org
---
include/exec/memory.h | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 500bfc0abd2..88c2451c066 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -776,11 +776,33 @@ static inline FlatView
*address_space_to_flatview(AddressSpace *as)
return qatomic_rcu_read(&as->current_map);
}
+/**
+ * typedef flatview_cb: callback for flatview_for_each_range()
+ *
+ * @start: start address of the range within the FlatView
+ * @len: length of the range in bytes
+ * @mr: MemoryRegion covering this range
+ * @opaque: data pointer passed to flatview_for_each_range()
+ *
+ * Returns: true to stop the iteration, false to keep going.
+ */
typedef bool (*flatview_cb)(Int128 start,
Int128 len,
- const MemoryRegion*, void*);
+ const MemoryRegion *mr,
+ void *opaque);
-void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque);
+/**
+ * flatview_for_each_range: Iterate through a FlatView
+ * @fv: the FlatView to iterate through
+ * @cb: function to call for each range
+ * @opaque: opaque data pointer to pass to @cb
+ *
+ * A FlatView is made up of a list of non-overlapping ranges, each of
+ * which is a slice of a MemoryRegion. This function iterates through
+ * each range in @fv, calling @cb. The callback function can terminate
+ * iteration early by returning 'true'.
+ */
+void flatview_for_each_range(FlatView *fv, flatview_cb cb, void *opaque);
/**
* struct MemoryRegionSection: describes a fragment of a #MemoryRegion
--
2.20.1
- [PULL 0/7] target-arm queue, Peter Maydell, 2021/03/23
- [PULL 3/7] memory: Document flatview_for_each_range(),
Peter Maydell <=
- [PULL 4/7] memory: Add offset_in_region to flatview_cb arguments, Peter Maydell, 2021/03/23
- [PULL 7/7] target/arm: Set ARMMMUFaultInfo.level in user-only arm_cpu_tlb_fill, Peter Maydell, 2021/03/23
- [PULL 5/7] hw/core/loader: Add new function rom_ptr_for_as(), Peter Maydell, 2021/03/23
- [PULL 6/7] target/arm: Make M-profile VTOR loads on reset handle memory aliasing, Peter Maydell, 2021/03/23
- [PULL 1/7] hw/arm/virt: Disable pl011 clock migration if needed, Peter Maydell, 2021/03/23
- [PULL 2/7] memory: Make flatview_cb return bool, not int, Peter Maydell, 2021/03/23
- Re: [PULL 0/7] target-arm queue, Peter Maydell, 2021/03/23