Hi Vladimir, On Wed, 2023-08-23 at 00:02 +0200, Vladimir 'phcoder' Serbinenko wrote: > > > > > + { > > + 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
Yes, I tested this code multiple times and it works as it is. I did not find any place in Grub that would use the code you suggested. I do not think it is needed. What is the purpose of this code? > > + { > > + 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 */ > > _______________________________________________ > > 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