qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 6/6] monitor: convert do_cpu_set() to QObject


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 6/6] monitor: convert do_cpu_set() to QObject, QError
Date: Wed, 27 Jan 2010 09:00:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Anthony Liguori <address@hidden> writes:

> On 01/20/2010 06:07 AM, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster<address@hidden>
>> ---
>>   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 } }"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]