[PATCH 09/12] Replace virDomainVcpuPinAdd with virDomainPinAdd

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

 



Make common between Vcpu and IOThreads

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c   | 42 ++++++++++++++++++++----------------------
 src/conf/domain_conf.h   | 10 +++++-----
 src/libvirt_private.syms |  2 +-
 src/libxl/libxl_driver.c | 10 +++++-----
 src/qemu/qemu_driver.c   | 16 ++++++++--------
 src/xen/xend_internal.c  | 10 +++++-----
 6 files changed, 44 insertions(+), 46 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 75d75bc..4a9d083 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16711,47 +16711,45 @@ virDomainPinFindByVcpu(virDomainPinDefPtr *def,
 }
 
 int
-virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
-                    size_t *nvcpupin,
-                    unsigned char *cpumap,
-                    int maplen,
-                    int vcpu)
+virDomainPinAdd(virDomainPinDefPtr **pindef_list,
+                size_t *npin,
+                unsigned char *cpumap,
+                int maplen,
+                int id)
 {
-    virDomainPinDefPtr vcpupin = NULL;
+    virDomainPinDefPtr pindef = NULL;
 
-    if (!vcpupin_list)
+    if (!pindef_list)
         return -1;
 
-    vcpupin = virDomainPinFindByVcpu(*vcpupin_list,
-                                     *nvcpupin,
-                                     vcpu);
-    if (vcpupin) {
-        vcpupin->id = vcpu;
-        virBitmapFree(vcpupin->cpumask);
-        vcpupin->cpumask = virBitmapNewData(cpumap, maplen);
-        if (!vcpupin->cpumask)
+    pindef = virDomainPinFindByVcpu(*pindef_list, *npin, id);
+    if (pindef) {
+        pindef->id = id;
+        virBitmapFree(pindef->cpumask);
+        pindef->cpumask = virBitmapNewData(cpumap, maplen);
+        if (!pindef->cpumask)
             return -1;
 
         return 0;
     }
 
-    /* No existing vcpupin matches vcpu, adding a new one */
+    /* No existing pindef matches id, adding a new one */
 
-    if (VIR_ALLOC(vcpupin) < 0)
+    if (VIR_ALLOC(pindef) < 0)
         goto error;
 
-    vcpupin->id = vcpu;
-    vcpupin->cpumask = virBitmapNewData(cpumap, maplen);
-    if (!vcpupin->cpumask)
+    pindef->id = id;
+    pindef->cpumask = virBitmapNewData(cpumap, maplen);
+    if (!pindef->cpumask)
         goto error;
 
-    if (VIR_APPEND_ELEMENT(*vcpupin_list, *nvcpupin, vcpupin) < 0)
+    if (VIR_APPEND_ELEMENT(*pindef_list, *npin, pindef) < 0)
         goto error;
 
     return 0;
 
  error:
-    virDomainPinDefFree(vcpupin);
+    virDomainPinDefFree(pindef);
     return -1;
 }
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index fe61b9f..10fdbb0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2549,11 +2549,11 @@ int virDomainDefCompatibleDevice(virDomainDefPtr def,
                                  virDomainDeviceDefPtr dev,
                                  virDomainDeviceAction action);
 
-int virDomainVcpuPinAdd(virDomainPinDefPtr **vcpupin_list,
-                        size_t *nvcpupin,
-                        unsigned char *cpumap,
-                        int maplen,
-                        int vcpu);
+int virDomainPinAdd(virDomainPinDefPtr **pindef_list,
+                    size_t *npin,
+                    unsigned char *cpumap,
+                    int maplen,
+                    int id);
 
 void virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
 
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 540936f..54c931e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -381,6 +381,7 @@ virDomainObjTaint;
 virDomainParseMemory;
 virDomainPausedReasonTypeFromString;
 virDomainPausedReasonTypeToString;
+virDomainPinAdd;
 virDomainPinDefArrayFree;
 virDomainPinDefCopy;
 virDomainPinDefFree;
@@ -437,7 +438,6 @@ virDomainTPMBackendTypeToString;
 virDomainTPMDefFree;
 virDomainTPMModelTypeFromString;
 virDomainTPMModelTypeToString;
-virDomainVcpuPinAdd;
 virDomainVcpuPinDel;
 virDomainVideoDefaultRAM;
 virDomainVideoDefaultType;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 97ef2c9..d1addf5 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1999,11 +1999,11 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
             goto endjob;
         targetDef->cputune.nvcpupin = 0;
     }
-    if (virDomainVcpuPinAdd(&targetDef->cputune.vcpupin,
-                            &targetDef->cputune.nvcpupin,
-                            cpumap,
-                            maplen,
-                            vcpu) < 0) {
+    if (virDomainPinAdd(&targetDef->cputune.vcpupin,
+                        &targetDef->cputune.nvcpupin,
+                        cpumap,
+                        maplen,
+                        vcpu) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("failed to update or add vcpupin xml"));
         goto endjob;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5d867c3..3e40724 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4978,8 +4978,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
             newVcpuPinNum = 0;
         }
 
-        if (virDomainVcpuPinAdd(&newVcpuPin, &newVcpuPinNum,
-                                cpumap, maplen, vcpu) < 0) {
+        if (virDomainPinAdd(&newVcpuPin, &newVcpuPinNum,
+                            cpumap, maplen, vcpu) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("failed to update vcpupin"));
             goto endjob;
@@ -5043,11 +5043,11 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
                     goto endjob;
                 persistentDef->cputune.nvcpupin = 0;
             }
-            if (virDomainVcpuPinAdd(&persistentDef->cputune.vcpupin,
-                                    &persistentDef->cputune.nvcpupin,
-                                    cpumap,
-                                    maplen,
-                                    vcpu) < 0) {
+            if (virDomainPinAdd(&persistentDef->cputune.vcpupin,
+                                &persistentDef->cputune.nvcpupin,
+                                cpumap,
+                                maplen,
+                                vcpu) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("failed to update or add vcpupin xml of "
                                  "a persistent domain"));
@@ -5255,7 +5255,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
             if (VIR_ALLOC(newVcpuPin) < 0)
                 goto endjob;
 
-            if (virDomainVcpuPinAdd(&newVcpuPin, &newVcpuPinNum, cpumap, maplen, -1) < 0) {
+            if (virDomainPinAdd(&newVcpuPin, &newVcpuPinNum, cpumap, maplen, -1) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("failed to update vcpupin"));
                 virDomainPinDefArrayFree(newVcpuPin, newVcpuPinNum);
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 1722c3f..6c8ec7c 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1897,11 +1897,11 @@ xenDaemonDomainPinVcpu(virConnectPtr conn,
                 goto cleanup;
             def->cputune.nvcpupin = 0;
         }
-        if (virDomainVcpuPinAdd(&def->cputune.vcpupin,
-                                &def->cputune.nvcpupin,
-                                cpumap,
-                                maplen,
-                                vcpu) < 0) {
+        if (virDomainPinAdd(&def->cputune.vcpupin,
+                            &def->cputune.nvcpupin,
+                            cpumap,
+                            maplen,
+                            vcpu) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            "%s", _("failed to add vcpupin xml entry"));
             return -1;
-- 
2.1.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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]