[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/18] dev: add an anonymous peripheral container
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 12/18] dev: add an anonymous peripheral container |
Date: |
Wed, 30 Nov 2011 15:03:42 -0600 |
Signed-off-by: Anthony Liguori <address@hidden>
---
hw/qdev.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index 8b8d53e..b944108 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -235,6 +235,19 @@ static DeviceState *qdev_get_peripheral(void)
return dev;
}
+static DeviceState *qdev_get_peripheral_anon(void)
+{
+ static DeviceState *dev;
+
+ if (dev == NULL) {
+ dev = qdev_create(NULL, "container");
+ qdev_property_add_child(qdev_get_root(), "peripheral-anon", dev, NULL);
+ qdev_init_nofail(dev);
+ }
+
+ return dev;
+}
+
DeviceState *qdev_device_add(QemuOpts *opts)
{
const char *driver, *path, *id;
@@ -287,7 +300,13 @@ DeviceState *qdev_device_add(QemuOpts *opts)
if (id) {
qdev->id = id;
qdev_property_add_child(qdev_get_peripheral(), qdev->id, qdev, NULL);
- }
+ } else {
+ static int anon_count;
+ gchar *name = g_strdup_printf("device[%d]", anon_count++);
+ qdev_property_add_child(qdev_get_peripheral_anon(), name,
+ qdev, NULL);
+ g_free(name);
+ }
if (qemu_opt_foreach(opts, set_property, qdev, 1) != 0) {
qdev_free(qdev);
return NULL;
--
1.7.4.1
- [Qemu-devel] [PATCH 02/18] qom: register legacy properties as new style properties, (continued)
- [Qemu-devel] [PATCH 02/18] qom: register legacy properties as new style properties, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 08/18] qapi: allow a 'gen' key to suppress code generation, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 10/18] qom: qom_{get,set} monitor commands, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 11/18] qdev: add explicitly named devices to the root complex, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 17/18] Add test tools, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 16/18] Make qmp.py easier to use, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 18/18] qdev: split out QOM functions to separate files, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 13/18] rtc: make piix3 set the rtc as a child, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 09/18] qmp: add qom-list command, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 15/18] qom: optimize qdev_get_canonical_path using a parent link, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 12/18] dev: add an anonymous peripheral container,
Anthony Liguori <=
- [Qemu-devel] [PATCH 14/18] rtc: add a dynamic property for retrieving the date, Anthony Liguori, 2011/11/30
- Re: [Qemu-devel] [PATCH 00/18] qom: dynamic properties and composition tree, Anthony Liguori, 2011/11/30