From: Ian Jackson Subject: Re: [PATCH RFC 6/9] libxl: introduce specific error code for libxl__wait_device_connection Date: Wed, 24 Jun 2015 16:30:08 +0100 Message-ID: <21898.52480.788199.605676@mariner.uk.xensource.com> References: <1435153656-19485-1-git-send-email-rob.hoes@citrix.com> <1435153656-19485-7-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 1Z7md1-0007SF-QK for xen-devel@lists.xenproject.org; Wed, 24 Jun 2015 15:30:19 +0000 In-Reply-To: <1435153656-19485-7-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: Rob Hoes Cc: xen-devel@lists.xenproject.org, euan.harris@citrix.com List-Id: xen-devel@lists.xenproject.org Rob Hoes writes ("[PATCH RFC 6/9] libxl: introduce specific error code for libxl__wait_device_connection"): ... > diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c > index 93bb41e..56c6e2e 100644 > --- a/tools/libxl/libxl_device.c > +++ b/tools/libxl/libxl_device.c > @@ -768,6 +768,7 @@ void libxl__wait_device_connection(libxl__egc *egc, libxl__ao_device *aodev) > LIBXL_INIT_TIMEOUT * 1000); > if (rc) { > LOG(ERROR, "unable to initialize device %s", be_path); > + rc = ERROR_DEVICE_WAIT_INIT; > goto out; Smashing rc values like this is an antipattern. For example, here, you would turn ERROR_CANCELLED (from my ao cancellation series) into ERROR_DEVICE_WAIT_INIT. See my earlier comments about making timeouts each have their own rc value depending what was waited for. This particular wait is normally waiting for the backend/frontend negotiation and state machine to complete, I think. Ian.