[PATCH 06/10] qemuDomainDiskLookupByNodename: Remove unused 'idx'

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


All callers pass NULL as the value. Remove the argument.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c  | 12 ++----------
 src/qemu/qemu_domain.h  |  3 +--
 src/qemu/qemu_process.c |  4 ++--
 3 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index cfdd9270da..64bd52c51f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11469,7 +11469,6 @@ qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,
  * @def: domain definition to look for the disk
  * @nodename: block backend node name to find
  * @src: filled with the specific backing store element if provided
- * @idx: index of @src in the backing chain, if provided
  *
  * Looks up the disk in the domain via @nodename and returns its definition.
  * Optionally fills @src and @idx if provided with the specific backing chain
@@ -11478,24 +11477,17 @@ qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,
 virDomainDiskDefPtr
 qemuDomainDiskLookupByNodename(virDomainDefPtr def,
                                const char *nodename,
-                               virStorageSourcePtr *src,
-                               unsigned int *idx)
+                               virStorageSourcePtr *src)
 {
     size_t i;
-    unsigned int srcindex;
     virStorageSourcePtr tmp = NULL;

-    if (!idx)
-        idx = &srcindex;
-
     if (src)
         *src = NULL;

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

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 6944b37ff7..d75fbc0af3 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -959,8 +959,7 @@ int qemuDomainNamespaceTeardownInput(virDomainObjPtr vm,

 virDomainDiskDefPtr qemuDomainDiskLookupByNodename(virDomainDefPtr def,
                                                    const char *nodename,
-                                                   virStorageSourcePtr *src,
-                                                   unsigned int *idx);
+                                                   virStorageSourcePtr *src);

 char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
                                         unsigned int idx);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9b6dc8e68b..580abb0fb4 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -880,7 +880,7 @@ qemuProcessHandleIOError(qemuMonitorPtr mon G_GNUC_UNUSED,
     if (diskAlias)
         disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, diskAlias, NULL);
     else if (nodename)
-        disk = qemuDomainDiskLookupByNodename(vm->def, nodename, NULL, NULL);
+        disk = qemuDomainDiskLookupByNodename(vm->def, nodename, NULL);
     else
         disk = NULL;

@@ -1509,7 +1509,7 @@ qemuProcessHandleBlockThreshold(qemuMonitorPtr mon G_GNUC_UNUSED,
               "threshold '%llu' exceeded by '%llu'",
               nodename, vm, vm->def->name, threshold, excess);

-    if ((disk = qemuDomainDiskLookupByNodename(vm->def, nodename, &src, NULL))) {
+    if ((disk = qemuDomainDiskLookupByNodename(vm->def, nodename, &src))) {
         if (virStorageSourceIsLocalStorage(src))
             path = src->path;

-- 
2.26.2




More information about the libvir-list mailing list