[Libguestfs] [PATCH] mltools, options: support --allow-discards when decrypting LUKS devices

Richard W.M. Jones rjones at redhat.com
Wed Jan 22 11:18:30 UTC 2020


On Wed, Jan 22, 2020 at 11:57:34AM +0100, Jan Synacek wrote:
> > >  /* in decrypt.c */
> > > -extern void inspect_do_decrypt (guestfs_h *g, struct key_store *ks);
> > > +extern void inspect_do_decrypt (guestfs_h *g, struct key_store *ks, int
> > allowdiscards);
> >
> > > -  inspect_do_decrypt (g, ks);
> > > +  inspect_do_decrypt (g, ks, 0);
> >
> > Kind of wonder if we want to use a C bool here instead of an int.
> >
> 
> I didn't notice that I could do that. But I think I've seen elsewhere in
> the code that for "flags" like this, ints are used. The OCaml bools also
> translate to C ints 1:1, but I guess that's the case for stdbool booleans
> too.

The generator translates Bool/OBool to int for external
APIs (because it has to for backwards compatibility with
very old versions that predate our use of stdbool.h).  However
it could probably use bool internally (eg. for the daemon)
but doesn't at the moment.

However inspect_do_decrypt is an internal API between
parts of the tools, and also isn't generated, so we can
do whatever we want for this one.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list