mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-30 13:31:52 -06:00
qdev: add a qdev_get_type() function and expose as a 'type' property
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
6a146eba33
commit
cd34d667d4
2 changed files with 21 additions and 0 deletions
|
@ -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++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue