aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-12 14:29:43 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-15 09:20:49 -0600
commitcd34d667d448bec91c81f4e46f9e7eb4e4857f6f (patch)
tree2c09ce02e084d5555942d8d21ca59de386dd1847 /hw/qdev.c
parent6a146eba33159cb97d28457d409d81066cbefb09 (diff)
qdev: add a qdev_get_type() function and expose as a 'type' property
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 0fc20fc6a8..83913c72f2 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -110,6 +110,8 @@ static DeviceState *qdev_create_from_info(BusState *bus, DeviceInfo *info)
qdev_property_add_legacy(dev, prop, NULL);
}
+ qdev_property_add_str(dev, "type", qdev_get_type, NULL, NULL);
+
return dev;
}
@@ -1031,6 +1033,11 @@ char* qdev_get_fw_dev_path(DeviceState *dev)
return strdup(path);
}
+char *qdev_get_type(DeviceState *dev, Error **errp)
+{
+ return g_strdup(dev->info->name);
+}
+
void qdev_ref(DeviceState *dev)
{
dev->ref++;