[libvirt PATCH v2 16/20] cpu_x86: Add virCPUDataGetHost

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/cpu/cpu.c            | 19 +++++++++++++++++++
 src/cpu/cpu.h            |  7 +++++++
 src/libvirt_private.syms |  1 +
 3 files changed, 27 insertions(+)

diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
index b5669246b4..285c7eee44 100644
--- a/src/cpu/cpu.c
+++ b/src/cpu/cpu.c
@@ -1190,6 +1190,25 @@ virCPUDataIsIdentical(const virCPUData *a,
 }
 
 
+/**
+ * virCPUDataGetHost:
+ *
+ */
+virCPUData*
+virCPUDataGetHost(void)
+{
+    struct cpuArchDriver *driver;
+
+    if (!(driver = cpuGetSubDriver(virArchFromHost())))
+        return NULL;
+
+    if (!driver->dataGetHost)
+        return NULL;
+
+    return driver->dataGetHost();
+}
+
+
 /**
  * virCPUArchIsSupported:
  *
diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h
index d3e5ca79f2..071b33fe76 100644
--- a/src/cpu/cpu.h
+++ b/src/cpu/cpu.h
@@ -130,6 +130,9 @@ typedef virCPUCompareResult
 (*virCPUArchDataIsIdentical)(const virCPUData *a,
                              const virCPUData *b);
 
+typedef virCPUData *
+(*virCPUArchDataGetHost)(void);
+
 struct cpuArchDriver {
     const char *name;
     const virArch *arch;
@@ -155,6 +158,7 @@ struct cpuArchDriver {
     virCPUArchValidateFeatures validateFeatures;
     virCPUArchDataAddFeature dataAddFeature;
     virCPUArchDataIsIdentical dataIsIdentical;
+    virCPUArchDataGetHost dataGetHost;
 };
 
 
@@ -291,6 +295,9 @@ virCPUCompareResult
 virCPUDataIsIdentical(const virCPUData *a,
                       const virCPUData *b);
 
+virCPUData*
+virCPUDataGetHost(void);
+
 bool
 virCPUArchIsSupported(virArch arch);
 
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e92670c85d..d4e2d3db74 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1460,6 +1460,7 @@ virCPUDataAddFeature;
 virCPUDataCheckFeature;
 virCPUDataFormat;
 virCPUDataFree;
+virCPUDataGetHost;
 virCPUDataIsIdentical;
 virCPUDataNew;
 virCPUDataNewCopy;
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux