Re: [RFC PATCH 03/11] conf: nodedev: Split virNodeDeviceDefFormat into more functions

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

 



On Wed, Mar 29, 2017 at 14:51:13 +0200, Erik Skultety wrote:
> Make the code look cleaner by moving the capability specific bits into
> separate functions.
> 
> Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
> ---
>  src/conf/node_device_conf.c | 578 ++++++++++++++++++++++++--------------------
>  1 file changed, 322 insertions(+), 256 deletions(-)
> 
> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index 7d0baa9d1a..72fb9a5611 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -155,6 +155,320 @@ virPCIEDeviceInfoFormat(virBufferPtr buf,
>  }
>  
>  
> +static void
> +virNodeDeviceCapSystemDefFormat(virBufferPtr buf,
> +                                const virNodeDevCapData *data)
> +{
> +    char uuidstr[VIR_UUID_STRING_BUFLEN];
> +
> +    if (data->system.product_name)
> +        virBufferEscapeString(buf, "<product>%s</product>\n",
> +                              data->system.product_name);
> +    virBufferAddLit(buf, "<hardware>\n");
> +    virBufferAdjustIndent(buf, 2);
> +    if (data->system.hardware.vendor_name)
> +        virBufferEscapeString(buf, "<vendor>%s</vendor>\n",
> +                              data->system.hardware.vendor_name);
> +    if (data->system.hardware.version)
> +        virBufferEscapeString(buf, "<version>%s</version>\n",
> +                              data->system.hardware.version);

virBufferEscapeString automatically skips formatting of the whole string
if the argument is NULL. So the condition is not necessary.

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