From patchwork Thu Jan 31 15:42:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 217203 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 04A4F2C008E for ; Fri, 1 Feb 2013 02:58:58 +1100 (EST) Received: from localhost ([::1]:38326 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0wGZ-0000Sc-Vr for incoming@patchwork.ozlabs.org; Thu, 31 Jan 2013 10:41:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:59693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0wFn-0006m1-OB for qemu-devel@nongnu.org; Thu, 31 Jan 2013 10:40:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0wFg-00022Y-Vn for qemu-devel@nongnu.org; Thu, 31 Jan 2013 10:40:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0wFg-00022N-NL for qemu-devel@nongnu.org; Thu, 31 Jan 2013 10:40:36 -0500 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.14.4/8.14.4) with ESMTP id r0VFeXkR027065 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 31 Jan 2013 10:40:33 -0500 Received: from lacos-laptop.usersys.redhat.com (vpn-61-61.rdu2.redhat.com [10.10.61.61]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0VFeP90009299; Thu, 31 Jan 2013 10:40:32 -0500 From: Laszlo Ersek To: qemu-devel@nongnu.org, fred.konrad@greensocs.com, peter.maydell@linaro.org, lcapitulino@redhat.com Date: Thu, 31 Jan 2013 16:42:25 +0100 Message-Id: <1359646945-2876-3-git-send-email-lersek@redhat.com> In-Reply-To: <510A7683.2000303@greensocs.com> References: <510A7683.2000303@greensocs.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 2/2] qbus_find_recursive(): the "free slots" constraint needs a dedicated error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When searching for a bus by name, lookup failure means different things for qbus_find_bus() and qbus_find_recursive(); distinguish them by error codes as well. Signed-off-by: Laszlo Ersek --- include/qapi/qmp/qerror.h | 3 +++ hw/qdev-monitor.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 6c0a18d..940ac21 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -69,6 +69,9 @@ void assert_no_error(Error *err); #define QERR_BUS_NOT_FOUND \ ERROR_CLASS_GENERIC_ERROR, "Bus '%s' not found" +#define QERR_BUS_WITH_SLOTS_NOT_FOUND \ + ERROR_CLASS_GENERIC_ERROR, "No bus called '%s' with free slots was found" + #define QERR_COMMAND_DISABLED \ ERROR_CLASS_GENERIC_ERROR, "The command %s has been disabled for this instance" diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c index 34f5014..f18fe50 100644 --- a/hw/qdev-monitor.c +++ b/hw/qdev-monitor.c @@ -331,7 +331,7 @@ static BusState *qbus_find(const char *path) } bus = qbus_find_recursive(sysbus_get_default(), elem, NULL); if (!bus) { - qerror_report(QERR_BUS_NOT_FOUND, elem); + qerror_report(QERR_BUS_WITH_SLOTS_NOT_FOUND, elem); return NULL; } pos = len;