From patchwork Mon Mar 22 10:38:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 48289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 48A0BB7CBD for ; Mon, 22 Mar 2010 22:06:45 +1100 (EST) Received: from localhost ([127.0.0.1]:43621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtfS2-0004T6-7k for incoming@patchwork.ozlabs.org; Mon, 22 Mar 2010 07:05:42 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ntf1a-0002ZR-4q for qemu-devel@nongnu.org; Mon, 22 Mar 2010 06:38:22 -0400 Received: from [199.232.76.173] (port=51646 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ntf1Y-0002ZG-Sk for qemu-devel@nongnu.org; Mon, 22 Mar 2010 06:38:21 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Ntf1W-0001SX-Mb for qemu-devel@nongnu.org; Mon, 22 Mar 2010 06:38:20 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:37819) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ntf1V-0001SH-Re for qemu-devel@nongnu.org; Mon, 22 Mar 2010 06:38:18 -0400 Received: from blackfin.pond.sub.org (pD951ABC6.dip.t-dialin.net [217.81.171.198]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 57880276DA2 for ; Mon, 22 Mar 2010 11:38:15 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id C49CFCB; Mon, 22 Mar 2010 11:38:14 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 22 Mar 2010 11:38:14 +0100 Message-Id: <1269254294-23876-3-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1269254294-23876-1-git-send-email-armbru@redhat.com> References: <1269254294-23876-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v2 2/2] monitor: convert do_device_del() to QObject, QError X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Markus Armbruster --- hw/qdev.c | 8 ++++---- hw/qdev.h | 2 +- qemu-monitor.hx | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index c521115..d3bf0fa 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -799,15 +799,15 @@ 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); + return qdev_unplug(dev); } 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 ff5f099..31087bd 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