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, mreitz@redhat.com
Subject: [PATCH 2/4] qemu-io: Support help options for --object
Date: Fri, 11 Oct 2019 22:55:49 +0200	[thread overview]
Message-ID: <20191011205551.32149-3-kwolf@redhat.com> (raw)
In-Reply-To: <20191011205551.32149-1-kwolf@redhat.com>

Instead of parsing help options as normal object properties and
returning an error, provide the same help functionality as the system
emulator in qemu-io, too.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-io.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/qemu-io.c b/qemu-io.c
index f64eca6940..91e3276592 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -475,6 +475,13 @@ static QemuOptsList qemu_object_opts = {
     },
 };
 
+static bool qemu_io_object_print_help(const char *type, QemuOpts *opts)
+{
+    if (user_creatable_print_help(type, opts)) {
+        exit(0);
+    }
+    return true;
+}
 
 static QemuOptsList file_opts = {
     .name = "file",
@@ -622,7 +629,7 @@ int main(int argc, char **argv)
 
     qemu_opts_foreach(&qemu_object_opts,
                       user_creatable_add_opts_foreach,
-                      NULL, &error_fatal);
+                      qemu_io_object_print_help, &error_fatal);
 
     if (!trace_init_backends()) {
         exit(1);
-- 
2.20.1



  parent reply	other threads:[~2019-10-11 20:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 20:55 [PATCH 0/4] qemu-img/io/nbd: Support help options for --object Kevin Wolf
2019-10-11 20:55 ` [PATCH 1/4] vl: Split off user_creatable_print_help() Kevin Wolf
2019-10-11 21:35   ` Eric Blake
2019-10-14  9:55     ` Kevin Wolf
2019-10-14 14:18       ` Eric Blake
2019-10-11 20:55 ` Kevin Wolf [this message]
2019-10-11 21:36   ` [PATCH 2/4] qemu-io: Support help options for --object Eric Blake
2019-10-11 20:55 ` [PATCH 3/4] qemu-img: " Kevin Wolf
2019-10-11 21:37   ` Eric Blake
2019-10-11 20:55 ` [PATCH 4/4] qemu-nbd: " Kevin Wolf
2019-10-11 21:39   ` Eric Blake
2019-10-14  9:47     ` Kevin Wolf

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=20191011205551.32149-3-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=mreitz@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.