Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nsjqi-0003E2-Ne for qemu-devel@nongnu.org; Fri, 19 Mar 2010 17:35:20 -0400 Received: from [199.232.76.173] (port=50756 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nsjqi-0003Dm-AG for qemu-devel@nongnu.org; Fri, 19 Mar 2010 17:35:20 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nsjqh-0006KG-0f for qemu-devel@nongnu.org; Fri, 19 Mar 2010 17:35:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15062) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nsjqg-0006KC-KO for qemu-devel@nongnu.org; Fri, 19 Mar 2010 17:35:18 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2JLZHEn024000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Mar 2010 17:35:17 -0400 From: Markus Armbruster References: <1268844367-31961-1-git-send-email-armbru@redhat.com> <20100318182724.39d66247@redhat.com> Date: Fri, 19 Mar 2010 22:35:16 +0100 In-Reply-To: <20100318182724.39d66247@redhat.com> (Luiz Capitulino's message of "Thu, 18 Mar 2010 18:27:24 -0300") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Luiz Capitulino Cc: qemu-devel@nongnu.org Luiz Capitulino writes: > 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. Thanks, will fix. [...]