From: Rob Hoes Subject: [PATCH RFC 4/9] libxl: use explicit error codes in libxl_ctx_alloc Date: Wed, 24 Jun 2015 14:47:31 +0100 Message-ID: <1435153656-19485-5-git-send-email-rob.hoes@citrix.com> References: <1435153656-19485-1-git-send-email-rob.hoes@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z7l1s-0005Ew-QX for xen-devel@lists.xenproject.org; Wed, 24 Jun 2015 13:47:52 +0000 In-Reply-To: <1435153656-19485-1-git-send-email-rob.hoes@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: euan.harris@citrix.com, Ian.Jackson@eu.citrix.com, Rob Hoes List-Id: xen-devel@lists.xenproject.org Signed-off-by: Rob Hoes --- 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; goto out; } @@ -107,7 +107,7 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version, 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; } ctx->xsh = xs_daemon_open(); @@ -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; } *pctx = ctx; diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c index 9ff4e78..b1e82c1 100644 --- a/tools/libxl/libxl_event.c +++ b/tools/libxl/libxl_event.c @@ -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; goto out; } diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index e9b3477..52795e4 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -114,6 +114,9 @@ libxl_error = Enumeration("error", [ (ENUM_PREV, "XS_TRANS_START"), (ENUM_PREV, "XS_TRANS_COMMIT"), (ENUM_PREV, "XS_REMOVE"), + + # libxc connection error + (ENUM_PREV, "XC_CONNECT"), ], value_namespace = "") libxl_domain_type = Enumeration("domain_type", [ -- 2.4.1