From: Ian Jackson Subject: Re: [PATCH v2 07/15] libxl: convert libxl_domain_destroy to an async op Date: Wed, 23 May 2012 11:45:00 +0100 Message-ID: <20412.49068.908220.54554@mariner.uk.xensource.com> References: <1337695365-5142-1-git-send-email-roger.pau@citrix.com> <1337695365-5142-8-git-send-email-roger.pau@citrix.com> <20411.50812.100404.117424@mariner.uk.xensource.com> <4FBCB225.3020507@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FBCB225.3020507@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: Roger Pau Monne Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Roger Pau Monne writes ("Re: [PATCH v2 07/15] libxl: convert libxl_domain_destroy to an async op"): > Ian Jackson wrote: > > Just a suggestion: rather than this business with *last it might be > > easier to assign a magic error code, or use +1, for "not all done > > yet". (+1 would work since all actual libxl error codes are -ve). > > By my reading of the current interface the return value is not > > meaningful if *last==0 on output, which is the opposite of the usual > > way round. > > This function currently returns two different things, the return value > returns the rc code of any operation that has failed, and the parameter > last marks if all device events are finished. Without the last > parameter, we won't be able to return the failed error code if all > devices had finished, since we had to return 0, so the error code would > be lost. I was suggesting that it should return: rc==0 if all devices completed successfully rc==ERROR_SOMETHING if all devices completed with at least one error rc==+1 if something is still going Or if you prefer rc==ERROR_OPERATION_NOT_YET_COMPLETE if something is still going > Since I think this is not really clear, I will split this function into > two different ones, one that checks if all devices are finished, and > another one that checks if some devices have reported errors. Please don't do that - you'll have to turn it into two loops and it'll be a lot more fiddly. Ian.