On 07/16/2015 10:43 AM, Michael Olbrich wrote: > Signed-off-by: Michael Olbrich <m.olbr...@pengutronix.de> > --- > common/efi-devicepath.c | 31 +++++++++++++++++++++++++++++++ > include/efi.h | 1 + > 2 files changed, 32 insertions(+) > > diff --git a/common/efi-devicepath.c b/common/efi-devicepath.c > index a53c6d2e8b9b..fdb86afc8eca 100644 > --- a/common/efi-devicepath.c > +++ b/common/efi-devicepath.c > @@ -1383,3 +1383,34 @@ u8 device_path_to_type(struct efi_device_path > *dev_path) > > return device_path_type(dev_path); > } > + > +char *device_path_to_partuuid(struct efi_device_path *dev_path) > +{ > + struct efi_device_path *dev_path_node; > + struct harddrive_device_path *hd; > + char *str = NULL;; > + > + dev_path = unpack_device_path(dev_path); > + > + for (dev_path_node = dev_path; !is_device_path_end(dev_path_node); > + dev_path_node = next_device_path_node(dev_path_node)) { > + > + if (device_path_type(dev_path_node) != MEDIA_DEVICE_PATH) > + continue; > + > + if (dev_path_node->sub_type != MEDIA_HARDDRIVE_DP) > + continue; > + > + hd = (struct harddrive_device_path *)dev_path_node; > + > + if (hd->signature_type != SIGNATURE_TYPE_GUID) > + continue; > + > + str = malloc(sizeof("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")+1); > + sprintf(str, "%pU)", (efi_guid_t *)&(hd->signature[0])); > + break; asprintf()?
Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
signature.asc
Description: OpenPGP digital signature
_______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox