Re: [libvirt PATCH v3 03/13] ch_domain: add methods to manage private vcpu data

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

 



On 12/10/21 21:34, Praveen K Paladugu wrote:
> From: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
> 
> Signed-off-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx>
> ---
>  src/ch/ch_domain.c | 50 +++++++++++++++++++++++++++++++++++++++++-----
>  src/ch/ch_domain.h | 11 ++++++++++
>  2 files changed, 56 insertions(+), 5 deletions(-)
> 
> diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c
> index bf4ce83595..36333a8a3f 100644
> --- a/src/ch/ch_domain.c
> +++ b/src/ch/ch_domain.c
> @@ -164,11 +164,6 @@ virCHDomainObjPrivateFree(void *data)
>      g_free(priv);
>  }
>  
> -virDomainXMLPrivateDataCallbacks virCHDriverPrivateDataCallbacks = {
> -    .alloc = virCHDomainObjPrivateAlloc,
> -    .free = virCHDomainObjPrivateFree,
> -};
> -
>  static int
>  virCHDomainDefPostParseBasic(virDomainDef *def,
>                               void *opaque G_GNUC_UNUSED)
> @@ -185,6 +180,45 @@ virCHDomainDefPostParseBasic(virDomainDef *def,
>      return 0;
>  }
>  
> +static virClass *virCHDomainVcpuPrivateClass;
> +static void virCHDomainVcpuPrivateDispose(void *obj);

This forward declaration could be replaced with the actual implementation.

> +
> +static int
> +virCHDomainVcpuPrivateOnceInit(void)
> +{
> +    if (!VIR_CLASS_NEW(virCHDomainVcpuPrivate, virClassForObject()))
> +        return -1;
> +
> +    return 0;
> +}
> +
> +VIR_ONCE_GLOBAL_INIT(virCHDomainVcpuPrivate);
> +
> +static virObject *
> +virCHDomainVcpuPrivateNew(void)
> +{
> +    virCHDomainVcpuPrivate *priv;
> +
> +    if (virCHDomainVcpuPrivateInitialize() < 0)
> +        return NULL;
> +
> +    if (!(priv = virObjectNew(virCHDomainVcpuPrivateClass)))
> +        return NULL;
> +
> +    return (virObject *) priv;
> +}
> +
> +
> +static void
> +virCHDomainVcpuPrivateDispose(void *obj)
> +{
> +    virCHDomainVcpuPrivate *priv = obj;
> +
> +    priv->tid = 0;
> +
> +    return;

This is basically a NOP. Nothing here deallocates any memory and
clearing our memory to zero is needless.

> +}

Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

Michal




[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