[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC PATCH v3 16/24] qom: Introduce object_has_no_children()
From: |
Bharata B Rao |
Subject: |
[Qemu-ppc] [RFC PATCH v3 16/24] qom: Introduce object_has_no_children() API |
Date: |
Fri, 24 Apr 2015 12:17:38 +0530 |
This QOM API can be used to check of an object has any child objects
associated with it.
Needed by PowerPC CPU hotplug code to release parent CPU core and
socket objects only after ascertaining that they don't have any child
objects.
Signed-off-by: Bharata B Rao <address@hidden>
---
include/qom/object.h | 11 +++++++++++
qom/object.c | 12 ++++++++++++
2 files changed, 23 insertions(+)
diff --git a/include/qom/object.h b/include/qom/object.h
index d2d7748..264e412 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1317,6 +1317,17 @@ int object_child_foreach(Object *obj, int (*fn)(Object
*child, void *opaque),
void *opaque);
/**
+ * object_has_no_children:
+ * @obj: the object which will be checked for children
+ *
+ * Navigate the properties list of the @obj and check for any child
+ * property.
+ *
+ * Returns: true if no child properties are found, else returns false.
+ */
+bool object_has_no_children(Object *obj);
+
+/**
* container_get:
* @root: root of the #path, e.g., object_get_root()
* @path: path to the container
diff --git a/qom/object.c b/qom/object.c
index d167038..0fddf00 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -683,6 +683,18 @@ int object_child_foreach(Object *obj, int (*fn)(Object
*child, void *opaque),
return ret;
}
+bool object_has_no_children(Object *obj)
+{
+ ObjectProperty *prop;
+
+ QTAILQ_FOREACH(prop, &obj->properties, node) {
+ if (object_property_is_child(prop)) {
+ return false;
+ }
+ }
+ return true;
+}
+
static void object_class_get_list_tramp(ObjectClass *klass, void *opaque)
{
GSList **list = opaque;
--
2.1.0
- [Qemu-ppc] [RFC PATCH v3 06/24] spapr: Consolidate cpu init code into a routine, (continued)
- [Qemu-ppc] [RFC PATCH v3 06/24] spapr: Consolidate cpu init code into a routine, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 07/24] cpu: Prepare Socket container type, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 08/24] ppc: Prepare CPU socket/core abstraction, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 09/24] spapr: Add CPU hotplug handler, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 10/24] ppc: Update cpu_model in MachineState, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 11/24] ppc: Create sockets and cores for CPUs, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 12/24] spapr: CPU hotplug support, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 13/24] cpus: Add Error argument to cpu_exec_init(), Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 14/24] cpus: Convert cpu_index into a bitmap, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 15/24] ppc: Move cpu_exec_init() call to realize function, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 16/24] qom: Introduce object_has_no_children() API,
Bharata B Rao <=
- [Qemu-ppc] [RFC PATCH v3 17/24] cpus: Reclaim vCPU objects, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 18/24] xics_kvm: Don't enable KVM_CAP_IRQ_XICS if already enabled, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 19/24] xics_kvm: Add cpu_destroy method to XICS, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 20/24] spapr: CPU hot unplug support, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 21/24] spapr: Initialize hotplug memory address space, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 22/24] numa: API to lookup NUMA node by address, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 23/24] spapr: Support ibm, dynamic-reconfiguration-memory, Bharata B Rao, 2015/04/24
- [Qemu-ppc] [RFC PATCH v3 24/24] spapr: Memory hotplug support, Bharata B Rao, 2015/04/24