From: Ian Jackson Subject: Re: [PATCH v2 08/15] libxl: convert libxl_device_disk_add to an asyn op Date: Tue, 22 May 2012 18:04:55 +0100 Message-ID: <20411.50999.888876.439341@mariner.uk.xensource.com> References: <1337695365-5142-1-git-send-email-roger.pau@citrix.com> <1337695365-5142-9-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1337695365-5142-9-git-send-email-roger.pau@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 ("[PATCH v2 08/15] libxl: convert libxl_device_disk_add to an asyn op"): > This patch converts libxl_device_disk_add to an ao operation that > waits for device backend to reach state XenbusStateInitWait and then > marks the operation as completed. This is not really useful now, but > will be used by latter patches that will launch hotplug scripts after > we reached the desired xenbus state. ... > +void libxl__initiate_device_add(libxl__egc *egc, libxl__ao_device *aoadd) > +{ > + STATE_AO_GC(aoadd->ao); > + char *be_path = libxl__device_backend_path(gc, aoadd->dev); > + char *state_path = libxl__sprintf(gc, "%s/state", be_path); > + char *state = libxl__xs_read(gc, XBT_NULL, state_path); > + int rc = 0; Do you really need to do the xenstore state read here ? Surely libxl__ev_devstate_wait will do it for you. > diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h > index 68d076c..a5fc092 100644 > --- a/tools/libxl/libxl_internal.h > +++ b/tools/libxl/libxl_internal.h ... > +/* Internal AO operation to connect a disk device */ > +_hidden void libxl__device_disk_add(libxl__egc *egc, uint32_t domid, > + libxl_device_disk *disk, > + libxl__ao_device *aorm); > + > +/* Arranges that dev will be added to the guest, and the > + * hotplug scripts will be executed (if necessary). When > + * this is done (or an error happens), the callback in > + * aorm->callback will be called. > + */ You really can't call this an aorm if it's being used for device addition :-). Can we call this "aodev" everywhere, right from the beginning ? Thanks, Ian.