grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v5 01/16] partmap/gpt: Add grub_gpt_partition_get_uuid()


From: Vladimir 'phcoder' Serbinenko
Subject: Re: [PATCH v5 01/16] partmap/gpt: Add grub_gpt_partition_get_uuid()
Date: Wed, 23 Aug 2023 14:26:27 +0200



Le mer. 23 août 2023, 13:55, Vitaly Kuzmichev <vitaly.kuzmichev@rtsoft.de> a écrit :
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?
I see what you have done here. You open the disk again. This is not needed and in fact some OFW variants dislike it. Also it breaks nested partition case (rare for gpt but possible). Instead of doing grub_disk_open do:
disk = dev->disk;
pt = disk->partition:
disk->partition = pt->parent;
<Use disk>
disk->partition = pt;

Similar code is used in couple of places which neednto access parent device. E.g. https://git.savannah.gnu.org/cgit/grub.git/tree/grub-core/parttool/msdospart.c#n53

reply via email to

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