From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] libxl: initialize vfb defbools in libxlMakeVfb Date: Mon, 20 Apr 2015 11:25:04 +0100 Message-ID: <1429525504.25195.402.camel@citrix.com> References: <1429291171-23640-1-git-send-email-olaf@aepfle.de> <553161CA.2090906@suse.com> <1429519143.25195.363.camel@citrix.com> <20150420093239.GA14169@aepfle.de> <1429523010.25195.397.camel@citrix.com> <20150420102009.GA16540@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150420102009.GA16540@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: libvir-list@redhat.com, Jim Fehlig , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2015-04-20 at 12:20 +0200, Olaf Hering wrote: > On Mon, Apr 20, Ian Campbell wrote: > > > If what you said were true then an assert would be a rather harsh > > overreaction to an application coding error. > > Currently both libxl and libvirt are coded that way. Since the sdl code > path in libvirt was never executed the crash in libxlMakeVfbList was not > noticed. > > So you are saying that an external user of libxl_device_vfb_init has to > call yet another function to initialize all defbool to give them either > true of false? Or should libxl_device_vfb_init call > libxl__device_vfb_setdefault directly? > Neither. Any code within libxl which consumes a libxl_device_vfb must, at some point before touching the defbools therein, have arranged to call the appropriate setdefaults function. It makes no sense to do that at init time, the whole purpose of a defbool is to allow the calling application to choose a value or to explicitly leave it as a request to for the default (which might vary depending on other selections). It is up to *libxl* to convert such requests for default behaviour into a specific value before trying to use it, that is the purpose of the internal setdefaults functions and for the assert when reading a defbool. Ian.