Use the source struct and the corresponding function so that we can
avoid using the path separately. Now that
qemuDomainPrepareDiskChainElementPath isn't use anywhere, we can safely
remove it.

Additionally, the removal fixes a misaligned comment as the removed
function was added under a comment for a different function.
---
 src/qemu/qemu_driver.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4546862..66752f1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12117,25 +12117,6 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr 
driver,
  * is sent but failed, and number of frozen filesystems on success. If -2 is
  * returned, FSThaw should be called revert the quiesced status. */
 static int
-qemuDomainPrepareDiskChainElementPath(virQEMUDriverPtr driver,
-                                      virDomainObjPtr vm,
-                                      virDomainDiskDefPtr disk,
-                                      const char *file,
-                                      qemuDomainDiskChainMode mode)
-{
-    virStorageSource src;
-
-    memset(&src, 0, sizeof(src));
-
-    src.type = VIR_STORAGE_TYPE_FILE;
-    src.format = VIR_STORAGE_FILE_RAW;
-    src.path = (char *) file; /* casting away const is safe here */
-
-    return qemuDomainPrepareDiskChainElement(driver, vm, disk, &src, mode);
-}
-
-
-static int
 qemuDomainSnapshotFSFreeze(virQEMUDriverPtr driver,
                            virDomainObjPtr vm,
                            const char **mountpoints,
@@ -15374,10 +15355,10 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
     if (VIR_STRDUP(mirror->path, dest) < 0)
         goto endjob;

-    if (qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
-                                              VIR_DISK_CHAIN_READ_WRITE) < 0) {
-        qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
-                                              VIR_DISK_CHAIN_NO_ACCESS);
+    if (qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
+                                          VIR_DISK_CHAIN_READ_WRITE) < 0) {
+        qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
+                                          VIR_DISK_CHAIN_NO_ACCESS);
         goto endjob;
     }

@@ -15388,8 +15369,8 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
     virDomainAuditDisk(vm, NULL, dest, "mirror", ret >= 0);
     qemuDomainObjExitMonitor(driver, vm);
     if (ret < 0) {
-        qemuDomainPrepareDiskChainElementPath(driver, vm, disk, dest,
-                                              VIR_DISK_CHAIN_NO_ACCESS);
+        qemuDomainPrepareDiskChainElement(driver, vm, disk, mirror,
+                                          VIR_DISK_CHAIN_NO_ACCESS);
         goto endjob;
     }

-- 
1.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to