From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N0bCT-0007se-UG for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:26:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N0bCP-0007mg-R4 for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:26:01 -0400 Received: from [199.232.76.173] (port=55718 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N0bCO-0007ld-TG for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:25:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26549) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N0bCM-0007PV-Qf for qemu-devel@nongnu.org; Wed, 21 Oct 2009 09:25:55 -0400 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9LDPrZL011394 for ; Wed, 21 Oct 2009 09:25:53 -0400 From: Gerd Hoffmann Date: Wed, 21 Oct 2009 15:25:28 +0200 Message-Id: <1256131543-28416-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1256131543-28416-1-git-send-email-kraxel@redhat.com> References: <1256131543-28416-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 07/22] qdev: add qdev_prop_exists() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Function test whenever a driver has a specific property. Signed-off-by: Gerd Hoffmann --- hw/qdev-properties.c | 5 +++++ hw/qdev.h | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) 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); -- 1.6.2.5