aboutsummaryrefslogtreecommitdiff
path: root/qom/object.c
diff options
context:
space:
mode:
Diffstat (limited to 'qom/object.c')
-rw-r--r--qom/object.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/qom/object.c b/qom/object.c
index 0739aa2..563e45b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -10,19 +10,20 @@
* See the COPYING file in the top-level directory.
*/
-#include "qemu/object.h"
+#include "qom/object.h"
#include "qemu-common.h"
-#include "qapi/qapi-visit-core.h"
+#include "qapi/visitor.h"
#include "qapi/string-input-visitor.h"
#include "qapi/string-output-visitor.h"
+#include "qapi/qmp/qerror.h"
/* TODO: replace QObject with a simpler visitor to avoid a dependency
* of the QOM core on QObject? */
-#include "qemu/qom-qobject.h"
-#include "qobject.h"
-#include "qbool.h"
-#include "qint.h"
-#include "qstring.h"
+#include "qom/qom-qobject.h"
+#include "qapi/qmp/qobject.h"
+#include "qapi/qmp/qbool.h"
+#include "qapi/qmp/qint.h"
+#include "qapi/qmp/qstring.h"
#define MAX_INTERFACES 32
@@ -360,12 +361,14 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp)
void object_unparent(Object *obj)
{
+ object_ref(obj);
if (obj->parent) {
object_property_del_child(obj->parent, obj, NULL);
}
if (obj->class->unparent) {
(obj->class->unparent)(obj);
}
+ object_unref(obj);
}
static void object_deinit(Object *obj, TypeImpl *type)
@@ -414,13 +417,6 @@ Object *object_new(const char *typename)
return object_new_with_type(ti);
}
-void object_delete(Object *obj)
-{
- object_unparent(obj);
- g_assert(obj->ref == 1);
- object_unref(obj);
-}
-
Object *object_dynamic_cast(Object *obj, const char *typename)
{
if (obj && object_class_dynamic_cast(object_get_class(obj), typename)) {
@@ -500,6 +496,11 @@ ObjectClass *object_get_class(Object *obj)
return obj->class;
}
+bool object_class_is_abstract(ObjectClass *klass)
+{
+ return klass->type->abstract;
+}
+
const char *object_class_get_name(ObjectClass *klass)
{
return klass->type->name;
@@ -1016,7 +1017,7 @@ gchar *object_get_canonical_path(Object *obj)
return newpath;
}
-Object *object_resolve_path_component(Object *parent, gchar *part)
+Object *object_resolve_path_component(Object *parent, const gchar *part)
{
ObjectProperty *prop = object_property_find(parent, part, NULL);
if (prop == NULL) {