From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VfrTO-0005P8-Jo for qemu-devel@nongnu.org; Mon, 11 Nov 2013 08:24:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VfrTI-00027G-E4 for qemu-devel@nongnu.org; Mon, 11 Nov 2013 08:24:10 -0500 Message-ID: <5280DA6F.2090607@suse.de> Date: Mon, 11 Nov 2013 14:23:59 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1384155875-26999-1-git-send-email-aik@ozlabs.ru> <1384155875-26999-5-git-send-email-aik@ozlabs.ru> <5280D061.50802@suse.de> <5280D329.8000507@siemens.com> In-Reply-To: <5280D329.8000507@siemens.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 4/6] qemu-option: support +foo/-foo command line agruments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka , qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , Alexander Graf , Luiz Capitulino , qemu-ppc@nongnu.org, Anthony Liguori , Igor Mammedov Am 11.11.2013 13:52, schrieb Jan Kiszka: > On 2013-11-11 13:41, Andreas F=E4rber wrote: >> Am 11.11.2013 08:44, schrieb Alexey Kardashevskiy: >>> This converts +foo/-foo to "foo=3Don"/"foo=3Doff" respectively when >>> QEMU parser is used for the command line options. >>> >>> "-cpu" parsers in x86 and other architectures should be unaffected >>> by this change. >>> >>> Signed-off-by: Alexey Kardashevskiy >>> --- >>> util/qemu-option.c | 6 ++++++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/util/qemu-option.c b/util/qemu-option.c >>> index efcb5dc..6c8667c 100644 >>> --- a/util/qemu-option.c >>> +++ b/util/qemu-option.c >>> @@ -890,6 +890,12 @@ static int opts_do_parse(QemuOpts *opts, const c= har *params, >>> if (strncmp(option, "no", 2) =3D=3D 0) { >>> memmove(option, option+2, strlen(option+2)+1); >>> pstrcpy(value, sizeof(value), "off"); >>> + } else if (strncmp(option, "-", 1) =3D=3D 0) { >>> + memmove(option, option+1, strlen(option+1)+1); >>> + pstrcpy(value, sizeof(value), "off"); >>> + } else if (strncmp(option, "+", 1) =3D=3D 0) { >>> + memmove(option, option+1, strlen(option+1)+1); >>> + pstrcpy(value, sizeof(value), "on"); >>> } else { >>> pstrcpy(value, sizeof(value), "on"); >>> } >> >> This looks like an interesting idea! However this is much too big a >> change to just CC ppc folks on... >> >> Jan, I wonder if this might break slirp's hostfwd option? >=20 > hostfwd starts with ":" in the simplest case - or what pattern do you > have in mind? Ah right, I had :8022-:22 or so in mind and mixed up optional host name with optional source port. Basically I'm checking for anything which is using the generic QemuOpts parsing and where a literal + or - may lead to unexpected parsing changes with this patch. Without having looked up more context for this hunk, it should not affect foo=3D-bar but only where foo=3D is optional, such as type names for driver=3D starting with either character (not awar= e of such types though). Andreas >> Not sure what other options potentially starting with '-' might be >> affected. Test cases would be a helpful way of demonstrating that this >> change does not have undesired side effects. --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg