From d8ed79aea7b89b1dc0dbd9ca0b05508e711d2c6d Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 21 Oct 2009 15:25:28 +0200 Subject: [PATCH] qdev: add qdev_prop_exists() Function test whenever a driver has a specific property. Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- hw/qdev-properties.c | 5 +++++ hw/qdev.h | 1 + 2 files changed, 6 insertions(+) diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 2d4eeecbe7..bda6699383 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -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; diff --git a/hw/qdev.h b/hw/qdev.h index 2e7983fca6..77075a8e03 100644 --- 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);