From patchwork Thu Jan 31 15:42:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC, 2/2] qbus_find_recursive(): the "free slots" constraint needs a dedicated error Date: Thu, 31 Jan 2013 05:42:25 -0000 From: Laszlo Ersek X-Patchwork-Id: 217203 Message-Id: <1359646945-2876-3-git-send-email-lersek@redhat.com> To: qemu-devel@nongnu.org, fred.konrad@greensocs.com, peter.maydell@linaro.org, lcapitulino@redhat.com 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;