From: Ian Campbell Subject: Re: [PATCH] libxl: make libxl_cdrom_insert async Date: Wed, 25 Jul 2012 10:11:53 +0100 Message-ID: <1343207513.18971.59.camel@zakaz.uk.xensource.com> References: <20494.53778.285137.699743@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20494.53778.285137.699743@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 Somehow missed this comment ... > > -int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk) > > +int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, > > + const libxl_asyncop_how *ao_how) > > { > ... > > + if (!disk->pdev_path) { > > + disk->pdev_path = strdup(""); > > Don't you mean libxl__strdup ? And presumably you should free the > previous pdev_path ? Previous pdev_path is NULL so there is no need to free it. I didn't actually change this line, diff just thinks I did for some reason, but I may as well make it a NOGC libxl__strdup while I'm here to get the error handling. > (TBH this massaging of the caller's libxl_device_disk is a bit > unfriendly but I don't think getting rid of that is critical at this > stage. We can constify it later, in 4.3.) It's quite a common pattern, the setdefaults function often does this sort of thing. Actually, probably this should actually be in libxl__device_disk_setdefault(), but lets not go there for 4.2. Ian.