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

Re: [Xen-devel] [PATCH RFC 4/9] libxl: use explicit error codes in libxl_ctx_alloc



Rob Hoes writes ("[PATCH RFC 4/9] libxl: use explicit error codes in 
libxl_ctx_alloc"):
> Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
> ---
>  tools/libxl/libxl.c         | 6 +++---
>  tools/libxl/libxl_event.c   | 2 +-
>  tools/libxl/libxl_types.idl | 3 +++
>  3 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index a6eb2df..f622981 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -89,7 +89,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
>          LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to initialize mutex");
>          free(ctx);
>          ctx = 0;
> -        rc = ERROR_FAIL;
> +        rc = ERROR_LOCK_FAIL;

I commented about ERROR_LOCK_FAIL earlier.

I think really if the mutex initialisation failed everything is
doomed.  You probably want to introduce
   ERROR_LIBXL_PROCESS_SEEMS_TOTALLY_BUST

>      ctx->xch = xc_interface_open(lg,lg,0);
>      if (!ctx->xch) {
>          LOGEV(ERROR, errno, "cannot open libxc handle");
> -        rc = ERROR_FAIL; goto out;
> +        rc = ERROR_XC_CONNECT; goto out;
...
> @@ -115,7 +115,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
>          ctx->xsh = xs_domain_open();
>      if (!ctx->xsh) {
>          LOGEV(ERROR, errno, "cannot connect to xenstore");
> -        rc = ERROR_FAIL; goto out;
> +        rc = ERROR_XS_CONNECT; goto out;

Good.

> @@ -740,7 +740,7 @@ int libxl__ctx_evtchn_init(libxl__gc *gc) {
>      xce = xc_evtchn_open(CTX->lg, 0);
>      if (!xce) {
>          LOGE(ERROR,"cannot open libxc evtchn handle");
> -        rc = ERROR_FAIL;
> +        rc = ERROR_XC_CONNECT;

If you're going to distinguish XS from XC, you probably want to
distinguish xce too.  It's a different /dev node.


If we're categorising errors these are "installation or permissions
problem".

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.