From patchwork Sun Mar 18 18:29:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 147416 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 90B44B6EE6 for ; Mon, 19 Mar 2012 05:29:59 +1100 (EST) Received: from localhost ([::1]:56428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9Krd-0007Nt-CS for incoming@patchwork.ozlabs.org; Sun, 18 Mar 2012 14:29:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9Kr2-0006CU-Ri for qemu-devel@nongnu.org; Sun, 18 Mar 2012 14:29:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9Kr1-00031f-3X for qemu-devel@nongnu.org; Sun, 18 Mar 2012 14:29:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9Kr0-00031R-Rf for qemu-devel@nongnu.org; Sun, 18 Mar 2012 14:29:19 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2IITHk2014562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 18 Mar 2012 14:29:17 -0400 Received: from garlic.redhat.com (reserved-200-252.tlv.redhat.com [10.35.200.252] (may be forged)) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q2IITEpA031064; Sun, 18 Mar 2012 14:29:16 -0400 From: Alon Levy To: qemu-devel@nongnu.org, Luiz Capitulino Date: Sun, 18 Mar 2012 19:29:09 +0100 Message-Id: <1332095353-19120-2-git-send-email-alevy@redhat.com> In-Reply-To: <1332095353-19120-1-git-send-email-alevy@redhat.com> References: <1331765714-26209-1-git-send-email-alevy@redhat.com> <1332095353-19120-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 1/5] qerror: add error codes for fopen failure 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 Added: QERR_EINTR QERR_EACCES QERR_EEXIST QERR_OPEN_FILE_EMFILE QERR_ENOSPC QERR_EPERM QERR_READ_ONLY QERR_ENOTDIR QERR_EFBIG Signed-off-by: Alon Levy --- qerror.c | 36 ++++++++++++++++++++++++++++++++++++ qerror.h | 27 +++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/qerror.c b/qerror.c index f55d435..4915939 100644 --- a/qerror.c +++ b/qerror.c @@ -213,6 +213,42 @@ static const QErrorStringTable qerror_table[] = { .desc = "Could not open '%(filename)'", }, { + .error_fmt = QERR_EINTR, + .desc = "Interrupted open of '%(filename)'", + }, + { + .error_fmt = QERR_EACCES, + .desc = "Cannot access file'", + }, + { + .error_fmt = QERR_EEXIST, + .desc = "File already exists'", + }, + { + .error_fmt = QERR_OPEN_FILE_EMFILE, + .desc = "Max open files when opening file'", + }, + { + .error_fmt = QERR_ENOSPC, + .desc = "No space left opening file'", + }, + { + .error_fmt = QERR_EPERM, + .desc = "Permission denied (EPERM) opening file'", + }, + { + .error_fmt = QERR_READ_ONLY, + .desc = "Read only filesystem opening file'", + }, + { + .error_fmt = QERR_ENOTDIR, + .desc = "Directory related error opening file'", + }, + { + .error_fmt = QERR_EFBIG, + .desc = "File too big opening'", + }, + { .error_fmt = QERR_PERMISSION_DENIED, .desc = "Insufficient permission to perform this operation", }, diff --git a/qerror.h b/qerror.h index e26c635..ddc04e8 100644 --- a/qerror.h +++ b/qerror.h @@ -181,6 +181,33 @@ QError *qobject_to_qerror(const QObject *obj); #define QERR_OPEN_FILE_FAILED \ "{ 'class': 'OpenFileFailed', 'data': { 'filename': %s } }" +#define QERR_OPEN_FILE_EMFILE \ + "{ 'class': 'OpenFileEMFILE', 'data': {} }" + +#define QERR_EINTR \ + "{ 'class': 'EINTR', 'data': {} }" + +#define QERR_EACCES \ + "{ 'class': 'EACCES', 'data': {} }" + +#define QERR_EEXIST \ + "{ 'class': 'EEXIST', 'data': {} }" + +#define QERR_ENOSPC \ + "{ 'class': 'ENOSPC', 'data': {} }" + +#define QERR_EPERM \ + "{ 'class': 'EPERM', 'data': {} }" + +#define QERR_READ_ONLY \ + "{ 'class': 'ReadOnly', 'data': {} }" + +#define QERR_ENOTDIR \ + "{ 'class': 'ENOTDIR', 'data': {} }" + +#define QERR_EFBIG \ + "{ 'class': 'EFBIG', 'data': {} }" + #define QERR_PERMISSION_DENIED \ "{ 'class': 'PermissionDenied', 'data': {} }"