summaryrefslogtreecommitdiffstats
path: root/include/qemu
diff options
context:
space:
mode:
authorPaolo Bonzini2012-04-11 23:30:20 +0200
committerAndreas Färber2012-06-18 15:14:36 +0200
commit32efc535b86626646442de7fe5793f3a47f4ce91 (patch)
tree0bc63c4a030217c49f98d14b5d56fbefccabd4b3 /include/qemu
parentqom: Introduce object_property_is_{child,link}() (diff)
downloadqemu-32efc535b86626646442de7fe5793f3a47f4ce91.tar.gz
qemu-32efc535b86626646442de7fe5793f3a47f4ce91.tar.xz
qemu-32efc535b86626646442de7fe5793f3a47f4ce91.zip
qom: Add object_child_foreach()
A utility function that will be used to implement hierarchical realization. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> [AF: Drop unrelated whitespace change, add Returns: in documentation] [AF: Use new object_property_is_child() helper.] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'include/qemu')
-rw-r--r--include/qemu/object.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/qemu/object.h b/include/qemu/object.h
index 487559c5c0..ce9e51f2ae 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -918,6 +918,20 @@ void object_property_add_str(Object *obj, const char *name,
struct Error **errp);
/**
+ * object_child_foreach:
+ * @obj: the object whose children will be navigated
+ * @fn: the iterator function to be called
+ * @opaque: an opaque value that will be passed to the iterator
+ *
+ * Call @fn passing each child of @obj and @opaque to it, until @fn returns
+ * non-zero.
+ *
+ * Returns: The last value returned by @fn, or 0 if there is no child.
+ */
+int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
+ void *opaque);
+
+/**
* container_get:
* @root: root of the #path, e.g., object_get_root()
* @path: path to the container