qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC 48/48] monitor: convert do_device_add() to Q


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH RFC 48/48] monitor: convert do_device_add() to QObject
Date: Mon, 01 Mar 2010 10:25:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Luiz Capitulino <address@hidden> writes:

> On Wed, 24 Feb 2010 18:56:00 +0100
> Markus Armbruster <address@hidden> wrote:
>
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>>  hw/qdev.c       |   29 +++++++++++++++++++++--------
>>  hw/qdev.h       |    2 +-
>>  qemu-monitor.hx |    3 ++-
>>  3 files changed, 24 insertions(+), 10 deletions(-)
>> 
>> diff --git a/hw/qdev.c b/hw/qdev.c
>> index bcd989c..a631492 100644
>> --- a/hw/qdev.c
>> +++ b/hw/qdev.c
>> @@ -586,7 +586,9 @@ static BusState *qbus_find(const char *path)
>>          dev = qbus_find_dev(bus, elem);
>>          if (!dev) {
>>              qemu_error_new(QERR_DEVICE_NOT_FOUND, elem);
>> -            qbus_list_dev(bus);
>> +            if (!in_qmp_mon()) {
>> +                qbus_list_dev(bus);
>> +            }
>>              return NULL;
>>          }
>>  
>> @@ -605,7 +607,9 @@ static BusState *qbus_find(const char *path)
>>                  return QLIST_FIRST(&dev->child_bus);
>>              default:
>>                  qemu_error_new(QERR_DEVICE_MULTIPLE_BUSSES, elem);
>> -                qbus_list_bus(dev);
>> +                if (!in_qmp_mon()) {
>> +                    qbus_list_bus(dev);
>> +                }
>>                  return NULL;
>>              }
>>          }
>> @@ -619,7 +623,9 @@ static BusState *qbus_find(const char *path)
>>          bus = qbus_find_bus(dev, elem);
>>          if (!bus) {
>>              qemu_error_new(QERR_BUS_NOT_FOUND, elem);
>> -            qbus_list_bus(dev);
>> +            if (!in_qmp_mon()) {
>> +                qbus_list_bus(dev);
>> +            }
>>              return NULL;
>>          }
>>      }
>> @@ -762,16 +768,23 @@ void do_info_qdm(Monitor *mon)
>>      }
>>  }
>>  
>> -void do_device_add(Monitor *mon, const QDict *qdict)
>> +int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
>>  {
>>      QemuOpts *opts;
>>  
>>      opts = qemu_opts_from_qdict(&qemu_device_opts, qdict);
>> -    if (opts) {
>> -        if (qdev_device_help(opts) || qdev_device_add(opts) == NULL) {
>> -            qemu_opts_del(opts);
>> -        }
>> +    if (!opts) {
>> +        return -1;
>>      }
>> +    if (!in_qmp_mon() && qdev_device_help(opts)) {
>> +        qemu_opts_del(opts);
>> +        return 0;
>> +    }
>> +    if (!qdev_device_add(opts)) {
>> +        qemu_opts_del(opts);
>> +        return -1;
>> +    }
>> +    return 0;
>>  }
>
>  We need at least basic documentation of the accepted parameters and
> an example, just like all others QMP-enabled handlers.

Fair enough.

[...]




reply via email to

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