qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] stop using stdio for monitor/serial/etc with -daemonize
Date: Tue, 25 Sep 2012 17:49:22 +0400	[thread overview]
Message-ID: <5061B662.2030005@msgid.tls.msk.ru> (raw)
In-Reply-To: <50619B33.7030903@msgid.tls.msk.ru>

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

      reply	other threads:[~2012-09-25 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25 10:43 [Qemu-devel] [PATCH] stop using stdio for monitor/serial/etc with -daemonize Michael Tokarev
2012-09-25 11:23 ` Peter Maydell
2012-09-25 11:53   ` Michael Tokarev
2012-09-25 13:49     ` Michael Tokarev [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5061B662.2030005@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).