On 08/04/2017 09:31 PM, Rob Clark wrote:
> There are a couple places where we'll need GUID -> string.  So add a
> helper.
> 
> Signed-off-by: Rob Clark <robdcl...@gmail.com>
> ---
>  include/efi_loader.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 1028bfb75d..e6c46f713e 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -239,6 +239,21 @@ static inline int guidcmp(const efi_guid_t *g1, const 
> efi_guid_t *g2)
>       return memcmp(g1, g2, sizeof(efi_guid_t));
>  }
>  
> +static inline int guidstr(char *s, const efi_guid_t *g)
> +{
> +     /* unpacked-guid, otherwise we have to have to consider endianess */
> +     struct {
> +             uint32_t data1;
> +             uint16_t data2;
> +             uint16_t data3;
> +             uint8_t  data4[8];
> +     } *ug = (void *)g;
> +     return sprintf(s, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
> +                    ug->data1, ug->data2, ug->data3, ug->data4[0],
> +                    ug->data4[1], ug->data4[2], ug->data4[3], ug->data4[4],
> +                    ug->data4[5], ug->data4[6], ug->data4[7]);
> +}
> +
>  /*
>   * Use these to indicate that your code / data should go into the EFI runtime
>   * section and thus still be available when the OS is running
> 


You may want to have a look at these:

include/uuid.h:40
int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin);

int uuid_guid_get_str(unsigned char *guid_bin, char *guid_str);

With a conversion to uchar* you should be able to use uuid_guid_get_str
for your purposes. So this patch could be eliminated from the series.

Regards

Heinrich
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to