Signed-off-by: Wenchao Xia <address@hidden>
---
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/
+++ 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.