From patchwork Mon Dec 7 12:42:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [FOR, 0.12, v3, 15/21] chardev: make chardevs specified in config file work. Date: Mon, 07 Dec 2009 02:42:47 -0000 From: Gerd Hoffmann X-Patchwork-Id: 40485 Message-Id: <1260189773-20728-16-git-send-email-kraxel@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , agraf@suse.de, lcapitulino@redhat.com The patch decuples the -chardev switch and the actual chardev initialization. Without this patch qemu ignores chardev entries coming via -readconfig. Signed-off-by: Gerd Hoffmann --- vl.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index 4551ee8..701b687 100644 --- a/vl.c +++ b/vl.c @@ -4620,6 +4620,16 @@ static int device_init_func(QemuOpts *opts, void *opaque) return 0; } +static int chardev_init_func(QemuOpts *opts, void *opaque) +{ + CharDriverState *chr; + + chr = qemu_chr_open_opts(opts, NULL); + if (!chr) + return -1; + return 0; +} + struct device_config { enum { DEV_USB, /* -usbdevice */ @@ -5240,9 +5250,6 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "parse error: %s\n", optarg); exit(1); } - if (qemu_chr_open_opts(opts, NULL) == NULL) { - exit(1); - } break; case QEMU_OPTION_serial: add_device_config(DEV_SERIAL, optarg); @@ -5553,6 +5560,9 @@ int main(int argc, char **argv, char **envp) qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0); + if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0) + exit(1); + if (display_type == DT_NOGRAPHIC) { if (default_parallel) add_device_config(DEV_PARALLEL, "null");