[PATCH 2/3] vz: Use virBitmapToDataBuf instead of virBitmapToData in vzDomainGetVcpus

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

 



---
 src/vz/vz_driver.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index a489767..8d90191 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -823,7 +823,6 @@ vzDomainGetVcpus(virDomainPtr domain,
 {
     virDomainObjPtr privdom = NULL;
     size_t i;
-    int v;
     int ret = -1;

     if (!(privdom = vzDomObjFromDomainRef(domain)))
@@ -847,19 +846,11 @@ vzDomainGetVcpus(virDomainPtr domain,
             }
         }
         if (cpumaps != NULL) {
-            unsigned char *tmpmap = NULL;
-            int tmpmapLen = 0;
-
             memset(cpumaps, 0, maplen * maxinfo);
-            virBitmapToData(privdom->def->cpumask, &tmpmap, &tmpmapLen);
-            if (tmpmapLen > maplen)
-                tmpmapLen = maplen;
-
-            for (v = 0; v < maxinfo; v++) {
-                unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v);
-                memcpy(cpumap, tmpmap, tmpmapLen);
-            }
-            VIR_FREE(tmpmap);
+            for (i = 0; i < maxinfo; i++)
+                virBitmapToDataBuf(privdom->def->cpumask,
+                                   VIR_GET_CPUMAP(cpumaps, maplen, i),
+                                   maplen);
         }
     }
     ret = maxinfo;
-- 
2.4.5

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