Patchwork [RfC,v3,07/10] qdev: add qdev_prop_exists()

login
register
mail settings
Submitter Gerd Hoffmann
Date Oct. 16, 2009, 1:42 p.m.
Message ID <1255700523-15270-8-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/36216/
State New
Headers show

Comments

Gerd Hoffmann - Oct. 16, 2009, 1:42 p.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/qdev-properties.c |    5 +++++
 hw/qdev.h            |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index c9843a2..370f356 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -452,6 +452,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;
diff --git a/hw/qdev.h b/hw/qdev.h
index c678ab2..5271a3c 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -245,6 +245,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);