From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NadCb-0000fa-WA for qemu-devel@nongnu.org; Thu, 28 Jan 2010 17:51:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NadCX-0000bA-73 for qemu-devel@nongnu.org; Thu, 28 Jan 2010 17:51:05 -0500 Received: from [199.232.76.173] (port=52810 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NadCW-0000b0-V0 for qemu-devel@nongnu.org; Thu, 28 Jan 2010 17:51:01 -0500 Received: from mail-iw0-f188.google.com ([209.85.223.188]:53716) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NadCV-0001Wl-Ga for qemu-devel@nongnu.org; Thu, 28 Jan 2010 17:50:59 -0500 Received: by iwn26 with SMTP id 26so1604294iwn.14 for ; Thu, 28 Jan 2010 14:50:58 -0800 (PST) Message-ID: <4B6214CF.8050905@codemonkey.ws> Date: Thu, 28 Jan 2010 16:50:55 -0600 From: Anthony Liguori MIME-Version: 1.0 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org On 01/27/2010 02:00 AM, Markus Armbruster wrote: > 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. > Yes, I don't mind changing error messages in the human monitor. > 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 } }" > Not a bad idea if you think it's important. I don't think it is though. I think the chances of anyone relying on specific error messages on the monitor is very, very low. Regards, Anthony Liguori