Revision 2f262e06
b/hw/qdev.c | ||
---|---|---|
515 | 515 |
return strdup(path); |
516 | 516 |
} |
517 | 517 |
|
518 |
static char *qdev_get_type(Object *obj, Error **errp) |
|
519 |
{ |
|
520 |
return g_strdup(object_get_typename(obj)); |
|
521 |
} |
|
522 |
|
|
523 | 518 |
/** |
524 | 519 |
* Legacy property handling |
525 | 520 |
*/ |
... | ... | |
638 | 633 |
qdev_property_add_static(dev, prop, NULL); |
639 | 634 |
} |
640 | 635 |
|
641 |
object_property_add_str(OBJECT(dev), "type", qdev_get_type, NULL, NULL); |
|
642 | 636 |
qdev_prop_set_defaults(dev, qdev_get_props(dev)); |
643 | 637 |
} |
644 | 638 |
|
b/qom/object.c | ||
---|---|---|
1231 | 1231 |
prop, errp); |
1232 | 1232 |
} |
1233 | 1233 |
|
1234 |
static char *qdev_get_type(Object *obj, Error **errp) |
|
1235 |
{ |
|
1236 |
return g_strdup(object_get_typename(obj)); |
|
1237 |
} |
|
1238 |
|
|
1239 |
static void object_instance_init(Object *obj) |
|
1240 |
{ |
|
1241 |
object_property_add_str(obj, "type", qdev_get_type, NULL, NULL); |
|
1242 |
} |
|
1243 |
|
|
1234 | 1244 |
static void register_types(void) |
1235 | 1245 |
{ |
1236 | 1246 |
static TypeInfo interface_info = { |
... | ... | |
1242 | 1252 |
static TypeInfo object_info = { |
1243 | 1253 |
.name = TYPE_OBJECT, |
1244 | 1254 |
.instance_size = sizeof(Object), |
1255 |
.instance_init = object_instance_init, |
|
1245 | 1256 |
.abstract = true, |
1246 | 1257 |
}; |
1247 | 1258 |
|
Also available in: Unified diff