Re: [PATCH 12/18] cpu: Align ppc64 CPU data with x86

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

 



On Tue, Aug 04, 2015 at 11:38:03 +0200, Andrea Bolognani wrote:
> Use a typedef instead of the plain struct and heap allocation. This
> will make it easier to extend the ppc64 specific CPU data later on.
> ---
>  src/cpu/cpu.h            |  2 +-
>  src/cpu/cpu_ppc64.c      | 81 ++++++++++++++++++++++++++++++++++++++----------
>  src/cpu/cpu_ppc64_data.h |  3 +-
>  3 files changed, 67 insertions(+), 19 deletions(-)
> 
> diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
> index 49d4226..7375876 100644
> --- a/src/cpu/cpu.h
> +++ b/src/cpu/cpu.h
> @@ -38,7 +38,7 @@ struct _virCPUData {
>      virArch arch;
>      union {
>          virCPUx86Data *x86;
> -        struct cpuPPC64Data ppc64;
> +        virCPUppc64Data *ppc64;
>          /* generic driver needs no data */
>      } data;
>  };
> diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
> index 4428a55..d186d4c 100644
> --- a/src/cpu/cpu_ppc64.c
> +++ b/src/cpu/cpu_ppc64.c
> @@ -48,7 +48,7 @@ struct ppc64_vendor {
>  struct ppc64_model {
>      char *name;
>      const struct ppc64_vendor *vendor;
> -    struct cpuPPC64Data data;
> +    virCPUppc64Data *data;
>      struct ppc64_model *next;
>  };
>  
> @@ -58,6 +58,31 @@ struct ppc64_map {
>  };
>  
>  static void
> +ppc64DataFree(virCPUppc64Data *data)
> +{
> +    if (!data)
> +        return;

This is redundant unless you want to add more fields in the structure
which will need to be freed here.

> +
> +    VIR_FREE(data);
> +}
...

ACK

Jirka

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