提交 668797dc 编写于 作者: J Jiri Denemark

cpu_conf: Pass policy to CPU feature filtering callbacks

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 2f7d8149
......@@ -147,7 +147,7 @@ virCPUDefCopyModelFilter(virCPUDefPtr dst,
dst->nfeatures = 0;
for (i = 0; i < src->nfeatures; i++) {
if (filter && !filter(src->features[i].name, opaque))
if (filter && !filter(src->features[i].name, src->features[i].policy, opaque))
continue;
n = dst->nfeatures++;
......@@ -937,7 +937,7 @@ virCPUDefFilterFeatures(virCPUDefPtr cpu,
size_t i = 0;
while (i < cpu->nfeatures) {
if (filter(cpu->features[i].name, opaque)) {
if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
i++;
continue;
}
......@@ -972,7 +972,7 @@ virCPUDefCheckFeatures(virCPUDefPtr cpu,
*features = NULL;
for (i = 0; i < cpu->nfeatures; i++) {
if (filter(cpu->features[i].name, opaque)) {
if (filter(cpu->features[i].name, cpu->features[i].policy, opaque)) {
if (virStringListAdd(&list, cpu->features[i].name) < 0)
return -1;
n++;
......
......@@ -161,6 +161,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
* Returns true if feature @name should copied, false otherwise.
*/
typedef bool (*virCPUDefFeatureFilter)(const char *name,
virCPUFeaturePolicy policy,
void *opaque);
int
......
......@@ -3233,6 +3233,15 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu)
}
static bool
x86FeatureFilterMigratable(const char *name,
virCPUFeaturePolicy policy G_GNUC_UNUSED,
void *cpu_map)
{
return x86FeatureIsMigratable(name, cpu_map);
}
static virCPUDefPtr
virCPUx86CopyMigratable(virCPUDefPtr cpu)
{
......@@ -3246,7 +3255,7 @@ virCPUx86CopyMigratable(virCPUDefPtr cpu)
return NULL;
if (virCPUDefCopyModelFilter(copy, cpu, false,
x86FeatureIsMigratable, map) < 0)
x86FeatureFilterMigratable, map) < 0)
goto error;
return copy;
......@@ -3381,6 +3390,7 @@ virCPUx86FeatureIsMSR(const char *name)
*/
bool
virCPUx86FeatureFilterSelectMSR(const char *name,
virCPUFeaturePolicy policy G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED)
{
return virCPUx86FeatureIsMSR(name);
......@@ -3397,6 +3407,7 @@ virCPUx86FeatureFilterSelectMSR(const char *name,
*/
bool
virCPUx86FeatureFilterDropMSR(const char *name,
virCPUFeaturePolicy policy G_GNUC_UNUSED,
void *opaque G_GNUC_UNUSED)
{
return !virCPUx86FeatureIsMSR(name);
......
......@@ -42,7 +42,9 @@ int virCPUx86DataSetVendor(virCPUDataPtr cpuData,
const char *vendor);
bool virCPUx86FeatureFilterSelectMSR(const char *name,
virCPUFeaturePolicy policy,
void *opaque);
bool virCPUx86FeatureFilterDropMSR(const char *name,
virCPUFeaturePolicy policy,
void *opaque);
......@@ -2908,6 +2908,7 @@ virQEMUCapsProbeQMPSEVCapabilities(virQEMUCapsPtr qemuCaps,
*/
bool
virQEMUCapsCPUFilterFeatures(const char *name,
virCPUFeaturePolicy policy G_GNUC_UNUSED,
void *opaque)
{
virArch *arch = opaque;
......
......@@ -667,6 +667,7 @@ bool virQEMUCapsGuestIsNative(virArch host,
virArch guest);
bool virQEMUCapsCPUFilterFeatures(const char *name,
virCPUFeaturePolicy policy,
void *opaque);
const char *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册