From patchwork Thu Nov 19 15:13:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 38847 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 6A21DB6F2B for ; Fri, 20 Nov 2009 02:29:11 +1100 (EST) Received: from localhost ([127.0.0.1]:60807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NB8wW-0007CQ-CS for incoming@patchwork.ozlabs.org; Thu, 19 Nov 2009 10:29:08 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NB8hx-0007ZI-Pm for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:14:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NB8ht-0007Vp-UK for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:14:05 -0500 Received: from [199.232.76.173] (port=49913 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NB8ht-0007Vf-JJ for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:14:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16123) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NB8hr-00023P-Uy for qemu-devel@nongnu.org; Thu, 19 Nov 2009 10:14:01 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAJFDxX2012733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 19 Nov 2009 10:13:59 -0500 Received: from localhost (vpn-9-45.rdu.redhat.com [10.11.9.45]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAJFDvn0017515; Thu, 19 Nov 2009 10:13:58 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 19 Nov 2009 13:13:32 -0200 Message-Id: <1258643623-8636-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1258643623-8636-1-git-send-email-lcapitulino@redhat.com> References: <1258643623-8636-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, avi@redhat.com Subject: [Qemu-devel] [PATCH 04/15] QError: Add errors used by QMP 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 NOTE: These errors where added quickly to satisfy immediate needs, they need to be reviewed. Signed-off-by: Luiz Capitulino --- qerror.c | 20 ++++++++++++++++++++ qerror.h | 15 +++++++++++++++ 2 files changed, 35 insertions(+), 0 deletions(-) diff --git a/qerror.c b/qerror.c index d8b125e..4349417 100644 --- a/qerror.c +++ b/qerror.c @@ -52,6 +52,26 @@ const QErrorStringTable qerror_table[] = { .error_fmt = QERR_KVM_MISSING_CAP, .desc = "Using KVM without %(capability), %(feature) unavailable", }, + { + .error_fmt = QERR_BAD_SYNTAX, + .desc = "wrong syntax: '%(reason)", + }, + { + .error_fmt = QERR_COMMAND_NOT_FOUND, + .desc = "command: %(name)", + }, + { + .error_fmt = QERR_COMMAND_NOT_ISSUED, + .desc = "a command should be issued", + }, + { + .error_fmt = QERR_INVALID_PARAMETER, + .desc = "invalid parameter '%(parameter)': %(reason)", + }, + { + .error_fmt = QERR_UNDEFINED_ERROR, + .desc = "an error has ocurred: %(hint)", + }, {} }; diff --git a/qerror.h b/qerror.h index 6c100af..1b704e4 100644 --- a/qerror.h +++ b/qerror.h @@ -47,4 +47,19 @@ QError *qobject_to_qerror(const QObject *obj); #define QERR_KVM_MISSING_CAP \ "{ 'class': 'KVMMissingCap', 'data': { 'capability': %s, 'feature': %s } }" +#define QERR_BAD_SYNTAX \ + "{ 'class': 'BadSyntax', 'data': { 'reason': %s } }" + +#define QERR_COMMAND_NOT_FOUND \ + "{ 'class': 'CommandNotFound', 'data': { 'name': %s } }" + +#define QERR_COMMAND_NOT_ISSUED \ + "{ 'class': 'CommandNotIssued', 'data': { } }" + +#define QERR_INVALID_PARAMETER \ + "{ 'class': 'InvalidParameter', 'data': { 'parameter': %s, 'reason': %s } }" + +#define QERR_UNDEFINED_ERROR \ + "{ 'class': 'UndefinedError', 'data': { 'hint': %s } }" + #endif /* QERROR_H */