Re: [PATCH v1 08/31] virpci: Introduce virPCIDeviceAddressCopy

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

 



On Thu, Jul 11, 2019 at 17:53:55 +0200, Michal Privoznik wrote:
> This helper is cleaner than plain memcpy() because one doesn't
> have to look into virPCIDeviceAddress struct to see if it
> contains any strings / pointers.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/libvirt_private.syms | 1 +
>  src/util/virpci.c        | 6 ++++++
>  src/util/virpci.h        | 2 ++
>  3 files changed, 9 insertions(+)

[...]

> diff --git a/src/util/virpci.c b/src/util/virpci.c
> index 59f478dd41..03ce651f40 100644
> --- a/src/util/virpci.c
> +++ b/src/util/virpci.c
> @@ -1730,6 +1730,12 @@ virPCIDeviceAddressEqual(const virPCIDeviceAddress *addr1,
>      return false;
>  }
>  

Please add a comment stating that this is a deep copy and also note with
the definitions of 'struct _virZPCIDeviceAddress' and
'struct _virPCIDeviceAddress' that there is a deep-copy function which
needs to be fixed when adding new members.

> +void virPCIDeviceAddressCopy(virPCIDeviceAddressPtr dst,
> +                             const virPCIDeviceAddress *src)
> +{
> +    memcpy(dst, src, sizeof(*src));
> +}
> +
>  char *
>  virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
>  {

ACK with the above addressed.

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux