[libvirt] [Xen-devel] [PATCH] libxl: initialize vfb defbools in libxlMakeVfb

Ian Campbell ian.campbell at citrix.com
Mon Apr 20 10:25:04 UTC 2015


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.





More information about the libvir-list mailing list