From: Li Zhang <zhlcindy@linux.vnet.ibm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Alexander Graf <agraf@suse.de>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH for-1.3] vl.c: Fix broken -usb option
Date: Fri, 23 Nov 2012 01:05:26 +0800 [thread overview]
Message-ID: <50AE5B56.9070402@linux.vnet.ibm.com> (raw)
In-Reply-To: <1353602925-28887-1-git-send-email-peter.maydell@linaro.org>
On 2012年11月23日 00:48, Peter Maydell wrote:
> Commit 094b287f0b accidentally broke the "-usb" command line
> option, so it would have no effect if the user had not specified
> any machine options at that point. (the return value from
> 'qemu_opts_find(qemu_find_opts("machine"), 0);' is NULL if there
> are no user specified options, so it is only to be used for
> looking up an option, not when trying to set one.) Similarly,
> would '-usbdevice' no longer cause USB to default to enabled.
>
> Fix this regression by using the same style of code for forcing
> the usb=on machine option that we use for other aliases such as
> '-enable-kvm'.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> For 1.3 as this is a regression which would presumably cause
> breakage for migrations and existing working qemu command lines.
>
> vl.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index c8e9c78..a3ab384 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3273,16 +3273,12 @@ int main(int argc, char **argv, char **envp)
> break;
> }
> case QEMU_OPTION_usb:
> - machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
> - if (machine_opts) {
> - qemu_opt_set_bool(machine_opts, "usb", true);
> - }
> + olist = qemu_find_opts("machine");
> + qemu_opts_parse(olist, "usb=on", 0);
> break;
> case QEMU_OPTION_usbdevice:
> - machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
> - if (machine_opts) {
> - qemu_opt_set_bool(machine_opts, "usb", true);
> - }
> + olist = qemu_find_opts("machine");
> + qemu_opts_parse(olist, "usb=on", 0);
> add_device_config(DEV_USB, optarg);
> break;
> case QEMU_OPTION_device:
Looks good to me.
Thanks.
--
Li Zhang
IBM China Linux Technology Centre
next prev parent reply other threads:[~2012-11-22 17:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 16:48 [Qemu-devel] [PATCH for-1.3] vl.c: Fix broken -usb option Peter Maydell
2012-11-22 17:05 ` Li Zhang [this message]
2012-11-26 21:49 ` Anthony Liguori
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=50AE5B56.9070402@linux.vnet.ibm.com \
--to=zhlcindy@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=patches@linaro.org \
--cc=peter.maydell@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 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.