[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 004/197] qom: introduce root device
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH v3 004/197] qom: introduce root device |
Date: |
Mon, 12 Dec 2011 14:18:00 -0600 |
This is based on Jan's suggestion for how to do unique naming. The root device
is the root of composition. All devices are reachable via child<> links from
this device.
Signed-off-by: Anthony Liguori <address@hidden>
---
Makefile.objs | 2 +-
hw/container.c | 20 ++++++++++++++++++++
hw/qdev.c | 12 ++++++++++++
hw/qdev.h | 8 ++++++++
4 files changed, 41 insertions(+), 1 deletions(-)
create mode 100644 hw/container.c
diff --git a/Makefile.objs b/Makefile.objs
index d7a6539..10e794c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -279,7 +279,7 @@ hw-obj-$(CONFIG_LSI_SCSI_PCI) += lsi53c895a.o
hw-obj-$(CONFIG_ESP) += esp.o
hw-obj-y += dma-helpers.o sysbus.o isa-bus.o
-hw-obj-y += qdev-addr.o
+hw-obj-y += qdev-addr.o container.o
# VGA
hw-obj-$(CONFIG_VGA_PCI) += vga-pci.o
diff --git a/hw/container.c b/hw/container.c
new file mode 100644
index 0000000..9cbf399
--- /dev/null
+++ b/hw/container.c
@@ -0,0 +1,20 @@
+#include "sysbus.h"
+
+static int container_initfn(SysBusDevice *dev)
+{
+ return 0;
+}
+
+static SysBusDeviceInfo container_info = {
+ .init = container_initfn,
+ .qdev.name = "container",
+ .qdev.size = sizeof(SysBusDevice),
+ .qdev.no_user = 1,
+};
+
+static void container_init(void)
+{
+ sysbus_register_withprop(&container_info);
+}
+
+device_init(container_init);
diff --git a/hw/qdev.c b/hw/qdev.c
index 6f77af9..bb0b9f7 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -1161,3 +1161,15 @@ void qdev_property_add_legacy(DeviceState *dev, Property
*prop,
g_free(type);
}
+
+DeviceState *qdev_get_root(void)
+{
+ static DeviceState *qdev_root;
+
+ if (!qdev_root) {
+ qdev_root = qdev_create(NULL, "container");
+ qdev_init_nofail(qdev_root);
+ }
+
+ return qdev_root;
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index 3b629d4..52aadd2 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -482,4 +482,12 @@ const char *qdev_property_get_type(DeviceState *dev, const
char *name,
*/
void qdev_property_add_legacy(DeviceState *dev, Property *prop, Error **errp);
+/**
+ * @qdev_get_root - returns the root device of the composition tree
+ *
+ * Returns:
+ * The root of the composition tree.
+ */
+DeviceState *qdev_get_root(void);
+
#endif
--
1.7.4.1
- [Qemu-devel] [PATCH v3 027/197] rename qobject -> object, (continued)
- [Qemu-devel] [PATCH v3 027/197] rename qobject -> object, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 057/197] add SMBusDevice to the type hiearchy, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 029/197] Start integration of qom w/qdev., Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 062/197] killall HDACodecDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 028/197] more renames, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 053/197] kill off SCSIDeviceInfo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 019/197] bug fix spotted by paolo, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 014/197] rtc: make piix3 set the rtc as a child (v2), Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 031/197] qdev: don't access name through info, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 063/197] make spapr a bit more patch monkey friendly, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 004/197] qom: introduce root device,
Anthony Liguori <=
- [Qemu-devel] [PATCH v3 044/197] usb: don't access dev->info directly, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 026/197] qom: add qobject, Anthony Liguori, 2011/12/12
- [Qemu-devel] [PATCH v3 068/197] Patch monkey PCIDeviceInfo conversion, Anthony Liguori, 2011/12/12