diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-07-15 13:43:34 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-07-16 17:28:53 -0500 |
commit | ccb63de38e63bd8cdcd3db7aeaebc8a34a02ded8 (patch) | |
tree | 58e9685597139fe064b1a20f39bdb81f4d0915bc /hw/qdev.c | |
parent | 96cc181089a532f9f4e6cf6858daf1f04d06cfc5 (diff) | |
download | qemu-ccb63de38e63bd8cdcd3db7aeaebc8a34a02ded8.tar.gz qemu-ccb63de38e63bd8cdcd3db7aeaebc8a34a02ded8.tar.bz2 qemu-ccb63de38e63bd8cdcd3db7aeaebc8a34a02ded8.zip |
qdev: add user-specified identifier to devices.
Add id field to DeviceState. Make "info qtree" print it.
This helps users and management apps identifying devices in monitor
output, which is especially useful with otherwise identical devices
such as two virtio disks.
This patch doesn't add a way to set the id, followup patches will do.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -114,7 +114,8 @@ void qdev_init(DeviceState *dev) void qdev_free(DeviceState *dev) { LIST_REMOVE(dev, sibling); - free(dev); + qemu_free(dev->id); + qemu_free(dev); } /* Get a character (serial) device interface. */ @@ -266,7 +267,8 @@ static void qdev_print_props(Monitor *mon, DeviceState *dev, Property *props, static void qdev_print(Monitor *mon, DeviceState *dev, int indent) { BusState *child; - qdev_printf("dev: %s\n", dev->info->name); + qdev_printf("dev: %s, id \"%s\"\n", dev->info->name, + dev->id ? dev->id : ""); indent += 2; if (dev->num_gpio_in) { qdev_printf("gpio-in %d\n", dev->num_gpio_in); |