于 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 <xiaw...@linux.vnet.ibm.com>
---
  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


Reply via email to