From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NsNFg-0003Pl-PI for qemu-devel@nongnu.org; Thu, 18 Mar 2010 17:27:36 -0400 Received: from [199.232.76.173] (port=58468 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsNFg-0003PI-AP for qemu-devel@nongnu.org; Thu, 18 Mar 2010 17:27:36 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NsNFe-0008Em-UQ for qemu-devel@nongnu.org; Thu, 18 Mar 2010 17:27:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11771) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NsNFe-0008Eg-Ik for qemu-devel@nongnu.org; Thu, 18 Mar 2010 17:27:34 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2ILRVKC024366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Mar 2010 17:27:32 -0400 Date: Thu, 18 Mar 2010 18:27:24 -0300 From: Luiz Capitulino Message-ID: <20100318182724.39d66247@redhat.com> In-Reply-To: <1268844367-31961-1-git-send-email-armbru@redhat.com> References: <1268844367-31961-1-git-send-email-armbru@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] monitor: convert do_device_del() to QObject, QError 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 Wed, 17 Mar 2010 17:46:07 +0100 Markus Armbruster wrote: > > Signed-off-by: Markus Armbruster > --- > hw/qdev.c | 7 ++++--- > hw/qdev.h | 2 +- > qemu-monitor.hx | 3 ++- > 3 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/hw/qdev.c b/hw/qdev.c > index 17a46a7..35460eb 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c > @@ -800,15 +800,16 @@ int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data) > return 0; > } > > -void do_device_del(Monitor *mon, const QDict *qdict) > +int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data) > { > const char *id = qdict_get_str(qdict, "id"); > DeviceState *dev; > > dev = qdev_find_recursive(main_system_bus, id); > if (NULL == dev) { > - error_report("Device '%s' not found", id); > - return; > + qerror_report(QERR_DEVICE_NOT_FOUND, id); > + return -1; > } > qdev_unplug(dev); This function can fail, otherwise looks good. > + return 0; > } > diff --git a/hw/qdev.h b/hw/qdev.h > index 9475705..40373c8 100644 > --- a/hw/qdev.h > +++ b/hw/qdev.h > @@ -176,7 +176,7 @@ void qbus_free(BusState *bus); > void do_info_qtree(Monitor *mon); > void do_info_qdm(Monitor *mon); > int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data); > -void do_device_del(Monitor *mon, const QDict *qdict); > +int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data); > > /*** qdev-properties.c ***/ > > diff --git a/qemu-monitor.hx b/qemu-monitor.hx > index 5308f36..d290b4b 100644 > --- a/qemu-monitor.hx > +++ b/qemu-monitor.hx > @@ -589,7 +589,8 @@ ETEXI > .args_type = "id:s", > .params = "device", > .help = "remove device", > - .mhandler.cmd = do_device_del, > + .user_print = monitor_user_noop, > + .mhandler.cmd_new = do_device_del, > }, > > STEXI