mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
efi: Deduplicate configuration table search function
We do table search in many places doing exactly the same algorithm. The only minor variance in users is which table is used if several entries are present. As specification mandates uniqueness and even if it ever isn't, first entry is good enough, unify this code and always use the first entry. Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
c6cf807fc0
commit
7ad30299da
7 files changed
+45
-103
No files matched your search
@@ -136,22 +136,16 @@ grub_cmd_lssal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
const grub_efi_system_table_t *st = grub_efi_system_table;
|
||||
grub_efi_configuration_table_t *t = st->configuration_table;
|
||||
unsigned int i;
|
||||
static grub_guid_t guid = GRUB_EFI_SAL_TABLE_GUID;
|
||||
void *table = grub_efi_find_configuration_table (&guid);
|
||||
|
||||
for (i = 0; i < st->num_table_entries; i++)
|
||||
if (table == NULL)
|
||||
{
|
||||
if (grub_memcmp (&guid, &t->vendor_guid,
|
||||
sizeof (grub_guid_t)) == 0)
|
||||
{
|
||||
disp_sal (t->vendor_table);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
t++;
|
||||
grub_printf ("SAL not found\n");
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
grub_printf ("SAL not found\n");
|
||||
|
||||
disp_sal (table);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user