]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: remove use of the terms 'master' and 'slave' when iterating CPUs
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 17 Jun 2020 10:20:32 +0000 (11:20 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 26 Jun 2020 14:39:34 +0000 (15:39 +0100)
When querying QEMU we have to iterate over two nested sets
of CPUs. The terms "main vcpu" and "sub vcpu" are a good
representation.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_monitor.c

index 3ec22b939fb11050990c2d6b17839f6e5ff24fcd..5033cbeabf0267c649744afcc7e4708c2278bee1 100644 (file)
@@ -1734,8 +1734,8 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
     char *tmp;
     int order = 1;
     size_t totalvcpus = 0;
-    size_t mastervcpu; /* this iterator is used for iterating hotpluggable entities */
-    size_t slavevcpu; /* this corresponds to subentries of a hotpluggable entry */
+    size_t mainvcpu; /* this iterator is used for iterating hotpluggable entities */
+    size_t subvcpu; /* this corresponds to subentries of a hotpluggable entry */
     size_t anyvcpu; /* this iterator is used for any vcpu entry in the result */
     size_t i;
     size_t j;
@@ -1777,31 +1777,31 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
     /* transfer appropriate data from the hotpluggable list to corresponding
      * entries. the entries returned by qemu may in fact describe multiple
      * logical vcpus in the guest */
-    mastervcpu = 0;
+    mainvcpu = 0;
     for (i = 0; i < nhotplugvcpus; i++) {
-        vcpus[mastervcpu].online = !!hotplugvcpus[i].qom_path;
-        vcpus[mastervcpu].hotpluggable = !!hotplugvcpus[i].alias ||
-                                         !vcpus[mastervcpu].online;
-        vcpus[mastervcpu].socket_id = hotplugvcpus[i].socket_id;
-        vcpus[mastervcpu].die_id = hotplugvcpus[i].die_id;
-        vcpus[mastervcpu].core_id = hotplugvcpus[i].core_id;
-        vcpus[mastervcpu].thread_id = hotplugvcpus[i].thread_id;
-        vcpus[mastervcpu].node_id = hotplugvcpus[i].node_id;
-        vcpus[mastervcpu].vcpus = hotplugvcpus[i].vcpus;
-        vcpus[mastervcpu].qom_path = g_steal_pointer(&hotplugvcpus[i].qom_path);
-        vcpus[mastervcpu].alias = g_steal_pointer(&hotplugvcpus[i].alias);
-        vcpus[mastervcpu].type = g_steal_pointer(&hotplugvcpus[i].type);
-        vcpus[mastervcpu].props = g_steal_pointer(&hotplugvcpus[i].props);
-        vcpus[mastervcpu].id = hotplugvcpus[i].enable_id;
-
-        /* copy state information to slave vcpus */
-        for (slavevcpu = mastervcpu + 1; slavevcpu < mastervcpu + hotplugvcpus[i].vcpus; slavevcpu++) {
-            vcpus[slavevcpu].online = vcpus[mastervcpu].online;
-            vcpus[slavevcpu].hotpluggable = vcpus[mastervcpu].hotpluggable;
+        vcpus[mainvcpu].online = !!hotplugvcpus[i].qom_path;
+        vcpus[mainvcpu].hotpluggable = !!hotplugvcpus[i].alias ||
+                                         !vcpus[mainvcpu].online;
+        vcpus[mainvcpu].socket_id = hotplugvcpus[i].socket_id;
+        vcpus[mainvcpu].die_id = hotplugvcpus[i].die_id;
+        vcpus[mainvcpu].core_id = hotplugvcpus[i].core_id;
+        vcpus[mainvcpu].thread_id = hotplugvcpus[i].thread_id;
+        vcpus[mainvcpu].node_id = hotplugvcpus[i].node_id;
+        vcpus[mainvcpu].vcpus = hotplugvcpus[i].vcpus;
+        vcpus[mainvcpu].qom_path = g_steal_pointer(&hotplugvcpus[i].qom_path);
+        vcpus[mainvcpu].alias = g_steal_pointer(&hotplugvcpus[i].alias);
+        vcpus[mainvcpu].type = g_steal_pointer(&hotplugvcpus[i].type);
+        vcpus[mainvcpu].props = g_steal_pointer(&hotplugvcpus[i].props);
+        vcpus[mainvcpu].id = hotplugvcpus[i].enable_id;
+
+        /* copy state information to sub vcpus */
+        for (subvcpu = mainvcpu + 1; subvcpu < mainvcpu + hotplugvcpus[i].vcpus; subvcpu++) {
+            vcpus[subvcpu].online = vcpus[mainvcpu].online;
+            vcpus[subvcpu].hotpluggable = vcpus[mainvcpu].hotpluggable;
         }
 
         /* calculate next master vcpu (hotpluggable unit) entry */
-        mastervcpu += hotplugvcpus[i].vcpus;
+        mainvcpu += hotplugvcpus[i].vcpus;
     }
 
     /* match entries from query cpus to the output array taking into account