From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8XYT-0005wd-QY for qemu-devel@nongnu.org; Mon, 03 Sep 2012 10:23:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8XYK-0007RF-0Q for qemu-devel@nongnu.org; Mon, 03 Sep 2012 10:23:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48295) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8XYJ-0007R9-OJ for qemu-devel@nongnu.org; Mon, 03 Sep 2012 10:22:59 -0400 Message-ID: <5044BD2A.1070409@redhat.com> Date: Mon, 03 Sep 2012 08:22:34 -0600 From: Eric Blake MIME-Version: 1.0 References: <1346663926-20188-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1346663926-20188-4-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1346663926-20188-4-git-send-email-xiawenc@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigB1B640052AC73EB6F2BD56DC" Subject: Re: [Qemu-devel] [PATCH 3/6] libqblock error handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, stefanha@gmail.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB1B640052AC73EB6F2BD56DC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/03/2012 03:18 AM, Wenchao Xia wrote: > This patch contains error handling APIs. >=20 > Signed-off-by: Wenchao Xia > --- > libqblock/libqblock-error.c | 44 +++++++++++++++++++++++++++++++++++= ++++++++ > libqblock/libqblock-error.h | 34 +++++++++++++++++++++++++++++++++ > 2 files changed, 78 insertions(+), 0 deletions(-) > create mode 100644 libqblock/libqblock-error.c > create mode 100644 libqblock/libqblock-error.h >=20 > diff --git a/libqblock/libqblock-error.c b/libqblock/libqblock-error.c > new file mode 100644 > index 0000000..28d1d77 > --- /dev/null > +++ b/libqblock/libqblock-error.c > @@ -0,0 +1,44 @@ > +#include "libqblock-error.h" No copyright. Shame. > +++ b/libqblock/libqblock-error.h > @@ -0,0 +1,34 @@ > +#ifndef LIBQBLOCK_ERROR No copyright. Shame. > +#define LIBQBLOCK_ERROR > + > +#include "libqblock-types.h" > + > +#define QB_ERR_MEM_ERR (-1) > +#define QB_ERR_INTERNAL_ERR (-2) > +#define QB_ERR_INVALID_PARAM (-3) > +#define QB_ERR_BLOCK_OUT_OF_RANGE (-100) Would an enum make more sense than #defines? > + > +/* error handling */ > +/** > + * qb_error_get_human_str: get human readable erro string. s/erro/error/ > + * > + * return a human readable string. > + * > + * @broker: operation broker, must be valid. > + * @buf: buf to receive the string. > + * @buf_size: the size of the string buf. > + */ > +void qb_error_get_human_str(struct QBroker *broker, > + char *buf, int buf_size); What happens if buf_size is too small to receive the entire error message? Should this function return int, with negative value on input error? --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigB1B640052AC73EB6F2BD56DC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQRL0qAAoJEKeha0olJ0NqEDwH/A3Cot7hFUdaz3oOdDrx/JnG jf7fFxdceNoQ0PLinnKMK5RqjPGdoX/o9xVEL9e+ya0qyr08ei79cwwWIIgYTyRa ZelUar+MIWpk8V/vu/MzigsgtfBBrPmxR6bxhgUuXec4p5BtR1wbRGg9XvZJnJUz 0DaFgRtTvM9ZkdxbB/wCZXCDWwdIqtc+NH+xcGSGH+Wpt6AMq1X3ALltSp2R8+uO SP4JqB1q+FPh24EsldyZZ2IDe1YnBbznWG/EEIa+34FmtlF4FTXJrV0dkOFJISgE +IH14HB5iz6iYOI63xlN1VnG0Fcn/QHyF1dR19MoWc7JX9TUZAmj/IGQQ1VQ4zo= =OueM -----END PGP SIGNATURE----- --------------enigB1B640052AC73EB6F2BD56DC--