>
> +       {
> +         disk = grub_disk_open (dev->disk->name);
> +         if (disk && grub_disk_read (disk, pt->offset, pt->index,
> +                                     sizeof (gptdata), &gptdata) == 0)
>
Did you test this? It looks like you're missing a line
disk->partition = disk->partition->parent;
And the restore disk->partition

> +           {
> +             guid = &gptdata.guid;
> +             guid->data1 = grub_le_to_cpu32 (guid->data1);
> +             guid->data2 = grub_le_to_cpu16 (guid->data2);
> +             guid->data3 = grub_le_to_cpu16 (guid->data3);
> +             part_uuid = grub_xasprintf ("%pG", guid);
> +           }
> +         if (!part_uuid)
> +           grub_error_push ();
> +         grub_disk_close (disk);
> +         if (!part_uuid)
> +           grub_error_pop ();
> +       }
> +    }
> +
> +  return part_uuid;
> +}
> +
>  grub_err_t
>  grub_gpt_partition_map_iterate (grub_disk_t disk,
>                                 grub_partition_iterate_hook_t hook,
> diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h
> index 020e71920..e52834ac2 100644
> --- a/include/grub/gpt_partition.h
> +++ b/include/grub/gpt_partition.h
> @@ -74,5 +74,7 @@ grub_gpt_partition_map_iterate (grub_disk_t disk,
>                                 grub_partition_iterate_hook_t hook,
>                                 void *hook_data);
>
> +char *
> +grub_gpt_partition_get_uuid (grub_device_t dev);
>
>  #endif /* ! GRUB_GPT_PARTITION_HEADER */
> --
> 2.34.1
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to