提交 57d52b24 编写于 作者: J Jiri Denemark

Replace union cpuData with virCPUData

上级 d87ca6ef
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -832,7 +832,7 @@ virQEMUCapsInitCPU(virCapsPtr caps,
virArch arch)
{
virCPUDefPtr cpu = NULL;
union cpuData *data = NULL;
virCPUDataPtr data = NULL;
virNodeInfo nodeinfo;
int ret = -1;
......
......@@ -5640,7 +5640,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;
......@@ -9894,7 +9894,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)
......
......@@ -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)
......
......@@ -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)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册