qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH V1 06/14] qdev: Added fn for querying device pro


From: Peter A. G. Crosthwaite
Subject: [Qemu-devel] [RFC PATCH V1 06/14] qdev: Added fn for querying device property types
Date: Thu, 25 Aug 2011 16:41:12 +1000

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 <address@hidden>
---
 hw/qdev-properties.c |    9 +++++++++
 hw/qdev.h            |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 0c0c292..b5b2a78 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -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;
diff --git a/hw/qdev.h b/hw/qdev.h
index 8a13ec9..79d9f9d 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -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);
-- 
1.7.3.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]