The virConnectPtr is no longer required for error reporting since that is recorded in a thread local. Remove use of virConnectPtr from all APIs in cpu_conf.{h,c} and update all callers to match --- src/conf/capabilities.c | 2 +- src/conf/cpu_conf.c | 54 ++++++++++++++++++++----------------------- src/conf/cpu_conf.h | 12 +++------ src/conf/domain_conf.c | 4 +- src/cpu/cpu.c | 58 ++++++++++++++++++++-------------------------- src/cpu/cpu.h | 27 ++++++++------------- src/cpu/cpu_map.c | 8 +++--- src/cpu/cpu_x86.c | 24 +++++++++--------- src/qemu/qemu_conf.c | 14 +++++----- src/qemu/qemu_driver.c | 2 +- 10 files changed, 91 insertions(+), 114 deletions(-) diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 47976af..dafd821 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -678,7 +678,7 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(&xml, " </features>\n"); } - virCPUDefFormatBuf(NULL, &xml, caps->host.cpu, " ", + virCPUDefFormatBuf(&xml, caps->host.cpu, " ", VIR_CPU_FORMAT_EMBEDED); virBufferAddLit(&xml, " </cpu>\n"); diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index fabbede..ed83188 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -31,9 +31,9 @@ #define VIR_FROM_THIS VIR_FROM_CPU -#define virCPUReportError(conn, code, fmt...) \ - virReportErrorHelper(conn, VIR_FROM_CPU, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) +#define virCPUReportError(code, fmt...) \ + virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \ + __FUNCTION__, __LINE__, fmt) VIR_ENUM_IMPL(virCPUMatch, VIR_CPU_MATCH_LAST, "minimum", @@ -69,8 +69,7 @@ virCPUDefFree(virCPUDefPtr def) #ifndef PROXY virCPUDefPtr -virCPUDefParseXML(virConnectPtr conn, - const xmlNodePtr node, +virCPUDefParseXML(const xmlNodePtr node, xmlXPathContextPtr ctxt, enum virCPUType mode) { @@ -97,7 +96,7 @@ virCPUDefParseXML(virConnectPtr conn, if (!match) { if (virXPathBoolean("boolean(./model)", ctxt)) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing match attribute for CPU specification")); goto error; } @@ -107,7 +106,7 @@ virCPUDefParseXML(virConnectPtr conn, VIR_FREE(match); if (def->match < 0) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid match attribute for CPU specification")); goto error; } @@ -117,7 +116,7 @@ virCPUDefParseXML(virConnectPtr conn, if (def->type == VIR_CPU_TYPE_HOST) { def->arch = virXPathString("string(./arch[1])", ctxt); if (!def->arch) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing CPU architecture")); goto error; } @@ -125,7 +124,7 @@ virCPUDefParseXML(virConnectPtr conn, if (!(def->model = virXPathString("string(./model[1])", ctxt)) && def->type == VIR_CPU_TYPE_HOST) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing CPU model name")); goto error; } @@ -137,7 +136,7 @@ virCPUDefParseXML(virConnectPtr conn, ret = virXPathULong("string(./topology[1]/@sockets)", ctxt, &ul); if (ret < 0) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing 'sockets' attribute in CPU topology")); goto error; } @@ -146,7 +145,7 @@ virCPUDefParseXML(virConnectPtr conn, ret = virXPathULong("string(./topology[1]/@cores)", ctxt, &ul); if (ret < 0) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing 'cores' attribute in CPU topology")); goto error; } @@ -155,14 +154,14 @@ virCPUDefParseXML(virConnectPtr conn, ret = virXPathULong("string(./topology[1]/@threads)", ctxt, &ul); if (ret < 0) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing 'threads' attribute in CPU topology")); goto error; } def->threads = (unsigned int) ul; if (!def->sockets || !def->cores || !def->threads) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid CPU topology")); goto error; } @@ -174,7 +173,7 @@ virCPUDefParseXML(virConnectPtr conn, if (n > 0) { if (!def->model) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Non-empty feature list specified without CPU model")); goto error; } @@ -197,7 +196,7 @@ virCPUDefParseXML(virConnectPtr conn, VIR_FREE(strpolicy); if (policy < 0) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid CPU feature policy")); goto error; } @@ -207,14 +206,14 @@ virCPUDefParseXML(virConnectPtr conn, if (!(name = virXMLPropString(nodes[i], "name")) || *name == 0) { VIR_FREE(name); - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid CPU feature name")); goto error; } for (j = 0 ; j < i ; j++) { if (STREQ(name, def->features[j].name)) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("CPU feature `%s' specified more than once"), name); VIR_FREE(name); @@ -243,14 +242,13 @@ error: char * -virCPUDefFormat(virConnectPtr conn, - virCPUDefPtr def, +virCPUDefFormat(virCPUDefPtr def, const char *indent, int flags) { virBuffer buf = VIR_BUFFER_INITIALIZER; - if (virCPUDefFormatBuf(conn, &buf, def, indent, flags) < 0) + if (virCPUDefFormatBuf(&buf, def, indent, flags) < 0) goto cleanup; if (virBufferError(&buf)) @@ -267,8 +265,7 @@ cleanup: int -virCPUDefFormatBuf(virConnectPtr conn, - virBufferPtr buf, +virCPUDefFormatBuf(virBufferPtr buf, virCPUDefPtr def, const char *indent, int flags) @@ -282,7 +279,7 @@ virCPUDefFormatBuf(virConnectPtr conn, indent = ""; if (!def->model && def->nfeatures) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Non-empty feature list specified without CPU model")); return -1; } @@ -291,7 +288,7 @@ virCPUDefFormatBuf(virConnectPtr conn, if (def->type == VIR_CPU_TYPE_GUEST && def->model) { const char *match; if (!(match = virCPUMatchTypeToString(def->match))) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected CPU match policy %d"), def->match); return -1; } @@ -320,7 +317,7 @@ virCPUDefFormatBuf(virConnectPtr conn, virCPUFeatureDefPtr feature = def->features + i; if (!feature->name) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing CPU feature name")); return -1; } @@ -330,7 +327,7 @@ virCPUDefFormatBuf(virConnectPtr conn, policy = virCPUFeaturePolicyTypeToString(feature->policy); if (!policy) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected CPU feature policy %d"), feature->policy); return -1; } @@ -351,8 +348,7 @@ virCPUDefFormatBuf(virConnectPtr conn, int -virCPUDefAddFeature(virConnectPtr conn, - virCPUDefPtr def, +virCPUDefAddFeature(virCPUDefPtr def, const char *name, int policy) { @@ -360,7 +356,7 @@ virCPUDefAddFeature(virConnectPtr conn, for (i = 0 ; i < def->nfeatures ; i++) { if (STREQ(name, def->features[i].name)) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("CPU feature `%s' specified more than once"), name); return -1; } diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index e95afaa..6a66959 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -85,8 +85,7 @@ virCPUDefFree(virCPUDefPtr def); #ifndef PROXY virCPUDefPtr -virCPUDefParseXML(virConnectPtr conn, - const xmlNodePtr node, +virCPUDefParseXML(const xmlNodePtr node, xmlXPathContextPtr ctxt, enum virCPUType mode); #endif @@ -98,21 +97,18 @@ enum virCPUFormatFlags { char * -virCPUDefFormat(virConnectPtr conn, - virCPUDefPtr def, +virCPUDefFormat(virCPUDefPtr def, const char *indent, int flags); int -virCPUDefFormatBuf(virConnectPtr conn, - virBufferPtr buf, +virCPUDefFormatBuf(virBufferPtr buf, virCPUDefPtr def, const char *indent, int flags); int -virCPUDefAddFeature(virConnectPtr conn, - virCPUDefPtr cpu, +virCPUDefAddFeature(virCPUDefPtr cpu, const char *name, int policy); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 101be4e..b8f82ab 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3928,7 +3928,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if ((node = virXPathNode("./cpu[1]", ctxt)) != NULL) { xmlNodePtr oldnode = ctxt->node; ctxt->node = node; - def->cpu = virCPUDefParseXML(NULL, node, ctxt, VIR_CPU_TYPE_GUEST); + def->cpu = virCPUDefParseXML(node, ctxt, VIR_CPU_TYPE_GUEST); ctxt->node = oldnode; if (def->cpu == NULL) @@ -5341,7 +5341,7 @@ char *virDomainDefFormat(virDomainDefPtr def, virBufferAddLit(&buf, " </features>\n"); } - if (virCPUDefFormatBuf(NULL, &buf, def->cpu, " ", 0) < 0) + if (virCPUDefFormatBuf(&buf, def->cpu, " ", 0) < 0) goto cleanup; virBufferVSprintf(&buf, " <clock offset='%s'/>\n", diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 5162d95..ae8d37d 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -40,14 +40,13 @@ static struct cpuArchDriver *drivers[] = { static struct cpuArchDriver * -cpuGetSubDriver(virConnectPtr conn, - const char *arch) +cpuGetSubDriver(const char *arch) { unsigned int i; unsigned int j; if (arch == NULL) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("undefined hardware architecture")); return NULL; } @@ -65,8 +64,7 @@ cpuGetSubDriver(virConnectPtr conn, virCPUCompareResult -cpuCompareXML(virConnectPtr conn, - virCPUDefPtr host, +cpuCompareXML(virCPUDefPtr host, const char *xml) { xmlDocPtr doc = NULL; @@ -83,11 +81,11 @@ cpuCompareXML(virConnectPtr conn, ctxt->node = xmlDocGetRootElement(doc); - cpu = virCPUDefParseXML(conn, ctxt->node, ctxt, VIR_CPU_TYPE_AUTO); + cpu = virCPUDefParseXML(ctxt->node, ctxt, VIR_CPU_TYPE_AUTO); if (cpu == NULL) goto cleanup; - ret = cpuCompare(conn, host, cpu); + ret = cpuCompare(host, cpu); cleanup: virCPUDefFree(cpu); @@ -99,17 +97,16 @@ cleanup: virCPUCompareResult -cpuCompare(virConnectPtr conn, - virCPUDefPtr host, +cpuCompare(virCPUDefPtr host, virCPUDefPtr cpu) { struct cpuArchDriver *driver; - if ((driver = cpuGetSubDriver(conn, host->arch)) == NULL) + if ((driver = cpuGetSubDriver(host->arch)) == NULL) return VIR_CPU_COMPARE_ERROR; if (driver->compare == NULL) { - virCPUReportError(conn, VIR_ERR_NO_SUPPORT, + virCPUReportError(VIR_ERR_NO_SUPPORT, _("cannot compare CPUs of %s architecture"), host->arch); return VIR_CPU_COMPARE_ERROR; @@ -120,8 +117,7 @@ cpuCompare(virConnectPtr conn, int -cpuDecode(virConnectPtr conn, - virCPUDefPtr cpu, +cpuDecode(virCPUDefPtr cpu, const union cpuData *data, unsigned int nmodels, const char **models) @@ -129,22 +125,22 @@ cpuDecode(virConnectPtr conn, struct cpuArchDriver *driver; if (models == NULL && nmodels != 0) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nonzero nmodels doesn't match with NULL models")); return -1; } if (cpu == NULL) { - virCPUReportError(conn, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("invalid CPU definition")); return -1; } - if ((driver = cpuGetSubDriver(conn, cpu->arch)) == NULL) + if ((driver = cpuGetSubDriver(cpu->arch)) == NULL) return -1; if (driver->decode == NULL) { - virCPUReportError(conn, VIR_ERR_NO_SUPPORT, + virCPUReportError(VIR_ERR_NO_SUPPORT, _("cannot decode CPU data for %s architecture"), cpu->arch); return -1; @@ -155,8 +151,7 @@ cpuDecode(virConnectPtr conn, int -cpuEncode(virConnectPtr conn, - const char *arch, +cpuEncode(const char *arch, const virCPUDefPtr cpu, union cpuData **forced, union cpuData **required, @@ -166,11 +161,11 @@ cpuEncode(virConnectPtr conn, { struct cpuArchDriver *driver; - if ((driver = cpuGetSubDriver(conn, arch)) == NULL) + if ((driver = cpuGetSubDriver(arch)) == NULL) return -1; if (driver->encode == NULL) { - virCPUReportError(conn, VIR_ERR_NO_SUPPORT, + virCPUReportError(VIR_ERR_NO_SUPPORT, _("cannot encode CPU data for %s architecture"), arch); return -1; @@ -182,8 +177,7 @@ cpuEncode(virConnectPtr conn, void -cpuDataFree(virConnectPtr conn, - const char *arch, +cpuDataFree(const char *arch, union cpuData *data) { struct cpuArchDriver *driver; @@ -191,11 +185,11 @@ cpuDataFree(virConnectPtr conn, if (data == NULL) return; - if ((driver = cpuGetSubDriver(conn, arch)) == NULL) + if ((driver = cpuGetSubDriver(arch)) == NULL) return; if (driver->free == NULL) { - virCPUReportError(conn, VIR_ERR_NO_SUPPORT, + virCPUReportError(VIR_ERR_NO_SUPPORT, _("cannot free CPU data for %s architecture"), arch); return; @@ -206,16 +200,15 @@ cpuDataFree(virConnectPtr conn, union cpuData * -cpuNodeData(virConnectPtr conn, - const char *arch) +cpuNodeData(const char *arch) { struct cpuArchDriver *driver; - if ((driver = cpuGetSubDriver(conn, arch)) == NULL) + if ((driver = cpuGetSubDriver(arch)) == NULL) return NULL; if (driver->nodeData == NULL) { - virCPUReportError(conn, VIR_ERR_NO_SUPPORT, + virCPUReportError(VIR_ERR_NO_SUPPORT, _("cannot get node CPU data for %s architecture"), arch); return NULL; @@ -226,18 +219,17 @@ cpuNodeData(virConnectPtr conn, virCPUCompareResult -cpuGuestData(virConnectPtr conn, - virCPUDefPtr host, +cpuGuestData(virCPUDefPtr host, virCPUDefPtr guest, union cpuData **data) { struct cpuArchDriver *driver; - if ((driver = cpuGetSubDriver(conn, host->arch)) == NULL) + if ((driver = cpuGetSubDriver(host->arch)) == NULL) return VIR_CPU_COMPARE_ERROR; if (driver->guestData == NULL) { - virCPUReportError(conn, VIR_ERR_NO_SUPPORT, + virCPUReportError(VIR_ERR_NO_SUPPORT, _("cannot compute guest CPU data for %s architecture"), host->arch); return VIR_CPU_COMPARE_ERROR; diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 5b1636d..1e04993 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -30,9 +30,9 @@ #include "cpu_x86_data.h" -#define virCPUReportError(conn, code, fmt...) \ - virReportErrorHelper(conn, VIR_FROM_CPU, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) +#define virCPUReportError(code, fmt...) \ + virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \ + __FUNCTION__, __LINE__, fmt) union cpuData { @@ -85,25 +85,21 @@ struct cpuArchDriver { extern virCPUCompareResult -cpuCompareXML(virConnectPtr conn, - virCPUDefPtr host, +cpuCompareXML(virCPUDefPtr host, const char *xml); extern virCPUCompareResult -cpuCompare (virConnectPtr conn, - virCPUDefPtr host, +cpuCompare (virCPUDefPtr host, virCPUDefPtr cpu); extern int -cpuDecode (virConnectPtr conn, - virCPUDefPtr cpu, +cpuDecode (virCPUDefPtr cpu, const union cpuData *data, unsigned int nmodels, const char **models); extern int -cpuEncode (virConnectPtr conn, - const char *arch, +cpuEncode (const char *arch, const virCPUDefPtr cpu, union cpuData **forced, union cpuData **required, @@ -112,17 +108,14 @@ cpuEncode (virConnectPtr conn, union cpuData **forbidden); extern void -cpuDataFree (virConnectPtr conn, - const char *arch, +cpuDataFree (const char *arch, union cpuData *data); extern union cpuData * -cpuNodeData (virConnectPtr conn, - const char *arch); +cpuNodeData (const char *arch); extern virCPUCompareResult -cpuGuestData(virConnectPtr conn, - virCPUDefPtr host, +cpuGuestData(virCPUDefPtr host, virCPUDefPtr guest, union cpuData **data); diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index b63e2eb..5fb88e0 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -78,13 +78,13 @@ int cpuMapLoad(const char *arch, int ret = -1; if (arch == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("undefined hardware architecture")); return -1; } if ((xml = xmlParseFile(CPUMAPFILE)) == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("cannot parse CPU map file: %s"), CPUMAPFILE); goto cleanup; @@ -102,14 +102,14 @@ int cpuMapLoad(const char *arch, ctxt->node = xmlDocGetRootElement(xml); if ((ctxt->node = virXPathNode(xpath, ctxt)) == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find CPU map for %s architecture"), arch); goto cleanup; } if ((feature_cb && load(ctxt, "feature", feature_cb, feature_data) < 0) || (model_cb && load(ctxt, "model", model_cb, model_data) < 0)) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("cannot parse CPU map for %s architecture"), arch); goto cleanup; } diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 93bd675..7ae7fbf 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -265,7 +265,7 @@ x86DataToCPU(const union cpuData *data, if ((cpuid = x86DataCpuid(tmp, feature->cpuid[i].function)) && x86cpuidMatchMasked(cpuid, feature->cpuid + i)) { x86cpuidClearBits(cpuid, feature->cpuid + i); - if (virCPUDefAddFeature(NULL, cpu, feature->name, + if (virCPUDefAddFeature(cpu, feature->name, VIR_CPU_FEATURE_REQUIRE) < 0) goto error; } @@ -334,13 +334,13 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, feature->name = virXPathString("string(@name)", ctxt); if (feature->name == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing CPU feature name")); goto ignore; } if (x86FeatureFind(map, feature->name)) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("CPU feature %s already defined"), feature->name); goto ignore; } @@ -370,7 +370,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, if (ret_fun < 0 || ret_eax == -2 || ret_ebx == -2 || ret_ecx == -2 || ret_edx == -2) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid cpuid[%d] in %s feature"), i, feature->name); goto ignore; } @@ -539,7 +539,7 @@ x86ModelFromCPU(const virCPUDefPtr cpu, if (cpu->type == VIR_CPU_TYPE_HOST || policy == VIR_CPU_FEATURE_REQUIRE) { if ((model = x86ModelFind(map, cpu->model)) == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU model %s"), cpu->model); goto error; } @@ -558,7 +558,7 @@ x86ModelFromCPU(const virCPUDefPtr cpu, continue; if ((feature = x86FeatureFind(map, cpu->features[i].name)) == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown CPU feature %s"), cpu->features[i].name); goto error; } @@ -647,7 +647,7 @@ x86ModelLoad(xmlXPathContextPtr ctxt, model->name = virXPathString("string(@name)", ctxt); if (model->name == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing CPU model name")); goto ignore; } @@ -658,14 +658,14 @@ x86ModelLoad(xmlXPathContextPtr ctxt, name = virXPathString("string(./model/@name)", ctxt); if (name == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Missing ancestor's name in CPU model %s"), model->name); goto ignore; } if ((ancestor = x86ModelFind(map, name)) == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Ancestor model %s not found for CPU model %s"), name, model->name); VIR_FREE(name); @@ -691,13 +691,13 @@ x86ModelLoad(xmlXPathContextPtr ctxt, char *name; if ((name = virXMLPropString(nodes[i], "name")) == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Missing feature name for CPU model %s"), model->name); goto ignore; } if ((feature = x86FeatureFind(map, name)) == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, _("Feature %s required by CPU model %s not found"), name, model->name); VIR_FREE(name); @@ -993,7 +993,7 @@ x86Decode(virCPUDefPtr cpu, } if (cpuModel == NULL) { - virCPUReportError(NULL, VIR_ERR_INTERNAL_ERROR, + virCPUReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot find suitable CPU model for given data")); goto out; } diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index beb4386..3988582 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1015,8 +1015,8 @@ qemudCapsInitCPU(virCapsPtr caps, cpu->cores = nodeinfo.cores; cpu->threads = nodeinfo.threads; - if (!(data = cpuNodeData(NULL, arch)) - || cpuDecode(NULL, cpu, data, 0, NULL) < 0) + if (!(data = cpuNodeData(arch)) + || cpuDecode(cpu, data, 0, NULL) < 0) goto error; caps->host.cpu = cpu; @@ -1024,7 +1024,7 @@ qemudCapsInitCPU(virCapsPtr caps, ret = 0; cleanup: - cpuDataFree(NULL, arch, data); + cpuDataFree(arch, data); return ret; @@ -2943,7 +2943,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, if (ncpus > 0 && host) { virCPUCompareResult cmp; - cmp = cpuGuestData(NULL, host, def->cpu, &data); + cmp = cpuGuestData(host, def->cpu, &data); switch (cmp) { case VIR_CPU_COMPARE_INCOMPATIBLE: qemuReportError(VIR_ERR_INTERNAL_ERROR, @@ -2959,7 +2959,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(ut->machine))) goto no_memory; - if (cpuDecode(NULL, guest, data, ncpus, cpus) < 0) + if (cpuDecode(guest, data, ncpus, cpus) < 0) goto cleanup; virBufferVSprintf(&buf, "%s", guest->model); @@ -2995,7 +2995,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, cleanup: virCPUDefFree(guest); - cpuDataFree(NULL, ut->machine, data); + cpuDataFree(ut->machine, data); if (cpus) { for (i = 0; i < ncpus; i++) @@ -5026,7 +5026,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, else feature = strdup(p); - ret = virCPUDefAddFeature(NULL, cpu, feature, policy); + ret = virCPUDefAddFeature(cpu, feature, policy); VIR_FREE(feature); if (ret < 0) goto error; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1b3b271..b009dd3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8495,7 +8495,7 @@ qemuCPUCompare(virConnectPtr conn, "%s", _("cannot get host CPU capabilities")); } else - ret = cpuCompareXML(conn, driver->caps->host.cpu, xmlDesc); + ret = cpuCompareXML(driver->caps->host.cpu, xmlDesc); qemuDriverUnlock(driver); -- 1.6.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list