X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=qdev-monitor.c;h=5f2fcdfc455113bb8076dfe75ec2e8b177e60ca3;hb=e42f869b5118fa9ac64dcea624276204567fc581;hp=4f78ecb091c51ccbecfe5e5fe9b716b7766aa74c;hpb=3b71ec8516bb50e9a743645bf139571de0b39f61;p=mirror_qemu.git diff --git a/qdev-monitor.c b/qdev-monitor.c index 4f78ecb091..5f2fcdfc45 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -136,6 +136,7 @@ static void qdev_print_devinfos(bool show_no_user) [DEVICE_CATEGORY_DISPLAY] = "Display", [DEVICE_CATEGORY_SOUND] = "Sound", [DEVICE_CATEGORY_MISC] = "Misc", + [DEVICE_CATEGORY_CPU] = "CPU", [DEVICE_CATEGORY_MAX] = "Uncategorized", }; GSList *list, *elt; @@ -539,10 +540,28 @@ static BusState *qbus_find(const char *path, Error **errp) return bus; } +void qdev_set_id(DeviceState *dev, const char *id) +{ + if (id) { + dev->id = id; + } + + if (dev->id) { + object_property_add_child(qdev_get_peripheral(), dev->id, + OBJECT(dev), NULL); + } else { + static int anon_count; + gchar *name = g_strdup_printf("device[%d]", anon_count++); + object_property_add_child(qdev_get_peripheral_anon(), name, + OBJECT(dev), NULL); + g_free(name); + } +} + DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) { DeviceClass *dc; - const char *driver, *path, *id; + const char *driver, *path; DeviceState *dev; BusState *bus = NULL; Error *err = NULL; @@ -591,21 +610,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) qdev_set_parent_bus(dev, bus); } - id = qemu_opts_id(opts); - if (id) { - dev->id = id; - } - - if (dev->id) { - object_property_add_child(qdev_get_peripheral(), dev->id, - OBJECT(dev), NULL); - } else { - static int anon_count; - gchar *name = g_strdup_printf("device[%d]", anon_count++); - object_property_add_child(qdev_get_peripheral_anon(), name, - OBJECT(dev), NULL); - g_free(name); - } + qdev_set_id(dev, qemu_opts_id(opts)); /* set properties */ if (qemu_opt_foreach(opts, set_property, dev, &err)) {