Re: [PATCH v8 07/14] conf: use virXMLFormatElement() in virDomainDeviceInfoFormat()

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

 




On 11/8/18 6:00 AM, Yi Min Zhao wrote:
> In order to add zPCI child element for PCI address, we update
> virDomainDeviceInfoFormat() to format device info by helper function
> virXMLFormatElement(). Then we could simply format zPCI address into
> child buffer later.
> 
> Signed-off-by: Yi Min Zhao <zyimin@xxxxxxxxxxxxx>
> Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx>
> Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 40 ++++++++++++++++++++++------------------
>  1 file changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 237540bccc..3e89659d3e 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -6428,6 +6428,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
>                            virDomainDeviceInfoPtr info,
>                            unsigned int flags)

[...]

> @@ -6556,7 +6558,9 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
>          break;
>      }
>  
> -    virBufferAddLit(buf, "/>\n");
> +    virXMLFormatElement(buf, "address", &attrBuf, NULL);

Coverity complains this morning that this doesn't check the status of
the call to virXMLFormatElement like is done for other callers in this
module.

Still since @buf will eventually be checked for error via a
virBufferCheckError and because this is a void function with *numerous*
callers, perhaps it'd just be easist to wrap it with a ignore_value. It
just delays when the error is checked - some paths don't check until the
virBufferCheckError in virDomainDefFormatInternal.

Alternatively virDomainDeviceInfoFormat could be turned into a non void
function and all callers handle it's failure.  I'll assume there's
varying opinions on either option. I'd probably opt for the change to
int return, but that's more changes...

John

> +
> +    virBufferFreeAndReset(&attrBuf);
>  }
>  
>  static int
> 

--
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