提交 fe78d2fd 编写于 作者: J Jiri Denemark

cpu_x86: Separate signature parsing from x86ModelParse

The code is separated into a new x86ModelParseSignature function.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 2e1e2b91
......@@ -1187,26 +1187,9 @@ x86ModelParseAncestor(virCPUx86ModelPtr model,
static int
x86ModelParse(xmlXPathContextPtr ctxt,
const char *name,
void *data)
x86ModelParseSignature(virCPUx86ModelPtr model,
xmlXPathContextPtr ctxt)
{
virCPUx86MapPtr map = data;
xmlNodePtr *nodes = NULL;
virCPUx86ModelPtr model;
char *vendor = NULL;
size_t i;
int n;
int ret = -1;
if (!(model = x86ModelNew()))
goto cleanup;
if (VIR_STRDUP(model->name, name) < 0)
goto cleanup;
if (x86ModelParseAncestor(model, ctxt, map) < 0)
goto cleanup;
if (virXPathBoolean("boolean(./signature)", ctxt)) {
unsigned int sigFamily = 0;
......@@ -1218,7 +1201,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature family in model %s"),
model->name);
goto cleanup;
return -1;
}
rc = virXPathUInt("string(./signature/@model)", ctxt, &sigModel);
......@@ -1226,12 +1209,41 @@ x86ModelParse(xmlXPathContextPtr ctxt,
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature model in model %s"),
model->name);
goto cleanup;
return -1;
}
model->signature = x86MakeSignature(sigFamily, sigModel, 0);
}
return 0;
}
static int
x86ModelParse(xmlXPathContextPtr ctxt,
const char *name,
void *data)
{
virCPUx86MapPtr map = data;
xmlNodePtr *nodes = NULL;
virCPUx86ModelPtr model;
char *vendor = NULL;
size_t i;
int n;
int ret = -1;
if (!(model = x86ModelNew()))
goto cleanup;
if (VIR_STRDUP(model->name, name) < 0)
goto cleanup;
if (x86ModelParseAncestor(model, ctxt, map) < 0)
goto cleanup;
if (x86ModelParseSignature(model, ctxt) < 0)
goto cleanup;
if (virXPathBoolean("boolean(./vendor)", ctxt)) {
vendor = virXPathString("string(./vendor/@name)", ctxt);
if (!vendor) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册