All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com,
	marcandre.lureau@redhat.com, pbonzini@redhat.com
Subject: [PATCH 2/6] char: Factor out qemu_chr_print_types()
Date: Fri, 23 Oct 2020 12:12:18 +0200	[thread overview]
Message-ID: <20201023101222.250147-3-kwolf@redhat.com> (raw)
In-Reply-To: <20201023101222.250147-1-kwolf@redhat.com>

We'll want to call the same from a non-QemuOpts code path.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 include/chardev/char.h |  1 +
 chardev/char.c         | 17 +++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/include/chardev/char.h b/include/chardev/char.h
index db42f0a8c6..3b91645081 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -212,6 +212,7 @@ void qemu_chr_be_update_read_handlers(Chardev *s,
  */
 void qemu_chr_be_event(Chardev *s, QEMUChrEvent event);
 
+void qemu_chr_print_types(void);
 int qemu_chr_add_client(Chardev *s, int fd);
 Chardev *qemu_chr_find(const char *name);
 
diff --git a/chardev/char.c b/chardev/char.c
index 78553125d3..028612c333 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -633,6 +633,16 @@ ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, Error **errp)
     return backend;
 }
 
+void qemu_chr_print_types(void)
+{
+    GString *str = g_string_new("");
+
+    chardev_name_foreach(help_string_append, str);
+
+    qemu_printf("Available chardev backend types: %s\n", str->str);
+    g_string_free(str, true);
+}
+
 Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
                                 Error **errp)
 {
@@ -644,12 +654,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
     char *bid = NULL;
 
     if (name && is_help_option(name)) {
-        GString *str = g_string_new("");
-
-        chardev_name_foreach(help_string_append, str);
-
-        qemu_printf("Available chardev backend types: %s\n", str->str);
-        g_string_free(str, true);
+        qemu_chr_print_types();
         return NULL;
     }
 
-- 
2.28.0



  parent reply	other threads:[~2020-10-23 10:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 10:12 [PATCH 0/6] qemu-storage-daemon: QAPIfy --chardev Kevin Wolf
2020-10-23 10:12 ` [PATCH 1/6] char/stdio: Fix QMP default for 'signal' Kevin Wolf
2020-10-23 10:38   ` Marc-André Lureau
2020-10-23 12:12   ` Markus Armbruster
2020-10-23 10:12 ` Kevin Wolf [this message]
2020-10-23 10:38   ` [PATCH 2/6] char: Factor out qemu_chr_print_types() Marc-André Lureau
2020-10-23 12:15     ` Markus Armbruster
2020-10-23 10:12 ` [PATCH 3/6] qapi: Remove wrapper struct for simple unions Kevin Wolf
2020-10-23 10:40   ` Marc-André Lureau
2020-10-23 11:06     ` Marc-André Lureau
2020-10-23 12:28       ` Kevin Wolf
2020-10-23 12:49     ` Markus Armbruster
2020-10-23 14:06       ` Kevin Wolf
2020-10-23 10:12 ` [PATCH 4/6] qapi: Optionally parse simple unions as flat Kevin Wolf
2020-10-23 10:12 ` [PATCH 5/6] tests/qapi-schema: Flat representation of simple unions Kevin Wolf
2020-10-23 10:12 ` [PATCH 6/6] qemu-storage-daemon: Use qmp_chardev_add() for --chardev Kevin Wolf
2020-10-26 13:33   ` Markus Armbruster
2020-10-23 10:36 ` [PATCH 0/6] qemu-storage-daemon: QAPIfy --chardev Daniel P. Berrangé
2020-10-23 11:05   ` Paolo Bonzini
2020-10-23 11:56   ` Kevin Wolf
2020-10-23 13:40   ` Markus Armbruster
2020-10-23 16:08     ` Paolo Bonzini
2020-10-25 17:42       ` Markus Armbruster

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=20201023101222.250147-3-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.