From: Ian Campbell Subject: Re: [PATCH] libxl: add option for discard support to xl disk configuration Date: Thu, 30 Jan 2014 11:07:08 +0000 Message-ID: <1391080028.29487.13.camel@kazak.uk.xensource.com> References: <1390933497-12819-1-git-send-email-olaf@aepfle.de> <1390991329.31814.58.camel@kazak.uk.xensource.com> <20140130105651.GA20496@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20140130105651.GA20496@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: anthony.perard@citrix.com, stefano.stabellini@eu.citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2014-01-30 at 11:56 +0100, Olaf Hering wrote: > On Wed, Jan 29, Ian Campbell wrote: > > > On Tue, 2014-01-28 at 19:24 +0100, Olaf Hering wrote: > > > + ("discard_enable", integer), > > I have a feeling this should be a libxl_defbool, to allow for the > > possibility of "libxl does what is best/lets the backend decide". > > > > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > > > index 2845ca4..3633a7d 100644 > > > --- a/tools/libxl/libxl.c > > > +++ b/tools/libxl/libxl.c > > > @@ -2196,6 +2196,8 @@ static void device_disk_add(libxl__egc *egc, uint32_t domid, > > > flexarray_append(back, disk->readwrite ? "w" : "r"); > > > flexarray_append(back, "device-type"); > > > flexarray_append(back, disk->is_cdrom ? "cdrom" : "disk"); > > > + flexarray_append(back, "discard_enable"); > > > + flexarray_append(back, libxl__sprintf(gc, "%d", (disk->discard_enable) ? 1 : 0)); > > And if this were a defbool then you'd want to use libxl_defbool_is_default: i.e. > > if (!libxl_defbool_is_default(disk->discard_enable)) > > flexarray_append(back, ..., libxl_defbool_val(...) ? "1" : "0")) > > > > (note the lack of libxl_sprintf here too). > > Did you have something like this in mind? Its all it takes. Looks about right, yes (modulo the over long line) Thanks. Ian.