On Thu, May 19, 2022 at 03:31:48PM -0500, Glenn Washburn wrote:
> On Thu, 19 May 2022 20:24:11 +0200
> Daniel Kiper <dki...@net-space.pl> wrote:
>
> > On Fri, May 13, 2022 at 12:00:50PM -0500, Glenn Washburn wrote:
> > > Signed-off-by: Glenn Washburn <developm...@efficientek.com>
> > > ---
> > >  grub-core/disk/cryptodisk.c | 53 ++++++++++++++++++++++---------------
> > >  1 file changed, 32 insertions(+), 21 deletions(-)
> > >
> > > diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
> > > index 94640b502..ecbda7ce9 100644
> > > --- a/grub-core/disk/cryptodisk.c
> > > +++ b/grub-core/disk/cryptodisk.c
> > > @@ -35,6 +35,17 @@ GRUB_MOD_LICENSE ("GPLv3+");
> > >
> > >  grub_cryptodisk_dev_t grub_cryptodisk_list;
> > >
> > > +enum
> > > +  {
> > > +    OPTION_UUID,
> > > +    OPTION_ALL,
> > > +    OPTION_BOOT,
> > > +    OPTION_PASSWORD,
> > > +    OPTION_KEYFILE,
> > > +    OPTION_KEYFILE_OFFSET,
> > > +    OPTION_KEYFILE_SIZE
> > > +  };
> >
> > I would prefer constants here.
>
> I chose enum because that is consistent with many other commands. By
> "constants" do you mean CPP defined macros? I can imagine you would
> mean variables with the "const" property. Without having done an
> exhaustive search, I don't believe any commands use CPP macros for the
> index. Here's a list of files for commands that use enums as the index:
>
> grub-core/commands/i386/pc/drivemap.c
> grub-core/commands/file.c
> grub-core/commands/pgp.c
> grub-core/commands/search_wrap.c
> grub-core/term/gfxterm_background.c
> grub-core/term/serial.c
> grub-core/term/terminfo.c
>
> The benefits of enum over CPP macro is that inserting into the enum
> list automatically renumbers the subsequent constants in the list. I
> failing to think of a good way to do that with CPP macros. Could you
> explain a little further precisely what you're wanting (maybe I've
> guessed wrong) and why you see it as superior to using enums?

If enum is used in the other commands please ignore my comment.
Sorry for the noise.

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to