[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] stop using stdio for monitor/serial/etc with -d
From: |
Michael Tokarev |
Subject: |
Re: [Qemu-devel] [PATCH] stop using stdio for monitor/serial/etc with -daemonize |
Date: |
Tue, 25 Sep 2012 17:49:22 +0400 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.6esrpre) Gecko/20120817 Icedove/10.0.6 |
On 25.09.2012 15:53, Michael Tokarev wrote:
> On 25.09.2012 15:23, Peter Maydell wrote:
[]
>> Would it be possible to condense this chain of ifs down a bit
>> by having a variable which gets appropriately set to
>> "stdio", "null" or "vc:80Cx24C" and then used in a single
>> set of add_device_config() calls?
>
> I think it can be, yes. Will try again :)
I don't think it is better (just an example, it doesn't quite work yet):
/* Create default monitor, serial, parallel and virtcon devices. */
/* reuse optarg variable */
optarg = NULL;
if (display_type != DT_NOGRAPHIC) {
/* regular case, all devices directed to the guest console */
optarg = "vc:80Cx24C";
} else if (is_daemonized()) {
/* nographic and daemonize, everything goes to null */
optarg = "null";
} else { /* -nographic and no -daemonize */
/* can't have both serial and virtcon on stdio */
if (default_serial && default_monitor) {
add_device_config(DEV_SERIAL, "mon:stdio");
} else if (default_virtcon && default_monitor) {
add_device_config(DEV_VIRTCON, "mon:stdio");
} else {
optarg = "stdio";
}
}
if (optarg && default_serial) {
add_device_config(DEV_SERIAL, optarg);
}
if (default_parallel) {
add_device_config(DEV_PARALLEL, display_type != DT_NOGRAPHIC ? "null" :
optarg);
}
if (optarg && default_monitor) {
monitor_parse(optarg, "readline");
}
if (optarg && default_virtcon) {
add_device_config(DEV_VIRTCON, optarg);
}
/mjt