@@ -583,6 +583,15 @@ int qdev_prop_exists(DeviceState *dev, const char *name)
return qdev_prop_find(dev, name) ? true : false;
}
+int qdev_prop_get_type(DeviceState *dev, const char *name, enum PropertyType *ret)
+{
+ Property *prop = qdev_prop_find(dev, name);
+ if (!prop)
+ return 1;
+ *ret = prop->info->type;
+ return 0;
+}
+
int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
{
Property *prop;
@@ -295,6 +295,7 @@ extern PropertyInfo qdev_prop_pci_devfn;
/* Set properties between creation and init. */
void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
int qdev_prop_exists(DeviceState *dev, const char *name);
+int qdev_prop_get_type(DeviceState *dev, const char *name, enum PropertyType *ret);
int qdev_prop_parse(DeviceState *dev, const char *name, const char *value);
void qdev_prop_set(DeviceState *dev, const char *name, void *src, enum PropertyType type);
void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value);
Added a function qdev_get_prop_type(), which allows a machine model to query the type of a qdev prop of a device using a handle to the device, and the string name of the property Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> --- hw/qdev-properties.c | 9 +++++++++ hw/qdev.h | 1 + 2 files changed, 10 insertions(+), 0 deletions(-)