qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/6] libqblock error handling


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 3/6] libqblock error handling
Date: Mon, 03 Sep 2012 08:22:34 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/03/2012 03:18 AM, Wenchao Xia wrote:
>   This patch contains error handling APIs.
> 
> Signed-off-by: Wenchao Xia <address@hidden>
> ---
>  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
> 
> 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?

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]