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

Re: [libvirt] [PATCH 09/23] qemu_conf: split out virQEMUDriverConfigLoadNVRAMEntry




On 1/15/19 8:23 AM, Ján Tomko wrote:
> Split out parts of the config parsing code to make
> the parent function easier to read.
> 
> Signed-off-by: Ján Tomko <jtomko redhat com>
> ---
>  src/qemu/qemu_conf.c | 49 +++++++++++++++++++++++++++++---------------
>  1 file changed, 32 insertions(+), 17 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index ca31a222e8..29f948346d 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -423,6 +423,37 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
>  }
>  
>  
> +static int
> +virQEMUDriverConfigLoadNVRAMEntry(virQEMUDriverConfigPtr cfg,
> +                                  virConfPtr conf)
> +{
> +    char **nvram = NULL;

VIR_AUTOPTR(virString)

> +    int ret = -1;
> +    size_t i;
> +
> +    if (virConfGetValueStringList(conf, "nvram", false, &nvram) < 0)
> +        goto cleanup;
> +    if (nvram) {
> +        virFirmwareFreeList(cfg->firmwares, cfg->nfirmwares);
> +
> +        cfg->nfirmwares = virStringListLength((const char *const *)nvram);
> +        if (nvram[0] && VIR_ALLOC_N(cfg->firmwares, cfg->nfirmwares) < 0)
> +            goto cleanup;
> +
> +        for (i = 0; nvram[i] != NULL; i++) {
> +            if (VIR_ALLOC(cfg->firmwares[i]) < 0)
> +                goto cleanup;
> +            if (virFirmwareParse(nvram[i], cfg->firmwares[i]) < 0)
> +                goto cleanup;
> +        }
> +    }
> +
> +    ret = 0;
> + cleanup:
> +    virStringListFree(nvram);
> +    return ret;
> +}
> +

blank line

Reviewed-by: John Ferlan <jferlan redhat com>

John


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