From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mxkh2-0004Es-0c for qemu-devel@nongnu.org; Tue, 13 Oct 2009 12:57:48 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mxkgx-0004AF-98 for qemu-devel@nongnu.org; Tue, 13 Oct 2009 12:57:47 -0400 Received: from [199.232.76.173] (port=51968 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mxkgw-00049u-Dc for qemu-devel@nongnu.org; Tue, 13 Oct 2009 12:57:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14641) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mxkgv-00024y-TA for qemu-devel@nongnu.org; Tue, 13 Oct 2009 12:57:42 -0400 From: Luiz Capitulino Date: Tue, 13 Oct 2009 13:57:03 -0300 Message-Id: <1255453026-18637-7-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1255453026-18637-1-git-send-email-lcapitulino@redhat.com> References: <1255453026-18637-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 6/9] QError: Add qdev not found error List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, kraxel@redhat.com Signed-off-by: Luiz Capitulino --- qerror.c | 12 ++++++++++++ qerror.h | 1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/qerror.c b/qerror.c index bbea770..88a8208 100644 --- a/qerror.c +++ b/qerror.c @@ -24,11 +24,23 @@ static const QType qerror_type = { .destroy = qerror_destroy_obj, }; +static void qemu_err_qdev_nodev(const QError *qerror) +{ + QDict *qdict = qobject_to_qdict(qerror->data); + qemu_error("Device \"%s\" not found. Try -device '?' for a list.\n", + qdict_get_str(qdict, "name")); +} + static QErrorTable qerror_table[] = { { .code = QERR_UNKNOWN, .desc = "unknown error", }, + { + .code = QERR_QDEV_NFOUND, + .desc = "device not found", + .user_print = qemu_err_qdev_nodev, + }, }; /** diff --git a/qerror.h b/qerror.h index ed25ef1..820f25e 100644 --- a/qerror.h +++ b/qerror.h @@ -21,6 +21,7 @@ */ typedef enum QErrorCode { QERR_UNKNOWN, + QERR_QDEV_NFOUND, QERR_MAX, } QErrorCode; -- 1.6.5.rc3.8.g8ba5e