From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN4pq-0002OM-0B for qemu-devel@nongnu.org; Mon, 10 Mar 2014 14:22:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WN4pj-0004cC-PO for qemu-devel@nongnu.org; Mon, 10 Mar 2014 14:21:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57442 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN4pj-0004bO-HK for qemu-devel@nongnu.org; Mon, 10 Mar 2014 14:21:51 -0400 Message-ID: <531E02BE.6040900@suse.de> Date: Mon, 10 Mar 2014 19:21:50 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <90998dac0113b5e791189eb3240d60c13446c709.1391607703.git.mrezanin@redhat.com> <4185154.1194203.1394440549303.JavaMail.zimbra@redhat.com> In-Reply-To: <4185154.1194203.1394440549303.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v6] vl.c: Output error on invalid machine type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Miroslav Rezanina , qemu-devel@nongnu.org Cc: Peter Maydell , "Michael S. Tsirkin" , Marcel Apfelbaum Hi, Am 10.03.2014 09:35, schrieb Miroslav Rezanina: > Hi, > is there any issue with this patch? It conflicts with Marcel's machine rework that I have queued. I wonder if we can avoid the reindent to minimize the collision by adding an exit(EXIT_FAILURE) in the new if? Regards, Andreas > Mirek > ----- Original Message ----- >> From: mrezanin@redhat.com >> To: qemu-devel@nongnu.org >> Sent: Wednesday, February 5, 2014 2:44:23 PM >> Subject: [Qemu-devel] [PATCH v6] vl.c: Output error on invalid machine= type >> >> From: Miroslav Rezanina >> >> Output error message using qemu's error_report() function when user >> provides the invalid machine type on the command line. This also saves >> time to find what issue is when you downgrade from one version of qemu >> to another that doesn't support required machine type yet (the version >> user downgraded to have to have this patch applied too, of course). >> >> Signed-off-by: Miroslav Rezanina >> --- >> v6: >> - print help instead of list supported machines on error >> vl.c | 18 ++++++++++++------ >> 1 file changed, 12 insertions(+), 6 deletions(-) >> >> diff --git a/vl.c b/vl.c >> index 383be1b..3297c0a 100644 >> --- a/vl.c >> +++ b/vl.c >> @@ -2600,13 +2600,19 @@ static QEMUMachine *machine_parse(const char *= name) >> if (machine) { >> return machine; >> } >> - printf("Supported machines are:\n"); >> - for (m =3D first_machine; m !=3D NULL; m =3D m->next) { >> - if (m->alias) { >> - printf("%-20s %s (alias of %s)\n", m->alias, m->desc, m->= name); >> + >> + if (name && !is_help_option(name)) { >> + error_report("Unsupported machine type"); >> + printf("\nUse '-M help' to list supported machines!\n"); >> + } else { >> + printf("Supported machines are:\n"); >> + for (m =3D first_machine; m !=3D NULL; m =3D m->next) { >> + if (m->alias) { >> + printf("%-20s %s (alias of %s)\n", m->alias, m->desc, >> m->name); >> + } >> + printf("%-20s %s%s\n", m->name, m->desc, >> + m->is_default ? " (default)" : ""); >> } >> - printf("%-20s %s%s\n", m->name, m->desc, >> - m->is_default ? " (default)" : ""); >> } >> exit(!name || !is_help_option(name)); >> } >> -- >> 1.8.5.3 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg