From: Ian Jackson Subject: Re: [PATCH V4 03/24] libxl.h: document the paradigm of using libxl types Date: Tue, 6 May 2014 14:12:20 +0100 Message-ID: <21352.57268.452232.280079@mariner.uk.xensource.com> References: <1398949101-23320-1-git-send-email-wei.liu2@citrix.com> <1398949101-23320-4-git-send-email-wei.liu2@citrix.com> <1399380576.3014.116.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1399380576.3014.116.camel@kazak.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 Campbell Cc: Wei Liu , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [PATCH V4 03/24] libxl.h: document the paradigm of using libxl types"): > On Thu, 2014-05-01 at 13:58 +0100, Wei Liu wrote: > > Signed-off-by: Wei Liu > > I think this reflects reality even if it's not what we would actually > have wanted. If we intend to change it, we should say so. > > + * The paradigm of using libxl types is that user always calls "init" > > + * function before using a type, and always calls "dispose" after using > > + * a type to clean up, regardless of the operations on this type > > + * succeed or fail. See xl code for examples. Here's a version which reads slightly better to a native speaker and is IMO slightly less ambiguous: * IDL-generated libxl types should be used as follows: the user must * always call the "init" function before using a type, even if the * variable is simply being passed by reference as an out parameter * to a libxl function. The user must always calls "dispose" exactly * once afterwards, to clean up, regardless of whether operations on * this object succeeded or failed. See the xl code for examples. I would add: * "init" is idempotent. We intend that "dispose" will become * idempotent, but this is not currently the case. Ian.