[libvirt] [PATCH 2/7] cpu: Export few x86-specific APIs

Daniel P. Berrange berrange at redhat.com
Tue Jul 23 16:30:17 UTC 2013


On Tue, Jul 23, 2013 at 06:11:31PM +0200, Jiri Denemark wrote:

This is adding a new function as well as exporting some
existing functions, so should probably be split in two.

> ---
>  src/cpu/cpu_x86.c        | 21 ++++++++++++++++++---
>  src/cpu/cpu_x86.h        | 10 ++++++++++
>  src/libvirt_private.syms |  7 +++++++
>  3 files changed, 35 insertions(+), 3 deletions(-)
> 
> diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
> index 560a2a9..dbbcfd2 100644
> --- a/src/cpu/cpu_x86.c
> +++ b/src/cpu/cpu_x86.c
> @@ -203,7 +203,7 @@ x86DataCpuid(const struct cpuX86Data *data,
>  }
>  
>  
> -static void
> +void
>  x86DataFree(struct cpuX86Data *data)

These are kind of generic names to be exposing outside the file.
It would be nice to update this file to use a better naming
prefix for all its functions  "virCPUx86DataNNNNN"

>  {
>      if (data == NULL)
> @@ -215,7 +215,7 @@ x86DataFree(struct cpuX86Data *data)
>  }
>  
>  
> -static virCPUDataPtr
> +virCPUDataPtr
>  x86MakeCPUData(virArch arch, struct cpuX86Data **data)
>  {
>      virCPUDataPtr cpuData;
> @@ -295,7 +295,7 @@ x86DataExpand(struct cpuX86Data *data,
>  }
>  
>  
> -static int
> +int
>  x86DataAddCpuid(struct cpuX86Data *data,
>                  const struct cpuX86cpuid *cpuid)
>  {
> @@ -323,6 +323,21 @@ x86DataAddCpuid(struct cpuX86Data *data,
>  }
>  
>  
> +int
> +x86DataSetVendor(struct cpuX86Data *data,
> +                 const char *vendor)
> +{
> +    struct cpuX86cpuid cpuid;
> +
> +    cpuid.function = 0;
> +    cpuid.ebx = virReadBufInt32LE(vendor);
> +    cpuid.edx = virReadBufInt32LE(vendor + 4);
> +    cpuid.ecx = virReadBufInt32LE(vendor + 8);
> +
> +    return x86DataAddCpuid(data, &cpuid);
> +}
> +
> +
>  static int
>  x86DataAdd(struct cpuX86Data *data1,
>             const struct cpuX86Data *data2)
> diff --git a/src/cpu/cpu_x86.h b/src/cpu/cpu_x86.h
> index 77965b7..8235076 100644
> --- a/src/cpu/cpu_x86.h
> +++ b/src/cpu/cpu_x86.h
> @@ -25,7 +25,17 @@
>  # define __VIR_CPU_X86_H__
>  
>  # include "cpu.h"
> +# include "cpu_x86_data.h"
>  
>  extern struct cpuArchDriver cpuDriverX86;
>  
> +int x86DataAddCpuid(struct cpuX86Data *data,
> +                    const struct cpuX86cpuid *cpuid);
> +int x86DataSetVendor(struct cpuX86Data *data,
> +                     const char *vendor);
> +
> +void x86DataFree(struct cpuX86Data *data);
> +
> +virCPUDataPtr x86MakeCPUData(virArch arch, struct cpuX86Data **data);
> +
>  #endif /* __VIR_CPU_X86_H__ */
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index e0f3876..7fe2bc0 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -724,6 +724,13 @@ cpuNodeData;
>  cpuUpdate;
>  
>  
> +# cpu/cpu_x86.h
> +x86DataAddCpuid;
> +x86DataFree;
> +x86DataSetVendor;
> +x86MakeCPUData;
> +
> +
>  # datatypes.h
>  virConnectClass;
>  virDomainClass;

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list