Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Na2pq-0005M7-Aq for qemu-devel@nongnu.org; Wed, 27 Jan 2010 03:01:10 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Na2pj-0005IK-UC for qemu-devel@nongnu.org; Wed, 27 Jan 2010 03:01:08 -0500 Received: from [199.232.76.173] (port=56767 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Na2pj-0005IE-Pg for qemu-devel@nongnu.org; Wed, 27 Jan 2010 03:01:03 -0500 Received: from mx20.gnu.org ([199.232.41.8]:56075) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Na2pi-0007lQ-HS for qemu-devel@nongnu.org; Wed, 27 Jan 2010 03:01:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Na2pg-0005ia-Su for qemu-devel@nongnu.org; Wed, 27 Jan 2010 03:01:01 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH v2 6/6] monitor: convert do_cpu_set() to QObject, QError References: <1263989255-13755-1-git-send-email-armbru@redhat.com> <1263989255-13755-7-git-send-email-armbru@redhat.com> <4B5F5D4C.2020605@codemonkey.ws> Date: Wed, 27 Jan 2010 09:00:37 +0100 In-Reply-To: <4B5F5D4C.2020605@codemonkey.ws> (Anthony Liguori's message of "Tue, 26 Jan 2010 15:23:24 -0600") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Anthony Liguori writes: > On 01/20/2010 06:07 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster >> --- >> monitor.c | 4 ++-- >> qemu-monitor.hx | 3 ++- >> 2 files changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/monitor.c b/monitor.c >> index 816f6fd..b9166c3 100644 >> --- a/monitor.c >> +++ b/monitor.c >> @@ -808,11 +808,11 @@ static void do_info_cpus(Monitor *mon, QObject **ret_data) >> *ret_data = QOBJECT(cpu_list); >> } >> >> -static void do_cpu_set(Monitor *mon, const QDict *qdict) >> +static void do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data) >> { >> int index = qdict_get_int(qdict, "index"); >> if (mon_set_cpu(index)< 0) >> - monitor_printf(mon, "Invalid CPU index\n"); >> + qemu_error_new(QERR_INVALID_CPU_INDEX); >> > > Just out of curiousity, why introduce a new error verses using > (QERR_INVALID_PARAMETER, "index")? To avoid changing the non-QMP monitor. If you don't care about that, I can revert 5/6 and update 6/6. Alternatively, here's a trick to reduce the number of client visible QMP errors while still keeping the old diagnostic on the non-QMP monitor: +#define QERR_INVALID_CPU_INDEX \ + "{ 'class': 'InvalidParameter, 'data': { 'name': 'index' } }" + #define QERR_INVALID_PARAMETER \ "{ 'class': 'InvalidParameter', 'data': { 'name': %s } }"