Message ID | 74685dbe793dcda72f02a4ef8f8fae68992dd813.1339578989.git.peter.crosthwaite@petalogix.com |
---|---|
State | New |
Headers | show |
Il 13/06/2012 11:38, Peter A. G. Crosthwaite ha scritto: > Create a default canonical path for an object which doesnt have one. This > is a workaround for a bug probably buried deep with qdev as objects should > always have valid canonical paths, but the need came about with the > petalogix_ml605_mmu platform, the ethernet and dma devices as created by > qdev have bogus paths (apparently). We already do this in qdev_init_nofail: if (!OBJECT(dev)->parent) { static int unattached_count = 0; gchar *name = g_strdup_printf("device[%d]", unattached_count++); object_property_add_child(container_get(qdev_get_machine(), "/unattached"), name, OBJECT(dev), NULL); g_free(name); } Probably we should move this piece to a function qdev_attach, so that you can call it before object_property_set_link. Alternatively, we could make object_property_set_link bypass the canonical paths and write the pointer directly, but I think this would be bad. Paolo
diff --git a/qom/object.c b/qom/object.c index e6c3cfb..1eba795 100644 --- a/qom/object.c +++ b/qom/object.c @@ -983,6 +983,13 @@ gchar *object_get_canonical_path(Object *obj) obj = INTERFACE(obj)->iface_obj; } + if (obj->parent == NULL) { + static int num_orphans = 0; + char orphan_name [16]; + snprintf(orphan_name, 16, "orphan%d", num_orphans++); + object_property_add_child(root, orphan_name, obj, NULL); + } + while (obj != root) { ObjectProperty *prop = NULL;
Create a default canonical path for an object which doesnt have one. This is a workaround for a bug probably buried deep with qdev as objects should always have valid canonical paths, but the need came about with the petalogix_ml605_mmu platform, the ethernet and dma devices as created by qdev have bogus paths (apparently). Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> --- qom/object.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)