[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/11] memory: MemoryRegion: rename parent to contain
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 10/11] memory: MemoryRegion: rename parent to container |
Date: |
Wed, 18 Jun 2014 15:42:07 +0200 |
Avoid confusion with the QOM parent.
Reviewed-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
include/exec/memory.h | 20 ++++++++++----------
memory.c | 40 ++++++++++++++++++++--------------------
2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 1d55ad9..549ae73 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -135,7 +135,7 @@ struct MemoryRegion {
const MemoryRegionIOMMUOps *iommu_ops;
void *opaque;
struct Object *owner;
- MemoryRegion *parent;
+ MemoryRegion *container;
Int128 size;
hwaddr addr;
void (*destructor)(MemoryRegion *mr);
@@ -815,11 +815,11 @@ void memory_region_set_enabled(MemoryRegion *mr, bool
enabled);
/*
* memory_region_set_address: dynamically update the address of a region
*
- * Dynamically updates the address of a region, relative to its parent.
+ * Dynamically updates the address of a region, relative to its container.
* May be used on regions are currently part of a memory hierarchy.
*
* @mr: the region to be updated
- * @addr: new address, relative to parent region
+ * @addr: new address, relative to container region
*/
void memory_region_set_address(MemoryRegion *mr, hwaddr addr);
@@ -836,16 +836,16 @@ void memory_region_set_alias_offset(MemoryRegion *mr,
hwaddr offset);
/**
- * memory_region_present: checks if an address relative to a @parent
- * translates into #MemoryRegion within @parent
+ * memory_region_present: checks if an address relative to a @container
+ * translates into #MemoryRegion within @container
*
- * Answer whether a #MemoryRegion within @parent covers the address
+ * Answer whether a #MemoryRegion within @container covers the address
* @addr.
*
- * @parent: a #MemoryRegion within which @addr is a relative address
- * @addr: the area within @parent to be searched
+ * @container: a #MemoryRegion within which @addr is a relative address
+ * @addr: the area within @container to be searched
*/
-bool memory_region_present(MemoryRegion *parent, hwaddr addr);
+bool memory_region_present(MemoryRegion *container, hwaddr addr);
/**
* memory_region_find: translate an address/size relative to a
@@ -866,7 +866,7 @@ bool memory_region_present(MemoryRegion *parent, hwaddr
addr);
* Similarly, the address@hidden is relative to the
* address space that contains both regions, the passed and the
* returned one. However, in the special case where the @mr argument
- * has no parent (and thus is the root of the address space), the
+ * has no container (and thus is the root of the address space), the
* following will hold:
* address@hidden >= @addr
* address@hidden + address@hidden <= @addr + @size
diff --git a/memory.c b/memory.c
index 06a4af7..85798b0 100644
--- a/memory.c
+++ b/memory.c
@@ -485,8 +485,8 @@ static AddressSpace
*memory_region_to_address_space(MemoryRegion *mr)
{
AddressSpace *as;
- while (mr->parent) {
- mr = mr->parent;
+ while (mr->container) {
+ mr = mr->container;
}
QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
if (mr == as->root) {
@@ -850,7 +850,7 @@ void memory_region_init(MemoryRegion *mr,
mr->opaque = NULL;
mr->owner = owner;
mr->iommu_ops = NULL;
- mr->parent = NULL;
+ mr->container = NULL;
mr->size = int128_make64(size);
if (size == UINT64_MAX) {
mr->size = int128_2_64();
@@ -1423,10 +1423,10 @@ void memory_region_del_eventfd(MemoryRegion *mr,
memory_region_transaction_commit();
}
-static void memory_region_update_parent_subregions(MemoryRegion *subregion)
+static void memory_region_update_container_subregions(MemoryRegion *subregion)
{
hwaddr offset = subregion->addr;
- MemoryRegion *mr = subregion->parent;
+ MemoryRegion *mr = subregion->container;
MemoryRegion *other;
memory_region_transaction_begin();
@@ -1469,10 +1469,10 @@ static void
memory_region_add_subregion_common(MemoryRegion *mr,
hwaddr offset,
MemoryRegion *subregion)
{
- assert(!subregion->parent);
- subregion->parent = mr;
+ assert(!subregion->container);
+ subregion->container = mr;
subregion->addr = offset;
- memory_region_update_parent_subregions(subregion);
+ memory_region_update_container_subregions(subregion);
}
void memory_region_add_subregion(MemoryRegion *mr,
@@ -1498,8 +1498,8 @@ void memory_region_del_subregion(MemoryRegion *mr,
MemoryRegion *subregion)
{
memory_region_transaction_begin();
- assert(subregion->parent == mr);
- subregion->parent = NULL;
+ assert(subregion->container == mr);
+ subregion->container = NULL;
QTAILQ_REMOVE(&mr->subregions, subregion, subregions_link);
memory_region_unref(subregion);
memory_region_update_pending |= mr->enabled && subregion->enabled;
@@ -1519,14 +1519,14 @@ void memory_region_set_enabled(MemoryRegion *mr, bool
enabled)
static void memory_region_readd_subregion(MemoryRegion *mr)
{
- MemoryRegion *parent = mr->parent;
+ MemoryRegion *container = mr->container;
- if (parent) {
+ if (container) {
memory_region_transaction_begin();
memory_region_ref(mr);
- memory_region_del_subregion(parent, mr);
- mr->parent = parent;
- memory_region_update_parent_subregions(mr);
+ memory_region_del_subregion(container, mr);
+ mr->container = container;
+ memory_region_update_container_subregions(mr);
memory_region_unref(mr);
memory_region_transaction_commit();
}
@@ -1578,10 +1578,10 @@ static FlatRange *flatview_lookup(FlatView *view,
AddrRange addr)
sizeof(FlatRange), cmp_flatrange_addr);
}
-bool memory_region_present(MemoryRegion *parent, hwaddr addr)
+bool memory_region_present(MemoryRegion *container, hwaddr addr)
{
- MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;
- if (!mr || (mr == parent)) {
+ MemoryRegion *mr = memory_region_find(container, addr, 1).mr;
+ if (!mr || (mr == container)) {
return false;
}
memory_region_unref(mr);
@@ -1599,8 +1599,8 @@ MemoryRegionSection memory_region_find(MemoryRegion *mr,
FlatRange *fr;
addr += mr->addr;
- for (root = mr; root->parent; ) {
- root = root->parent;
+ for (root = mr; root->container; ) {
+ root = root->container;
addr += root->addr;
}
--
1.8.3.1
- [Qemu-devel] [PULL 00/11] Memory API changes for 2014-06-18, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 01/11] MAINTAINERS: Add myself as Memory API maintainer, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 02/11] exec: introduce qemu_ram_unset_idstr() to unset RAMBlock idstr, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 05/11] memory: Simplify mr_add_subregion() if-else, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 06/11] exec: dummy_section: Pass address space through., Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 09/11] memory: MemoryRegion: factor out memory region re-adder, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 08/11] memory: MemoryRegion: factor out subregion add functionality, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 07/11] qtest: fix qtest_clock_warp() for no deadline case, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 10/11] memory: MemoryRegion: rename parent to container,
Paolo Bonzini <=
- [Qemu-devel] [PULL 11/11] memory: Don't call memory_region_update_coalesced_range if nothing changed, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 03/11] unset RAMBlock idstr when unregister MemoryRegion, Paolo Bonzini, 2014/06/18
- [Qemu-devel] [PULL 04/11] memory: Don't update all memory region when ioeventfd changed, Paolo Bonzini, 2014/06/18
- Re: [Qemu-devel] [PULL 00/11] Memory API changes for 2014-06-18, Peter Maydell, 2014/06/18