aboutsummaryrefslogtreecommitdiff
path: root/hw/qdev.h
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-12 14:29:42 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-15 09:20:49 -0600
commit6a146eba33159cb97d28457d409d81066cbefb09 (patch)
tree272555e4ad8544561d44616cbe52ba5a91101c49 /hw/qdev.h
parentad6d45fa0837acf3e8cab323ee5b08e05a9410a5 (diff)
qom: add string property type
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.h')
-rw-r--r--hw/qdev.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/qdev.h b/hw/qdev.h
index fdab84835e..9faf2ee18b 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -574,4 +574,26 @@ void qdev_property_add_link(DeviceState *dev, const char *name,
const char *type, DeviceState **child,
Error **errp);
+/**
+ * @qdev_property_add_str
+ *
+ * Add a string property using getters/setters. This function will add a
+ * property of type 'string'.
+ *
+ * @dev - the device to add a property to
+ *
+ * @name - the name of the property
+ *
+ * @get - the getter or NULL if the property is write-only. This function must
+ * return a string to be freed by @g_free().
+ *
+ * @set - the setter or NULL if the property is read-only
+ *
+ * @errp - if an error occurs, a pointer to an area to store the error
+ */
+void qdev_property_add_str(DeviceState *dev, const char *name,
+ char *(*get)(DeviceState *, Error **),
+ void (*set)(DeviceState *, const char *, Error **),
+ Error **errp);
+
#endif