qdev: add qdev_prop_exists()
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 21 Oct 2009 13:25:28 +0000 (15:25 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 27 Oct 2009 17:28:38 +0000 (12:28 -0500)
Function test whenever a driver has a specific property.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/qdev-properties.c
hw/qdev.h

index 2d4eeec..bda6699 100644 (file)
@@ -480,6 +480,11 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name)
     return NULL;
 }
 
+int qdev_prop_exists(DeviceState *dev, const char *name)
+{
+    return qdev_prop_find(dev, name) ? true : false;
+}
+
 int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
 {
     Property *prop;
index 2e7983f..77075a8 100644 (file)
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -249,6 +249,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_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_uint8(DeviceState *dev, const char *name, uint8_t value);