mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 06:49:35 +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
@@ -1031,3 +1031,21 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
grub_efi_find_configuration_table (const grub_guid_t *target_guid)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
|
||||
{
|
||||
grub_guid_t *guid =
|
||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
||||
|
||||
if (! grub_memcmp (guid, target_guid, sizeof (grub_guid_t)))
|
||||
return (void *)
|
||||
grub_efi_system_table->configuration_table[i].vendor_table;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user