[libvirt] [PATCH] conf: Copy loadparm in virDomainDeviceInfoCopy()

Andrea Bolognani posted 1 patch 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1498497208-2287-1-git-send-email-abologna@redhat.com
src/conf/domain_conf.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
[libvirt] [PATCH] conf: Copy loadparm in virDomainDeviceInfoCopy()
Posted by Andrea Bolognani 6 years, 9 months ago
Commit 54fa1b44afc8 added virDomainDeviceInfo::loadparm
and updated virDomainDeviceInfoClear() accordingly, but
omitted the necessary virDomainDeviceInfoCopy() changes.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/conf/domain_conf.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e5595d7..8fabb89 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3812,12 +3812,14 @@ virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
     /* first a shallow copy of *everything* */
     *dst = *src;
 
-    /* then redo the two fields that are pointers */
+    /* then copy whatever's left */
     dst->alias = NULL;
     dst->romfile = NULL;
+    dst->loadparm = NULL;
 
     if (VIR_STRDUP(dst->alias, src->alias) < 0 ||
-        VIR_STRDUP(dst->romfile, src->romfile) < 0)
+        VIR_STRDUP(dst->romfile, src->romfile) < 0 ||
+        VIR_STRDUP(dst->loadparm, src->loadparm) < 0)
         return -1;
     return 0;
 }
-- 
2.7.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: Copy loadparm in virDomainDeviceInfoCopy()
Posted by Ján Tomko 6 years, 9 months ago
On Mon, Jun 26, 2017 at 07:13:28PM +0200, Andrea Bolognani wrote:
>Commit 54fa1b44afc8 added virDomainDeviceInfo::loadparm
>and updated virDomainDeviceInfoClear() accordingly, but
>omitted the necessary virDomainDeviceInfoCopy() changes.
>
>Signed-off-by: Andrea Bolognani <abologna@redhat.com>
>---
> src/conf/domain_conf.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>

ACK

We should probably rewrite virDomainDeviceInfo in markdown and
autogenerate the *Copy and *Clear functions by a Rust script
to avoid such mistakes in the future.

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: Copy loadparm in virDomainDeviceInfoCopy()
Posted by Andrea Bolognani 6 years, 9 months ago
On Tue, 2017-06-27 at 11:25 +0200, Ján Tomko wrote:
> We should probably rewrite virDomainDeviceInfo in markdown and
> autogenerate the *Copy and *Clear functions by a Rust script
> to avoid such mistakes in the future.

Don't forget to CC: me when you post those patches!

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: Copy loadparm in virDomainDeviceInfoCopy()
Posted by Farhan Ali 6 years, 9 months ago
Hi Andrea,

Thank you for fixing this :)

Thanks
Farhan

On 06/26/2017 01:13 PM, Andrea Bolognani wrote:
> Commit 54fa1b44afc8 added virDomainDeviceInfo::loadparm
> and updated virDomainDeviceInfoClear() accordingly, but
> omitted the necessary virDomainDeviceInfoCopy() changes.
>
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/conf/domain_conf.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e5595d7..8fabb89 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -3812,12 +3812,14 @@ virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
>      /* first a shallow copy of *everything* */
>      *dst = *src;
>
> -    /* then redo the two fields that are pointers */
> +    /* then copy whatever's left */
>      dst->alias = NULL;
>      dst->romfile = NULL;
> +    dst->loadparm = NULL;
>
>      if (VIR_STRDUP(dst->alias, src->alias) < 0 ||
> -        VIR_STRDUP(dst->romfile, src->romfile) < 0)
> +        VIR_STRDUP(dst->romfile, src->romfile) < 0 ||
> +        VIR_STRDUP(dst->loadparm, src->loadparm) < 0)
>          return -1;
>      return 0;
>  }
>

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