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

Re: [libvirt] [PATCH V3 13/24] src/xenxs:Export code for reuse



David Kiarie wrote:
> From: Kiarie Kahurani <davidkiarie4 gmail com>
>
> wrap code tagged for resuse into onef function and export it
>   

s/onef/one/

Regards,
Jim

> signed-off-by: David Kiarie<davidkiarie4 gmail com>
> ---
>  src/xenxs/xen_xm.c | 71 ++++++++++++++++++++++++++++++++----------------------
>  src/xenxs/xen_xm.h |  2 ++
>  2 files changed, 44 insertions(+), 29 deletions(-)
>
> diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
> index b21d794..aa943ca 100644
> --- a/src/xenxs/xen_xm.c
> +++ b/src/xenxs/xen_xm.c
> @@ -1249,56 +1249,69 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
>  
>      return 0;
>  }
> -/*
> - * Turn a config record into a lump of XML describing the
> - * domain, suitable for later feeding for virDomainCreateXML
> - */
> -virDomainDefPtr
> -xenParseXM(virConfPtr conf, int xendConfigVersion,
> -           virCapsPtr caps)
> -{
> -    virDomainDefPtr def = NULL;
>  
> -    if (VIR_ALLOC(def) < 0)
> -        return NULL;
>  
> -    def->virtType = VIR_DOMAIN_VIRT_XEN;
> -    def->id = -1;
> +int
> +xenParseConfigCommon(virConfPtr conf, virDomainDefPtr def,
> +                     virCapsPtr caps, int xendConfigVersion)
> +{
>  
>      if (xenParseXMGeneralMeta(conf, def, caps) < 0)
> -        goto cleanup;
> +        return -1;
>  
>      if (xenParseXMOS(conf, def) < 0)
> -        goto cleanup;
> +        return -1;
>  
>      if (xenParseXMMem(conf, def) < 0)
> -        goto cleanup;
> +        return -1;
> +
> +    if (xenParseXMTimeOffset(conf, def, xendConfigVersion) < 0)
> +        return -1;
>  
>      if (xenParseXMEventsActions(conf, def) < 0)
> -        goto cleanup;
> +        return -1;
> +
> +    if (xenParseXMPCI(conf, def) < 0)
> +        return -1;
>  
>      if (xenParseXMCPUFeatures(conf, def) < 0)
> -        goto cleanup;
> +        return -1;
>  
> -    if (xenParseXMTimeOffset(conf, def, xendConfigVersion) < 0)
> -        goto cleanup;
> +    if (xenParseXMEmulatedDevices(conf, def) < 0)
> +        return -1;
>  
> -    if (xenParseXMDisk(conf, def, xendConfigVersion) < 0)
> -        goto cleanup;
> +    if (xenParseXMCharDev(conf, def) < 0)
> +        return -1;
> +
> +    if (xenParseXMVfb(conf, def, xendConfigVersion) < 0)
> +        return -1;
>  
>      if (xenParseXMVif(conf, def) < 0)
> -        goto cleanup;
> +        return -1;
>  
> -    if (xenParseXMPCI(conf, def) < 0)
> -        goto cleanup;
> +    return 0;
> +}
>  
> -    if (xenParseXMEmulatedDevices(conf, def) < 0)
> -        goto cleanup;
> +/*
> + * Turn a config record into a lump of XML describing the
> + * domain, suitable for later feeding for virDomainCreateXML
> + */
> +virDomainDefPtr
> +xenParseXM(virConfPtr conf, int xendConfigVersion,
> +           virCapsPtr caps)
> +{
> +    virDomainDefPtr def = NULL;
>  
> -    if (xenParseXMVfb(conf, def, xendConfigVersion) < 0)
> +    if (VIR_ALLOC(def) < 0)
> +        return NULL;
> +
> +    def->virtType = VIR_DOMAIN_VIRT_XEN;
> +    def->id = -1;
> +
> +    if (xenParseConfigCommon(conf, def, caps, xendConfigVersion) < 0)
>          goto cleanup;
>  
> -    if (xenParseXMCharDev(conf, def) < 0)
> +    if (xenParseXMDisk(conf, def, xendConfigVersion) < 0)
>          goto cleanup;
>  
>      return def;
> diff --git a/src/xenxs/xen_xm.h b/src/xenxs/xen_xm.h
> index 629a4b3..5292396 100644
> --- a/src/xenxs/xen_xm.h
> +++ b/src/xenxs/xen_xm.h
> @@ -35,5 +35,7 @@ virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def,
>  
>  virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion,
>                             virCapsPtr caps);
> +int xenParseConfigCommon(virConfPtr conf, virDomainDefPtr def, 
> +                         virCapsPtr caps, int xendConfigVersion);
>  
>  #endif /* __VIR_XEN_XM_H__ */
>   


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