[PATCH 3/8] rename virBlkioDeviceWeightPtr to virBlkioDevicePtr

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

 



The throttle blkio cgroup will reuse this struct.

Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
---
 src/conf/domain_conf.c | 18 +++++++++---------
 src/conf/domain_conf.h | 10 +++++-----
 src/lxc/lxc_cgroup.c   |  6 +++---
 src/qemu/qemu_cgroup.c |  8 ++++----
 src/qemu/qemu_driver.c | 18 +++++++++---------
 5 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 397671a..26242b6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -882,13 +882,13 @@ virDomainXMLOptionGetNamespace(virDomainXMLOptionPtr xmlopt)
 
 
 void
-virBlkioDeviceArrayClear(virBlkioDeviceWeightPtr deviceWeights,
+virBlkioDeviceArrayClear(virBlkioDevicePtr devices,
                          int ndevices)
 {
     size_t i;
 
     for (i = 0; i < ndevices; i++)
-        VIR_FREE(deviceWeights[i].path);
+        VIR_FREE(devices[i].path);
 }
 
 /**
@@ -901,11 +901,11 @@ virBlkioDeviceArrayClear(virBlkioDeviceWeightPtr deviceWeights,
  *     <weight>weight</weight>
  *   </device>
  *
- * and fills a virBlkioDeviceWeight struct.
+ * and fills a virBlkioDeviceTune struct.
  */
 static int
 virDomainBlkioDeviceParseXML(xmlNodePtr root,
-                             virBlkioDeviceWeightPtr dw)
+                             virBlkioDevicePtr dev)
 {
     char *c;
     xmlNodePtr node;
@@ -913,16 +913,16 @@ virDomainBlkioDeviceParseXML(xmlNodePtr root,
     node = root->children;
     while (node) {
         if (node->type == XML_ELEMENT_NODE) {
-            if (xmlStrEqual(node->name, BAD_CAST "path") && !dw->path) {
-                dw->path = (char *)xmlNodeGetContent(node);
+            if (xmlStrEqual(node->name, BAD_CAST "path") && !dev->path) {
+                dev->path = (char *)xmlNodeGetContent(node);
             } else if (xmlStrEqual(node->name, BAD_CAST "weight")) {
                 c = (char *)xmlNodeGetContent(node);
-                if (virStrToLong_ui(c, NULL, 10, &dw->weight) < 0) {
+                if (virStrToLong_ui(c, NULL, 10, &dev->weight) < 0) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                    _("could not parse weight %s"),
                                    c);
                     VIR_FREE(c);
-                    VIR_FREE(dw->path);
+                    VIR_FREE(dev->path);
                     return -1;
                 }
                 VIR_FREE(c);
@@ -930,7 +930,7 @@ virDomainBlkioDeviceParseXML(xmlNodePtr root,
         }
         node = node->next;
     }
-    if (!dw->path) {
+    if (!dev->path) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("missing per-device path"));
         return -1;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 96598b5..b410fd0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1860,9 +1860,9 @@ virDomainVcpuPinDefPtr virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
                                                   int nvcpupin,
                                                   int vcpu);
 
-typedef struct _virBlkioDeviceWeight virBlkioDeviceWeight;
-typedef virBlkioDeviceWeight *virBlkioDeviceWeightPtr;
-struct _virBlkioDeviceWeight {
+typedef struct _virBlkioDevice virBlkioDevice;
+typedef virBlkioDevice *virBlkioDevicePtr;
+struct _virBlkioDevice {
     char *path;
     unsigned int weight;
 };
@@ -1911,7 +1911,7 @@ struct _virDomainIdMapDef {
 };
 
 
-void virBlkioDeviceArrayClear(virBlkioDeviceWeightPtr deviceWeights,
+void virBlkioDeviceArrayClear(virBlkioDevicePtr deviceWeights,
                               int ndevices);
 
 typedef struct _virDomainResourceDef virDomainResourceDef;
@@ -1940,7 +1940,7 @@ struct _virDomainDef {
         unsigned int weight;
 
         size_t ndevices;
-        virBlkioDeviceWeightPtr devices;
+        virBlkioDevicePtr devices;
     } blkio;
 
     struct {
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 275e250..310a476 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -112,10 +112,10 @@ static int virLXCCgroupSetupBlkioTune(virDomainDefPtr def,
 
     if (def->blkio.ndevices) {
         for (i = 0; i < def->blkio.ndevices; i++) {
-            virBlkioDeviceWeightPtr dw = &def->blkio.devices[i];
-            if (!dw->weight)
+            virBlkioDevicePtr dev = &def->blkio.devices[i];
+            if (!dev->weight)
                 continue;
-            if (virCgroupSetBlkioDeviceWeight(cgroup, dw->path, dw->weight) < 0)
+            if (virCgroupSetBlkioDeviceWeight(cgroup, dev->path, dev->weight) < 0)
                 return -1;
         }
     }
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index f0cacd0..a18955e 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -399,11 +399,11 @@ qemuSetupBlkioCgroup(virDomainObjPtr vm)
 
     if (vm->def->blkio.ndevices) {
         for (i = 0; i < vm->def->blkio.ndevices; i++) {
-            virBlkioDeviceWeightPtr dw = &vm->def->blkio.devices[i];
-            if (!dw->weight)
+            virBlkioDevicePtr dev = &vm->def->blkio.devices[i];
+            if (!dev->weight)
                 continue;
-            if (virCgroupSetBlkioDeviceWeight(priv->cgroup, dw->path,
-                                              dw->weight) < 0)
+            if (virCgroupSetBlkioDeviceWeight(priv->cgroup, dev->path,
+                                              dev->weight) < 0)
                 return -1;
         }
     }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a7d96a9..45d11cd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7432,15 +7432,15 @@ cleanup:
  */
 static int
 qemuDomainParseDeviceWeightStr(char *deviceWeightStr,
-                               virBlkioDeviceWeightPtr *dw, size_t *size)
+                               virBlkioDevicePtr *dev, size_t *size)
 {
     char *temp;
     int ndevices = 0;
     int nsep = 0;
     size_t i;
-    virBlkioDeviceWeightPtr result = NULL;
+    virBlkioDevicePtr result = NULL;
 
-    *dw = NULL;
+    *dev = NULL;
     *size = 0;
 
     if (STREQ(deviceWeightStr, ""))
@@ -7496,7 +7496,7 @@ qemuDomainParseDeviceWeightStr(char *deviceWeightStr,
     if (!i)
         VIR_FREE(result);
 
-    *dw = result;
+    *dev = result;
     *size = i;
 
     return 0;
@@ -7513,13 +7513,13 @@ cleanup:
 /* Modify dest_array to reflect all device weight changes described in
  * src_array.  */
 static int
-qemuDomainMergeDeviceWeights(virBlkioDeviceWeightPtr *dest_array,
+qemuDomainMergeDeviceWeights(virBlkioDevicePtr *dest_array,
                              size_t *dest_size,
-                             virBlkioDeviceWeightPtr src_array,
+                             virBlkioDevicePtr src_array,
                              size_t src_size)
 {
     size_t i, j;
-    virBlkioDeviceWeightPtr dest, src;
+    virBlkioDevicePtr dest, src;
 
     for (i = 0; i < src_size; i++) {
         bool found = false;
@@ -7614,7 +7614,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
                     ret = -1;
             } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
                 size_t ndevices;
-                virBlkioDeviceWeightPtr devices = NULL;
+                virBlkioDevicePtr devices = NULL;
                 size_t j;
 
                 if (qemuDomainParseDeviceWeightStr(params[i].value.s,
@@ -7660,7 +7660,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
 
                 persistentDef->blkio.weight = params[i].value.ui;
             } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT)) {
-                virBlkioDeviceWeightPtr devices = NULL;
+                virBlkioDevicePtr devices = NULL;
                 size_t ndevices;
 
                 if (qemuDomainParseDeviceWeightStr(params[i].value.s,
-- 
1.8.3.1

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