diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-09-10 10:58:35 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-11 10:19:47 -0500 |
commit | 191bc01bc970bd1e86f34ddeab896b2b27fd5124 (patch) | |
tree | 2e88485ef5ca527010d714964bb441020f0df0b1 /vl.c | |
parent | 9d868d4517be12226991b2cc55d11bc0f83ea7b2 (diff) |
switch chardev to QemuOpts: infrastructure, null device
start switching chardevs to QemuOpts. This patch adds the
infrastructure and converts the null device.
The patch brings two new functions:
qemu_chr_open_opts()
same as qemu_chr_open(), but uses QemuOpts instead of a
option char string.
qemu_chr_parse_compat()
accepts a traditional chardev option string, returns the
corresponding QemuOpts instance, to handle backward
compatibility.
The patch also adds a new -chardev switch which can be used to create
named+unconnected chardevs, like this:
-chardev null,id=test
This uses the new qemu_chr_open_opts. Thus with this patch alone only
the null device works. The other devices will follow ...
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -5281,6 +5281,16 @@ int main(int argc, char **argv, char **envp) monitor_devices[monitor_device_index] = optarg; monitor_device_index++; break; + case QEMU_OPTION_chardev: + opts = qemu_opts_parse(&qemu_chardev_opts, optarg, "backend"); + if (!opts) { + fprintf(stderr, "parse error: %s\n", optarg); + exit(1); + } + if (NULL == qemu_chr_open_opts(opts, NULL)) { + exit(1); + } + break; case QEMU_OPTION_serial: if (serial_device_index >= MAX_SERIAL_PORTS) { fprintf(stderr, "qemu: too many serial ports\n"); |