From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Pau Monne Subject: Re: [PATCH v2 05/15] libxl: change libxl__ao_device_remove to libxl__ao_device Date: Tue, 22 May 2012 16:55:32 +0100 Message-ID: <4FBBB6F4.6020404@citrix.com> References: <1337695365-5142-1-git-send-email-roger.pau@citrix.com> <1337695365-5142-6-git-send-email-roger.pau@citrix.com> <20411.44130.574284.772580@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20411.44130.574284.772580@mariner.uk.xensource.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: Ian Jackson Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Jackson wrote: > Roger Pau Monne writes ("[PATCH v2 05/15] libxl: change libxl__ao_device_remove to libxl__ao_device"): >> Introduce a new structure to track state of device backends, that will >> be used in following patches on this series. >> >> This structure if used for both device creation and device >> destruction and removes libxl__ao_device_remove. > >> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h >> index ae5527b..b62110a 100644 >> --- a/tools/libxl/libxl_internal.h >> +++ b/tools/libxl/libxl_internal.h >> @@ -1802,6 +1795,44 @@ _hidden void libxl__bootloader_init(libxl__bootloader_state *bl); > ... >> +/* Device AO operations */ >> >> -typedef struct { >> - libxl__ao *ao; >> - libxl__ev_devstate ds; >> -} libxl__ao_device_remove; >> +void libxl__init_ao_device(libxl__ao_device *aorm, libxl__ao *ao, >> + libxl__ao_device **base) >> +{ >> + aorm->ao = ao; >> + aorm->active = 1; >> + aorm->rc = 0; >> + aorm->base = base; >> +} > > I think a function "init" should set "active" to 0, surely ? > Since the operation has not in fact been started. So perhaps this > should just be a memset. Forget to answer this, we cannot use active = 0 at init because in the hypothetical case that a device add/remove finished before queuing all the others (so the others would be active == 0) it would mark the ao as complete, since it would see all other operations as finished.