From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nrmoa-00046Z-LJ for mharc-grub-devel@gnu.org; Thu, 19 May 2022 16:32:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nrmoU-00044m-Dy for grub-devel@gnu.org; Thu, 19 May 2022 16:32:04 -0400 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]:33727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nrmoR-0000AN-SI for grub-devel@gnu.org; Thu, 19 May 2022 16:32:01 -0400 Received: by mail-vs1-xe2f.google.com with SMTP id z6so6411851vsp.0 for ; Thu, 19 May 2022 13:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=Ok/nTdjnn0JCcGUCWawOaALPXbZiCa9n/LnSy55Ptug=; b=Qfbgu3CFGmgVeijIaroODtqEUtGdKzmC8biutILYMvE9qAE9eNhBKbeqGFL5a0DYmr /90ZPRlnoadm2S+8wOntVVl3LDekeqdCFjADuuNz/AqQjIVIjF2QWthBTrCYdOBtZz2Y uL0MnIM8THBCeX69PL4var7Sx7nnuWuW+qLoxBHWLftHoq/9WOEAKBbMjrM+IYQadgav 0DBQabFYfGWFK3ihHskDfwCUSE9HXQrviP9xDg/lMsSxzq1mkdoAo5i2LHnhfcYoic2x WSm2ZuU7X0lwUog5s1p/xyh+4aBwda2CMrmW6c/4RM9iwxOiHaXLuopxYa6VMWatKfml DNTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=Ok/nTdjnn0JCcGUCWawOaALPXbZiCa9n/LnSy55Ptug=; b=hNnG3VAwS5qVCsbB5e03X6LOOv/CezGsZhqvNGL2qNJrTGJ4Byh4xhttA336wShsgp CIYu1YKLizn5fhwwwpsu5nXE6gLS8v2HTB7KNIm1ZsM18/i1TYsFyb8PY5B0ItOXXjnz A6uQhwoLwaS612M/5QndmXXS8VipbiVxyYChM2xot+zTlKpK1oVWloRQJCLrqSLdzYnX WiqcL6ZuTMLG1ZMsLO6qlxqKMOQOK2NSfRxaSEFse8+vYYiZcKeTy/N7+EBlSn0zEYdT vxJzdO5dTQexD8IjBSOz904lXYy9D0S0jpzl/fbEctRETSHYxM7MkxcS2NhSDx0/iCr5 Uxnw== X-Gm-Message-State: AOAM532N4oBO2MDiEDSmN1bvY+QMG26ksrey2OM8nltu2Tclg6XaHUTt UxwiQWhi6OHn+U2csWxgvNamHg== X-Google-Smtp-Source: ABdhPJzSYCuIY6Ti0rLQRvNUqgCHSBszGcWLt0Grzwu9WwXOojPTlc1Mk0QwpWV0tDf1atgXbDk1Uw== X-Received: by 2002:a67:e19a:0:b0:335:e34b:1374 with SMTP id e26-20020a67e19a000000b00335e34b1374mr3205377vsl.22.1652992316168; Thu, 19 May 2022 13:31:56 -0700 (PDT) Received: from crass-HP-ZBook-15-G2 ([37.218.244.249]) by smtp.gmail.com with ESMTPSA id y23-20020a67dd17000000b0032d275e6914sm314006vsj.20.2022.05.19.13.31.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 13:31:55 -0700 (PDT) Date: Thu, 19 May 2022 15:31:48 -0500 From: Glenn Washburn To: Daniel Kiper Cc: grub-devel@gnu.org, Denis 'GNUtoo' Carikli , Patrick Steinhardt , John Lane Subject: Re: [PATCH v2 4/5] cryptodisk: Use enum constants as indexes into cryptomount option array Message-ID: <20220519153148.5f135aca@crass-HP-ZBook-15-G2> In-Reply-To: <20220519182411.avtawk6w2zr7aegm@tomti.i.net-space.pl> References: <20220519182411.avtawk6w2zr7aegm@tomti.i.net-space.pl> Reply-To: development@efficientek.com X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::e2f; envelope-from=development@efficientek.com; helo=mail-vs1-xe2f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2022 20:32:06 -0000 On Thu, 19 May 2022 20:24:11 +0200 Daniel Kiper wrote: > On Fri, May 13, 2022 at 12:00:50PM -0500, Glenn Washburn wrote: > > Signed-off-by: Glenn Washburn > > --- > > 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? Glenn > > Otherwise patches LGTM. > > Daniel