qom: add string property type

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2011-12-12 14:29:42 -06:00
parent ad6d45fa08
commit 6a146eba33
2 changed files with 81 additions and 0 deletions

View file

@ -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