All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glenn Washburn <development@efficientek.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>,
	Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>,
	James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH v2 3/4] cryptodisk: Move global variables into grub_cryptomount_args struct
Date: Sun, 3 Oct 2021 18:57:45 -0500	[thread overview]
Message-ID: <20211003185745.454aa5f7@crass-HP-ZBook-15-G2> (raw)
In-Reply-To: <YVoBeamE+frBb+f+@xps>

On Sun, 3 Oct 2021 21:16:09 +0200
Patrick Steinhardt <ps@pks.im> wrote:

> On Mon, Sep 27, 2021 at 06:14:02PM -0500, Glenn Washburn wrote:
> > Signed-off-by: Glenn Washburn <development@efficientek.com>
> > ---
> >  grub-core/disk/cryptodisk.c | 26 +++++++++-----------------
> >  grub-core/disk/geli.c       |  9 ++++-----
> >  grub-core/disk/luks.c       | 11 +++++------
> >  grub-core/disk/luks2.c      |  6 +++---
> >  include/grub/cryptodisk.h   |  6 ++++--
> >  5 files changed, 25 insertions(+), 33 deletions(-)
> > 
> > diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
> > index 86eaabe60..5e153ee0a 100644
> > --- a/grub-core/disk/cryptodisk.c
> > +++ b/grub-core/disk/cryptodisk.c
> > @@ -984,9 +984,6 @@ grub_util_cryptodisk_get_uuid (grub_disk_t disk)
> >  
> >  #endif
> >  
> > -static int check_boot, have_it;
> 
> We should really just get rid of `have_it`. It's only used in three
> locations, and we only require it because
> `grub_cryptodisk_scan_device_real` doesn't properly tell us whether it
> was found or not. Using a parameter struct to pass back this value to
> the caller feels like a code smell, and only papers over this weird
> usage.
> 
> Anyway, your patch doesn't make it any worse, so we may just as well fix
> it after this series has landed.

I guess you wrote this before taknig a look at the next patch in this
series, which does get rid of have_it (renamed to found_uuid). The
intent of this patch was not to change the existing behavior, just get
rid of the globals. I could've moved the following patch before this
one, in which case have_it wouldn't exist here. But for historical
reasons it was easier not too.

> 
> [snip]
> > diff --git a/include/grub/cryptodisk.h b/include/grub/cryptodisk.h
> > index 5bd970692..230167ab0 100644
> > --- a/include/grub/cryptodisk.h
> > +++ b/include/grub/cryptodisk.h
> > @@ -69,6 +69,9 @@ typedef gcry_err_code_t
> >  
> >  struct grub_cryptomount_args
> >  {

  /* Flag to indicate that only bootable volumes should be decrypted */ 

> > +  grub_uint32_t check_boot : 1;
> > +  grub_uint32_t found_uuid : 1;

  /* Only volumes matching this UUID should be decrpyted */

> > +  char *search_uuid;

  /* Key data used to decrypt voume */

> >    grub_uint8_t *key_data;

  /* Length of key_data */

> >    grub_size_t key_len;
> >  };
> 
> Would be nice to have comments here which explain what these parameters
> do. for `key_data` and `key_len` it's obvious enough, but as a reader I
> wouldn't really know what `check_boot` ought to indicate.

I was trying to use the same names to provide continuity (except for
have_it which is badly named). check_boot might better be named as
only_boot. I can add some comments. I agree that as a reader I like to
see descriptions of struct fields. How do the comments above look? I
didn't add one for found_uuid because the next patch gets rid of it
anyway.

Glenn


  reply	other threads:[~2021-10-03 23:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 23:13 [PATCH v2 0/4] Refactor/improve cryptomount data passing to crypto modules Glenn Washburn
2021-09-27 23:14 ` [PATCH v2 1/4] cryptodisk: Add infrastructure to pass data from cryptomount to cryptodisk modules Glenn Washburn
2021-10-03 19:04   ` Patrick Steinhardt
2021-09-27 23:14 ` [PATCH v2 2/4] cryptodisk: Refactor password input from crypto dev modules into cryptodisk Glenn Washburn
2021-10-03 19:10   ` Patrick Steinhardt
2021-09-27 23:14 ` [PATCH v2 3/4] cryptodisk: Move global variables into grub_cryptomount_args struct Glenn Washburn
2021-10-03 19:16   ` Patrick Steinhardt
2021-10-03 23:57     ` Glenn Washburn [this message]
2021-10-04  8:43       ` Patrick Steinhardt
2021-10-04 17:13         ` Glenn Washburn
2021-09-27 23:14 ` [PATCH v2 4/4] cryptodisk: Remove unneeded found_uuid from cryptomount args Glenn Washburn
2021-10-03 20:22   ` Patrick Steinhardt
2021-10-03 23:57     ` Glenn Washburn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211003185745.454aa5f7@crass-HP-ZBook-15-G2 \
    --to=development@efficientek.com \
    --cc=GNUtoo@cyberdimension.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.