[Libguestfs] [PATCH 2/3] New API parameter: Add discard parameter to guestfs_add_drive_opts.

Richard W.M. Jones rjones at redhat.com
Mon Mar 10 17:58:27 UTC 2014


On Mon, Mar 10, 2014 at 06:50:39PM +0100, Pino Toscano wrote:
> Hi,
> 
> On Monday 10 March 2014 17:28:53 Richard W.M. Jones wrote:
> > index 1e84061..584c4de 100644
> > --- a/src/launch-direct.c
> > +++ b/src/launch-direct.c
> > @@ -509,6 +509,29 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
> >      CLEANUP_FREE char *file = NULL, *escaped_file = NULL, *param = NULL;
> > 
> >      if (!drv->overlay) {
> > +      const char *discard_mode = "";
> > +      int major = data->qemu_version_major, minor = data->qemu_version_minor;
> > +
> > +      switch (drv->discard) {
> > +      case discard_disable:
> > +        /* Since the default is always discard=ignore, don't specify it
> > +         * on the command line.  This also avoids unnecessary breakage
> > +         * with qemu < 1.5 which didn't have the option at all.
> > +         */
> > +        break;
> > +      case discard_enable:
> > +        if (!guestfs___discard_possible (g, drv, major, minor))
> 
> There is an argument mismatch in this call to guestfs___discard_possible
> (int's vs bool's).
> 
> What about turn guestfs___discard_possible to just get the qemu version,
> and do the checks in it rather than asking to prefill the two
> "is qemu >= 1.5" and "is qemu >= 1.6" bool's?

This is the result of two different attempts to write this function,
and a lot of confusion :-(  I'll fix it ...

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list