Part_msdos size is critical as it's in critical supported configuration part_msdos+biosdisk+any FS. Please put it in a non-critical module
Le mar. 22 août 2023, 23:41, Vitaly Kuzmichev <vitaly.kuzmic...@rtsoft.de> a écrit : > This patch adds a function to provide partition PARTUUID on MBR > formatted disks by extracting 32-bit disk signature code from MBR > at offset 0x01B8 and adding partition number to it, similarly to > 'blkid' output. > > Signed-off-by: Vitaly Kuzmichev <vitaly.kuzmic...@rtsoft.de> > --- > grub-core/partmap/msdos.c | 32 ++++++++++++++++++++++++++++++++ > include/grub/msdos_partition.h | 3 +++ > 2 files changed, 35 insertions(+) > > diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c > index c85bb74be..4ad9ea74f 100644 > --- a/grub-core/partmap/msdos.c > +++ b/grub-core/partmap/msdos.c > @@ -24,12 +24,44 @@ > #include <grub/misc.h> > #include <grub/dl.h> > #include <grub/i18n.h> > +#include <grub/i386/pc/boot.h> > > GRUB_MOD_LICENSE ("GPLv3+"); > > static struct grub_partition_map grub_msdos_partition_map; > > > +char * > +grub_mbr_partition_get_uuid (grub_device_t dev) > +{ > + grub_disk_t disk; > + grub_partition_t pt; > + grub_uint32_t disk_uuid; > + char *part_uuid = NULL; > + > + if (dev && dev->disk && dev->disk->partition && > dev->disk->partition->partmap) > + { > + pt = dev->disk->partition; > + if (grub_strcmp (pt->partmap->name, "msdos") == 0) > + { > + disk = grub_disk_open (dev->disk->name); > + if (disk && grub_disk_read (disk, 0, > + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC, > + sizeof (disk_uuid), &disk_uuid) == 0) > + part_uuid = grub_xasprintf ("%08x-%02x", > + grub_le_to_cpu32 (disk_uuid), > + pt->number + 1); > + if (!part_uuid) > + grub_error_push (); > + grub_disk_close (disk); > + if (!part_uuid) > + grub_error_pop (); > + } > + } > + > + return part_uuid; > +} > + > #ifdef GRUB_UTIL > #include <grub/emu/misc.h> > > diff --git a/include/grub/msdos_partition.h > b/include/grub/msdos_partition.h > index fdc2904d3..ff7600915 100644 > --- a/include/grub/msdos_partition.h > +++ b/include/grub/msdos_partition.h > @@ -124,4 +124,7 @@ grub_partition_msdos_iterate (grub_disk_t disk, > grub_partition_iterate_hook_t hook, > void *hook_data); > > +char * > +grub_mbr_partition_get_uuid (grub_device_t dev); > + > #endif /* ! GRUB_PC_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