[libvirt] [PATCH 3/9] Split out virDomainIOMMUDefFormat

Ján Tomko posted 9 patches 8 years, 10 months ago
[libvirt] [PATCH 3/9] Split out virDomainIOMMUDefFormat
Posted by Ján Tomko 8 years, 10 months ago
Make adding subelements easier.
---
 src/conf/domain_conf.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ffc6a68..1245fdd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23842,6 +23842,15 @@ virDomainDefIothreadShouldFormat(virDomainDefPtr def)
 }
 
 
+static void
+virDomainIOMMUDefFormat(virBufferPtr buf,
+                        virDomainIOMMUDefPtr iommu)
+{
+    virBufferAsprintf(buf, "<iommu model='%s'/>\n",
+                      virDomainIOMMUModelTypeToString(iommu->model));
+}
+
+
 /* This internal version appends to an existing buffer
  * (possibly with auto-indent), rather than flattening
  * to string.
@@ -24595,10 +24604,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
             goto error;
     }
 
-    if (def->iommu) {
-        virBufferAsprintf(buf, "<iommu model='%s'/>\n",
-                          virDomainIOMMUModelTypeToString(def->iommu->model));
-    }
+    if (def->iommu)
+        virDomainIOMMUDefFormat(buf, def->iommu);
 
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</devices>\n");
-- 
2.10.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 3/9] Split out virDomainIOMMUDefFormat
Posted by John Ferlan 8 years, 10 months ago

On 03/23/2017 11:26 AM, Ján Tomko wrote:
> Make adding subelements easier.

No bz reference here

> ---
>  src/conf/domain_conf.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index ffc6a68..1245fdd 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -23842,6 +23842,15 @@ virDomainDefIothreadShouldFormat(virDomainDefPtr def)
>  }
>  
>  
> +static void
> +virDomainIOMMUDefFormat(virBufferPtr buf,
> +                        virDomainIOMMUDefPtr iommu)

Could also use const virDomainIOMMUDef *iommu here I think

ACK regardless,

John

> +{
> +    virBufferAsprintf(buf, "<iommu model='%s'/>\n",
> +                      virDomainIOMMUModelTypeToString(iommu->model));
> +}
> +
> +
>  /* This internal version appends to an existing buffer
>   * (possibly with auto-indent), rather than flattening
>   * to string.
> @@ -24595,10 +24604,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
>              goto error;
>      }
>  
> -    if (def->iommu) {
> -        virBufferAsprintf(buf, "<iommu model='%s'/>\n",
> -                          virDomainIOMMUModelTypeToString(def->iommu->model));
> -    }
> +    if (def->iommu)
> +        virDomainIOMMUDefFormat(buf, def->iommu);
>  
>      virBufferAdjustIndent(buf, -2);
>      virBufferAddLit(buf, "</devices>\n");
> 

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