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

Re: [Xen-devel] [PATCH 2/2] tools: add new xl command get-config for getting hypervisor config



On Thu, Jan 17, 2019 at 03:57:22PM +0100, Juergen Gross wrote:
> Add   new subcommand "get-config" to xl config to print the hypervisor
> .config file.

I slight prefer get-xen-config or get-hypervisor-config.

> 
> To be able to reuse already existing decompressing code in libxenguest
> xc_inflate_buffer() has to be moved to libxenguest.h.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
[...]
>  
> +int libxl_get_config(libxl_ctx *ctx, char **buffer)
> +{
> +    int ret;
> +    unsigned long gz_size, out_size;
> +    char *gz_buffer;
> +    GC_INIT(ctx);
> +
> +    ret = xc_get_config(ctx->xch, &gz_buffer, &gz_size);
> +    if (ret < 0) {
> +        LOGEV(ERROR, ret, "getting config");
> +        GC_FREE;
> +        return ERROR_FAIL;
> +    }
> +
> +    *buffer = xc_inflate_buffer(ctx->xch, gz_buffer, gz_size, &out_size);
> +
> +    GC_FREE;

Please move this to the end of the function and ...

> +    free(gz_buffer);
> +
> +    if (!*buffer) {
> +        LOGE(ERROR, "decompressing config data failed");
> +        return ERROR_FAIL;

... use goto style instead.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.