[PATCH 07/10] virStorageSourceFindByNodeName: Remove unused 'idx' argument

Peter Krempa pkrempa at redhat.com
Wed Jul 15 13:10:09 UTC 2020


None of the callers actually use it.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c    |  9 ++++-----
 src/util/virstoragefile.c | 16 +++-------------
 src/util/virstoragefile.h |  3 +--
 3 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 64bd52c51f..ed7ec77ed4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2498,15 +2498,15 @@ qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlockJobDataPtr job,
         return;

     if (job->disk &&
-        (*src = virStorageSourceFindByNodeName(job->disk->src, nodename, NULL)))
+        (*src = virStorageSourceFindByNodeName(job->disk->src, nodename)))
         return;

     if (job->chain &&
-        (*src = virStorageSourceFindByNodeName(job->chain, nodename, NULL)))
+        (*src = virStorageSourceFindByNodeName(job->chain, nodename)))
         return;

     if (job->mirrorChain &&
-        (*src = virStorageSourceFindByNodeName(job->mirrorChain, nodename, NULL)))
+        (*src = virStorageSourceFindByNodeName(job->mirrorChain, nodename)))
         return;

     /* the node was in the XML but was not found in the job definitions */
@@ -11486,8 +11486,7 @@ qemuDomainDiskLookupByNodename(virDomainDefPtr def,
         *src = NULL;

     for (i = 0; i < def->ndisks; i++) {
-        if ((tmp = virStorageSourceFindByNodeName(def->disks[i]->src,
-                                                  nodename, NULL))) {
+        if ((tmp = virStorageSourceFindByNodeName(def->disks[i]->src, nodename))) {
             if (src)
                 *src = tmp;

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 274883c4bd..00d8e16ef9 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -4589,33 +4589,23 @@ virStorageSourceIsRelative(virStorageSourcePtr src)
  * virStorageSourceFindByNodeName:
  * @top: backing chain top
  * @nodeName: node name to find in backing chain
- * @index: if provided the index in the backing chain
  *
  * Looks up the given storage source in the backing chain and returns the
- * pointer to it. If @index is passed then it's filled by the index in the
- * backing chain. On failure NULL is returned and no error is reported.
+ * pointer to it.
+ * On failure NULL is returned and no error is reported.
  */
 virStorageSourcePtr
 virStorageSourceFindByNodeName(virStorageSourcePtr top,
-                               const char *nodeName,
-                               unsigned int *idx)
+                               const char *nodeName)
 {
     virStorageSourcePtr tmp;

-    if (idx)
-        *idx = 0;
-
     for (tmp = top; virStorageSourceIsBacking(tmp); tmp = tmp->backingStore) {
         if ((tmp->nodeformat && STREQ(tmp->nodeformat, nodeName)) ||
             (tmp->nodestorage && STREQ(tmp->nodestorage, nodeName)))
             return tmp;
-
-        if (idx)
-            (*idx)++;
     }

-    if (idx)
-        *idx = 0;
     return NULL;
 }

diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index c68bdc9680..f73b3ee005 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -526,8 +526,7 @@ bool virStorageSourceIsRelative(virStorageSourcePtr src);

 virStorageSourcePtr
 virStorageSourceFindByNodeName(virStorageSourcePtr top,
-                               const char *nodeName,
-                               unsigned int *index)
+                               const char *nodeName)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);

 void
-- 
2.26.2




More information about the libvir-list mailing list