[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 13/33] cpu: Introduce virCPUDataNew



Signed-off-by: Jiri Denemark <jdenemar redhat com>
---
 src/cpu/cpu.c            | 19 +++++++++++++++++++
 src/cpu/cpu.h            |  3 +++
 src/libvirt_private.syms |  1 +
 3 files changed, 23 insertions(+)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index 64419eee3..3063f00eb 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -312,6 +312,25 @@ cpuEncode(virArch arch,
 
 
 /**
+ * virCPUDataNew:
+ *
+ * Returns an allocated memory for virCPUData or NULL on error.
+ */
+virCPUDataPtr
+virCPUDataNew(virArch arch)
+{
+    virCPUDataPtr data;
+
+    if (VIR_ALLOC(data) < 0)
+        return NULL;
+
+    data->arch = arch;
+
+    return data;
+}
+
+
+/**
  * cpuDataFree:
  *
  * @data: CPU data structure to be freed
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index 69c17e72a..ceb1e7256 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -162,6 +162,9 @@ cpuEncode   (virArch arch,
              virCPUDataPtr *vendor)
     ATTRIBUTE_NONNULL(2);
 
+virCPUDataPtr
+virCPUDataNew(virArch arch);
+
 void
 cpuDataFree (virCPUDataPtr data);
 
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6bbb36b4e..a2bcc6241 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -997,6 +997,7 @@ virCPUCompareXML;
 virCPUConvertLegacy;
 virCPUDataCheckFeature;
 virCPUDataFormat;
+virCPUDataNew;
 virCPUDataParse;
 virCPUGetModels;
 virCPUTranslate;
-- 
2.11.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]