conf: Introduce virCPUDefCopyWithoutModel

Useful for copying a CPU definition without model related parts (i.e.,
without model name, feature list, vendor).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-06-17 09:44:43 +02:00
parent b27adaed37
commit bcf46ddb3f
3 changed files with 19 additions and 1 deletions

View File

@ -114,8 +114,9 @@ virCPUDefCopyModel(virCPUDefPtr dst,
return 0; return 0;
} }
virCPUDefPtr virCPUDefPtr
virCPUDefCopy(const virCPUDef *cpu) virCPUDefCopyWithoutModel(const virCPUDef *cpu)
{ {
virCPUDefPtr copy; virCPUDefPtr copy;
@ -131,6 +132,18 @@ virCPUDefCopy(const virCPUDef *cpu)
copy->threads = cpu->threads; copy->threads = cpu->threads;
copy->arch = cpu->arch; copy->arch = cpu->arch;
return copy;
}
virCPUDefPtr
virCPUDefCopy(const virCPUDef *cpu)
{
virCPUDefPtr copy;
if (!(copy = virCPUDefCopyWithoutModel(cpu)))
return NULL;
if (virCPUDefCopyModel(copy, cpu, false) < 0) if (virCPUDefCopyModel(copy, cpu, false) < 0)
goto error; goto error;
@ -141,6 +154,7 @@ virCPUDefCopy(const virCPUDef *cpu)
return NULL; return NULL;
} }
virCPUDefPtr virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node, virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,

View File

@ -126,6 +126,9 @@ virCPUDefCopyModel(virCPUDefPtr dst,
virCPUDefPtr virCPUDefPtr
virCPUDefCopy(const virCPUDef *cpu); virCPUDefCopy(const virCPUDef *cpu);
virCPUDefPtr
virCPUDefCopyWithoutModel(const virCPUDef *cpu);
virCPUDefPtr virCPUDefPtr
virCPUDefParseXML(xmlNodePtr node, virCPUDefParseXML(xmlNodePtr node,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,

View File

@ -66,6 +66,7 @@ virCapabilitiesSetNetPrefix;
virCPUDefAddFeature; virCPUDefAddFeature;
virCPUDefCopy; virCPUDefCopy;
virCPUDefCopyModel; virCPUDefCopyModel;
virCPUDefCopyWithoutModel;
virCPUDefFormat; virCPUDefFormat;
virCPUDefFormatBuf; virCPUDefFormatBuf;
virCPUDefFree; virCPUDefFree;