mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
cpu_x86: Separate signature parsing from x86ModelParse
The code is separated into a new x86ModelParseSignature function. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
2e1e2b910c
commit
fe78d2fda9
@ -1186,6 +1186,39 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
x86ModelParseSignature(virCPUx86ModelPtr model,
|
||||||
|
xmlXPathContextPtr ctxt)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (virXPathBoolean("boolean(./signature)", ctxt)) {
|
||||||
|
unsigned int sigFamily = 0;
|
||||||
|
unsigned int sigModel = 0;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
rc = virXPathUInt("string(./signature/@family)", ctxt, &sigFamily);
|
||||||
|
if (rc < 0 || sigFamily == 0) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Invalid CPU signature family in model %s"),
|
||||||
|
model->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
|
||||||
|
if (rc < 0 || sigModel == 0) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Invalid CPU signature model in model %s"),
|
||||||
|
model->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
model->signature = x86MakeSignature(sigFamily, sigModel, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
x86ModelParse(xmlXPathContextPtr ctxt,
|
x86ModelParse(xmlXPathContextPtr ctxt,
|
||||||
const char *name,
|
const char *name,
|
||||||
@ -1208,29 +1241,8 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
|||||||
if (x86ModelParseAncestor(model, ctxt, map) < 0)
|
if (x86ModelParseAncestor(model, ctxt, map) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virXPathBoolean("boolean(./signature)", ctxt)) {
|
if (x86ModelParseSignature(model, ctxt) < 0)
|
||||||
unsigned int sigFamily = 0;
|
|
||||||
unsigned int sigModel = 0;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = virXPathUInt("string(./signature/@family)", ctxt, &sigFamily);
|
|
||||||
if (rc < 0 || sigFamily == 0) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("Invalid CPU signature family in model %s"),
|
|
||||||
model->name);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
|
|
||||||
if (rc < 0 || sigModel == 0) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("Invalid CPU signature model in model %s"),
|
|
||||||
model->name);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
model->signature = x86MakeSignature(sigFamily, sigModel, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (virXPathBoolean("boolean(./vendor)", ctxt)) {
|
if (virXPathBoolean("boolean(./vendor)", ctxt)) {
|
||||||
vendor = virXPathString("string(./vendor/@name)", ctxt);
|
vendor = virXPathString("string(./vendor/@name)", ctxt);
|
||||||
|
Loading…
Reference in New Issue
Block a user