[libvirt] [PATCH V5 10/12] src/xenxs: Refactor code formating Vfb config

Jim Fehlig jfehlig at suse.com
Thu Aug 14 17:05:27 UTC 2014


Kiarie Kahurani wrote:
> introduce function
>    xenFormatXMVfb(virConfPtr conf,.........);
> which formats Vfb config instead
>   

Continuing my review from yesterday...

> Signed-off-by: Kiarie Kahurani <davidkiarie4 at gmail.com>
> ---
>  src/xenxs/xen_xm.c | 171 ++++++++++++++++++++++++++++++-----------------------
>  1 file changed, 97 insertions(+), 74 deletions(-)
>
> diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
> index 9edfbbb..4795644 100644
> --- a/src/xenxs/xen_xm.c
> +++ b/src/xenxs/xen_xm.c
> @@ -2102,108 +2102,65 @@ xenFormatXMOS(virConfPtr conf, virDomainDefPtr def,
>  
>      return 0;
>  }
> -/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
> -   either 32, or 64 on a platform where long is big enough.  */
> -verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
> -
> -virConfPtr
> -xenFormatXM(virConnectPtr conn,
> -            virDomainDefPtr def,
> -            int xendConfigVersion)
> -{
> -    virConfPtr conf = NULL;
> -    int hvm = 0;
> -    size_t i;
> -    virConfValuePtr netVal = NULL;
> -
> -    if (!(conf = virConfNew()))
> -        goto cleanup;
> -
> -    if (xenFormatXMGeneralMeta(conf, def) < 0)
> -        goto cleanup;
> -
> -    if (xenFormatXMMem(conf, def) < 0)
> -        goto cleanup;
> -
> -    if (xenFormatXMCPUFeatures(conf, def, xendConfigVersion) < 0)
> -        goto cleanup;
> -
> -    hvm = STREQ(def->os.type, "hvm");
>  
> -    if (xenFormatXMOS(conf, def, xendConfigVersion) < 0)
> -        goto cleanup;
> -
> -    if (xenFormatXMTimeOffset(conf, def, xendConfigVersion) < 0)
> -        goto cleanup;
>  
> -    if (xenFormatXMEventActions(conf, def) < 0)
> -        goto cleanup;
> -
> -    if (hvm) {
> -        for (i = 0; i < def->ninputs; i++) {
> -            if (def->inputs[i]->bus == VIR_DOMAIN_INPUT_BUS_USB) {
> -                if (xenXMConfigSetInt(conf, "usb", 1) < 0)
> -                    goto cleanup;
> -                switch (def->inputs[i]->type) {
> -                    case VIR_DOMAIN_INPUT_TYPE_MOUSE:
> -                        if (xenXMConfigSetString(conf, "usbdevice", "mouse") < 0)
> -                            goto cleanup;
> -                        break;
> -                    case VIR_DOMAIN_INPUT_TYPE_TABLET:
> -                        if (xenXMConfigSetString(conf, "usbdevice", "tablet") < 0)
> -                            goto cleanup;
> -                        break;
> -                    case VIR_DOMAIN_INPUT_TYPE_KBD:
> -                        if (xenXMConfigSetString(conf, "usbdevice", "keyboard") < 0)
> -                            goto cleanup;
> -                        break;
> -                }
> -                break;
> -            }
> -        }
> -    }
> +static int
> +xenFormatXMVfb(virConfPtr conf, virDomainDefPtr def,
> +               int xendConfigVersion)
>   

Previously mentioned style nit. Will fix before pushing. Otherwise ACK.

Regards,
Jim




More information about the libvir-list mailing list