summaryrefslogtreecommitdiffstats
path: root/hw/qdev-properties.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-10 10:58:53 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-11 10:19:49 -0500
commit06113719be29c6f8e3f93f98c4ebe3318e889c0c (patch)
treead4df58989f0f39ad44f2ecd938560158eb8b51d /hw/qdev-properties.c
parentc845f401497ff0995ece2b3df628808cf6d74dbe (diff)
downloadhqemu-06113719be29c6f8e3f93f98c4ebe3318e889c0c.zip
hqemu-06113719be29c6f8e3f93f98c4ebe3318e889c0c.tar.gz
qdev: add parser for chardev properties
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev-properties.c')
-rw-r--r--hw/qdev-properties.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 28b2716..2ecb58d 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -193,6 +193,16 @@ PropertyInfo qdev_prop_drive = {
/* --- character device --- */
+static int parse_chr(DeviceState *dev, Property *prop, const char *str)
+{
+ CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
+
+ *ptr = qemu_chr_find(str);
+ if (*ptr == NULL)
+ return -1;
+ return 0;
+}
+
static int print_chr(DeviceState *dev, Property *prop, char *dest, size_t len)
{
CharDriverState **ptr = qdev_get_prop_ptr(dev, prop);
@@ -208,6 +218,7 @@ PropertyInfo qdev_prop_chr = {
.name = "chr",
.type = PROP_TYPE_CHR,
.size = sizeof(CharDriverState*),
+ .parse = parse_chr,
.print = print_chr,
};
OpenPOWER on IntegriCloud