<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 22, 2020 at 10:50 AM Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Jan 22, 2020 at 10:14:38AM +0100, Jan Synacek wrote:<br>
> -val inspect_decrypt : Guestfs.guestfs -> key_store -> unit<br>
> +val inspect_decrypt : Guestfs.guestfs -> ?allow_discards:bool -> key_store -> unit<br>
><br>
>  (** Simple implementation of decryption: look for any [crypto_LUKS]<br>
>      partitions and decrypt them, then rescan for VGs.  This only works<br>
>      for Fedora whole-disk encryption. *)<br>
<br>
Documentation here needs a short explanation of what the<br>
new allow_discards parameter does, and what the default is.<br></blockquote><div><br></div><div style="font-family:monospace,monospace" class="gmail_default">Will fix.</div><div style="font-family:monospace,monospace" class="gmail_default"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> diff --git a/options/decrypt.c b/options/decrypt.c<br>
> index 683cf5e..0f24a7a 100644<br>
> --- a/options/decrypt.c<br>
> +++ b/options/decrypt.c<br>
> @@ -71,7 +71,7 @@ make_mapname (const char *device, char *mapname, size_t len)<br>
>   * encryption schemes.<br>
>   */<br>
>  void<br>
> -inspect_do_decrypt (guestfs_h *g, struct key_store *ks)<br>
> +inspect_do_decrypt (guestfs_h *g, struct key_store *ks, int allowdiscards)<br>
>  {<br>
>    CLEANUP_FREE_STRING_LIST char **partitions = guestfs_list_partitions (g);<br>
>    if (partitions == NULL)<br>
> @@ -101,7 +101,8 @@ inspect_do_decrypt (guestfs_h *g, struct key_store *ks)<br>
>           * is set?  This might break 'mount_ro'.<br>
>           */<br>
>          guestfs_push_error_handler (g, NULL, NULL);<br>
> -        r = guestfs_luks_open (g, partitions[i], keys[j], mapname);<br>
> +        r = guestfs_luks_open_opts (g, partitions[i], keys[j], mapname,<br>
> +                                 GUESTFS_LUKS_OPEN_OPTS_ALLOWDISCARDS, allowdiscards, -1);<br>
<br>
Obviously this means this patch depends on the API change :-)<br></blockquote><div><br></div><div><div style="font-family:monospace,monospace" class="gmail_default">Yes. Am I supposed to note that somewhere? Or did I miss anything?<br></div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
[...]<br>
>  /* in decrypt.c */<br>
> -extern void inspect_do_decrypt (guestfs_h *g, struct key_store *ks);<br>
> +extern void inspect_do_decrypt (guestfs_h *g, struct key_store *ks, int allowdiscards);<br>
<br>
> -  inspect_do_decrypt (g, ks);<br>
> +  inspect_do_decrypt (g, ks, 0);<br>
<br>
Kind of wonder if we want to use a C bool here instead of an int.<br></blockquote><div><br></div><div><div style="font-family:monospace,monospace" class="gmail_default">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.<br></div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Rich.<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
virt-builder quickly builds VMs from scratch<br>
<a href="http://libguestfs.org/virt-builder.1.html" rel="noreferrer" target="_blank">http://libguestfs.org/virt-builder.1.html</a><br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Jan Synacek<br>Software Engineer, Red Hat</div></div>