From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1qKPSv-0000D2-Dp for mharc-grub-devel@gnu.org; Fri, 14 Jul 2023 16:32:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKPSt-0000Ct-Rr for grub-devel@gnu.org; Fri, 14 Jul 2023 16:32:35 -0400 Received: from mail-ua1-x92c.google.com ([2607:f8b0:4864:20::92c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKPSr-0006Bl-N6 for grub-devel@gnu.org; Fri, 14 Jul 2023 16:32:35 -0400 Received: by mail-ua1-x92c.google.com with SMTP id a1e0cc1a2514c-791a0651fa3so859542241.0 for ; Fri, 14 Jul 2023 13:32:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20221208.gappssmtp.com; s=20221208; t=1689366750; x=1691958750; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=f5Kp5wdRB0/YrpJiBpkngtAz3wSBt83rYSKIgpEhsF8=; b=oj0C3oHJvGebH4Tv3HgDT43eNCH9Piczq4nbqZ78pAsuqcWLLFC8VN1LlTEg0DBGYk 5En/9kmQ+nBGRVq70j2AVfdAlHk90Bb5Et+AmzBmKCSU95IWGMWn9N0sRmoqoLi05Cj8 zR7TFDPGjJW+/EunDdAsG7i7sqDa7ytll2gLW1tJ0ef8H6B6B5VTJAMofNy6GTLQh3sK YoSMA/I9dhR/RXc7fh64Rc4Ig/dO8Ty3v7GV3r2jHsmK4aNSSeon0+cJGufMCawgv5kE 4BzCV4tA8SPMUfRhcgoPZo6Qe/W5LD1G0p6lCKw49a0suLJSubsbyDYdHAhbgYiKWa1p 2uqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689366750; x=1691958750; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f5Kp5wdRB0/YrpJiBpkngtAz3wSBt83rYSKIgpEhsF8=; b=dKOh8ljhX4KugjEF6Uapjw1Qi5QH4mBOun5xeGImLdFIS6JH7adFVZ5IvbTGBVMUCn PErJTpIhSg7Dje24a2/IiNCEjLHZC2xiaLjaShTSrbaYIoV/QRttZjFFKdFHbxTcKUYr coyj6GedRwPubcI2LzJUCSv/CmF22dOvIRZQZUrxot9QDiCu5jK5Cedrw/+FQk8McR0F QphI4jZuxr+XibJb4LVJe+2xWo7KaUjSjtg1rbdzSsBMBkyHZaALr8Ya5NpRmXJbOSXQ 6yT9BQnVTb3xRUsHJphIvALawOYykWt7C55zd+BOP2EEFeni9B0U2dha3aWAJNnJQjUi SaZQ== X-Gm-Message-State: ABy/qLZDb/TkbAX+EptvSqRkwR47DXDM4EmlIhIVS2wdtzO9DMNlZYQu uE5EPHOpJIAhXT3VIb2EHdJ+roGyczwDg0s5RHWFnQ== X-Google-Smtp-Source: APBJJlGy69uuaeC3gdP4HmosftfdLC5yiscjj6NhcZlMNJEdzUuBVtPcnlKkgbZ4z8GXatkxwRfpPg== X-Received: by 2002:a67:f9c3:0:b0:443:6cba:b1b0 with SMTP id c3-20020a67f9c3000000b004436cbab1b0mr3967715vsq.19.1689366750472; Fri, 14 Jul 2023 13:32:30 -0700 (PDT) Received: from localhost.localdomain ([199.58.83.12]) by smtp.gmail.com with ESMTPSA id d1-20020a0cdb01000000b0063659410b04sm4178615qvk.107.2023.07.14.13.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jul 2023 13:32:29 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org, Daniel Kiper Cc: Glenn Washburn Subject: [PATCH] acpi: Use options enum to index command options Date: Fri, 14 Jul 2023 15:32:04 -0500 Message-Id: <20230714203204.1778539-1-development@efficientek.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::92c; envelope-from=development@efficientek.com; helo=mail-ua1-x92c.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: Fri, 14 Jul 2023 20:32:36 -0000 Signed-off-by: Glenn Washburn --- grub-core/commands/acpi.c | 46 +++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c index 1c034463cf0f..31fc60e2cb26 100644 --- a/grub-core/commands/acpi.c +++ b/grub-core/commands/acpi.c @@ -38,6 +38,20 @@ GRUB_MOD_LICENSE ("GPLv3+"); +enum + { + OPTION_EXCLUDE, + OPTION_LOAD_ONLY, + OPTION_V1, + OPTION_V2, + OPTION_OEMID, + OPTION_OEMTABLE, + OPTION_OEMTABLEREV, + OPTION_OEMTABLECREATOR, + OPTION_OEMTABLECREATORREV, + OPTION_NO_EBDA + }; + static const struct grub_arg_option options[] = { {"exclude", 'x', 0, N_("Don't load host tables specified by comma-separated list."), @@ -497,14 +511,14 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args) /* RSDT consists of header and an array of 32-bit pointers. */ struct grub_acpi_table_header *rsdt; - exclude = state[0].set ? grub_strdup (state[0].arg) : 0; + exclude = state[OPTION_EXCLUDE].set ? grub_strdup (state[OPTION_EXCLUDE].arg) : 0; if (exclude) { for (ptr = exclude; *ptr; ptr++) *ptr = grub_tolower (*ptr); } - load_only = state[1].set ? grub_strdup (state[1].arg) : 0; + load_only = state[OPTION_EXCLUDE].set ? grub_strdup (state[OPTION_EXCLUDE].arg) : 0; if (load_only) { for (ptr = load_only; *ptr; ptr++) @@ -612,26 +626,26 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args) } /* Does user specify versions to generate? */ - if (state[2].set || state[3].set) + if (state[OPTION_V1].set || state[OPTION_V2].set) { - rev1 = state[2].set; - if (state[3].set) + rev1 = state[OPTION_V1].set; + if (state[OPTION_V2].set) rev2 = rev2 ? : 2; else rev2 = 0; } /* Does user override root header information? */ - if (state[4].set) - grub_strncpy (root_oemid, state[4].arg, sizeof (root_oemid)); - if (state[5].set) - grub_strncpy (root_oemtable, state[5].arg, sizeof (root_oemtable)); - if (state[6].set) - root_oemrev = grub_strtoul (state[6].arg, 0, 0); - if (state[7].set) - grub_strncpy (root_creator_id, state[7].arg, sizeof (root_creator_id)); - if (state[8].set) - root_creator_rev = grub_strtoul (state[8].arg, 0, 0); + if (state[OPTION_OEMID].set) + grub_strncpy (root_oemid, state[OPTION_OEMID].arg, sizeof (root_oemid)); + if (state[OPTION_OEMTABLE].set) + grub_strncpy (root_oemtable, state[OPTION_OEMTABLE].arg, sizeof (root_oemtable)); + if (state[OPTION_OEMTABLEREV].set) + root_oemrev = grub_strtoul (state[OPTION_OEMTABLEREV].arg, 0, 0); + if (state[OPTION_OEMTABLECREATOR].set) + grub_strncpy (root_creator_id, state[OPTION_OEMTABLECREATOR].arg, sizeof (root_creator_id)); + if (state[OPTION_OEMTABLECREATORREV].set) + root_creator_rev = grub_strtoul (state[OPTION_OEMTABLECREATORREV].arg, 0, 0); /* Load user tables */ for (i = 0; i < argc; i++) @@ -747,7 +761,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args) acpi_tables = 0; #if defined (__i386__) || defined (__x86_64__) - if (! state[9].set) + if (! state[OPTION_NO_EBDA].set) { grub_err_t err; err = grub_acpi_create_ebda (); -- 2.34.1