提交 782be9f0 编写于 作者: J Jiri Denemark

cpu_x86: Move and rename x86ModelHasSignature

Later in this series the function will work on a newly introduced
virCPUx86Signatures structure. Let's move it to the place were all
related functions will be added and rename the function as
virCPUx86SignaturesMatch for easier review of the virCPUx86Signatures
patch.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 a8ec1d74
...@@ -1110,6 +1110,21 @@ virCPUx86SignaturesCopy(virCPUx86ModelPtr dst, ...@@ -1110,6 +1110,21 @@ virCPUx86SignaturesCopy(virCPUx86ModelPtr dst,
} }
static bool
virCPUx86SignaturesMatch(virCPUx86ModelPtr model,
uint32_t signature)
{
size_t i;
for (i = 0; i < model->nsignatures; i++) {
if (model->signatures[i] == signature)
return true;
}
return false;
}
static void static void
x86ModelFree(virCPUx86ModelPtr model) x86ModelFree(virCPUx86ModelPtr model)
{ {
...@@ -1875,21 +1890,6 @@ virCPUx86Compare(virCPUDefPtr host, ...@@ -1875,21 +1890,6 @@ virCPUx86Compare(virCPUDefPtr host,
} }
static bool
x86ModelHasSignature(virCPUx86ModelPtr model,
uint32_t signature)
{
size_t i;
for (i = 0; i < model->nsignatures; i++) {
if (model->signatures[i] == signature)
return true;
}
return false;
}
static char * static char *
x86FormatSignatures(virCPUx86ModelPtr model) x86FormatSignatures(virCPUx86ModelPtr model)
{ {
...@@ -1961,8 +1961,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, ...@@ -1961,8 +1961,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
* consider candidates with matching family/model. * consider candidates with matching family/model.
*/ */
if (signature && if (signature &&
x86ModelHasSignature(current, signature) && virCPUx86SignaturesMatch(current, signature) &&
!x86ModelHasSignature(candidate, signature)) { !virCPUx86SignaturesMatch(candidate, signature)) {
VIR_DEBUG("%s differs in signature from matching %s", VIR_DEBUG("%s differs in signature from matching %s",
cpuCandidate->model, cpuCurrent->model); cpuCandidate->model, cpuCurrent->model);
return 0; return 0;
...@@ -1978,8 +1978,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current, ...@@ -1978,8 +1978,8 @@ x86DecodeUseCandidate(virCPUx86ModelPtr current,
* result in longer list of features. * result in longer list of features.
*/ */
if (signature && if (signature &&
x86ModelHasSignature(candidate, signature) && virCPUx86SignaturesMatch(candidate, signature) &&
!x86ModelHasSignature(current, signature)) { !virCPUx86SignaturesMatch(current, signature)) {
VIR_DEBUG("%s provides matching signature", cpuCandidate->model); VIR_DEBUG("%s provides matching signature", cpuCandidate->model);
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册