[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/18] qdev: add explicitly named devices to the roo
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 11/18] qdev: add explicitly named devices to the root complex |
Date: |
Wed, 30 Nov 2011 15:03:41 -0600 |
We first add a 'peripheral' container to the root device that we add user
created devices to. This provides all user created devices with a unique and
isolated namespace.
Signed-off-by: Anthony Liguori <address@hidden>
---
hw/qdev.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/hw/qdev.c b/hw/qdev.c
index 658ed2c..8b8d53e 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -222,6 +222,19 @@ int qdev_device_help(QemuOpts *opts)
return 1;
}
+static DeviceState *qdev_get_peripheral(void)
+{
+ static DeviceState *dev;
+
+ if (dev == NULL) {
+ dev = qdev_create(NULL, "container");
+ qdev_property_add_child(qdev_get_root(), "peripheral", dev, NULL);
+ qdev_init_nofail(dev);
+ }
+
+ return dev;
+}
+
DeviceState *qdev_device_add(QemuOpts *opts)
{
const char *driver, *path, *id;
@@ -273,6 +286,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
id = qemu_opts_id(opts);
if (id) {
qdev->id = id;
+ qdev_property_add_child(qdev_get_peripheral(), qdev->id, qdev, NULL);
}
if (qemu_opt_foreach(opts, set_property, qdev, 1) != 0) {
qdev_free(qdev);
--
1.7.4.1
- [Qemu-devel] [PATCH 00/18] qom: dynamic properties and composition tree, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 03/18] qom: introduce root device, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 04/18] qdev: provide an interface to return canonical path from root, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 05/18] qdev: provide a path resolution, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 01/18] qom: add new dynamic property infrastructure based on Visitors, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 07/18] qom: add link properties, Anthony Liguori, 2011/11/30
- [Qemu-devel] [PATCH 06/18] qom: add child properties (composition), Anthony Liguori, 2011/11/30
- [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 <=
- [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, 2011/11/30
- [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