From: Wei Liu Subject: Re: [PATCH 1/3] libxl, xl: don't init/dispose when not necessary Date: Tue, 10 Feb 2015 11:39:07 +0000 Message-ID: <20150210113907.GD27856@zion.uk.xensource.com> References: <1423488068-31268-1-git-send-email-wei.liu2@citrix.com> <1423488068-31268-2-git-send-email-wei.liu2@citrix.com> <21721.58231.791546.413355@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <21721.58231.791546.413355@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: jfehlig@suse.com, Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Tue, Feb 10, 2015 at 10:54:47AM +0000, Ian Jackson wrote: > Wei Liu writes ("[PATCH 1/3] libxl, xl: don't init/dispose when not necessary"): > > Functions like libxl__device_disk_from_xs_be and > > libxl_vdev_to_device_disk should not touch the disk struct passed in. > > It's caller's responsibility to do that. > ... > > Note that libxl_vdev_to_device_disk is a public API so a macro is > > defined in libxl.h to indicate the change of behaviour. > > I don't think this is really on, in the public API. > Yes, it's public API -- not in libxl.h, but in libxl_utils.h. And xl is using it. The problem is that calling _init inside libxl_vdev_to_device_disk violates our pattern of using libxl types. > Why not make libxl_..._free idempotent ? Then extra calls to _init > are harmless. > That would be a good idea and it should be done in a separate patch set. Strictly speaking this patch is not required to fix the bug Jim spotted. I will just drop it in this series and rework in while I make _dispose idempotent. Wei. > Ian.