grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 02/11] Unify GUID types


From: Oliver Steffen
Subject: Re: [PATCH v9 02/11] Unify GUID types
Date: Fri, 11 Aug 2023 04:10:14 -0700
User-agent: alot/0.8.1

Quoting John Paul Adrian Glaubitz (2023-08-11 10:32:17)
> Hi Oliver!
>
> On Fri, 2023-05-26 at 13:35 +0200, Oliver Steffen wrote:
> > There are 3 implementations of a GUID in Grub. Replace them with a
> > common one, placed in types.h.
> >
> > It uses the "packed" flavor of the GUID structs, the alignment attribute
> > is dropped, since it is not required.
> >
> > Signed-off-by: Oliver Steffen <osteffen@redhat.com>
> > Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
> > ---
> >  grub-core/commands/acpi.c            |  4 +-
> >  grub-core/commands/efi/efifwsetup.c  |  4 +-
> >  grub-core/commands/efi/loadbios.c    | 14 +++---
> >  grub-core/commands/efi/lsefi.c       |  4 +-
> >  grub-core/commands/efi/lsefisystab.c |  4 +-
> >  grub-core/commands/efi/lssal.c       |  4 +-
> >  grub-core/commands/efi/smbios.c      | 12 +++---
> >  grub-core/commands/efi/tpm.c         |  6 +--
> >  grub-core/commands/probe.c           |  2 +-
> >  grub-core/disk/efi/efidisk.c         |  4 +-
> >  grub-core/disk/ldm.c                 |  2 +-
> >  grub-core/efiemu/i386/pc/cfgtables.c |  6 +--
> >  grub-core/efiemu/main.c              |  4 +-
> >  grub-core/efiemu/runtime/efiemu.c    | 14 +++---
> >  grub-core/kern/efi/acpi.c            | 12 +++---
> >  grub-core/kern/efi/efi.c             | 22 +++++-----
> >  grub-core/kern/efi/fdt.c             |  2 +-
> >  grub-core/kern/efi/init.c            |  2 +-
> >  grub-core/kern/efi/sb.c              |  4 +-
> >  grub-core/loader/efi/fdt.c           |  2 +-
> >  grub-core/loader/efi/linux.c         |  4 +-
> >  grub-core/loader/i386/xnu.c          |  4 +-
> >  grub-core/loader/ia64/efi/linux.c    |  2 +-
> >  grub-core/net/drivers/efi/efinet.c   |  4 +-
> >  grub-core/partmap/gpt.c              |  4 +-
> >  grub-core/term/efi/console.c         |  2 +-
> >  grub-core/term/efi/serial.c          |  2 +-
> >  grub-core/video/efi_gop.c            |  8 ++--
> >  grub-core/video/efi_uga.c            |  2 +-
> >  include/grub/efi/api.h               | 64 ++++++++++------------------
> >  include/grub/efi/efi.h               | 16 +++----
> >  include/grub/efiemu/efiemu.h         | 10 ++---
> >  include/grub/efiemu/runtime.h        |  2 +-
> >  include/grub/gpt_partition.h         | 13 +-----
> >  include/grub/types.h                 |  9 ++++
> >  util/grub-install.c                  |  2 +-
> >  util/grub-probe.c                    |  2 +-
> >  37 files changed, 130 insertions(+), 148 deletions(-)
> >
> > diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
> > index ab067ae6e..deec4bb43 100644
> > --- a/grub-core/commands/acpi.c
> > +++ b/grub-core/commands/acpi.c
> > @@ -759,8 +759,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int 
> > argc, char **args)
> >
> >  #ifdef GRUB_MACHINE_EFI
> >    {
> > -    struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
> > -    struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
> > +    static grub_guid_t acpi = GRUB_EFI_ACPI_TABLE_GUID;
> > +    static grub_guid_t acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
> >
> >      grub_efi_system_table->boot_services->install_configuration_table 
> > (&acpi20,
> >                                                                      
> > grub_acpi_get_rsdpv2 ());
> > diff --git a/grub-core/commands/efi/efifwsetup.c 
> > b/grub-core/commands/efi/efifwsetup.c
> > index de66c3035..704f9d352 100644
> > --- a/grub-core/commands/efi/efifwsetup.c
> > +++ b/grub-core/commands/efi/efifwsetup.c
> > @@ -38,7 +38,7 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ 
> > ((unused)),
> >    grub_efi_uint64_t os_indications = GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
> >    grub_err_t status;
> >    grub_size_t oi_size;
> > -  static grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> > +  static grub_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> >
> >    if (argc >= 1 && grub_strcmp(args[0], "--is-supported") == 0)
> >      return !efifwsetup_is_supported ();
> > @@ -72,7 +72,7 @@ efifwsetup_is_supported (void)
> >  {
> >    grub_efi_uint64_t *os_indications_supported = NULL;
> >    grub_size_t oi_size = 0;
> > -  static grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> > +  static grub_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> >    grub_efi_boolean_t ret = 0;
> >
> >    grub_efi_get_variable ("OsIndicationsSupported", &global, &oi_size,
> > diff --git a/grub-core/commands/efi/loadbios.c 
> > b/grub-core/commands/efi/loadbios.c
> > index 574e41046..8f6b0ecfc 100644
> > --- a/grub-core/commands/efi/loadbios.c
> > +++ b/grub-core/commands/efi/loadbios.c
> > @@ -27,9 +27,9 @@
> >
> >  GRUB_MOD_LICENSE ("GPLv3+");
> >
> > -static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
> > -static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
> > -static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
> > +static grub_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
> > +static grub_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
> > +static grub_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
> >
> >  #define EBDA_SEG_ADDR        0x40e
> >  #define LOW_MEM_ADDR 0x413
> > @@ -105,15 +105,15 @@ fake_bios_data (int use_rom)
> >    smbios = 0;
> >    for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
> >      {
> > -      grub_efi_packed_guid_t *guid =
> > +      grub_guid_t *guid =
> >       &grub_efi_system_table->configuration_table[i].vendor_guid;
> >
> > -      if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_efi_guid_t)))
> > +      if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_guid_t)))
> >       {
> >         acpi = grub_efi_system_table->configuration_table[i].vendor_table;
> >         grub_dprintf ("efi", "ACPI2: %p\n", acpi);
> >       }
> > -      else if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t)))
> > +      else if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_guid_t)))
> >       {
> >         void *t;
> >
> > @@ -122,7 +122,7 @@ fake_bios_data (int use_rom)
> >           acpi = t;
> >         grub_dprintf ("efi", "ACPI: %p\n", t);
> >       }
> > -      else if (! grub_memcmp (guid, &smbios_guid, sizeof 
> > (grub_efi_guid_t)))
> > +      else if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_guid_t)))
> >       {
> >         smbios = grub_efi_system_table->configuration_table[i].vendor_table;
> >         grub_dprintf ("efi", "SMBIOS: %p\n", smbios);
> > diff --git a/grub-core/commands/efi/lsefi.c b/grub-core/commands/efi/lsefi.c
> > index 539701497..6935cd302 100644
> > --- a/grub-core/commands/efi/lsefi.c
> > +++ b/grub-core/commands/efi/lsefi.c
> > @@ -31,7 +31,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
> >
> >  struct known_protocol
> >  {
> > -  grub_efi_guid_t guid;
> > +  grub_guid_t guid;
> >    const char *name;
> >  } known_protocols[] =
> >    {
> > @@ -96,7 +96,7 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ 
> > ((unused)),
> >        grub_efi_handle_t handle = handles[i];
> >        grub_efi_status_t status;
> >        grub_efi_uintn_t num_protocols;
> > -      grub_efi_packed_guid_t **protocols;
> > +      grub_guid_t **protocols;
> >        grub_efi_device_path_t *dp;
> >
> >        grub_printf ("Handle %p\n", handle);
> > diff --git a/grub-core/commands/efi/lsefisystab.c 
> > b/grub-core/commands/efi/lsefisystab.c
> > index ac3299b7f..eff8c41f3 100644
> > --- a/grub-core/commands/efi/lsefisystab.c
> > +++ b/grub-core/commands/efi/lsefisystab.c
> > @@ -29,7 +29,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
> >
> >  struct guid_mapping
> >  {
> > -  grub_efi_guid_t guid;
> > +  grub_guid_t guid;
> >    const char *name;
> >  };
> >
> > @@ -104,7 +104,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd 
> > __attribute__ ((unused)),
> >
> >        for (j = 0; j < ARRAY_SIZE (guid_mappings); j++)
> >       if (grub_memcmp (&guid_mappings[j].guid, &t->vendor_guid,
> > -                      sizeof (grub_efi_guid_t)) == 0)
> > +                      sizeof (grub_guid_t)) == 0)
> >         grub_printf ("   %s", guid_mappings[j].name);
> >
> >        grub_printf ("\n");
> > diff --git a/grub-core/commands/efi/lssal.c b/grub-core/commands/efi/lssal.c
> > index 5084ddd8b..fd6085f1b 100644
> > --- a/grub-core/commands/efi/lssal.c
> > +++ b/grub-core/commands/efi/lssal.c
> > @@ -139,12 +139,12 @@ grub_cmd_lssal (struct grub_command *cmd 
> > __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;
> > -  grub_efi_packed_guid_t guid = GRUB_EFI_SAL_TABLE_GUID;
> > +  static grub_guid_t guid = GRUB_EFI_SAL_TABLE_GUID;
> >
> >    for (i = 0; i < st->num_table_entries; i++)
> >      {
> >        if (grub_memcmp (&guid, &t->vendor_guid,
> > -                    sizeof (grub_efi_packed_guid_t)) == 0)
> > +                    sizeof (grub_guid_t)) == 0)
> >       {
> >         disp_sal (t->vendor_table);
> >         return GRUB_ERR_NONE;
> > diff --git a/grub-core/commands/efi/smbios.c 
> > b/grub-core/commands/efi/smbios.c
> > index 75202d5aa..d77239732 100644
> > --- a/grub-core/commands/efi/smbios.c
> > +++ b/grub-core/commands/efi/smbios.c
> > @@ -26,14 +26,14 @@ struct grub_smbios_eps *
> >  grub_machine_smbios_get_eps (void)
> >  {
> >    unsigned i;
> > -  static grub_efi_packed_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
> > +  static grub_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
> >
> >    for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
> >      {
> > -      grub_efi_packed_guid_t *guid =
> > +      grub_guid_t *guid =
> >       &grub_efi_system_table->configuration_table[i].vendor_guid;
> >
> > -      if (! grub_memcmp (guid, &smbios_guid, sizeof 
> > (grub_efi_packed_guid_t)))
> > +      if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_guid_t)))
> >       return (struct grub_smbios_eps *)
> >         grub_efi_system_table->configuration_table[i].vendor_table;
> >      }
> > @@ -45,14 +45,14 @@ struct grub_smbios_eps3 *
> >  grub_machine_smbios_get_eps3 (void)
> >  {
> >    unsigned i;
> > -  static grub_efi_packed_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
> > +  static grub_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
> >
> >    for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
> >      {
> > -      grub_efi_packed_guid_t *guid =
> > +      grub_guid_t *guid =
> >       &grub_efi_system_table->configuration_table[i].vendor_guid;
> >
> > -      if (! grub_memcmp (guid, &smbios3_guid, sizeof 
> > (grub_efi_packed_guid_t)))
> > +      if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_guid_t)))
> >       return (struct grub_smbios_eps3 *)
> >         grub_efi_system_table->configuration_table[i].vendor_table;
> >      }
> > diff --git a/grub-core/commands/efi/tpm.c b/grub-core/commands/efi/tpm.c
> > index 421355204..c616768f9 100644
> > --- a/grub-core/commands/efi/tpm.c
> > +++ b/grub-core/commands/efi/tpm.c
> > @@ -30,9 +30,9 @@
> >
> >  typedef TCG_PCR_EVENT grub_tpm_event_t;
> >
> > -static grub_efi_guid_t tpm_guid = EFI_TPM_GUID;
> > -static grub_efi_guid_t tpm2_guid = EFI_TPM2_GUID;
> > -static grub_efi_guid_t cc_measurement_guid = 
> > GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID;
> > +static grub_guid_t tpm_guid = EFI_TPM_GUID;
> > +static grub_guid_t tpm2_guid = EFI_TPM2_GUID;
> > +static grub_guid_t cc_measurement_guid = 
> > GRUB_EFI_CC_MEASUREMENT_PROTOCOL_GUID;
> >
> >  static grub_efi_handle_t *grub_tpm_handle;
> >  static grub_uint8_t grub_tpm_version;
> > diff --git a/grub-core/commands/probe.c b/grub-core/commands/probe.c
> > index 9a80ea54f..cc8c05586 100644
> > --- a/grub-core/commands/probe.c
> > +++ b/grub-core/commands/probe.c
> > @@ -119,7 +119,7 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, int argc, 
> > char **args)
> >         if (grub_strcmp(dev->disk->partition->partmap->name, "gpt") == 0)
> >           {
> >             struct grub_gpt_partentry entry;
> > -           grub_gpt_part_guid_t *guid;
> > +           grub_guid_t *guid;
> >
> >             if (grub_disk_read(disk, p->offset, p->index, sizeof(entry), 
> > &entry))
> >               {
> > diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
> > index ad025010a..3b5ed5691 100644
> > --- a/grub-core/disk/efi/efidisk.c
> > +++ b/grub-core/disk/efi/efidisk.c
> > @@ -37,7 +37,7 @@ struct grub_efidisk_data
> >  };
> >
> >  /* GUID.  */
> > -static grub_efi_guid_t block_io_guid = GRUB_EFI_BLOCK_IO_GUID;
> > +static grub_guid_t block_io_guid = GRUB_EFI_BLOCK_IO_GUID;
> >
> >  static struct grub_efidisk_data *fd_devices;
> >  static struct grub_efidisk_data *hd_devices;
> > @@ -319,7 +319,7 @@ name_devices (struct grub_efidisk_data *devices)
> >         == GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE)
> >       {
> >         grub_efi_vendor_device_path_t *vendor = 
> > (grub_efi_vendor_device_path_t *) dp;
> > -       const struct grub_efi_guid apple = GRUB_EFI_VENDOR_APPLE_GUID;
> > +       static const grub_guid_t apple = GRUB_EFI_VENDOR_APPLE_GUID;
> >
> >         if (vendor->header.length == sizeof (*vendor)
> >             && grub_memcmp (&vendor->vendor_guid, &apple,
> > diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c
> > index 9632bc489..34bfe6bd1 100644
> > --- a/grub-core/disk/ldm.c
> > +++ b/grub-core/disk/ldm.c
> > @@ -136,7 +136,7 @@ msdos_has_ldm_partition (grub_disk_t dsk)
> >    return has_ldm;
> >  }
> >
> > -static const grub_gpt_part_guid_t ldm_type = GRUB_GPT_PARTITION_TYPE_LDM;
> > +static const grub_guid_t ldm_type = GRUB_GPT_PARTITION_TYPE_LDM;
> >
> >  /* Helper for gpt_ldm_sector.  */
> >  static int
> > diff --git a/grub-core/efiemu/i386/pc/cfgtables.c 
> > b/grub-core/efiemu/i386/pc/cfgtables.c
> > index 1098f0b79..056ec0bc9 100644
> > --- a/grub-core/efiemu/i386/pc/cfgtables.c
> > +++ b/grub-core/efiemu/i386/pc/cfgtables.c
> > @@ -29,9 +29,9 @@ grub_machine_efiemu_init_tables (void)
> >  {
> >    void *table;
> >    grub_err_t err;
> > -  static grub_efi_guid_t smbios = GRUB_EFI_SMBIOS_TABLE_GUID;
> > -  static grub_efi_guid_t acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
> > -  static grub_efi_guid_t acpi = GRUB_EFI_ACPI_TABLE_GUID;
> > +  static grub_guid_t smbios = GRUB_EFI_SMBIOS_TABLE_GUID;
> > +  static grub_guid_t acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
> > +  static grub_guid_t acpi = GRUB_EFI_ACPI_TABLE_GUID;
> >
> >    err = grub_efiemu_unregister_configuration_table (smbios);
> >    if (err)
> > diff --git a/grub-core/efiemu/main.c b/grub-core/efiemu/main.c
> > index a81934725..e7037f4ed 100644
> > --- a/grub-core/efiemu/main.c
> > +++ b/grub-core/efiemu/main.c
> > @@ -80,7 +80,7 @@ grub_efiemu_unload (void)
> >
> >  /* Remove previously registered table from the list */
> >  grub_err_t
> > -grub_efiemu_unregister_configuration_table (grub_efi_guid_t guid)
> > +grub_efiemu_unregister_configuration_table (grub_guid_t guid)
> >  {
> >    struct grub_efiemu_configuration_table *cur, *prev;
> >
> > @@ -136,7 +136,7 @@ grub_efiemu_register_prepare_hook (grub_err_t (*hook) 
> > (void *data),
> >     or with a hook
> >  */
> >  grub_err_t
> > -grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
> > +grub_efiemu_register_configuration_table (grub_guid_t guid,
> >                                         void * (*get_table) (void *data),
> >                                         void (*unload) (void *data),
> >                                         void *data)
> > diff --git a/grub-core/efiemu/runtime/efiemu.c 
> > b/grub-core/efiemu/runtime/efiemu.c
> > index 53b3cce7b..c84b30652 100644
> > --- a/grub-core/efiemu/runtime/efiemu.c
> > +++ b/grub-core/efiemu/runtime/efiemu.c
> > @@ -66,7 +66,7 @@ efiemu_convert_pointer (grub_efi_uintn_t 
> > debug_disposition,
> >
> >  grub_efi_status_t __grub_efi_api
> >  efiemu_get_variable (grub_efi_char16_t *variable_name,
> > -                  const grub_efi_guid_t *vendor_guid,
> > +                  const grub_guid_t *vendor_guid,
> >                    grub_efi_uint32_t *attributes,
> >                    grub_efi_uintn_t *data_size,
> >                    void *data);
> > @@ -74,11 +74,11 @@ efiemu_get_variable (grub_efi_char16_t *variable_name,
> >  grub_efi_status_t __grub_efi_api
> >  efiemu_get_next_variable_name (grub_efi_uintn_t *variable_name_size,
> >                              grub_efi_char16_t *variable_name,
> > -                            grub_efi_guid_t *vendor_guid);
> > +                            grub_guid_t *vendor_guid);
> >
> >  grub_efi_status_t __grub_efi_api
> >  efiemu_set_variable (grub_efi_char16_t *variable_name,
> > -                  const grub_efi_guid_t *vendor_guid,
> > +                  const grub_guid_t *vendor_guid,
> >                    grub_efi_uint32_t attributes,
> >                    grub_efi_uintn_t data_size,
> >                    void *data);
> > @@ -416,7 +416,7 @@ EFI_FUNC (efiemu_convert_pointer) (grub_efi_uintn_t 
> > debug_disposition,
> >
> >  /* Find variable by name and GUID. */
> >  static struct efi_variable *
> > -find_variable (const grub_efi_guid_t *vendor_guid,
> > +find_variable (const grub_guid_t *vendor_guid,
> >              grub_efi_char16_t *variable_name)
> >  {
> >    grub_uint8_t *ptr;
> > @@ -438,7 +438,7 @@ find_variable (const grub_efi_guid_t *vendor_guid,
> >
> >  grub_efi_status_t __grub_efi_api
> >  EFI_FUNC (efiemu_get_variable) (grub_efi_char16_t *variable_name,
> > -                             const grub_efi_guid_t *vendor_guid,
> > +                             const grub_guid_t *vendor_guid,
> >                               grub_efi_uint32_t *attributes,
> >                               grub_efi_uintn_t *data_size,
> >                               void *data)
> > @@ -464,7 +464,7 @@ EFI_FUNC (efiemu_get_variable) (grub_efi_char16_t 
> > *variable_name,
> >  grub_efi_status_t __grub_efi_api EFI_FUNC
> >  (efiemu_get_next_variable_name) (grub_efi_uintn_t *variable_name_size,
> >                                grub_efi_char16_t *variable_name,
> > -                              grub_efi_guid_t *vendor_guid)
> > +                              grub_guid_t *vendor_guid)
> >  {
> >    struct efi_variable *efivar;
> >    LOG ('l');
> > @@ -503,7 +503,7 @@ grub_efi_status_t __grub_efi_api EFI_FUNC
> >
> >  grub_efi_status_t __grub_efi_api
> >  EFI_FUNC (efiemu_set_variable) (grub_efi_char16_t *variable_name,
> > -                             const grub_efi_guid_t *vendor_guid,
> > +                             const grub_guid_t *vendor_guid,
> >                               grub_efi_uint32_t attributes,
> >                               grub_efi_uintn_t data_size,
> >                               void *data)
> > diff --git a/grub-core/kern/efi/acpi.c b/grub-core/kern/efi/acpi.c
> > index 74f8cd1a9..461c77c33 100644
> > --- a/grub-core/kern/efi/acpi.c
> > +++ b/grub-core/kern/efi/acpi.c
> > @@ -26,14 +26,14 @@ struct grub_acpi_rsdp_v10 *
> >  grub_machine_acpi_get_rsdpv1 (void)
> >  {
> >    unsigned i;
> > -  static grub_efi_packed_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
> > +  static grub_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
> >
> >    for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
> >      {
> > -      grub_efi_packed_guid_t *guid =
> > +      grub_guid_t *guid =
> >       &grub_efi_system_table->configuration_table[i].vendor_guid;
> >
> > -      if (! grub_memcmp (guid, &acpi_guid, sizeof 
> > (grub_efi_packed_guid_t)))
> > +      if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_guid_t)))
> >       return (struct grub_acpi_rsdp_v10 *)
> >         grub_efi_system_table->configuration_table[i].vendor_table;
> >      }
> > @@ -44,14 +44,14 @@ struct grub_acpi_rsdp_v20 *
> >  grub_machine_acpi_get_rsdpv2 (void)
> >  {
> >    unsigned i;
> > -  static grub_efi_packed_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
> > +  static grub_guid_t acpi20_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
> >
> >    for (i = 0; i < grub_efi_system_table->num_table_entries; i++)
> >      {
> > -      grub_efi_packed_guid_t *guid =
> > +      grub_guid_t *guid =
> >       &grub_efi_system_table->configuration_table[i].vendor_guid;
> >
> > -      if (! grub_memcmp (guid, &acpi20_guid, sizeof 
> > (grub_efi_packed_guid_t)))
> > +      if (! grub_memcmp (guid, &acpi20_guid, sizeof (grub_guid_t)))
> >       return (struct grub_acpi_rsdp_v20 *)
> >         grub_efi_system_table->configuration_table[i].vendor_table;
> >      }
> > diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
> > index 4a1df6fb2..9e7d1a4a7 100644
> > --- a/grub-core/kern/efi/efi.c
> > +++ b/grub-core/kern/efi/efi.c
> > @@ -35,12 +35,12 @@ grub_efi_handle_t grub_efi_image_handle;
> >  /* The pointer to a system table. Filled in by the startup code.  */
> >  grub_efi_system_table_t *grub_efi_system_table;
> >
> > -static grub_efi_guid_t console_control_guid = 
> > GRUB_EFI_CONSOLE_CONTROL_GUID;
> > -static grub_efi_guid_t loaded_image_guid = GRUB_EFI_LOADED_IMAGE_GUID;
> > -static grub_efi_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
> > +static grub_guid_t console_control_guid = GRUB_EFI_CONSOLE_CONTROL_GUID;
> > +static grub_guid_t loaded_image_guid = GRUB_EFI_LOADED_IMAGE_GUID;
> > +static grub_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
> >
> >  void *
> > -grub_efi_locate_protocol (grub_efi_guid_t *protocol, void *registration)
> > +grub_efi_locate_protocol (grub_guid_t *protocol, void *registration)
> >  {
> >    void *interface;
> >    grub_efi_status_t status;
> > @@ -59,7 +59,7 @@ grub_efi_locate_protocol (grub_efi_guid_t *protocol, void 
> > *registration)
> >     from the heap.  */
> >  grub_efi_handle_t *
> >  grub_efi_locate_handle (grub_efi_locate_search_type_t search_type,
> > -                     grub_efi_guid_t *protocol,
> > +                     grub_guid_t *protocol,
> >                       void *search_key,
> >                       grub_efi_uintn_t *num_handles)
> >  {
> > @@ -98,7 +98,7 @@ grub_efi_locate_handle (grub_efi_locate_search_type_t 
> > search_type,
> >
> >  void *
> >  grub_efi_open_protocol (grub_efi_handle_t handle,
> > -                     grub_efi_guid_t *protocol,
> > +                     grub_guid_t *protocol,
> >                       grub_efi_uint32_t attributes)
> >  {
> >    grub_efi_boot_services_t *b;
> > @@ -119,7 +119,7 @@ grub_efi_open_protocol (grub_efi_handle_t handle,
> >  }
> >
> >  grub_efi_status_t
> > -grub_efi_close_protocol (grub_efi_handle_t handle, grub_efi_guid_t 
> > *protocol)
> > +grub_efi_close_protocol (grub_efi_handle_t handle, grub_guid_t *protocol)
> >  {
> >    grub_efi_boot_services_t *b = grub_efi_system_table->boot_services;
> >
> > @@ -203,7 +203,7 @@ grub_efi_set_virtual_address_map (grub_efi_uintn_t 
> > memory_map_size,
> >  }
> >
> >  grub_err_t
> > -grub_efi_set_variable_with_attributes (const char *var, const 
> > grub_efi_guid_t *guid,
> > +grub_efi_set_variable_with_attributes (const char *var, const grub_guid_t 
> > *guid,
> >                     void *data, grub_size_t datasize, grub_efi_uint32_t 
> > attributes)
> >  {
> >    grub_efi_status_t status;
> > @@ -230,7 +230,7 @@ grub_efi_set_variable_with_attributes (const char *var, 
> > const grub_efi_guid_t *g
> >  }
> >
> >  grub_err_t
> > -grub_efi_set_variable (const char *var, const grub_efi_guid_t *guid,
> > +grub_efi_set_variable (const char *var, const grub_guid_t *guid,
> >                     void *data, grub_size_t datasize)
> >  {
> >    return grub_efi_set_variable_with_attributes (var, guid, data, datasize,
> > @@ -241,7 +241,7 @@ grub_efi_set_variable (const char *var, const 
> > grub_efi_guid_t *guid,
> >
> >  grub_efi_status_t
> >  grub_efi_get_variable_with_attributes (const char *var,
> > -                                    const grub_efi_guid_t *guid,
> > +                                    const grub_guid_t *guid,
> >                                      grub_size_t *datasize_out,
> >                                      void **data_out,
> >                                      grub_efi_uint32_t *attributes)
> > @@ -296,7 +296,7 @@ grub_efi_get_variable_with_attributes (const char *var,
> >  }
> >
> >  grub_efi_status_t
> > -grub_efi_get_variable (const char *var, const grub_efi_guid_t *guid,
> > +grub_efi_get_variable (const char *var, const grub_guid_t *guid,
> >                      grub_size_t *datasize_out, void **data_out)
> >  {
> >    return grub_efi_get_variable_with_attributes (var, guid, datasize_out, 
> > data_out, NULL);
> > diff --git a/grub-core/kern/efi/fdt.c b/grub-core/kern/efi/fdt.c
> > index 24f955289..8fcf43f1b 100644
> > --- a/grub-core/kern/efi/fdt.c
> > +++ b/grub-core/kern/efi/fdt.c
> > @@ -24,7 +24,7 @@ void *
> >  grub_efi_get_firmware_fdt (void)
> >  {
> >    grub_efi_configuration_table_t *tables;
> > -  static grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
> > +  static grub_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
> >    void *firmware_fdt = NULL;
> >    unsigned int i;
> >
> > diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
> > index e873ef529..8a9c838c0 100644
> > --- a/grub-core/kern/efi/init.c
> > +++ b/grub-core/kern/efi/init.c
> > @@ -36,7 +36,7 @@ static grub_efi_char16_t stack_chk_fail_msg[] =
> >    L"* GRUB: ABORTED!!! *\r\n"
> >    L"* GRUB: REBOOTING IN 5 SECONDS... *\r\n";
> >
> > -static grub_efi_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
> > +static grub_guid_t rng_protocol_guid = GRUB_EFI_RNG_PROTOCOL_GUID;
> >
> >  /*
> >   * Don't put this on grub_efi_init()'s local stack to avoid it
> > diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c
> > index db42c2539..80cfa0888 100644
> > --- a/grub-core/kern/efi/sb.c
> > +++ b/grub-core/kern/efi/sb.c
> > @@ -30,7 +30,7 @@
> >  #include <grub/types.h>
> >  #include <grub/verify.h>
> >
> > -static grub_efi_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
> > +static grub_guid_t shim_lock_guid = GRUB_EFI_SHIM_LOCK_GUID;
> >
> >  /*
> >   * Determine whether we're in secure boot mode.
> > @@ -41,7 +41,7 @@ static grub_efi_guid_t shim_lock_guid = 
> > GRUB_EFI_SHIM_LOCK_GUID;
> >  grub_uint8_t
> >  grub_efi_get_secureboot (void)
> >  {
> > -  static grub_efi_guid_t efi_variable_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> > +  static grub_guid_t efi_variable_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> >    grub_efi_status_t status;
> >    grub_efi_uint32_t attr = 0;
> >    grub_size_t size = 0;
> > diff --git a/grub-core/loader/efi/fdt.c b/grub-core/loader/efi/fdt.c
> > index 35a3be2e5..439964b9c 100644
> > --- a/grub-core/loader/efi/fdt.c
> > +++ b/grub-core/loader/efi/fdt.c
> > @@ -86,7 +86,7 @@ grub_err_t
> >  grub_fdt_install (void)
> >  {
> >    grub_efi_boot_services_t *b;
> > -  static grub_efi_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
> > +  static grub_guid_t fdt_guid = GRUB_EFI_DEVICE_TREE_GUID;
> >    grub_efi_status_t status;
> >
> >    if (fdt == NULL && loaded_fdt == NULL)
> > diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
> > index 1d98fa365..c1eef7c98 100644
> > --- a/grub-core/loader/efi/linux.c
> > +++ b/grub-core/loader/efi/linux.c
> > @@ -51,8 +51,8 @@ static struct grub_linux_initrd_context initrd_ctx = {0, 
> > 0, 0};
> >  static grub_efi_handle_t initrd_lf2_handle = NULL;
> >  static bool initrd_use_loadfile2 = false;
> >
> > -static grub_efi_guid_t load_file2_guid = GRUB_EFI_LOAD_FILE2_PROTOCOL_GUID;
> > -static grub_efi_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
> > +static grub_guid_t load_file2_guid = GRUB_EFI_LOAD_FILE2_PROTOCOL_GUID;
> > +static grub_guid_t device_path_guid = GRUB_EFI_DEVICE_PATH_GUID;
> >
> >  static initrd_media_device_path_t initrd_lf2_device_path = {
> >    {
> > diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
> > index 4c88ce5e0..93ba4476d 100644
> > --- a/grub-core/loader/i386/xnu.c
> > +++ b/grub-core/loader/i386/xnu.c
> > @@ -48,7 +48,7 @@ grub_uint32_t grub_xnu_entry_point, grub_xnu_arg1, 
> > grub_xnu_stack;
> >  /* Aliases set for some tables. */
> >  struct tbl_alias
> >  {
> > -  grub_efi_guid_t guid;
> > +  grub_guid_t guid;
> >    const char *name;
> >  };
> >
> > @@ -694,7 +694,7 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t 
> > *fsbfreq_out)
> >      {
> >        void *ptr;
> >        struct grub_xnu_devtree_key *curkey;
> > -      grub_efi_packed_guid_t guid;
> > +      grub_guid_t guid;
> >        char guidbuf[64];
> >
> >        /* Retrieve current key. */
> > diff --git a/grub-core/loader/ia64/efi/linux.c 
> > b/grub-core/loader/ia64/efi/linux.c
> > index fb9b961f7..3dd2e8236 100644
> > --- a/grub-core/loader/ia64/efi/linux.c
> > +++ b/grub-core/loader/ia64/efi/linux.c
> > @@ -106,7 +106,7 @@ query_fpswa (void)
> >    grub_efi_boot_services_t *bs;
> >    grub_efi_status_t status;
> >    grub_efi_uintn_t size;
> > -  static const grub_efi_guid_t fpswa_protocol =
> > +  static const grub_guid_t fpswa_protocol =
> >      { 0xc41b6531, 0x97b9, 0x11d3,
> >        {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} };
> >
> > diff --git a/grub-core/net/drivers/efi/efinet.c 
> > b/grub-core/net/drivers/efi/efinet.c
> > index 56a179709..3ea25cf98 100644
> > --- a/grub-core/net/drivers/efi/efinet.c
> > +++ b/grub-core/net/drivers/efi/efinet.c
> > @@ -27,8 +27,8 @@
> >  GRUB_MOD_LICENSE ("GPLv3+");
> >
> >  /* GUID.  */
> > -static grub_efi_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
> > -static grub_efi_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
> > +static grub_guid_t net_io_guid = GRUB_EFI_SIMPLE_NETWORK_GUID;
> > +static grub_guid_t pxe_io_guid = GRUB_EFI_PXE_GUID;
> >
> >  static grub_err_t
> >  send_card_buffer (struct grub_net_card *dev,
> > diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c
> > index 075cc96f1..877ceefc3 100644
> > --- a/grub-core/partmap/gpt.c
> > +++ b/grub-core/partmap/gpt.c
> > @@ -36,10 +36,10 @@ static grub_uint8_t grub_gpt_magic[8] =
> >      0x45, 0x46, 0x49, 0x20, 0x50, 0x41, 0x52, 0x54
> >    };
> >
> > -static const grub_gpt_part_guid_t grub_gpt_partition_type_empty = 
> > GRUB_GPT_PARTITION_TYPE_EMPTY;
> > +static const grub_guid_t grub_gpt_partition_type_empty = 
> > GRUB_GPT_PARTITION_TYPE_EMPTY;
> >
> >  #ifdef GRUB_UTIL
> > -static const grub_gpt_part_guid_t grub_gpt_partition_type_bios_boot = 
> > GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
> > +static const grub_guid_t grub_gpt_partition_type_bios_boot = 
> > GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
> >  #endif
> >
> >  /* 512 << 7 = 65536 byte sectors.  */
> > diff --git a/grub-core/term/efi/console.c b/grub-core/term/efi/console.c
> > index 9a7bc0fcf..bb587f39d 100644
> > --- a/grub-core/term/efi/console.c
> > +++ b/grub-core/term/efi/console.c
> > @@ -352,7 +352,7 @@ grub_console_getkeystatus (struct grub_term_input *term)
> >  static grub_err_t
> >  grub_efi_console_input_init (struct grub_term_input *term)
> >  {
> > -  static grub_efi_guid_t text_input_ex_guid =
> > +  static grub_guid_t text_input_ex_guid =
> >      GRUB_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
> >
> >    if (grub_efi_is_finished)
> > diff --git a/grub-core/term/efi/serial.c b/grub-core/term/efi/serial.c
> > index e86ebce3f..5dfd2d86c 100644
> > --- a/grub-core/term/efi/serial.c
> > +++ b/grub-core/term/efi/serial.c
> > @@ -31,7 +31,7 @@
> >  #include <grub/i18n.h>
> >
> >  /* GUID.  */
> > -static grub_efi_guid_t serial_io_guid = GRUB_EFI_SERIAL_IO_GUID;
> > +static grub_guid_t serial_io_guid = GRUB_EFI_SERIAL_IO_GUID;
> >
> >  static void
> >  do_real_config (struct grub_serial_port *port)
> > diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
> > index 9c7901038..7247aeea7 100644
> > --- a/grub-core/video/efi_gop.c
> > +++ b/grub-core/video/efi_gop.c
> > @@ -32,10 +32,10 @@
> >
> >  GRUB_MOD_LICENSE ("GPLv3+");
> >
> > -static grub_efi_guid_t graphics_output_guid = GRUB_EFI_GOP_GUID;
> > -static grub_efi_guid_t active_edid_guid = GRUB_EFI_EDID_ACTIVE_GUID;
> > -static grub_efi_guid_t discovered_edid_guid = 
> > GRUB_EFI_EDID_DISCOVERED_GUID;
> > -static grub_efi_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> > +static grub_guid_t graphics_output_guid = GRUB_EFI_GOP_GUID;
> > +static grub_guid_t active_edid_guid = GRUB_EFI_EDID_ACTIVE_GUID;
> > +static grub_guid_t discovered_edid_guid = GRUB_EFI_EDID_DISCOVERED_GUID;
> > +static grub_guid_t efi_var_guid = GRUB_EFI_GLOBAL_VARIABLE_GUID;
> >  static struct grub_efi_gop *gop;
> >  static unsigned old_mode;
> >  static int restore_needed;
> > diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c
> > index aa4659b8e..d53079e0b 100644
> > --- a/grub-core/video/efi_uga.c
> > +++ b/grub-core/video/efi_uga.c
> > @@ -32,7 +32,7 @@
> >
> >  GRUB_MOD_LICENSE ("GPLv3+");
> >
> > -static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
> > +static grub_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
> >  static struct grub_efi_uga_draw_protocol *uga;
> >  static grub_uint64_t uga_fb;
> >  static grub_uint32_t uga_pitch;
> > diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
> > index fb881ae12..c0b6e86f1 100644
> > --- a/include/grub/efi/api.h
> > +++ b/include/grub/efi/api.h
> > @@ -639,24 +639,6 @@ typedef grub_uint8_t grub_efi_ip_address_t[8] 
> > __attribute__ ((aligned(4)));
> >  typedef grub_efi_uint64_t grub_efi_physical_address_t;
> >  typedef grub_efi_uint64_t grub_efi_virtual_address_t;
> >
> > -struct grub_efi_guid
> > -{
> > -  grub_uint32_t data1;
> > -  grub_uint16_t data2;
> > -  grub_uint16_t data3;
> > -  grub_uint8_t data4[8];
> > -} __attribute__ ((aligned(8)));
> > -typedef struct grub_efi_guid grub_efi_guid_t;
> > -
> > -struct grub_efi_packed_guid
> > -{
> > -  grub_uint32_t data1;
> > -  grub_uint16_t data2;
> > -  grub_uint16_t data3;
> > -  grub_uint8_t data4[8];
> > -} GRUB_PACKED;
> > -typedef struct grub_efi_packed_guid grub_efi_packed_guid_t;
> > -
> >  /* XXX although the spec does not specify the padding, this actually
> >     must have the padding!  */
> >  struct grub_efi_memory_descriptor
> > @@ -743,7 +725,7 @@ typedef struct grub_efi_memory_mapped_device_path 
> > grub_efi_memory_mapped_device_
> >  struct grub_efi_vendor_device_path
> >  {
> >    grub_efi_device_path_t header;
> > -  grub_efi_packed_guid_t vendor_guid;
> > +  grub_guid_t vendor_guid;
> >    grub_efi_uint8_t vendor_defined_data[0];
> >  } GRUB_PACKED;
> >  typedef struct grub_efi_vendor_device_path grub_efi_vendor_device_path_t;
> > @@ -987,7 +969,7 @@ typedef struct grub_efi_cdrom_device_path 
> > grub_efi_cdrom_device_path_t;
> >  struct grub_efi_vendor_media_device_path
> >  {
> >    grub_efi_device_path_t header;
> > -  grub_efi_packed_guid_t vendor_guid;
> > +  grub_guid_t vendor_guid;
> >    grub_efi_uint8_t vendor_defined_data[0];
> >  } GRUB_PACKED;
> >  typedef struct grub_efi_vendor_media_device_path 
> > grub_efi_vendor_media_device_path_t;
> > @@ -1006,7 +988,7 @@ typedef struct grub_efi_file_path_device_path 
> > grub_efi_file_path_device_path_t;
> >  struct grub_efi_protocol_device_path
> >  {
> >    grub_efi_device_path_t header;
> > -  grub_efi_packed_guid_t guid;
> > +  grub_guid_t guid;
> >  } GRUB_PACKED;
> >  typedef struct grub_efi_protocol_device_path 
> > grub_efi_protocol_device_path_t;
> >
> > @@ -1015,7 +997,7 @@ typedef struct grub_efi_protocol_device_path 
> > grub_efi_protocol_device_path_t;
> >  struct grub_efi_piwg_device_path
> >  {
> >    grub_efi_device_path_t header;
> > -  grub_efi_packed_guid_t guid;
> > +  grub_guid_t guid;
> >  } GRUB_PACKED;
> >  typedef struct grub_efi_piwg_device_path grub_efi_piwg_device_path_t;
> >
> > @@ -1186,47 +1168,47 @@ struct grub_efi_boot_services
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *install_protocol_interface) (grub_efi_handle_t *handle,
> > -                                             grub_efi_guid_t *protocol,
> > +                                             grub_guid_t *protocol,
> >                                               grub_efi_interface_type_t 
> > protocol_interface_type,
> >                                               void *protocol_interface);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *reinstall_protocol_interface) (grub_efi_handle_t handle,
> > -                                               grub_efi_guid_t *protocol,
> > +                                               grub_guid_t *protocol,
> >                                                 void *old_interface,
> >                                                 void *new_interface);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *uninstall_protocol_interface) (grub_efi_handle_t handle,
> > -                                               grub_efi_guid_t *protocol,
> > +                                               grub_guid_t *protocol,
> >                                                 void *protocol_interface);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *handle_protocol) (grub_efi_handle_t handle,
> > -                                  grub_efi_guid_t *protocol,
> > +                                  grub_guid_t *protocol,
> >                                    void **protocol_interface);
> >
> >    void *reserved;
> >
> >    grub_efi_status_t
> > -  (__grub_efi_api *register_protocol_notify) (grub_efi_guid_t *protocol,
> > +  (__grub_efi_api *register_protocol_notify) (grub_guid_t *protocol,
> >                                             grub_efi_event_t event,
> >                                             void **registration);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *locate_handle) (grub_efi_locate_search_type_t 
> > search_type,
> > -                                grub_efi_guid_t *protocol,
> > +                                grub_guid_t *protocol,
> >                                  void *search_key,
> >                                  grub_efi_uintn_t *buffer_size,
> >                                  grub_efi_handle_t *buffer);
> >
> >    grub_efi_status_t
> > -  (__grub_efi_api *locate_device_path) (grub_efi_guid_t *protocol,
> > +  (__grub_efi_api *locate_device_path) (grub_guid_t *protocol,
> >                                       grub_efi_device_path_t **device_path,
> >                                       grub_efi_handle_t *device);
> >
> >    grub_efi_status_t
> > -  (__grub_efi_api *install_configuration_table) (grub_efi_guid_t *guid,
> > +  (__grub_efi_api *install_configuration_table) (grub_guid_t *guid,
> >                                                void *table);
> >
> >    grub_efi_status_t
> > @@ -1280,7 +1262,7 @@ struct grub_efi_boot_services
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *open_protocol) (grub_efi_handle_t handle,
> > -                                grub_efi_guid_t *protocol,
> > +                                grub_guid_t *protocol,
> >                                  void **protocol_interface,
> >                                  grub_efi_handle_t agent_handle,
> >                                  grub_efi_handle_t controller_handle,
> > @@ -1288,30 +1270,30 @@ struct grub_efi_boot_services
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *close_protocol) (grub_efi_handle_t handle,
> > -                                 grub_efi_guid_t *protocol,
> > +                                 grub_guid_t *protocol,
> >                                   grub_efi_handle_t agent_handle,
> >                                   grub_efi_handle_t controller_handle);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *open_protocol_information) (grub_efi_handle_t handle,
> > -                                            grub_efi_guid_t *protocol,
> > +                                            grub_guid_t *protocol,
> >                                              
> > grub_efi_open_protocol_information_entry_t **entry_buffer,
> >                                              grub_efi_uintn_t *entry_count);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *protocols_per_handle) (grub_efi_handle_t handle,
> > -                                       grub_efi_packed_guid_t 
> > ***protocol_buffer,
> > +                                       grub_guid_t ***protocol_buffer,
> >                                         grub_efi_uintn_t 
> > *protocol_buffer_count);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *locate_handle_buffer) (grub_efi_locate_search_type_t 
> > search_type,
> > -                                       grub_efi_guid_t *protocol,
> > +                                       grub_guid_t *protocol,
> >                                         void *search_key,
> >                                         grub_efi_uintn_t *no_handles,
> >                                         grub_efi_handle_t **buffer);
> >
> >    grub_efi_status_t
> > -  (__grub_efi_api *locate_protocol) (grub_efi_guid_t *protocol,
> > +  (__grub_efi_api *locate_protocol) (grub_guid_t *protocol,
> >                                    void *registration,
> >                                    void **protocol_interface);
> >
> > @@ -1369,7 +1351,7 @@ struct grub_efi_runtime_services
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *get_variable) (grub_efi_char16_t *variable_name,
> > -                               const grub_efi_guid_t *vendor_guid,
> > +                               const grub_guid_t *vendor_guid,
> >                                 grub_efi_uint32_t *attributes,
> >                                 grub_efi_uintn_t *data_size,
> >                                 void *data);
> > @@ -1377,11 +1359,11 @@ struct grub_efi_runtime_services
> >    grub_efi_status_t
> >    (__grub_efi_api *get_next_variable_name) (grub_efi_uintn_t 
> > *variable_name_size,
> >                                           grub_efi_char16_t *variable_name,
> > -                                         grub_efi_guid_t *vendor_guid);
> > +                                         grub_guid_t *vendor_guid);
> >
> >    grub_efi_status_t
> >    (__grub_efi_api *set_variable) (grub_efi_char16_t *variable_name,
> > -                               const grub_efi_guid_t *vendor_guid,
> > +                               const grub_guid_t *vendor_guid,
> >                                 grub_efi_uint32_t attributes,
> >                                 grub_efi_uintn_t data_size,
> >                                 void *data);
> > @@ -1399,7 +1381,7 @@ typedef struct grub_efi_runtime_services 
> > grub_efi_runtime_services_t;
> >
> >  struct grub_efi_configuration_table
> >  {
> > -  grub_efi_packed_guid_t vendor_guid;
> > +  grub_guid_t vendor_guid;
> >    void *vendor_table;
> >  } GRUB_PACKED;
> >  typedef struct grub_efi_configuration_table grub_efi_configuration_table_t;
> > @@ -1794,7 +1776,7 @@ struct grub_efi_shim_lock_protocol
> >  };
> >  typedef struct grub_efi_shim_lock_protocol grub_efi_shim_lock_protocol_t;
> >
> > -typedef grub_efi_guid_t grub_efi_rng_algorithm_t;
> > +typedef grub_guid_t grub_efi_rng_algorithm_t;
> >
> >  struct grub_efi_rng_protocol
> >  {
> > diff --git a/include/grub/efi/efi.h b/include/grub/efi/efi.h
> > index 26f33433b..3d056a0a4 100644
> > --- a/include/grub/efi/efi.h
> > +++ b/include/grub/efi/efi.h
> > @@ -37,18 +37,18 @@ struct linux_arch_kernel_header {
> >  };
> >
> >  /* Functions.  */
> > -void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
> > +void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_guid_t *protocol,
> >                                            void *registration);
> >  grub_efi_handle_t *
> >  EXPORT_FUNC(grub_efi_locate_handle) (grub_efi_locate_search_type_t 
> > search_type,
> > -                                  grub_efi_guid_t *protocol,
> > +                                  grub_guid_t *protocol,
> >                                    void *search_key,
> >                                    grub_efi_uintn_t *num_handles);
> >  void *EXPORT_FUNC(grub_efi_open_protocol) (grub_efi_handle_t handle,
> > -                                        grub_efi_guid_t *protocol,
> > +                                        grub_guid_t *protocol,
> >                                          grub_efi_uint32_t attributes);
> >  grub_efi_status_t
> > -EXPORT_FUNC(grub_efi_close_protocol) (grub_efi_handle_t handle, 
> > grub_efi_guid_t *protocol);
> > +EXPORT_FUNC(grub_efi_close_protocol) (grub_efi_handle_t handle, 
> > grub_guid_t *protocol);
> >  int EXPORT_FUNC(grub_efi_set_text_mode) (int on);
> >  void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
> >  void *
> > @@ -89,23 +89,23 @@ grub_err_t EXPORT_FUNC 
> > (grub_efi_set_virtual_address_map) (grub_efi_uintn_t memo
> >                                                          grub_efi_uint32_t 
> > descriptor_version,
> >                                                          
> > grub_efi_memory_descriptor_t *virtual_map);
> >  grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable_with_attributes) 
> > (const char *variable,
> > -                                                                    const 
> > grub_efi_guid_t *guid,
> > +                                                                    const 
> > grub_guid_t *guid,
> >                                                                      
> > grub_size_t *datasize_out,
> >                                                                      void 
> > **data_out,
> >                                                                      
> > grub_efi_uint32_t *attributes);
> >  grub_efi_status_t EXPORT_FUNC (grub_efi_get_variable) (const char 
> > *variable,
> > -                                                    const grub_efi_guid_t 
> > *guid,
> > +                                                    const grub_guid_t 
> > *guid,
> >                                                      grub_size_t 
> > *datasize_out,
> >                                                      void **data_out);
> >  grub_err_t
> >  EXPORT_FUNC (grub_efi_set_variable_with_attributes) (const char *var,
> > -                                  const grub_efi_guid_t *guid,
> > +                                  const grub_guid_t *guid,
> >                                    void *data,
> >                                    grub_size_t datasize,
> >                                    grub_efi_uint32_t attributes);
> >  grub_err_t
> >  EXPORT_FUNC (grub_efi_set_variable) (const char *var,
> > -                                  const grub_efi_guid_t *guid,
> > +                                  const grub_guid_t *guid,
> >                                    void *data,
> >                                    grub_size_t datasize);
> >  int
> > diff --git a/include/grub/efiemu/efiemu.h b/include/grub/efiemu/efiemu.h
> > index 5325e5839..caf0b505f 100644
> > --- a/include/grub/efiemu/efiemu.h
> > +++ b/include/grub/efiemu/efiemu.h
> > @@ -176,26 +176,26 @@ grub_err_t grub_efiemu_loadcore_load (void);
> >  struct grub_efiemu_configuration_table
> >  {
> >    struct grub_efiemu_configuration_table *next;
> > -  grub_efi_guid_t guid;
> > +  grub_guid_t guid;
> >    void * (*get_table) (void *data);
> >    void (*unload) (void *data);
> >    void *data;
> >  };
> >  struct grub_efiemu_configuration_table32
> >  {
> > -  grub_efi_packed_guid_t vendor_guid;
> > +  grub_guid_t vendor_guid;
> >    grub_efi_uint32_t vendor_table;
> >  } GRUB_PACKED;
> >  typedef struct grub_efiemu_configuration_table32 
> > grub_efiemu_configuration_table32_t;
> >  struct grub_efiemu_configuration_table64
> >  {
> > -  grub_efi_packed_guid_t vendor_guid;
> > +  grub_guid_t vendor_guid;
> >    grub_efi_uint64_t vendor_table;
> >  } GRUB_PACKED;
> >  typedef struct grub_efiemu_configuration_table64 
> > grub_efiemu_configuration_table64_t;
> > -grub_err_t grub_efiemu_unregister_configuration_table (grub_efi_guid_t 
> > guid);
> > +grub_err_t grub_efiemu_unregister_configuration_table (grub_guid_t guid);
> >  grub_err_t
> > -grub_efiemu_register_configuration_table (grub_efi_guid_t guid,
> > +grub_efiemu_register_configuration_table (grub_guid_t guid,
> >                                         void * (*get_table) (void *data),
> >                                         void (*unload) (void *data),
> >                                         void *data);
> > diff --git a/include/grub/efiemu/runtime.h b/include/grub/efiemu/runtime.h
> > index 36d2dedf4..c9ad9fdfa 100644
> > --- a/include/grub/efiemu/runtime.h
> > +++ b/include/grub/efiemu/runtime.h
> > @@ -29,7 +29,7 @@ struct grub_efiemu_ptv_rel
> >
> >  struct efi_variable
> >  {
> > -  grub_efi_packed_guid_t guid;
> > +  grub_guid_t guid;
> >    grub_uint32_t namelen;
> >    grub_uint32_t size;
> >    grub_efi_uint32_t attributes;
> > diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
> > index 7a93f4329..020e71920 100644
> > --- a/include/grub/gpt_partition.h
> > +++ b/include/grub/gpt_partition.h
> > @@ -22,15 +22,6 @@
> >  #include <grub/types.h>
> >  #include <grub/partition.h>
> >
> > -struct grub_gpt_part_guid
> > -{
> > -  grub_uint32_t data1;
> > -  grub_uint16_t data2;
> > -  grub_uint16_t data3;
> > -  grub_uint8_t data4[8];
> > -} GRUB_PACKED;
> > -typedef struct grub_gpt_part_guid grub_gpt_part_guid_t;
> > -
> >  #define GRUB_GPT_PARTITION_TYPE_EMPTY \
> >    { 0x0, 0x0, 0x0, \
> >      { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } \
> > @@ -70,8 +61,8 @@ struct grub_gpt_header
> >
> >  struct grub_gpt_partentry
> >  {
> > -  grub_gpt_part_guid_t type;
> > -  grub_gpt_part_guid_t guid;
> > +  grub_guid_t type;
> > +  grub_guid_t guid;
> >    grub_uint64_t start;
> >    grub_uint64_t end;
> >    grub_uint64_t attrib;
> > diff --git a/include/grub/types.h b/include/grub/types.h
> > index 6d5dc5cda..c56ce9820 100644
> > --- a/include/grub/types.h
> > +++ b/include/grub/types.h
> > @@ -365,4 +365,13 @@ static inline void grub_set_unaligned64 (void *ptr, 
> > grub_uint64_t val)
> >  # define grub_absolute_pointer(val) ((void *) (val))
> >  #endif
> >
> > +struct grub_guid
> > +{
> > +  grub_uint32_t data1;
> > +  grub_uint16_t data2;
> > +  grub_uint16_t data3;
> > +  grub_uint8_t data4[8];
> > +} GRUB_PACKED;
> > +typedef struct grub_guid grub_guid_t;
> > +
> >  #endif /* ! GRUB_TYPES_HEADER */
> > diff --git a/util/grub-install.c b/util/grub-install.c
> > index e20820d9e..1ad04db36 100644
> > --- a/util/grub-install.c
> > +++ b/util/grub-install.c
> > @@ -728,7 +728,7 @@ is_prep_partition (grub_device_t dev)
> >        if (grub_disk_read (dev->disk, p->offset, p->index,
> >                         sizeof (gptdata), &gptdata) == 0)
> >       {
> > -       const grub_gpt_part_guid_t template = {
> > +       const grub_guid_t template = {
> >           grub_cpu_to_le32_compile_time (0x9e1a2d38),
> >           grub_cpu_to_le16_compile_time (0xc612),
> >           grub_cpu_to_le16_compile_time (0x4316),
> > diff --git a/util/grub-probe.c b/util/grub-probe.c
> > index 446bd2553..65c1ca3f8 100644
> > --- a/util/grub-probe.c
> > +++ b/util/grub-probe.c
> > @@ -133,7 +133,7 @@ get_targets_string (void)
> >  }
> >
> >  static int
> > -print_gpt_guid (grub_gpt_part_guid_t guid)
> > +print_gpt_guid (grub_guid_t guid)
> >  {
> >    guid.data1 = grub_le_to_cpu32 (guid.data1);
> >    guid.data2 = grub_le_to_cpu16 (guid.data2);
>
> According to [1], this change broke GRUB on ia64:
>
> Welcome to GRUB!
>
> 7 0 0x00006B 0x000000000000001E unexpected trap
> 7 0 0x000066 0x000000000000001E trap taken, number in ext PE
> 7 0 0x00003C 0x0000000000005A00 trap taken, offset in ext PE
>
> I assume this is because of the strict alignment requirements on ia64.
>
> Could you have a look?
>
I am very sorry for this mistake.
My goal was to unify the two GUID types we had in grub but I missed the
fact that in my "solution" the alignments are not correct in all cases.

The quickest way out could be to revert the GUID unification and printf
format specifier commits:

6ad116e5f guid: Make use of GUID printf format specifier
f82dbf2bd kern/misc: Add a format specifier GUIDs
06edd40db guid: Unify GUID types

And use the explicit, long-winded format string for printing the GUID
in the bli module instead (added in the commits following those).

I am open to suggestions / comments.

Sorry again,
 Oliver

> Thanks,
> Adrian
>
> > [1] https://lists.gnu.org/archive/html/grub-devel/2023-08/msg00016.html
>
> --
>  .''`.  John Paul Adrian Glaubitz
> : :' :  Debian Developer
> `. `'   Physicist
>   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]