---
src/cpu/cpu.c | 22 +++++++++----------
src/cpu/cpu.h | 51 ++++++++++++++++++++++----------------------
src/cpu/cpu_arm.c | 8 +++----
src/cpu/cpu_powerpc.c | 8 +++----
src/cpu/cpu_s390.c | 8 +++----
src/cpu/cpu_x86.c | 30 +++++++++++++-------------
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_command.c | 4 ++--
src/vmware/vmware_conf.c | 2 +-
tests/cputest.c | 4 ++--
10 files changed, 70 insertions(+), 69 deletions(-)
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index f3bc76f..a2d797d 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -130,7 +130,7 @@ cpuCompare(virCPUDefPtr host,
int
cpuDecode(virCPUDefPtr cpu,
- const union cpuData *data,
+ const virCPUDataPtr data,
const char **models,
unsigned int nmodels,
const char *preferred)
@@ -174,12 +174,12 @@ cpuDecode(virCPUDefPtr cpu,
int
cpuEncode(virArch arch,
const virCPUDefPtr cpu,
- union cpuData **forced,
- union cpuData **required,
- union cpuData **optional,
- union cpuData **disabled,
- union cpuData **forbidden,
- union cpuData **vendor)
+ virCPUDataPtr *forced,
+ virCPUDataPtr *required,
+ virCPUDataPtr *optional,
+ virCPUDataPtr *disabled,
+ virCPUDataPtr *forbidden,
+ virCPUDataPtr *vendor)
{
struct cpuArchDriver *driver;
@@ -205,7 +205,7 @@ cpuEncode(virArch arch,
void
cpuDataFree(virArch arch,
- union cpuData *data)
+ virCPUDataPtr data)
{
struct cpuArchDriver *driver;
@@ -228,7 +228,7 @@ cpuDataFree(virArch arch,
}
-union cpuData *
+virCPUDataPtr
cpuNodeData(virArch arch)
{
struct cpuArchDriver *driver;
@@ -252,7 +252,7 @@ cpuNodeData(virArch arch)
virCPUCompareResult
cpuGuestData(virCPUDefPtr host,
virCPUDefPtr guest,
- union cpuData **data,
+ virCPUDataPtr *data,
char **msg)
{
struct cpuArchDriver *driver;
@@ -420,7 +420,7 @@ cpuUpdate(virCPUDefPtr guest,
int
cpuHasFeature(virArch arch,
- const union cpuData *data,
+ const virCPUDataPtr data,
const char *feature)
{
struct cpuArchDriver *driver;
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index b2c02db..1c67489 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -32,11 +32,12 @@
# include "cpu_ppc_data.h"
-union cpuData {
+typedef union _virCPUData virCPUData;
+typedef virCPUData *virCPUDataPtr;
+union _virCPUData {
struct cpuX86Data *x86;
- /* generic driver needs no data */
- /* PowerPC driver need data*/
struct cpuPPCData ppc;
+ /* generic driver needs no data */
};
@@ -46,30 +47,30 @@ typedef virCPUCompareResult
typedef int
(*cpuArchDecode) (virCPUDefPtr cpu,
- const union cpuData *data,
+ const virCPUDataPtr data,
const char **models,
unsigned int nmodels,
const char *preferred);
typedef int
(*cpuArchEncode) (const virCPUDefPtr cpu,
- union cpuData **forced,
- union cpuData **required,
- union cpuData **optional,
- union cpuData **disabled,
- union cpuData **forbidden,
- union cpuData **vendor);
+ virCPUDataPtr *forced,
+ virCPUDataPtr *required,
+ virCPUDataPtr *optional,
+ virCPUDataPtr *disabled,
+ virCPUDataPtr *forbidden,
+ virCPUDataPtr *vendor);
typedef void
-(*cpuArchDataFree) (union cpuData *data);
+(*cpuArchDataFree) (virCPUDataPtr data);
-typedef union cpuData *
+typedef virCPUDataPtr
(*cpuArchNodeData) (void);
typedef virCPUCompareResult
(*cpuArchGuestData) (virCPUDefPtr host,
virCPUDefPtr guest,
- union cpuData **data,
+ virCPUDataPtr *data,
char **message);
typedef virCPUDefPtr
@@ -83,7 +84,7 @@ typedef int
const virCPUDefPtr host);
typedef int
-(*cpuArchHasFeature) (const union cpuData *data,
+(*cpuArchHasFeature) (const virCPUDataPtr data,
const char *feature);
@@ -113,7 +114,7 @@ cpuCompare (virCPUDefPtr host,
extern int
cpuDecode (virCPUDefPtr cpu,
- const union cpuData *data,
+ const virCPUDataPtr data,
const char **models,
unsigned int nmodels,
const char *preferred);
@@ -121,24 +122,24 @@ cpuDecode (virCPUDefPtr cpu,
extern int
cpuEncode (virArch arch,
const virCPUDefPtr cpu,
- union cpuData **forced,
- union cpuData **required,
- union cpuData **optional,
- union cpuData **disabled,
- union cpuData **forbidden,
- union cpuData **vendor);
+ virCPUDataPtr *forced,
+ virCPUDataPtr *required,
+ virCPUDataPtr *optional,
+ virCPUDataPtr *disabled,
+ virCPUDataPtr *forbidden,
+ virCPUDataPtr *vendor);
extern void
cpuDataFree (virArch arch,
- union cpuData *data);
+ virCPUDataPtr data);
-extern union cpuData *
+extern virCPUDataPtr
cpuNodeData (virArch arch);
extern virCPUCompareResult
cpuGuestData(virCPUDefPtr host,
virCPUDefPtr guest,
- union cpuData **data,
+ virCPUDataPtr *data,
char **msg);
extern char *
@@ -159,7 +160,7 @@ cpuUpdate (virCPUDefPtr guest,
extern int
cpuHasFeature(virArch arch,
- const union cpuData *data,
+ const virCPUDataPtr data,
const char *feature);
diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c
index 0748267..25e25ba 100644
--- a/src/cpu/cpu_arm.c
+++ b/src/cpu/cpu_arm.c
@@ -30,10 +30,10 @@
static const virArch archs[] = { VIR_ARCH_ARMV7L };
-static union cpuData *
+static virCPUDataPtr
ArmNodeData(void)
{
- union cpuData *data;
+ virCPUDataPtr data;
ignore_value(VIR_ALLOC(data));
return data;
@@ -41,7 +41,7 @@ ArmNodeData(void)
static int
ArmDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
- const union cpuData *data ATTRIBUTE_UNUSED,
+ const virCPUDataPtr data ATTRIBUTE_UNUSED,
const char **models ATTRIBUTE_UNUSED,
unsigned int nmodels ATTRIBUTE_UNUSED,
const char *preferred ATTRIBUTE_UNUSED)
@@ -50,7 +50,7 @@ ArmDecode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
}
static void
-ArmDataFree(union cpuData *data)
+ArmDataFree(virCPUDataPtr data)
{
VIR_FREE(data);
}
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 8bac133..0d319f4 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -301,7 +301,7 @@ ppcCompare(virCPUDefPtr host,
static int
ppcDecode(virCPUDefPtr cpu,
- const union cpuData *data,
+ const virCPUDataPtr data,
const char **models,
unsigned int nmodels,
const char *preferred ATTRIBUTE_UNUSED)
@@ -342,7 +342,7 @@ cleanup:
static void
-ppcDataFree(union cpuData *data)
+ppcDataFree(virCPUDataPtr data)
{
if (data == NULL)
return;
@@ -351,10 +351,10 @@ ppcDataFree(union cpuData *data)
}
#if defined(__powerpc__) || defined(__powerpc64__)
-static union cpuData *
+static virCPUDataPtr
ppcNodeData(void)
{
- union cpuData *data;
+ virCPUDataPtr data;
if (VIR_ALLOC(data) < 0)
return NULL;
diff --git a/src/cpu/cpu_s390.c b/src/cpu/cpu_s390.c
index 0d578a4..cbfae42 100644
--- a/src/cpu/cpu_s390.c
+++ b/src/cpu/cpu_s390.c
@@ -31,10 +31,10 @@
static const virArch archs[] = { VIR_ARCH_S390, VIR_ARCH_S390X };
-static union cpuData *
+static virCPUDataPtr
s390NodeData(void)
{
- union cpuData *data;
+ virCPUDataPtr data;
if (VIR_ALLOC(data) < 0)
return NULL;
@@ -45,7 +45,7 @@ s390NodeData(void)
static int
s390Decode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
- const union cpuData *data ATTRIBUTE_UNUSED,
+ const virCPUDataPtr data ATTRIBUTE_UNUSED,
const char **models ATTRIBUTE_UNUSED,
unsigned int nmodels ATTRIBUTE_UNUSED,
const char *preferred ATTRIBUTE_UNUSED)
@@ -54,7 +54,7 @@ s390Decode(virCPUDefPtr cpu ATTRIBUTE_UNUSED,
}
static void
-s390DataFree(union cpuData *data)
+s390DataFree(virCPUDataPtr data)
{
VIR_FREE(data);
}
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index c6e78c5..75ad647 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -215,10 +215,10 @@ x86DataFree(struct cpuX86Data *data)
}
-static union cpuData *
+static virCPUDataPtr
x86MakeCPUData(struct cpuX86Data **data)
{
- union cpuData *cpuData;
+ virCPUDataPtr cpuData;
if (VIR_ALLOC(cpuData) < 0)
return NULL;
@@ -230,7 +230,7 @@ x86MakeCPUData(struct cpuX86Data **data)
}
static void
-x86FreeCPUData(union cpuData *data)
+x86FreeCPUData(virCPUDataPtr data)
{
if (!data)
return;
@@ -1151,7 +1151,7 @@ error:
static virCPUCompareResult
x86Compute(virCPUDefPtr host,
virCPUDefPtr cpu,
- union cpuData **guest,
+ virCPUDataPtr *guest,
char **message)
{
struct x86_map *map = NULL;
@@ -1303,7 +1303,7 @@ x86Compare(virCPUDefPtr host,
static virCPUCompareResult
x86GuestData(virCPUDefPtr host,
virCPUDefPtr guest,
- union cpuData **data,
+ virCPUDataPtr *data,
char **message)
{
return x86Compute(host, guest, data, message);
@@ -1413,7 +1413,7 @@ out:
static int
x86DecodeCPUData(virCPUDefPtr cpu,
- const union cpuData *data,
+ const virCPUDataPtr data,
const char **models,
unsigned int nmodels,
const char *preferred)
@@ -1443,12 +1443,12 @@ x86EncodePolicy(const virCPUDefPtr cpu,
static int
x86Encode(const virCPUDefPtr cpu,
- union cpuData **forced,
- union cpuData **required,
- union cpuData **optional,
- union cpuData **disabled,
- union cpuData **forbidden,
- union cpuData **vendor)
+ virCPUDataPtr *forced,
+ virCPUDataPtr *required,
+ virCPUDataPtr *optional,
+ virCPUDataPtr *disabled,
+ virCPUDataPtr *forbidden,
+ virCPUDataPtr *vendor)
{
struct x86_map *map = NULL;
struct cpuX86Data *data_forced = NULL;
@@ -1628,10 +1628,10 @@ cpuidSet(uint32_t base, struct cpuX86cpuid **set)
}
-static union cpuData *
+static virCPUDataPtr
x86NodeData(void)
{
- union cpuData *cpuData = NULL;
+ virCPUDataPtr cpuData = NULL;
struct cpuX86Data *data;
int ret;
@@ -1872,7 +1872,7 @@ x86Update(virCPUDefPtr guest,
return -1;
}
-static int x86HasFeature(const union cpuData *data,
+static int x86HasFeature(const virCPUDataPtr data,
const char *name)
{
struct x86_map *map;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 16a3664..8d40f25 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -832,7 +832,7 @@ virQEMUCapsInitCPU(virCapsPtr caps,
virArch arch)
{
virCPUDefPtr cpu = NULL;
- union cpuData *data = NULL;
+ virCPUDataPtr data = NULL;
virNodeInfo nodeinfo;
int ret = -1;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8c58a7c..30b7bc0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5648,7 +5648,7 @@ qemuBuildCpuArgStr(const virQEMUDriverPtr driver,
size_t ncpus = 0;
char **cpus = NULL;
const char *default_model;
- union cpuData *data = NULL;
+ virCPUDataPtr data = NULL;
bool have_cpu = false;
char *compare_msg = NULL;
int ret = -1;
@@ -9902,7 +9902,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
if (dom->os.arch == VIR_ARCH_X86_64) {
bool is_32bit = false;
if (cpu) {
- union cpuData *cpuData = NULL;
+ virCPUDataPtr cpuData = NULL;
if (cpuEncode(VIR_ARCH_X86_64, cpu, NULL, &cpuData,
NULL, NULL, NULL, NULL) < 0)
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index ed99e59..bb88899 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -56,7 +56,7 @@ vmwareCapsInit(void)
virCapsPtr caps = NULL;
virCapsGuestPtr guest = NULL;
virCPUDefPtr cpu = NULL;
- union cpuData *data = NULL;
+ virCPUDataPtr data = NULL;
if ((caps = virCapabilitiesNew(virArchFromHost(),
0, 0)) == NULL)
diff --git a/tests/cputest.c b/tests/cputest.c
index d08550d..6708bcf 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -261,7 +261,7 @@ cpuTestGuestData(const void *arg)
virCPUDefPtr host = NULL;
virCPUDefPtr cpu = NULL;
virCPUDefPtr guest = NULL;
- union cpuData *guestData = NULL;
+ virCPUDataPtr guestData = NULL;
virCPUCompareResult cmpResult;
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *result = NULL;
@@ -417,7 +417,7 @@ cpuTestHasFeature(const void *arg)
const struct data *data = arg;
int ret = -1;
virCPUDefPtr host = NULL;
- union cpuData *hostData = NULL;
+ virCPUDataPtr hostData = NULL;
int result;
if (!(host = cpuTestLoadXML(data->arch, data->host)))
--
1.8.3.2