diff mbox series

[1/3] efi_loader: Add guidcpy function

Message ID 1577202865-1215-2-git-send-email-sughosh.ganu@linaro.org
State Superseded, archived
Delegated to: Heinrich Schuchardt
Headers show
Series qemu: arm64: Add support for efi_rng_protocol | expand

Commit Message

Sughosh Ganu Dec. 24, 2019, 3:54 p.m. UTC
Add guidcpy function to copy the source guid to the destination
guid.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
---
 include/efi_loader.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Heinrich Schuchardt Dec. 24, 2019, 5:06 p.m. UTC | #1
On 12/24/19 4:54 PM, Sughosh Ganu wrote:
> Add guidcpy function to copy the source guid to the destination
> guid.
>
> Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> ---
>   include/efi_loader.h | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 16a1b25..bec7873 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -17,6 +17,11 @@ static inline int guidcmp(const void *g1, const void *g2)
>   	return memcmp(g1, g2, sizeof(efi_guid_t));
>   }
>
> +static inline void *guidcpy(efi_guid_t *dst, const efi_guid_t *src)
> +{
> +	return memcpy(dst, src, sizeof(*dst));

If we introduce this function, here are other places to use it:

lib/efi_loader/efi_boottime.c:1404:
memcpy(&item->protocol, protocol, sizeof(efi_guid_t));
lib/efi_loader/efi_boottime.c:1635:
memcpy(&systab.tables[i].guid, guid, sizeof(*guid));

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

> +}
> +
>   /* No need for efi loader support in SPL */
>   #if CONFIG_IS_ENABLED(EFI_LOADER)
>
>
Sughosh Ganu Dec. 25, 2019, 5:23 a.m. UTC | #2
On Tue, 24 Dec 2019 at 22:42, Heinrich Schuchardt <xypron.glpk@gmx.de>
wrote:

> On 12/24/19 4:54 PM, Sughosh Ganu wrote:
> > Add guidcpy function to copy the source guid to the destination
> > guid.
> >
> > Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
> > ---
> >   include/efi_loader.h | 5 +++++
> >   1 file changed, 5 insertions(+)
> >
> > diff --git a/include/efi_loader.h b/include/efi_loader.h
> > index 16a1b25..bec7873 100644
> > --- a/include/efi_loader.h
> > +++ b/include/efi_loader.h
> > @@ -17,6 +17,11 @@ static inline int guidcmp(const void *g1, const void
> *g2)
> >       return memcmp(g1, g2, sizeof(efi_guid_t));
> >   }
> >
> > +static inline void *guidcpy(efi_guid_t *dst, const efi_guid_t *src)
> > +{
> > +     return memcpy(dst, src, sizeof(*dst));
>
> If we introduce this function, here are other places to use it:
>
> lib/efi_loader/efi_boottime.c:1404:
> memcpy(&item->protocol, protocol, sizeof(efi_guid_t));
> lib/efi_loader/efi_boottime.c:1635:
> memcpy(&systab.tables[i].guid, guid, sizeof(*guid));
>

Ok. Will make changes to use guidcpy for these two instances as well in V2.

-sughosh
diff mbox series

Patch

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 16a1b25..bec7873 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -17,6 +17,11 @@  static inline int guidcmp(const void *g1, const void *g2)
 	return memcmp(g1, g2, sizeof(efi_guid_t));
 }
 
+static inline void *guidcpy(efi_guid_t *dst, const efi_guid_t *src)
+{
+	return memcpy(dst, src, sizeof(*dst));
+}
+
 /* No need for efi loader support in SPL */
 #if CONFIG_IS_ENABLED(EFI_LOADER)