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

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

 




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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>

John

--
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