From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBIDN-0000Ig-40 for qemu-devel@nongnu.org; Tue, 11 Sep 2012 00:36:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBIDM-0006po-3t for qemu-devel@nongnu.org; Tue, 11 Sep 2012 00:36:45 -0400 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:49093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBIDL-0006ms-Fs for qemu-devel@nongnu.org; Tue, 11 Sep 2012 00:36:44 -0400 Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Sep 2012 10:06:38 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8B4aXHQ29163568 for ; Tue, 11 Sep 2012 10:06:33 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8B4aWsm003919 for ; Tue, 11 Sep 2012 14:36:33 +1000 Message-ID: <504EBFC5.4060202@linux.vnet.ibm.com> Date: Tue, 11 Sep 2012 12:36:21 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1347265586-17698-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1347265586-17698-4-git-send-email-xiawenc@linux.vnet.ibm.com> <504E5C9F.6050208@redhat.com> In-Reply-To: <504E5C9F.6050208@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V2 3/6] libqblock error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, pbonzini@redhat.com 于 2012-9-11 5:33, Eric Blake 写道: > On 09/10/2012 02:26 AM, Wenchao Xia wrote: >> This patch contains error handling APIs, which user could call them to >> get error details. >> OK. >> Signed-off-by: Wenchao Xia >> --- >> libqblock/libqblock-error.c | 60 +++++++++++++++++++++++++++++++++++++++++++ >> libqblock/libqblock-error.h | 50 +++++++++++++++++++++++++++++++++++ >> 2 files changed, 110 insertions(+), 0 deletions(-) >> create mode 100644 libqblock/libqblock-error.c >> create mode 100644 libqblock/libqblock-error.h > > Again, this should come earlier in the series, and I'm focusing on the > .h as a potential user, rather than on the .c. > >> + default: >> + err_ret_str = "Unknow error."; > > s/Unknow/Unknown/ > OK, will fix it. >> +++ b/libqblock/libqblock-error.h >> +/** >> + * qb_error_get_errno: get error number, only valid when err_ret is >> + * QB_ERR_INTERNAL_ERR. >> + * >> + * return negative errno or 0 if last error is not QB_ERR_INTERNAL_ERR. > > So does this return EINVAL or -EINVAL? If you return positive errno > values, then you can reserve 0 for no error, and a QB_*-specific > negative value in the case where QB_ERR_INTERNAL_ERR was not the last error. > I think better to split these kind of errors, they are two level of errors, level one is libqblock's error, and errno is 2nd level of error, belong to one kind of level 1 error, QB_ERR_INTERNAL_ERR. -- Best Regards Wenchao Xia