qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	peterx@redhat.com
Subject: [Qemu-devel] [RFC 2/3] monitor: generate flag parse helper from init func
Date: Fri, 24 Aug 2018 17:08:25 +0800	[thread overview]
Message-ID: <20180824090826.21370-3-peterx@redhat.com> (raw)
In-Reply-To: <20180824090826.21370-1-peterx@redhat.com>

Just to put the flag parsing part into a standalone function, which will
be used in follow up patches.  No functional change.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 vl.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/vl.c b/vl.c
index 16b913f9d5..25e156c020 100644
--- a/vl.c
+++ b/vl.c
@@ -2302,10 +2302,8 @@ static int fsdev_init_func(void *opaque, QemuOpts *opts, Error **errp)
 }
 #endif
 
-static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
+static int mon_parse_flags(QemuOpts *opts)
 {
-    Chardev *chr;
-    const char *chardev;
     const char *mode;
     int flags;
 
@@ -2330,6 +2328,16 @@ static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
         flags |= MONITOR_USE_OOB;
     }
 
+    return flags;
+}
+
+static int mon_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+    Chardev *chr;
+    const char *chardev;
+    int flags;
+
+    flags = mon_parse_flags(opts);
     chardev = qemu_opt_get(opts, "chardev");
     chr = qemu_chr_find(chardev);
     if (chr == NULL) {
-- 
2.17.1

  parent reply	other threads:[~2018-08-24  9:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24  9:08 [Qemu-devel] [RFC 0/3] chardev: introduce chardev contexts Peter Xu
2018-08-24  9:08 ` [Qemu-devel] [RFC 1/3] " Peter Xu
2018-08-24  9:08 ` Peter Xu [this message]
2018-08-24  9:08 ` [Qemu-devel] [RFC 3/3] monitor: switch to use chardev's iothread Peter Xu
2018-08-24 13:46 ` [Qemu-devel] [RFC 0/3] chardev: introduce chardev contexts Marc-André Lureau
2018-08-27  2:30   ` Peter Xu

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=20180824090826.21370-3-peterx@redhat.com \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).