aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-06-12 23:06:22 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-06-12 23:06:22 +0100
commit7d3660e79830a069f1848bb4fa1cdf8f666424fb (patch)
tree5651ddf02414086c31d0bfca7713e1800d4f0fc8 /qom
parent9e3903136d9acde2fb2dd9e967ba928050a6cb4a (diff)
parent3575b0aea983ad57804c9af739ed8ff7bc168393 (diff)
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* Miscellaneous fixes and feature enablement (many) * SEV refactoring (David) * Hyper-V initial support (Jon) * i386 TCG fixes (x87 and SSE, Joseph) * vmport cleanup and improvements (Philippe, Liran) * Use-after-free with vCPU hot-unplug (Nengyuan) * run-coverity-scan improvements (myself) * Record/replay fixes (Pavel) * -machine kernel_irqchip=split improvements for INTx (Peter) * Code cleanups (Philippe) * Crash and security fixes (PJP) * HVF cleanups (Roman) # gpg: Signature made Fri 12 Jun 2020 16:57:04 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (116 commits) target/i386: Remove obsolete TODO file stubs: move Xen stubs to accel/ replay: fix replay shutdown for console mode exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/hcd-musb.h' hw/usb: Move device-specific declarations to new 'hcd-musb.h' header exec/memory: Remove unused MemoryRegionMmio type checkpatch: reversed logic with acpi test checks target/i386: sev: Unify SEVState and SevGuestState target/i386: sev: Remove redundant handle field target/i386: sev: Remove redundant policy field target/i386: sev: Remove redundant cbitpos and reduced_phys_bits fields target/i386: sev: Partial cleanup to sev_state global target/i386: sev: Embed SEVState in SevGuestState target/i386: sev: Rename QSevGuestInfo target/i386: sev: Move local structure definitions into .c file target/i386: sev: Remove unused QSevGuestInfoClass xen: fix build without pci passthrough i386: hvf: Drop HVFX86EmulatorState i386: hvf: Move mmio_buf into CPUX86State i386: hvf: Move lazy_flags into CPUX86State ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # hw/i386/acpi-build.c
Diffstat (limited to 'qom')
-rw-r--r--qom/container.c1
-rw-r--r--qom/object.c39
2 files changed, 18 insertions, 22 deletions
diff --git a/qom/container.c b/qom/container.c
index 14e7ae485b..455e8410c6 100644
--- a/qom/container.c
+++ b/qom/container.c
@@ -16,7 +16,6 @@
static const TypeInfo container_info = {
.name = "container",
- .instance_size = sizeof(Object),
.parent = TYPE_OBJECT,
};
diff --git a/qom/object.c b/qom/object.c
index d0be42c8d6..b0ed560fd8 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -262,8 +262,7 @@ static void type_initialize_interface(TypeImpl *ti, TypeImpl *interface_type,
new_iface->concrete_class = ti->class;
new_iface->interface_type = interface_type;
- ti->class->interfaces = g_slist_append(ti->class->interfaces,
- iface_impl->class);
+ ti->class->interfaces = g_slist_append(ti->class->interfaces, new_iface);
}
static void object_property_free(gpointer data)
@@ -316,8 +315,6 @@ static void type_initialize(TypeImpl *ti)
g_assert(parent->instance_size <= ti->instance_size);
memcpy(ti->class, parent->class, parent->class_size);
ti->class->interfaces = NULL;
- ti->class->properties = g_hash_table_new_full(
- g_str_hash, g_str_equal, NULL, object_property_free);
for (e = parent->class->interfaces; e; e = e->next) {
InterfaceClass *iface = e->data;
@@ -347,11 +344,11 @@ static void type_initialize(TypeImpl *ti)
type_initialize_interface(ti, t, t);
}
- } else {
- ti->class->properties = g_hash_table_new_full(
- g_str_hash, g_str_equal, NULL, object_property_free);
}
+ ti->class->properties = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
+ object_property_free);
+
ti->class->type = ti;
while (parent) {
@@ -497,10 +494,8 @@ static void object_class_property_init_all(Object *obj)
}
}
-static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
+static void object_initialize_with_type(Object *obj, size_t size, TypeImpl *type)
{
- Object *obj = data;
-
type_initialize(type);
g_assert(type->instance_size >= sizeof(Object));
@@ -1051,7 +1046,10 @@ static int do_object_child_foreach(Object *obj,
break;
}
if (recurse) {
- do_object_child_foreach(child, fn, opaque, true);
+ ret = do_object_child_foreach(child, fn, opaque, true);
+ if (ret != 0) {
+ break;
+ }
}
}
}
@@ -1953,26 +1951,25 @@ Object *object_resolve_path_component(Object *parent, const char *part)
}
static Object *object_resolve_abs_path(Object *parent,
- char **parts,
- const char *typename,
- int index)
+ char **parts,
+ const char *typename)
{
Object *child;
- if (parts[index] == NULL) {
+ if (*parts == NULL) {
return object_dynamic_cast(parent, typename);
}
- if (strcmp(parts[index], "") == 0) {
- return object_resolve_abs_path(parent, parts, typename, index + 1);
+ if (strcmp(*parts, "") == 0) {
+ return object_resolve_abs_path(parent, parts + 1, typename);
}
- child = object_resolve_path_component(parent, parts[index]);
+ child = object_resolve_path_component(parent, *parts);
if (!child) {
return NULL;
}
- return object_resolve_abs_path(child, parts, typename, index + 1);
+ return object_resolve_abs_path(child, parts + 1, typename);
}
static Object *object_resolve_partial_path(Object *parent,
@@ -1984,7 +1981,7 @@ static Object *object_resolve_partial_path(Object *parent,
GHashTableIter iter;
ObjectProperty *prop;
- obj = object_resolve_abs_path(parent, parts, typename, 0);
+ obj = object_resolve_abs_path(parent, parts, typename);
g_hash_table_iter_init(&iter, parent->properties);
while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&prop)) {
@@ -2029,7 +2026,7 @@ Object *object_resolve_path_type(const char *path, const char *typename,
*ambiguousp = ambiguous;
}
} else {
- obj = object_resolve_abs_path(object_get_root(), parts, typename, 1);
+ obj = object_resolve_abs_path(object_get_root(), parts + 1, typename);
}
g_strfreev(parts);