qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	patches@linaro.org
Subject: [Qemu-devel] [PATCH 1/4] qemu-option: Add support for merged QemuOptsLists
Date: Wed,  8 Feb 2012 05:41:37 +0000	[thread overview]
Message-ID: <1328679700-31015-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1328679700-31015-1-git-send-email-peter.maydell@linaro.org>

Add support for option lists which are merged together, so that
"-listname foo=bar -listname bar=baz" is equivalent to "-listname
foo=bar,bar=baz" rather than generating two separate lists of options.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 qemu-option.c |    7 ++++++-
 qemu-option.h |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/qemu-option.c b/qemu-option.c
index 4626ccf..35cd609 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -741,13 +741,18 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fail_if_exist
         }
         opts = qemu_opts_find(list, id);
         if (opts != NULL) {
-            if (fail_if_exists) {
+            if (fail_if_exists && !list->merge_lists) {
                 qerror_report(QERR_DUPLICATE_ID, id, list->name);
                 return NULL;
             } else {
                 return opts;
             }
         }
+    } else if (list->merge_lists) {
+        opts = qemu_opts_find(list, NULL);
+        if (opts) {
+            return opts;
+        }
     }
     opts = g_malloc0(sizeof(*opts));
     if (id) {
diff --git a/qemu-option.h b/qemu-option.h
index e6f61e6..3ca00c3 100644
--- a/qemu-option.h
+++ b/qemu-option.h
@@ -100,6 +100,7 @@ typedef struct QemuOptDesc {
 struct QemuOptsList {
     const char *name;
     const char *implied_opt_name;
+    bool merge_lists;  /* Merge multiple uses of option into a single list? */
     QTAILQ_HEAD(, QemuOpts) head;
     QemuOptDesc desc[];
 };
-- 
1.7.5.4

  reply	other threads:[~2012-02-08  5:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-08  5:41 [Qemu-devel] [PATCH 0/4] arm: add device tree support (via machine opts) Peter Maydell
2012-02-08  5:41 ` Peter Maydell [this message]
2012-02-08  5:41 ` [Qemu-devel] [PATCH 2/4] Make -machine/-enable-kvm options merge into a single list Peter Maydell
2012-02-17  8:11   ` andrzej zaborowski
2012-02-08  5:41 ` [Qemu-devel] [PATCH 3/4] Make kernel, initrd and append be machine_opts Peter Maydell
2012-02-22 18:31   ` Anthony Liguori
2012-02-08  5:41 ` [Qemu-devel] [PATCH 4/4] arm: add device tree support Peter Maydell
2012-02-20 19:47   ` Peter Maydell
2012-02-21  9:23     ` Peter Crosthwaite
2012-02-08  8:16 ` [Qemu-devel] [PATCH 0/4] arm: add device tree support (via machine opts) Peter Crosthwaite

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=1328679700-31015-2-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=grant.likely@secretlab.ca \
    --cc=patches@linaro.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 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).