cpu: Rename {powerpc,ppc} => ppc64 (internal symbols)

Update the names of the symbols used internally by the driver.

No functional changes.
上级 e89733c4
...@@ -40,26 +40,26 @@ VIR_LOG_INIT("cpu.cpu_ppc64"); ...@@ -40,26 +40,26 @@ VIR_LOG_INIT("cpu.cpu_ppc64");
static const virArch archs[] = { VIR_ARCH_PPC64, VIR_ARCH_PPC64LE }; static const virArch archs[] = { VIR_ARCH_PPC64, VIR_ARCH_PPC64LE };
struct ppc_vendor { struct ppc64_vendor {
char *name; char *name;
struct ppc_vendor *next; struct ppc64_vendor *next;
}; };
struct ppc_model { struct ppc64_model {
char *name; char *name;
const struct ppc_vendor *vendor; const struct ppc64_vendor *vendor;
struct cpuPPC64Data data; struct cpuPPC64Data data;
struct ppc_model *next; struct ppc64_model *next;
}; };
struct ppc_map { struct ppc64_map {
struct ppc_vendor *vendors; struct ppc64_vendor *vendors;
struct ppc_model *models; struct ppc64_model *models;
}; };
static void static void
ppcModelFree(struct ppc_model *model) ppc64ModelFree(struct ppc64_model *model)
{ {
if (model == NULL) if (model == NULL)
return; return;
...@@ -68,11 +68,11 @@ ppcModelFree(struct ppc_model *model) ...@@ -68,11 +68,11 @@ ppcModelFree(struct ppc_model *model)
VIR_FREE(model); VIR_FREE(model);
} }
static struct ppc_model * static struct ppc64_model *
ppcModelFind(const struct ppc_map *map, ppc64ModelFind(const struct ppc64_map *map,
const char *name) const char *name)
{ {
struct ppc_model *model; struct ppc64_model *model;
model = map->models; model = map->models;
while (model != NULL) { while (model != NULL) {
...@@ -85,11 +85,11 @@ ppcModelFind(const struct ppc_map *map, ...@@ -85,11 +85,11 @@ ppcModelFind(const struct ppc_map *map,
return NULL; return NULL;
} }
static struct ppc_model * static struct ppc64_model *
ppcModelFindPVR(const struct ppc_map *map, ppc64ModelFindPVR(const struct ppc64_map *map,
uint32_t pvr) uint32_t pvr)
{ {
struct ppc_model *model; struct ppc64_model *model;
model = map->models; model = map->models;
while (model != NULL) { while (model != NULL) {
...@@ -105,19 +105,19 @@ ppcModelFindPVR(const struct ppc_map *map, ...@@ -105,19 +105,19 @@ ppcModelFindPVR(const struct ppc_map *map,
* If the exact CPU isn't found, return the nearest matching CPU generation * If the exact CPU isn't found, return the nearest matching CPU generation
*/ */
if (pvr & 0x0000FFFFul) if (pvr & 0x0000FFFFul)
return ppcModelFindPVR(map, (pvr & 0xFFFF0000ul)); return ppc64ModelFindPVR(map, (pvr & 0xFFFF0000ul));
return NULL; return NULL;
} }
static struct ppc_model * static struct ppc64_model *
ppcModelCopy(const struct ppc_model *model) ppc64ModelCopy(const struct ppc64_model *model)
{ {
struct ppc_model *copy; struct ppc64_model *copy;
if (VIR_ALLOC(copy) < 0 || if (VIR_ALLOC(copy) < 0 ||
VIR_STRDUP(copy->name, model->name) < 0) { VIR_STRDUP(copy->name, model->name) < 0) {
ppcModelFree(copy); ppc64ModelFree(copy);
return NULL; return NULL;
} }
...@@ -127,11 +127,11 @@ ppcModelCopy(const struct ppc_model *model) ...@@ -127,11 +127,11 @@ ppcModelCopy(const struct ppc_model *model)
return copy; return copy;
} }
static struct ppc_vendor * static struct ppc64_vendor *
ppcVendorFind(const struct ppc_map *map, ppc64VendorFind(const struct ppc64_map *map,
const char *name) const char *name)
{ {
struct ppc_vendor *vendor; struct ppc64_vendor *vendor;
vendor = map->vendors; vendor = map->vendors;
while (vendor) { while (vendor) {
...@@ -145,7 +145,7 @@ ppcVendorFind(const struct ppc_map *map, ...@@ -145,7 +145,7 @@ ppcVendorFind(const struct ppc_map *map,
} }
static void static void
ppcVendorFree(struct ppc_vendor *vendor) ppc64VendorFree(struct ppc64_vendor *vendor)
{ {
if (!vendor) if (!vendor)
return; return;
...@@ -154,34 +154,34 @@ ppcVendorFree(struct ppc_vendor *vendor) ...@@ -154,34 +154,34 @@ ppcVendorFree(struct ppc_vendor *vendor)
VIR_FREE(vendor); VIR_FREE(vendor);
} }
static struct ppc_model * static struct ppc64_model *
ppcModelFromCPU(const virCPUDef *cpu, ppc64ModelFromCPU(const virCPUDef *cpu,
const struct ppc_map *map) const struct ppc64_map *map)
{ {
struct ppc_model *model = NULL; struct ppc64_model *model = NULL;
if ((model = ppcModelFind(map, cpu->model)) == NULL) { if ((model = ppc64ModelFind(map, cpu->model)) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU model %s"), cpu->model); _("Unknown CPU model %s"), cpu->model);
goto error; goto error;
} }
if ((model = ppcModelCopy(model)) == NULL) if ((model = ppc64ModelCopy(model)) == NULL)
goto error; goto error;
return model; return model;
error: error:
ppcModelFree(model); ppc64ModelFree(model);
return NULL; return NULL;
} }
static int static int
ppcVendorLoad(xmlXPathContextPtr ctxt, ppc64VendorLoad(xmlXPathContextPtr ctxt,
struct ppc_map *map) struct ppc64_map *map)
{ {
struct ppc_vendor *vendor = NULL; struct ppc64_vendor *vendor = NULL;
if (VIR_ALLOC(vendor) < 0) if (VIR_ALLOC(vendor) < 0)
return -1; return -1;
...@@ -193,7 +193,7 @@ ppcVendorLoad(xmlXPathContextPtr ctxt, ...@@ -193,7 +193,7 @@ ppcVendorLoad(xmlXPathContextPtr ctxt,
goto ignore; goto ignore;
} }
if (ppcVendorFind(map, vendor->name)) { if (ppc64VendorFind(map, vendor->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU vendor %s already defined"), vendor->name); _("CPU vendor %s already defined"), vendor->name);
goto ignore; goto ignore;
...@@ -210,15 +210,15 @@ ppcVendorLoad(xmlXPathContextPtr ctxt, ...@@ -210,15 +210,15 @@ ppcVendorLoad(xmlXPathContextPtr ctxt,
return 0; return 0;
ignore: ignore:
ppcVendorFree(vendor); ppc64VendorFree(vendor);
goto cleanup; goto cleanup;
} }
static int static int
ppcModelLoad(xmlXPathContextPtr ctxt, ppc64ModelLoad(xmlXPathContextPtr ctxt,
struct ppc_map *map) struct ppc64_map *map)
{ {
struct ppc_model *model; struct ppc64_model *model;
char *vendor = NULL; char *vendor = NULL;
unsigned long pvr; unsigned long pvr;
...@@ -232,7 +232,7 @@ ppcModelLoad(xmlXPathContextPtr ctxt, ...@@ -232,7 +232,7 @@ ppcModelLoad(xmlXPathContextPtr ctxt,
goto ignore; goto ignore;
} }
if (ppcModelFind(map, model->name)) { if (ppc64ModelFind(map, model->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU model %s already defined"), model->name); _("CPU model %s already defined"), model->name);
goto ignore; goto ignore;
...@@ -247,7 +247,7 @@ ppcModelLoad(xmlXPathContextPtr ctxt, ...@@ -247,7 +247,7 @@ ppcModelLoad(xmlXPathContextPtr ctxt,
goto ignore; goto ignore;
} }
if (!(model->vendor = ppcVendorFind(map, vendor))) { if (!(model->vendor = ppc64VendorFind(map, vendor))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown vendor %s referenced by CPU model %s"), _("Unknown vendor %s referenced by CPU model %s"),
vendor, model->name); vendor, model->name);
...@@ -276,22 +276,22 @@ ppcModelLoad(xmlXPathContextPtr ctxt, ...@@ -276,22 +276,22 @@ ppcModelLoad(xmlXPathContextPtr ctxt,
return 0; return 0;
ignore: ignore:
ppcModelFree(model); ppc64ModelFree(model);
goto cleanup; goto cleanup;
} }
static int static int
ppcMapLoadCallback(cpuMapElement element, ppc64MapLoadCallback(cpuMapElement element,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
void *data) void *data)
{ {
struct ppc_map *map = data; struct ppc64_map *map = data;
switch (element) { switch (element) {
case CPU_MAP_ELEMENT_VENDOR: case CPU_MAP_ELEMENT_VENDOR:
return ppcVendorLoad(ctxt, map); return ppc64VendorLoad(ctxt, map);
case CPU_MAP_ELEMENT_MODEL: case CPU_MAP_ELEMENT_MODEL:
return ppcModelLoad(ctxt, map); return ppc64ModelLoad(ctxt, map);
case CPU_MAP_ELEMENT_FEATURE: case CPU_MAP_ELEMENT_FEATURE:
case CPU_MAP_ELEMENT_LAST: case CPU_MAP_ELEMENT_LAST:
break; break;
...@@ -301,46 +301,46 @@ ppcMapLoadCallback(cpuMapElement element, ...@@ -301,46 +301,46 @@ ppcMapLoadCallback(cpuMapElement element,
} }
static void static void
ppcMapFree(struct ppc_map *map) ppc64MapFree(struct ppc64_map *map)
{ {
if (map == NULL) if (map == NULL)
return; return;
while (map->models != NULL) { while (map->models != NULL) {
struct ppc_model *model = map->models; struct ppc64_model *model = map->models;
map->models = model->next; map->models = model->next;
ppcModelFree(model); ppc64ModelFree(model);
} }
while (map->vendors != NULL) { while (map->vendors != NULL) {
struct ppc_vendor *vendor = map->vendors; struct ppc64_vendor *vendor = map->vendors;
map->vendors = vendor->next; map->vendors = vendor->next;
ppcVendorFree(vendor); ppc64VendorFree(vendor);
} }
VIR_FREE(map); VIR_FREE(map);
} }
static struct ppc_map * static struct ppc64_map *
ppcLoadMap(void) ppc64LoadMap(void)
{ {
struct ppc_map *map; struct ppc64_map *map;
if (VIR_ALLOC(map) < 0) if (VIR_ALLOC(map) < 0)
return NULL; return NULL;
if (cpuMapLoad("ppc64", ppcMapLoadCallback, map) < 0) if (cpuMapLoad("ppc64", ppc64MapLoadCallback, map) < 0)
goto error; goto error;
return map; return map;
error: error:
ppcMapFree(map); ppc64MapFree(map);
return NULL; return NULL;
} }
static virCPUDataPtr static virCPUDataPtr
ppcMakeCPUData(virArch arch, struct cpuPPC64Data *data) ppc64MakeCPUData(virArch arch, struct cpuPPC64Data *data)
{ {
virCPUDataPtr cpuData; virCPUDataPtr cpuData;
...@@ -355,15 +355,15 @@ ppcMakeCPUData(virArch arch, struct cpuPPC64Data *data) ...@@ -355,15 +355,15 @@ ppcMakeCPUData(virArch arch, struct cpuPPC64Data *data)
} }
static virCPUCompareResult static virCPUCompareResult
ppcCompute(virCPUDefPtr host, ppc64Compute(virCPUDefPtr host,
const virCPUDef *cpu, const virCPUDef *cpu,
virCPUDataPtr *guestData, virCPUDataPtr *guestData,
char **message) char **message)
{ {
struct ppc_map *map = NULL; struct ppc64_map *map = NULL;
struct ppc_model *host_model = NULL; struct ppc64_model *host_model = NULL;
struct ppc_model *guest_model = NULL; struct ppc64_model *guest_model = NULL;
virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR; virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
virArch arch; virArch arch;
...@@ -411,9 +411,9 @@ ppcCompute(virCPUDefPtr host, ...@@ -411,9 +411,9 @@ ppcCompute(virCPUDefPtr host,
goto cleanup; goto cleanup;
} }
if (!(map = ppcLoadMap()) || if (!(map = ppc64LoadMap()) ||
!(host_model = ppcModelFromCPU(host, map)) || !(host_model = ppc64ModelFromCPU(host, map)) ||
!(guest_model = ppcModelFromCPU(cpu, map))) !(guest_model = ppc64ModelFromCPU(cpu, map)))
goto cleanup; goto cleanup;
if (guestData != NULL) { if (guestData != NULL) {
...@@ -433,21 +433,21 @@ ppcCompute(virCPUDefPtr host, ...@@ -433,21 +433,21 @@ ppcCompute(virCPUDefPtr host,
goto cleanup; goto cleanup;
} }
if (!(*guestData = ppcMakeCPUData(arch, &guest_model->data))) if (!(*guestData = ppc64MakeCPUData(arch, &guest_model->data)))
goto cleanup; goto cleanup;
} }
ret = VIR_CPU_COMPARE_IDENTICAL; ret = VIR_CPU_COMPARE_IDENTICAL;
cleanup: cleanup:
ppcMapFree(map); ppc64MapFree(map);
ppcModelFree(host_model); ppc64ModelFree(host_model);
ppcModelFree(guest_model); ppc64ModelFree(guest_model);
return ret; return ret;
} }
static virCPUCompareResult static virCPUCompareResult
ppcCompare(virCPUDefPtr host, ppc64Compare(virCPUDefPtr host,
virCPUDefPtr cpu, virCPUDefPtr cpu,
bool failIncompatible) bool failIncompatible)
{ {
...@@ -464,7 +464,7 @@ ppcCompare(virCPUDefPtr host, ...@@ -464,7 +464,7 @@ ppcCompare(virCPUDefPtr host,
} }
static int static int
ppcDecode(virCPUDefPtr cpu, ppc64Decode(virCPUDefPtr cpu,
const virCPUData *data, const virCPUData *data,
const char **models, const char **models,
unsigned int nmodels, unsigned int nmodels,
...@@ -472,15 +472,15 @@ ppcDecode(virCPUDefPtr cpu, ...@@ -472,15 +472,15 @@ ppcDecode(virCPUDefPtr cpu,
unsigned int flags) unsigned int flags)
{ {
int ret = -1; int ret = -1;
struct ppc_map *map; struct ppc64_map *map;
const struct ppc_model *model; const struct ppc64_model *model;
virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1); virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES, -1);
if (data == NULL || (map = ppcLoadMap()) == NULL) if (data == NULL || (map = ppc64LoadMap()) == NULL)
return -1; return -1;
if (!(model = ppcModelFindPVR(map, data->data.ppc64.pvr))) { if (!(model = ppc64ModelFindPVR(map, data->data.ppc64.pvr))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Cannot find CPU model with PVR 0x%08x"), _("Cannot find CPU model with PVR 0x%08x"),
data->data.ppc64.pvr); data->data.ppc64.pvr);
...@@ -502,14 +502,14 @@ ppcDecode(virCPUDefPtr cpu, ...@@ -502,14 +502,14 @@ ppcDecode(virCPUDefPtr cpu,
ret = 0; ret = 0;
cleanup: cleanup:
ppcMapFree(map); ppc64MapFree(map);
return ret; return ret;
} }
static void static void
ppcDataFree(virCPUDataPtr data) ppc64DataFree(virCPUDataPtr data)
{ {
if (data == NULL) if (data == NULL)
return; return;
...@@ -518,7 +518,7 @@ ppcDataFree(virCPUDataPtr data) ...@@ -518,7 +518,7 @@ ppcDataFree(virCPUDataPtr data)
} }
static virCPUDataPtr static virCPUDataPtr
ppcNodeData(virArch arch) ppc64NodeData(virArch arch)
{ {
virCPUDataPtr cpuData; virCPUDataPtr cpuData;
...@@ -536,16 +536,16 @@ ppcNodeData(virArch arch) ...@@ -536,16 +536,16 @@ ppcNodeData(virArch arch)
} }
static virCPUCompareResult static virCPUCompareResult
ppcGuestData(virCPUDefPtr host, ppc64GuestData(virCPUDefPtr host,
virCPUDefPtr guest, virCPUDefPtr guest,
virCPUDataPtr *data, virCPUDataPtr *data,
char **message) char **message)
{ {
return ppcCompute(host, guest, data, message); return ppc64Compute(host, guest, data, message);
} }
static int static int
ppcUpdate(virCPUDefPtr guest, ppc64Update(virCPUDefPtr guest,
const virCPUDef *host) const virCPUDef *host)
{ {
switch ((virCPUMode) guest->mode) { switch ((virCPUMode) guest->mode) {
...@@ -568,32 +568,32 @@ ppcUpdate(virCPUDefPtr guest, ...@@ -568,32 +568,32 @@ ppcUpdate(virCPUDefPtr guest,
} }
static virCPUDefPtr static virCPUDefPtr
ppcBaseline(virCPUDefPtr *cpus, ppc64Baseline(virCPUDefPtr *cpus,
unsigned int ncpus, unsigned int ncpus,
const char **models ATTRIBUTE_UNUSED, const char **models ATTRIBUTE_UNUSED,
unsigned int nmodels ATTRIBUTE_UNUSED, unsigned int nmodels ATTRIBUTE_UNUSED,
unsigned int flags) unsigned int flags)
{ {
struct ppc_map *map = NULL; struct ppc64_map *map = NULL;
const struct ppc_model *model; const struct ppc64_model *model;
const struct ppc_vendor *vendor = NULL; const struct ppc64_vendor *vendor = NULL;
virCPUDefPtr cpu = NULL; virCPUDefPtr cpu = NULL;
size_t i; size_t i;
virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES | virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL); VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
if (!(map = ppcLoadMap())) if (!(map = ppc64LoadMap()))
goto error; goto error;
if (!(model = ppcModelFind(map, cpus[0]->model))) { if (!(model = ppc64ModelFind(map, cpus[0]->model))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU model %s"), cpus[0]->model); _("Unknown CPU model %s"), cpus[0]->model);
goto error; goto error;
} }
for (i = 0; i < ncpus; i++) { for (i = 0; i < ncpus; i++) {
const struct ppc_vendor *vnd; const struct ppc64_vendor *vnd;
if (STRNEQ(cpus[i]->model, model->name)) { if (STRNEQ(cpus[i]->model, model->name)) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s", virReportError(VIR_ERR_OPERATION_FAILED, "%s",
...@@ -604,7 +604,7 @@ ppcBaseline(virCPUDefPtr *cpus, ...@@ -604,7 +604,7 @@ ppcBaseline(virCPUDefPtr *cpus,
if (!cpus[i]->vendor) if (!cpus[i]->vendor)
continue; continue;
if (!(vnd = ppcVendorFind(map, cpus[i]->vendor))) { if (!(vnd = ppc64VendorFind(map, cpus[i]->vendor))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Unknown CPU vendor %s"), cpus[i]->vendor); _("Unknown CPU vendor %s"), cpus[i]->vendor);
goto error; goto error;
...@@ -641,7 +641,7 @@ ppcBaseline(virCPUDefPtr *cpus, ...@@ -641,7 +641,7 @@ ppcBaseline(virCPUDefPtr *cpus,
cpu->match = VIR_CPU_MATCH_EXACT; cpu->match = VIR_CPU_MATCH_EXACT;
cleanup: cleanup:
ppcMapFree(map); ppc64MapFree(map);
return cpu; return cpu;
...@@ -652,14 +652,14 @@ ppcBaseline(virCPUDefPtr *cpus, ...@@ -652,14 +652,14 @@ ppcBaseline(virCPUDefPtr *cpus,
} }
static int static int
ppcGetModels(char ***models) ppc64GetModels(char ***models)
{ {
struct ppc_map *map; struct ppc64_map *map;
struct ppc_model *model; struct ppc64_model *model;
char *name; char *name;
size_t nmodels = 0; size_t nmodels = 0;
if (!(map = ppcLoadMap())) if (!(map = ppc64LoadMap()))
goto error; goto error;
if (models && VIR_ALLOC_N(*models, 0) < 0) if (models && VIR_ALLOC_N(*models, 0) < 0)
...@@ -681,7 +681,7 @@ ppcGetModels(char ***models) ...@@ -681,7 +681,7 @@ ppcGetModels(char ***models)
} }
cleanup: cleanup:
ppcMapFree(map); ppc64MapFree(map);
return nmodels; return nmodels;
...@@ -698,14 +698,14 @@ struct cpuArchDriver cpuDriverPPC64 = { ...@@ -698,14 +698,14 @@ struct cpuArchDriver cpuDriverPPC64 = {
.name = "ppc64", .name = "ppc64",
.arch = archs, .arch = archs,
.narch = ARRAY_CARDINALITY(archs), .narch = ARRAY_CARDINALITY(archs),
.compare = ppcCompare, .compare = ppc64Compare,
.decode = ppcDecode, .decode = ppc64Decode,
.encode = NULL, .encode = NULL,
.free = ppcDataFree, .free = ppc64DataFree,
.nodeData = ppcNodeData, .nodeData = ppc64NodeData,
.guestData = ppcGuestData, .guestData = ppc64GuestData,
.baseline = ppcBaseline, .baseline = ppc64Baseline,
.update = ppcUpdate, .update = ppc64Update,
.hasFeature = NULL, .hasFeature = NULL,
.getModels = ppcGetModels, .getModels = ppc64GetModels,
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部