From: Ian Jackson Subject: Re: [PATCH v2 05/15] libxl: change libxl__ao_device_remove to libxl__ao_device Date: Tue, 22 May 2012 17:32:40 +0100 Message-ID: <20411.49064.253608.487183@mariner.uk.xensource.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> <4FBBB6F4.6020404@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4FBBB6F4.6020404@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 05/15] libxl: change libxl__ao_device_remove to libxl__ao_device"): > Ian Jackson wrote: > > Roger Pau Monne writes ("[PATCH v2 05/15] libxl: change libxl__ao_device_remove to libxl__ao_device"): > >> 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); > > ... > >> +{ > >> + 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. Hmmm. I see. Yes. I think you need to rename _init to _prepare or something then. And it will then need a comment explaining the semantics. Are you allowed to call the operation start function without calling _prepare, for example? Do you have to take any destruction steps after calling just prepare but changing your mind ? (answer seems to be "no") etc. Ian.